+ add template to bug steps.

+ create zt_userTPL.
This commit is contained in:
fujia
2010-07-23 01:33:16 +00:00
parent 87998afbf4
commit 726af24771
3 changed files with 63 additions and 0 deletions
+12
View File
@@ -28,3 +28,15 @@ CREATE TABLE IF NOT EXISTS `zt_docLib` (
ALTER TABLE `zt_module` CHANGE `product` `root` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `zt_module` CHANGE `view` `type` CHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
update zt_module set `type` = 'story' where `type` = 'product';
-- tpl
CREATE TABLE IF NOT EXISTS `zt_userTPL` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`company` mediumint(8) unsigned NOT NULL,
`account` char(30) NOT NULL,
`type` char(30) NOT NULL,
`title` varchar(150) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY (`id`),
KEY `company` (`company`),
KEY `account` (`account`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+48
View File
@@ -0,0 +1,48 @@
<style>
.button-c {padding:1px}
</style>
<script language='Javascript'>
/* 设置bug模板。*/
function setTemplate(templateID)
{
$('#tplTitleBox' + templateID).attr('style', 'text-decoration:underline; color:#8B008B');
steps = $('#template' + templateID).text();
$("#steps").val(steps);
}
/* 保存bug模板。*/
function saveTemplate()
{
content = $("#steps").val();
jPrompt(setTemplateTitle, '','', function(r)
{
if(!r || !content) return;
saveTemplateLink = createLink('bug', 'saveTemplate');
steps = $("#steps").val();
$.post(saveTemplateLink, {title:r, content:content}, function(data)
{
$('#tplBox').html(data);
});
});
}
/* 删除bug模板。*/
function deleteTemplate(templateID)
{
if(!templateID) return;
hiddenwin.location.href = createLink('bug', 'deleteTemplate', 'templateID=' + templateID);
$('#tplBox' + templateID).addClass('hidden');
}
var setTemplateTitle = '<?php echo $lang->bug->setTemplateTitle;?>';
</script>
<?php
foreach($templates as $key => $template)
{
echo "<span id='tplBox$template->id'>";
echo ($key + 1) . ". <span id='tplTitleBox$template->id' onclick='setTemplate($template->id)' style='text-decoration:underline; color:blue' class='hand'>$template->title</span>";
echo html::commonButton('x', "onclick=deleteTemplate($template->id)");
echo "<span id='template$template->id' class='hidden'>$template->content</span>";
echo '<br /></span>';
}
echo html::commonButton($lang->save, 'onclick=saveTemplate()');
+3
View File
@@ -0,0 +1,3 @@
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
<link rel="stylesheet" href="<?php echo $clientTheme;?>alert.css" />
<script src="<?php echo $jsRoot;?>jquery/alert/raw.js" type="text/javascript"></script>