From b26423f10c8a41eac0bbc1a7362e18bb67e665fc Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Sun, 1 May 2011 08:08:05 +0000 Subject: [PATCH] * change code for task#443 --- module/story/control.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 66827b5e88..287938e41e 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -605,24 +605,30 @@ class story extends control foreach($stories as $story) { - $childStories = explode(',', $story->childStories); - $linkStories = explode(',', $story->linkStories); - $module = $this->dao->select('name')->from(TABLE_MODULE)->where('id')->eq($story->module)->fetch(); - $storySpec = $this->dao->select('spec')->from(TABLE_STORYSPEC)->where('story')->eq($story->id)->fetch(); - $legendAttatchs = $this->dao->select('pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->eq($story->id)->fetchAll(); + $childStories = explode(',', $story->childStories); + $linkStories = explode(',', $story->linkStories); + $module = $this->dao->select('name')->from(TABLE_MODULE)->where('id')->eq($story->module)->fetch(); + $storySpec = $this->dao->select('spec')->from(TABLE_STORYSPEC)->where('story')->eq($story->id)->fetch(); - if(isset($storySpec->spec)) + if($_POST['fileType'] == 'html') { - $storySpec->spec = str_replace("<br />", "\n", $storySpec->spec); - $storySpec->spec = str_replace("
", "\n", $storySpec->spec); - $storySpec->spec = str_replace(" ", " ", $storySpec->spec); - $storySpec->spec = str_replace('"', '""', $storySpec->spec); + $legendAttatchs = $this->dao->select('pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->eq($story->id)->fetchAll(); + + foreach($legendAttatchs as $legendAttatch) + { + $legendAttatch->pathname = "http://" . $_SERVER['HTTP_HOST'] . $this->config->webRoot . "data/upload/$story->company/" . $legendAttatch->pathname; + $story->legendAttatchs .= "pathname>" . $legendAttatch->title . "
"; + } } - - foreach($legendAttatchs as $legendAttatch) + else if($_POST['fileType'] == 'csv') { - $legendAttatch->pathname = "http://" . $_SERVER['HTTP_HOST'] . $this->config->webRoot . "data/upload/$story->company/" . $legendAttatch->pathname; - $story->legendAttatchs .= "pathname>" . $legendAttatch->title . "
"; + if(isset($storySpec->spec)) + { + $storySpec->spec = str_replace("<br />", "\n", $storySpec->spec); + $storySpec->spec = str_replace("
", "\n", $storySpec->spec); + $storySpec->spec = str_replace(" ", " ", $storySpec->spec); + $storySpec->spec = str_replace('"', '""', $storySpec->spec); + } } foreach($childStories as $childStory)