This commit is contained in:
Yagami
2019-02-22 14:21:27 +08:00
9 changed files with 75 additions and 12 deletions
+2 -1
View File
@@ -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');
+20 -1
View File
@@ -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("<div class='edui-box edui-button edui-for-markdown edui-default'><div class='edui-default' onmouseover='toggleHover(this)' onmouseout='toggleHover(this)'><div class='edui-button-wrap edui-default' style='padding-right:4px;padding-left:4px;'><div class='edui-default' onclick='toggleEditor(\"markdown\")' title='Markdown'>Markdown</div></div></div></div>");
@@ -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');
}
}
+4
View File
@@ -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'] = '链接';
+4 -4
View File
@@ -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;
+10 -1
View File
@@ -53,7 +53,16 @@ var browseType = '<?php echo $browseType;?>';
<li><?php common::printLink('doc', 'deleteLib', "libID=$libID", "<i class='icon icon-trash'></i>" . $lang->doc->deleteLib, 'hiddenwin');?></li>
</ul>
</div>
<?php common::printLink('doc', 'create', "libID=$libID&moduleID=$moduleID", "<i class='icon icon-plus'></i> " . $this->lang->doc->create, '', "class='btn btn-primary'");?>
<?php if(common::hasPriv('doc', 'create')):?>
<div class="dropdown">
<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> <?php echo $lang->doc->create;?> <span class='caret'></span></button>
<ul class='dropdown-menu'>
<?php foreach($lang->doc->typeList as $typeKey => $typeName):?>
<li><?php echo html::a($this->createLink('doc', 'create', "libID=$libID&moduleID=$moduleID&type=$typeKey"), $typeName);?></li>
<?php endforeach;?>
</ul>
</div>
<?php endif;?>
<?php endif;?>
</nav>
</div>
+10 -1
View File
@@ -25,7 +25,16 @@
<li><?php common::printLink('doc', 'deleteLib', "libID=$libID", "<i class='icon icon-trash'></i>" . $lang->doc->deleteLib, 'hiddenwin');?></li>
</ul>
</div>
<?php common::printLink('doc', 'create', "libID=$libID&moduleID=$moduleID", "<i class='icon icon-plus'></i> " . $this->lang->doc->create, '', "class='btn btn-primary'");?>
<?php if(common::hasPriv('doc', 'create')):?>
<div class="dropdown">
<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i> <?php echo $lang->doc->create;?> <span class='caret'></span></button>
<ul class='dropdown-menu'>
<?php foreach($lang->doc->typeList as $typeKey => $typeName):?>
<li><?php echo html::a($this->createLink('doc', 'create', "libID=$libID&moduleID=$moduleID&type=$typeKey"), $typeName);?></li>
<?php endforeach;?>
</ul>
</div>
<?php endif;?>
<?php endif;?>
</nav>
</div>
+6 -1
View File
@@ -43,7 +43,11 @@
</tr>
<tr>
<th><?php echo $lang->doc->type;?></th>
<td><?php echo html::radio('type', $lang->doc->types, 'text');?></td>
<?php
$typeKeyList = array();
foreach($lang->doc->types as $typeKey => $typeName) $typeKeyList[$typeKey] = $typeKey;
?>
<td><?php echo html::radio('type', $lang->doc->types, zget($typeKeyList, $docType, 'text'));?></td>
</tr>
<tr id='contentBox'>
<th><?php echo $lang->doc->content;?></th>
@@ -91,5 +95,6 @@
</form>
</div>
</div>
<?php js::set('docType', $docType);?>
<?php js::set('noticeAcl', $lang->doc->noticeAcl['doc']);?>
<?php include '../../common/view/footer.html.php';?>
+18 -2
View File
@@ -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()
+1 -1
View File
@@ -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;
}