diff --git a/module/doc/control.php b/module/doc/control.php index 7c309b241e..050d692c83 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -296,7 +296,7 @@ class doc extends control * @access public * @return void */ - public function create($libID, $moduleID = 0) + public function create($libID, $moduleID = 0, $docType = '') { if(!empty($_POST)) { @@ -354,6 +354,7 @@ class doc extends control $this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0); $this->view->moduleID = $moduleID; $this->view->type = $type; + $this->view->docType = $docType; $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode'); diff --git a/module/doc/js/create.js b/module/doc/js/create.js index c2ba6a55e9..1c163e90f4 100644 --- a/module/doc/js/create.js +++ b/module/doc/js/create.js @@ -1,6 +1,7 @@ $(function() { toggleAcl($('[name=acl]').val(), 'doc'); + setTimeout(function(){initPage(docType)}, 100); $('input[name="type"]').change(function() { var type = $(this).val(); @@ -14,7 +15,7 @@ $(function() $('#contentBox').addClass('hidden'); $('#urlBox').removeClass('hidden'); } - }) + }); window.editor['content'].addListener('ready', function() { $('div#content .edui-toolbar').append("
Markdown
"); @@ -41,3 +42,21 @@ function toggleEditor(type) } $('#contentType').val(type); } + +function initPage(type) +{ + if(type == 'html' || type == 'markdown') + { + if(type == 'markdown') + { + $('#contentBox .contentmarkdown').removeClass('hidden'); + $('#contentBox .contenthtml').addClass('hidden'); + $('#contentBox #contentType').val(type); + } + } + else if(type == 'url') + { + $('#contentBox').addClass('hidden'); + $('#urlBox').removeClass('hidden'); + } +} diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index e0c57bfa8f..22c1822915 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -118,6 +118,10 @@ $lang->doc->aclList['open'] = '公开'; $lang->doc->aclList['custom'] = '自定义'; $lang->doc->aclList['private'] = '私有'; +$lang->doc->typeList['html'] = '富文本'; +$lang->doc->typeList['markdown'] = 'Markdown'; +$lang->doc->typeList['url'] = '链接'; + $lang->doc->types['text'] = '文档'; $lang->doc->types['url'] = '链接'; diff --git a/module/doc/model.php b/module/doc/model.php index 5e17ae4349..76aef30730 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -855,7 +855,7 @@ class docModel extends model $account = ',' . $this->app->user->account . ','; if(isset($object->addedBy) and $object->addedBy == $this->app->user->account) return true; - if(strpos(",$object->users,", $account) !== false) return true; + if(isset($object->users) and strpos(",{$object->users},", $account) !== false) return true; if($object->acl == 'custom') { $userGroups = $this->app->user->groups; @@ -872,8 +872,8 @@ class docModel extends model if(isset($extraDocLibs[$object->id])) return true; } - if($object->project) return $this->loadModel('project')->checkPriv($object->project); - if($object->product) return $this->loadModel('product')->checkPriv($object->product); + if(!empty($object->project)) return $this->loadModel('project')->checkPriv($object->project); + if(!empty($object->product)) return $this->loadModel('product')->checkPriv($object->product); return false; } @@ -1141,7 +1141,7 @@ class docModel extends model $projects = $mineProjects = $otherProjects = $closedProjects = array(); foreach($libs as $lib) { - if(!$this->app->user->admin and !$this->lib->checkPriv($lib->id)) continue; + if(!$this->app->user->admin and !$this->checkPrivLib($lib)) continue; if($lib->status != 'done' and $lib->status != 'closed' and $lib->PM == $this->app->user->account) { $mineProjects[$lib->id] = $lib; diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index 1ccc855ab2..eed51a77ce 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -53,7 +53,16 @@ var browseType = '';
  • " . $lang->doc->deleteLib, 'hiddenwin');?>
  • - " . $this->lang->doc->create, '', "class='btn btn-primary'");?> + + + diff --git a/module/doc/view/browsebygrid.html.php b/module/doc/view/browsebygrid.html.php index 8093c27333..087dc53bb4 100644 --- a/module/doc/view/browsebygrid.html.php +++ b/module/doc/view/browsebygrid.html.php @@ -25,7 +25,16 @@
  • " . $lang->doc->deleteLib, 'hiddenwin');?>
  • - " . $this->lang->doc->create, '', "class='btn btn-primary'");?> + + + diff --git a/module/doc/view/create.html.php b/module/doc/view/create.html.php index 1d87861612..af8b953695 100644 --- a/module/doc/view/create.html.php +++ b/module/doc/view/create.html.php @@ -43,7 +43,11 @@ doc->type;?> - doc->types, 'text');?> + doc->types as $typeKey => $typeName) $typeKeyList[$typeKey] = $typeKey; + ?> + doc->types, zget($typeKeyList, $docType, 'text'));?> doc->content;?> @@ -91,5 +95,6 @@ + doc->noticeAcl['doc']);?> diff --git a/module/doc/view/side.html.php b/module/doc/view/side.html.php index 446b66d703..73904b12c6 100644 --- a/module/doc/view/side.html.php +++ b/module/doc/view/side.html.php @@ -219,8 +219,24 @@ $(function() $('#mainRow .side-col .tabs .nav-tabs li a').click(function() { - var href = $(this).attr('href'); - $(this).closest('.side-col').find('.side-footer #orderLib').toggleClass('hidden', (href.indexOf('product') > 0 || href.indexOf('project') > 0)); + var href = $(this).attr('href'); + var canOrder = !(href.indexOf('product') > 0 || href.indexOf('project') > 0); + $(this).closest('.side-col').find('.side-footer #orderLib').toggleClass('hidden', !canOrder); + $(this).closest('.side-col').find('.side-footer #cancelOrder').toggleClass('hidden', !canOrder); + + var $tabPane = $('#mainRow .side-col .tabs .tab-content .tab-pane.active'); + var $orderLib = $(this).closest('.side-col').find('.side-footer #orderLib'); + var $cancelOrder = $(this).closest('.side-col').find('.side-footer #cancelOrder'); + if($tabPane.find('.libs-group.sort').length > 0 && canOrder) + { + $orderLib.addClass('hidden'); + $cancelOrder.removeClass('hidden'); + } + if($tabPane.find('.libs-group.sort').length == 0 && canOrder) + { + $orderLib.removeClass('hidden'); + $cancelOrder.addClass('hidden'); + } }); $('#orderLib').click(function() diff --git a/module/story/control.php b/module/story/control.php index cb614ef09c..5651588012 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1415,7 +1415,7 @@ class story extends control } else { - $stmt = $this->dbh->query($this->session->storyQueryCondition . ($this->post->exportType == 'selected' ? " AND t2.id IN({$this->cookie->checkedItem})" : '') . " ORDER BY " . strtr($orderBy, '_', ' ')); + $stmt = $this->dbh->query($this->session->storyQueryCondition . ($this->post->exportType == 'selected' ? " AND t1.id IN({$this->cookie->checkedItem})" : '') . " ORDER BY " . strtr($orderBy, '_', ' ')); while($row = $stmt->fetch()) $stories[$row->id] = $row; }