diff --git a/module/cron/model.php b/module/cron/model.php index 1296b676d5..9f3b96bf46 100644 --- a/module/cron/model.php +++ b/module/cron/model.php @@ -49,7 +49,7 @@ class cronModel extends model { $this->app->loadClass('crontab', true); - $parsedCron = array(); + $parsedCrons = array(); foreach($crons as $cron) { $row = "{$cron->m} {$cron->h} {$cron->dom} {$cron->mon} {$cron->dow} {$cron->command}"; diff --git a/module/dev/lang/de.php b/module/dev/lang/de.php index c14623441f..5d22b32858 100644 --- a/module/dev/lang/de.php +++ b/module/dev/lang/de.php @@ -108,6 +108,10 @@ $lang->dev->tableList['userview'] = 'User Privilege'; $lang->dev->tableList['im_chatuser'] = 'Client Users'; $lang->dev->tableList['im_message'] = 'Client Messages'; $lang->dev->tableList['im_messagestatus'] = 'Client Messages Status'; +$lang->dev->tableList['repo'] = 'Code'; +$lang->dev->tableList['repohistory'] = 'Repo History'; +$lang->dev->tableList['repofiles'] = 'Repo Files'; +$lang->dev->tableList['repobranch'] = 'Repo Branch'; $lang->dev->groupList['my'] = 'Dashboard'; $lang->dev->groupList['product'] = $lang->productCommon; diff --git a/module/dev/lang/en.php b/module/dev/lang/en.php index 63c2833110..038ddd60d3 100644 --- a/module/dev/lang/en.php +++ b/module/dev/lang/en.php @@ -108,6 +108,10 @@ $lang->dev->tableList['userview'] = 'User Privilege'; $lang->dev->tableList['im_chatuser'] = 'Client Users'; $lang->dev->tableList['im_message'] = 'Client Messages'; $lang->dev->tableList['im_messagestatus'] = 'Client Messages Status'; +$lang->dev->tableList['repo'] = 'Code'; +$lang->dev->tableList['repohistory'] = 'Repo History'; +$lang->dev->tableList['repofiles'] = 'Repo Files'; +$lang->dev->tableList['repobranch'] = 'Repo Branch'; $lang->dev->groupList['my'] = 'Dashboard'; $lang->dev->groupList['product'] = $lang->productCommon; diff --git a/module/dev/lang/fr.php b/module/dev/lang/fr.php index 515c70a0f1..db381b75a3 100644 --- a/module/dev/lang/fr.php +++ b/module/dev/lang/fr.php @@ -108,6 +108,10 @@ $lang->dev->tableList['userview'] = 'Droits Utilisateur'; $lang->dev->tableList['im_chatuser'] = 'Utilisateurs Client'; $lang->dev->tableList['im_message'] = 'Messages Client'; $lang->dev->tableList['im_messagestatus'] = 'Statut Messages Client'; +$lang->dev->tableList['repo'] = 'Code'; +$lang->dev->tableList['repohistory'] = 'Repo History'; +$lang->dev->tableList['repofiles'] = 'Repo Files'; +$lang->dev->tableList['repobranch'] = 'Repo Branch'; $lang->dev->groupList['my'] = 'Dashboard'; $lang->dev->groupList['product'] = $lang->productCommon; diff --git a/module/dev/lang/zh-cn.php b/module/dev/lang/zh-cn.php index 1d428a47be..5c92c0bb8b 100644 --- a/module/dev/lang/zh-cn.php +++ b/module/dev/lang/zh-cn.php @@ -123,7 +123,6 @@ $lang->dev->groupList['company'] = '组织'; $lang->dev->groupList['repo'] = '代码'; $lang->dev->groupList['api'] = 'API'; $lang->dev->groupList['message'] = '消息'; -$lang->dev->groupList['repo'] = '代码'; $lang->dev->endGroupList['admin'] = '后台'; $lang->dev->endGroupList['system'] = '系统'; diff --git a/module/dev/lang/zh-tw.php b/module/dev/lang/zh-tw.php index 4853705aa8..5ce8a90da6 100644 --- a/module/dev/lang/zh-tw.php +++ b/module/dev/lang/zh-tw.php @@ -108,6 +108,10 @@ $lang->dev->tableList['userview'] = '可訪問權限'; $lang->dev->tableList['im_chatuser'] = '客戶端用戶'; $lang->dev->tableList['im_message'] = '客戶端消息'; $lang->dev->tableList['im_messagestatus'] = '客戶端狀態'; +$lang->dev->tableList['repo'] = '代碼'; +$lang->dev->tableList['repohistory'] = '版本歷史'; +$lang->dev->tableList['repofiles'] = '代碼檔案'; +$lang->dev->tableList['repobranch'] = '代碼分支'; $lang->dev->groupList['my'] = '我的地盤'; $lang->dev->groupList['product'] = $lang->productCommon; diff --git a/module/dev/model.php b/module/dev/model.php index f86506eb45..e13c4bc6bc 100644 --- a/module/dev/model.php +++ b/module/dev/model.php @@ -18,6 +18,8 @@ class devModel extends model $table = current($table); if(empty($this->config->db->prefix) or strpos($table, $this->config->db->prefix) !== false) { + if(strpos($table, $this->config->db->prefix . 'flow_') === 0) continue; + $subTable = substr($table, strpos($table, '_') + 1); $group = zget($this->config->dev->group, $subTable, 'other'); $tables[$group][$subTable] = $table; diff --git a/module/doc/control.php b/module/doc/control.php index 50cb0b9f90..7409ee206f 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -37,6 +37,9 @@ class doc extends control */ public function index() { + $this->from = 'doc'; + setcookie('from', 'doc', $this->config->cookieLife, $this->config->webRoot, '', false, true); + $this->doc->setMenu(); $this->session->set('docList', $this->app->getURI(true)); @@ -78,7 +81,7 @@ class doc extends control public function browse($libID = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $from = 'doc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->from = $from; - setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', false, true); $this->loadModel('search'); @@ -96,6 +99,8 @@ class doc extends control $type = $lib->type; $productID = $lib->product; $projectID = $lib->project; + + if($type != 'product' and $type != 'project') $from = 'doc'; } $this->libs = $this->doc->getLibs($type, '', $libID); @@ -303,6 +308,7 @@ class doc extends control { if(!empty($_POST)) { + setcookie('lastDocModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', false, false); $docResult = $this->doc->create(); if(!$docResult or dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); @@ -318,7 +324,7 @@ class doc extends control if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ; $this->action->create('doc', $docID, 'Created', $fileAction); - $vars = "libID=$libID&browseType=byModule&moduleID={$this->post->module}&orderBy=id_desc&from=$this->from"; + $vars = "libID={$this->post->lib}&browseType=byModule&moduleID={$this->post->module}&orderBy=id_desc&from=$this->from"; $link = $this->createLink('doc', 'browse', $vars); if($this->app->getViewType() == 'xhtml') $link = $this->createLink('doc', 'view', "docID=$docID"); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link)); @@ -361,7 +367,7 @@ class doc extends control $this->view->libs = $this->doc->getLibs($type = 'all', $extra = "withObject,$unclosed", $libID); $this->view->libName = $this->dao->findByID($libID)->from(TABLE_DOCLIB)->fetch('name'); $this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0); - $this->view->moduleID = $moduleID; + $this->view->moduleID = $moduleID ? (int)$moduleID : (int)$this->cookie->lastDocModule; $this->view->type = $type; $this->view->docType = $docType; $this->view->groups = $this->loadModel('group')->getPairs(); @@ -502,6 +508,40 @@ class doc extends control } } + /** + * Delete file for doc. + * + * @param int $docID + * @param int $fileID + * @param string $confirm + * @access public + * @return void + */ + public function deleteFile($docID, $fileID, $confirm = 'no') + { + $this->loadModel('file'); + if($confirm == 'no') + { + die(js::confirm($this->lang->file->confirmDelete, inlink('deleteFile', "docID=$docID&fileID=$fileID&confirm=yes"))); + } + else + { + $docContent = $this->dao->select('t1.*')->from(TABLE_DOCCONTENT)->alias('t1') + ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.doc=t2.id and t1.version=t2.version') + ->where('t2.id')->eq($docID) + ->fetch(); + unset($docContent->id); + $docContent->files = trim(str_replace(",{$fileID},", ',', ",{$docContent->files},"), ','); + $docContent->version += 1; + $this->dao->insert(TABLE_DOCCONTENT)->data($docContent)->exec(); + $this->dao->update(TABLE_DOC)->set('version')->eq($docContent->version)->where('id')->eq($docID)->exec(); + + $file = $this->file->getById($fileID); + $this->loadModel('action')->create($file->objectType, $file->objectID, 'deletedFile', '', $extra=$file->title); + die(js::locate($this->createLink('doc', 'view', "docID=$docID"), 'parent')); + } + } + /** * Collect doc, doclib or module of doclib. * diff --git a/module/doc/js/view.js b/module/doc/js/view.js index 2c353f2a50..34edfddc4f 100644 --- a/module/doc/js/view.js +++ b/module/doc/js/view.js @@ -45,5 +45,5 @@ $(function() function deleteFile(fileID) { if(!fileID) return; - hiddenwin.location.href =createLink('file', 'delete', 'fileID=' + fileID); + hiddenwin.location.href =createLink('doc', 'deleteFile', 'docID=' + docID + '&fileID=' + fileID); } diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index b59a444006..bcdc41af51 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -78,8 +78,6 @@ $lang->doc->editType = 'Bearbeiten'; $lang->doc->deleteType = 'Löschen'; $lang->doc->addType = 'Hinzufügen'; $lang->doc->childType = 'Child'; -$lang->doc->editType = 'Manage Category'; -$lang->doc->deleteType = 'Delete Category'; $lang->doc->collect = 'Favorit hinzufügen'; $lang->doc->cancelCollection = 'Favorit entfernen'; $lang->doc->deleteFile = 'Delete File'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 3c42b4b086..d5c9516d3a 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -78,8 +78,6 @@ $lang->doc->editType = 'Edit'; $lang->doc->deleteType = 'Delete'; $lang->doc->addType = 'Add'; $lang->doc->childType = 'Categories'; -$lang->doc->editType = 'Manage Category'; -$lang->doc->deleteType = 'Delete Category'; $lang->doc->collect = 'Add Favorite'; $lang->doc->cancelCollection = 'Remove Favorite'; $lang->doc->deleteFile = 'Delete File'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 4724fc9ac0..7fb5c0059d 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -78,8 +78,6 @@ $lang->doc->editType = 'Editer'; $lang->doc->deleteType = 'Supprimer'; $lang->doc->addType = 'Ajouter'; $lang->doc->childType = 'Catégories'; -$lang->doc->editType = 'Manage Category'; -$lang->doc->deleteType = 'Delete Category'; $lang->doc->collect = 'Ajouter aux Favoris'; $lang->doc->cancelCollection = 'Retirer des Favoris'; $lang->doc->deleteFile = 'Supprimer Fichier'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 3b6b511d69..24f6e7741c 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -78,8 +78,6 @@ $lang->doc->editType = '编辑分类'; $lang->doc->deleteType = '删除分类'; $lang->doc->addType = '增加分类'; $lang->doc->childType = '子分类'; -$lang->doc->editType = '维护分类'; -$lang->doc->deleteType = '删除分类'; $lang->doc->collect = '收藏'; $lang->doc->cancelCollection = '取消收藏'; $lang->doc->deleteFile = '删除附件'; diff --git a/module/doc/lang/zh-tw.php b/module/doc/lang/zh-tw.php index 7cfd4790ea..c1b8ab910a 100644 --- a/module/doc/lang/zh-tw.php +++ b/module/doc/lang/zh-tw.php @@ -78,8 +78,6 @@ $lang->doc->editType = '編輯分類'; $lang->doc->deleteType = '刪除分類'; $lang->doc->addType = '增加分類'; $lang->doc->childType = '子分類'; -$lang->doc->editType = '維護分類'; -$lang->doc->deleteType = '刪除分類'; $lang->doc->collect = '收藏'; $lang->doc->cancelCollection = '取消收藏'; $lang->doc->deleteFile = '刪除附件'; diff --git a/module/doc/model.php b/module/doc/model.php index c313eb58f4..612e27ccf1 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -71,6 +71,7 @@ class docModel extends model { $allLibGroups = $this->getAllLibGroups($libID); $currentGroups = $allLibGroups[$type]; + /* Append closed project. */ if(!isset($currentGroups[$currentLib]) and $type == 'project') { $project = $this->dao->select('id,name,status')->from(TABLE_PROJECT)->where('id')->eq($currentLib)->fetch(); @@ -372,7 +373,7 @@ class docModel extends model if($moduleID) { $modules = array($moduleID => $moduleID); - if(strpos($this->config->doc->custom->showLibs, 'children') === false) $modules = $this->loadModel('tree')->getAllChildId($moduleID); + if(strpos($this->config->doc->custom->showLibs, 'children') !== false) $modules = $this->loadModel('tree')->getAllChildId($moduleID); } $docs = $this->getDocs($libID, $modules, $sort, $pager); } @@ -446,13 +447,20 @@ class docModel extends model $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'doc', false); if(!$docs) return array(); + $docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc'); foreach($docs as $index => $doc) { $docs[$index]->fileSize = 0; if(isset($files[$index])) { - $fileSize = 0; - foreach($files[$index] as $file) $fileSize += $file->size; + $docContent = $docContents[$index]; + $fileSize = 0; + foreach($files[$index] as $file) + { + if(strpos(",{$docContent->files},", ",{$file->id},") === false) continue; + $fileSize += $file->size; + } + if($fileSize < 1024) { $fileSize .= 'B'; @@ -514,7 +522,8 @@ class docModel extends model ->where('deleted')->eq(0) ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi() ->beginIF($libID)->andWhere('lib')->in($libID)->fi() - ->beginIF(!empty($module) or strpos($this->config->doc->custom->showLibs, 'children') === false)->andWhere('module')->in($module)->fi() + ->beginIF(strpos($this->config->doc->custom->showLibs, 'children') === false)->andWhere('module')->in($module)->fi() + ->beginIF(!empty($module) and strpos($this->config->doc->custom->showLibs, 'children') !== false)->andWhere('module')->in($module)->fi() ->query(); $docIdList = array(); @@ -609,7 +618,9 @@ class docModel extends model ->join('users', ',') ->remove('files,labels,uid') ->get(); - $doc->contentMarkdown = strip_tags($this->post->contentMarkdown, $this->config->allowedTags); + + /* Fix bug #2929. strip_tags($this->post->contentMarkdown, $this->config->allowedTags)*/ + $doc->contentMarkdown = $this->post->contentMarkdown; if($doc->acl == 'private') $doc->users = $this->app->user->account; $condition = "lib = '$doc->lib' AND module = $doc->module"; @@ -1035,7 +1046,7 @@ class docModel extends model } else { - $hasProject = $this->dao->select('DISTINCT product')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $hasProject = $this->dao->select('DISTINCT t1.product')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->in($productIdList) ->andWhere('t2.deleted')->eq(0) @@ -1158,7 +1169,7 @@ class docModel extends model } else { - $hasProject = $this->dao->select('DISTINCT product')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $hasProject = $this->dao->select('DISTINCT t1.product')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->in($idList) ->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi() @@ -1201,7 +1212,7 @@ class docModel extends model } else { - $hasProject = $this->dao->select('DISTINCT product, count(project) as projectCount')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $hasProject = $this->dao->select('DISTINCT t1.product, count(project) as projectCount')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->eq($objectID) ->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi() diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index d902d32cee..16f0bda852 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -26,7 +26,7 @@ var browseType = '';
-
+
diff --git a/module/doc/view/browsebygrid.html.php b/module/doc/view/browsebygrid.html.php index 27522f24f3..950a1bf8a9 100644 --- a/module/doc/view/browsebygrid.html.php +++ b/module/doc/view/browsebygrid.html.php @@ -1,5 +1,5 @@
-
+
diff --git a/module/doc/view/index.html.php b/module/doc/view/index.html.php index 858d07282c..5c497bf2cf 100644 --- a/module/doc/view/index.html.php +++ b/module/doc/view/index.html.php @@ -14,7 +14,7 @@
-
+
diff --git a/module/doc/view/objectlibs.html.php b/module/doc/view/objectlibs.html.php index ec334307fe..38f9e0c0d1 100644 --- a/module/doc/view/objectlibs.html.php +++ b/module/doc/view/objectlibs.html.php @@ -22,7 +22,7 @@
-
+
diff --git a/module/doc/view/objectlibsbylist.html.php b/module/doc/view/objectlibsbylist.html.php index 8c90b46750..caa5926713 100644 --- a/module/doc/view/objectlibsbylist.html.php +++ b/module/doc/view/objectlibsbylist.html.php @@ -1,5 +1,5 @@
-
+
diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php index 8f155c7506..0d1be15e9d 100644 --- a/module/doc/view/view.html.php +++ b/module/doc/view/view.html.php @@ -18,6 +18,7 @@ js::set('fullscreen', $lang->doc->fullscreen); js::set('retrack', $lang->doc->retrack); js::set('sysurl', common::getSysUrl()); +js::set('docID', $doc->id); ?>