From a410db00cad5424f50599af53174e97a261583d6 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Fri, 20 Jun 2014 09:18:07 +0800 Subject: [PATCH 1/3] * code for task#1873. --- module/tree/model.php | 44 ++++++++++++++++++++++++++-- module/tree/view/browsetask.html.php | 24 +++++---------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/module/tree/model.php b/module/tree/model.php index d5bd14f0c3..dc1c06a53d 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -320,7 +320,7 @@ class treeModel extends model foreach($products as $id => $product) { $extra['productID'] = $id; - if($userFunc[1] == 'createTaskManageLink') + if($manage) { $menu .= "
  • " . $product; } @@ -332,7 +332,7 @@ class treeModel extends model /* tree menu. */ $treeMenu = array(); $query = $this->dao->select('*')->from(TABLE_MODULE) - ->where("((root = $rootID and type = 'task') OR (root = $id and type = 'story'))") + ->where("((root = $rootID and type = 'task' and parent != 0) OR (root = $id and type = 'story'))") ->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi() ->orderBy('grade desc, type, `order`') ->get(); @@ -368,6 +368,46 @@ class treeModel extends model $lastMenu = "\n"; $menu .= $lastMenu . '
  • '; } + + if($startModule == 0) + { + /* tree menu. */ + $treeMenu = array(); + $query = $this->dao->select('*')->from(TABLE_MODULE) + ->where("root = $rootID and type = 'task'") + ->orderBy('grade desc, type, `order`') + ->get(); + $stmt = $this->dbh->query($query); + while($module = $stmt->fetch()) + { + /* if not manage, ignore unused modules. */ + if(!$manage and !isset($projectModules[$module->id])) continue; + + $linkHtml = call_user_func($userFunc, 'task', $module, $extra); + + if(isset($treeMenu[$module->id]) and !empty($treeMenu[$module->id])) + { + if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = ''; + $treeMenu[$module->parent] .= "
  • $linkHtml"; + $treeMenu[$module->parent] .= "\n"; + } + else + { + if(isset($treeMenu[$module->parent]) and !empty($treeMenu[$module->parent])) + { + $treeMenu[$module->parent] .= "
  • $linkHtml\n"; + } + else + { + $treeMenu[$module->parent] = "
  • $linkHtml\n"; + } + } + $treeMenu[$module->parent] .= "
  • \n"; + } + + $tree = isset($treeMenu[0]) ? $treeMenu[0] : ''; + $menu .= $tree . ''; + } return $menu; } diff --git a/module/tree/view/browsetask.html.php b/module/tree/view/browsetask.html.php index eff66f494f..3489dd1d6d 100644 --- a/module/tree/view/browsetask.html.php +++ b/module/tree/view/browsetask.html.php @@ -65,31 +65,23 @@ echo '' . html::input("products[id$id]", $product, 'class=form-control disabled="true"') . ''; } } - else + foreach($sons as $sonModule) { - echo '
    '; - foreach($sons as $sonModule) - { - if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order; - $disabled = $sonModule->type == 'task' ? '' : 'disabled="true"'; - echo '' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=form-control ' . $disabled) . ''; - } - for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '' . html::input("modules[]", '', 'class=form-control') . ''; + if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order; + $disabled = $sonModule->type == 'task' ? '' : 'disabled="true"'; + echo '' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=form-control ' . $disabled) . ''; } + for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '' . html::input("modules[]", '', 'class=form-control') . ''; ?> -
    From 78534a9e00bf7a0c55d4b564df75c148a535eae0 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Fri, 20 Jun 2014 10:02:09 +0800 Subject: [PATCH 2/3] * code for task#1892. --- module/common/model.php | 2 +- module/misc/control.php | 43 +++++++++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index 989f7e0def..2c2101dcad 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -569,7 +569,7 @@ class commonModel extends model $notifyFile = $app->getBasePath() . 'www/data/notify/notify.zip'; if(!file_exists($notifyFile)) return false; - echo html::a(helper::createLink('misc', 'downNotify'), " " . $lang->downNotify) . '   '; + echo html::a(helper::createLink('misc', 'downNotify'), "", '', "title='$lang->downNotify'") . '   '; } } diff --git a/module/misc/control.php b/module/misc/control.php index 7087f21e4b..59e9de8179 100644 --- a/module/misc/control.php +++ b/module/misc/control.php @@ -94,30 +94,39 @@ class misc extends control { $notifyDir = $this->app->getBasePath() . 'www/data/notify/'; $packageFile = $notifyDir . 'notify.zip'; - $tmpDir = $notifyDir . 'notify'; - $loginFile = $tmpDir . '/tmp/.logininfo'; - - $this->app->loadClass('pclzip', true); - $sourceZip = new pclzip($packageFile); - $files = $sourceZip->extract(PCLZIP_OPT_PATH, $notifyDir); - if($files == 0) die("Error : ".$sourceZip->errorInfo(true)); + $loginFile = $notifyDir . 'config.json'; + /* write login info into tmp file. */ $loginInfo = new stdclass(); - $loginInfo->account = $this->app->user->account; - $loginInfo->password = $this->app->user->password; - $loginInfo->zentaourl = common::getSysURL() . $this->config->webRoot; + $userInfo = new stdclass(); + $userInfo->Account = $this->app->user->account; + $userInfo->Url = common::getSysURL() . $this->config->webRoot; + $userInfo->PassMd5 = $this->app->user->password; + $userInfo->Role = $this->app->user->role; + $userInfo->AutoSignIn = true; + $userInfo->Lang = $this->cookie->lang; + $loginInfo->User = $userInfo; + $loginInfo->LastLoginTime = time() / 86400 + 25569; $loginInfo = json_encode($loginInfo); file_put_contents($loginFile, $loginInfo); - unlink($packageFile); - $newZip = new pclzip($packageFile); - if($newZip->create($tmpDir, PCLZIP_OPT_REMOVE_PATH, $notifyDir)) - { - $this->zfile = $this->app->loadClass('zfile'); - $this->zfile->removeDir($tmpDir); - } + define('PCLZIP_TEMPORARY_DIR', $notifyDir); + $this->app->loadClass('pclzip', true); + + /* remove the old config.json, add a new one. */ + $archive = new pclzip($packageFile); + $result = $archive->delete(PCLZIP_OPT_BY_NAME, 'config.json'); + if($result == 0) die("Error : " . $archive->errorInfo(true)); + + $result = $archive->add($loginFile, PCLZIP_OPT_REMOVE_ALL_PATH); + if($result == 0) die("Error : " . $archive->errorInfo(true)); + + unlink($loginFile); + $this->fetch('file', 'sendDownHeader', array('fileName' => 'notify.zip', 'zip', file_get_contents($packageFile))); + $result = $archive->delete(PCLZIP_OPT_BY_NAME, 'config.json'); + if($result == 0) die("Error : " . $archive->errorInfo(true)); } /** From def3baca157c4ed4f42fc095b7265de30428d9b3 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Fri, 20 Jun 2014 14:24:32 +0800 Subject: [PATCH 3/3] * code for task#1915. --- module/bug/js/browse.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/module/bug/js/browse.js b/module/bug/js/browse.js index 9e431dc374..b0d47891e5 100644 --- a/module/bug/js/browse.js +++ b/module/bug/js/browse.js @@ -3,10 +3,4 @@ $(document).ready(function() $('#' + browseType + 'Tab').addClass('active'); $('#module' + moduleID).addClass('active'); if(browseType == 'bysearch') ajaxGetSearchForm(); - - /* If customed and the browse is ie6, remove the ie6.css. */ - if(customed && $.browser.msie && Math.floor(parseInt($.browser.version)) == 6) - { - $("#browsecss").attr('href', ''); - } });