From cd7a847fc4eeb78615e16eb42893601d31aec99a Mon Sep 17 00:00:00 2001 From: fujia Date: Mon, 13 Sep 2010 09:50:25 +0000 Subject: [PATCH] + parseubb to bug steps and userTPL when upgrade. --- module/bug/model.php | 2 +- module/bug/view/buildtemplates.html.php | 2 +- module/upgrade/model.php | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 4adbcb79d5..510477d869 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -454,7 +454,7 @@ class bugModel extends model public function saveUserBugTemplate() { $template = fixer::input('post') - ->specialChars('title, content') + ->specialChars('title') ->add('account', $this->app->user->account) ->add('type', 'bug') ->get(); diff --git a/module/bug/view/buildtemplates.html.php b/module/bug/view/buildtemplates.html.php index fb57365d5c..b715c62380 100644 --- a/module/bug/view/buildtemplates.html.php +++ b/module/bug/view/buildtemplates.html.php @@ -30,7 +30,7 @@ KE.plugin.savetemplate = { function setTemplate(templateID) { $('#tplTitleBox' + templateID).attr('style', 'text-decoration:underline; color:#8B008B'); - steps = $('#template' + templateID).text(); + steps = $('#template' + templateID).html(); KE.html('steps', steps); } diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 171848e91e..4553313b88 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -293,6 +293,7 @@ class upgradeModel extends model private function upgradeFrom1_2To1_3() { $this->execSQL($this->getUpgradeFile('1.2')); + $this->updateUbb(); if(!$this->isError()) $this->setting->updateVersion('1.3'); } @@ -317,6 +318,24 @@ class upgradeModel extends model } } + /* 更新bug表的steps字段和userTPL表的content字段。*/ + private function updateUbb() + { + $bugs = $this->dao->select('id, steps')->from(TABLE_BUG)->fetchAll(); + $userTemplates = $this->dao->select('id, content')->from(TABLE_USERTPL)->fetchAll(); + + foreach($bugs as $id => $bug) + { + $bug->steps = html::parseUBB($bug->steps); + $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bug->id)->exec(); + } + foreach($userTemplates as $template) + { + $template->content = html::parseUBB($template->content); + $this->dao->update(TABLE_USERTPL)->data($template)->where('id')->eq($template->id)->exec(); + } + } + /* 获得要更新的sql文件。*/ private function getUpgradeFile($version) {