* Fix doc menu of execution.
This commit is contained in:
@@ -328,7 +328,7 @@ $lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|libID
|
||||
$lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|libID=0&browseTyp=collectedbyme", 'alias' => 'collect');
|
||||
$lang->doc->menu->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product", 'alias' => 'product');
|
||||
$lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project", 'alias' => 'project');
|
||||
$lang->doc->menu->custom = array('link' => "{$lang->doc->custom}|doc|objectLibs|libID=0");
|
||||
$lang->doc->menu->custom = array('link' => "{$lang->doc->custom}|doc|objectLibs|type=custom");
|
||||
|
||||
$lang->doc->dividerMenu = ',product,';
|
||||
|
||||
|
||||
+73
-27
@@ -304,13 +304,15 @@ class doc extends control
|
||||
/**
|
||||
* Create a doc.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param int|string $libID
|
||||
* @param int $moduleID
|
||||
* @param string $docType
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($type, $objectID, $libID, $moduleID = 0, $docType = '')
|
||||
public function create($objectType, $objectID, $libID, $moduleID = 0, $docType = '')
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -330,9 +332,8 @@ class doc extends control
|
||||
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ;
|
||||
$this->action->create('doc', $docID, 'Created', $fileAction);
|
||||
|
||||
$vars = "libID=" . (int)$this->post->lib . "&browseType=byModule&moduleID=" . (int)$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");
|
||||
$params = "type=$objectType&objectID=$objectID&libID=$libID&docID=" . $docResult['id'];
|
||||
$link = $this->createLink('doc', 'objectLibs', $params);
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
|
||||
}
|
||||
|
||||
@@ -393,10 +394,13 @@ class doc extends control
|
||||
*
|
||||
* @param int $docID
|
||||
* @param bool $comment
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function edit($docID, $comment = false)
|
||||
public function edit($docID, $comment = false, $objectType = '', $objectID = 0, $libID = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -415,7 +419,16 @@ class doc extends control
|
||||
$actionID = $this->action->create('doc', $docID, $action, $fileAction . $this->post->comment);
|
||||
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('doc', 'view', "docID=$docID")));
|
||||
|
||||
if($objectType)
|
||||
{
|
||||
$link = $this->createLink('doc', 'objectLibs', "type=$objectType&objectID=$objectID&libID=$libID&docID=$docID");
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = $this->createLink('doc', 'view', "docID=$docID");
|
||||
}
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
|
||||
}
|
||||
|
||||
/* Get doc and set menu. */
|
||||
@@ -436,6 +449,10 @@ class doc extends control
|
||||
{
|
||||
$this->project->setMenu($lib->project);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->rawMethod = $objectType;
|
||||
}
|
||||
|
||||
/* Set my menu. */
|
||||
if($this->app->openApp == 'my')
|
||||
@@ -517,10 +534,11 @@ class doc extends control
|
||||
*
|
||||
* @param int $docID
|
||||
* @param string $confirm yes|no
|
||||
* @param string $from
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function delete($docID, $confirm = 'no')
|
||||
public function delete($docID, $confirm = 'no', $from = 'list')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
@@ -542,9 +560,17 @@ class doc extends control
|
||||
{
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = '';
|
||||
|
||||
if($from == 'lib')
|
||||
{
|
||||
$pos = strpos($this->session->docList, 'docID');
|
||||
$link = $pos !== false ? substr($this->session->docList, 0, $pos - 1) : $this->session->docList;
|
||||
$response['locate'] = $link;
|
||||
}
|
||||
}
|
||||
$this->send($response);
|
||||
}
|
||||
|
||||
die(js::locate($this->session->docList, 'parent'));
|
||||
}
|
||||
}
|
||||
@@ -882,34 +908,53 @@ class doc extends control
|
||||
$this->session->set('docList', $this->app->getURI(true), 'doc');
|
||||
|
||||
$objects = $this->doc->getOrderedObjects($type);
|
||||
if($type == 'product')
|
||||
|
||||
if($type == 'custom')
|
||||
{
|
||||
$objectID = $this->product->saveState($objectID, $objects);
|
||||
$table = TABLE_PRODUCT;
|
||||
|
||||
$libs = $this->doc->getLibsByObject('product', $objectID);
|
||||
|
||||
if($libID == 0) $libID = key($libs);
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID);
|
||||
|
||||
$this->app->rawMethod = 'product';
|
||||
$libs = $this->doc->getLibs('custom');
|
||||
$this->app->rawMethod = 'custom';
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectID = $this->project->saveState($objectID, $objects);
|
||||
$table = TABLE_PROJECT;
|
||||
else{
|
||||
if($type == 'product')
|
||||
{
|
||||
$objectID = $this->product->saveState($objectID, $objects);
|
||||
$table = TABLE_PRODUCT;
|
||||
|
||||
$libs = $this->doc->getLibsByObject('project', $objectID);
|
||||
$libs = $this->doc->getLibsByObject('product', $objectID);
|
||||
|
||||
if($libID == 0) $libID = key($libs);
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID);
|
||||
if($libID == 0) $libID = key($libs);
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID);
|
||||
|
||||
$this->app->rawMethod = 'project';
|
||||
$this->app->rawMethod = 'product';
|
||||
}
|
||||
else if($type == 'project')
|
||||
{
|
||||
$objectID = $this->project->saveState($objectID, $objects);
|
||||
$table = TABLE_PROJECT;
|
||||
|
||||
$libs = $this->doc->getLibsByObject('project', $objectID);
|
||||
|
||||
if($libID == 0) $libID = key($libs);
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID);
|
||||
|
||||
$this->app->rawMethod = 'project';
|
||||
}
|
||||
else if($type == 'execution')
|
||||
{
|
||||
$table = TABLE_EXECUTION;
|
||||
$libs = $this->doc->getLibsByObject('execution', $objectID);
|
||||
|
||||
if($libID == 0) $libID = key($libs);
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID);
|
||||
|
||||
$this->app->rawMethod = 'project';
|
||||
}
|
||||
|
||||
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
if(empty($object)) $this->locate($this->createLink($type, 'create', '', '', '', $this->session->project));
|
||||
}
|
||||
|
||||
if(!$libID) $libID = key($libs);
|
||||
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
if(empty($object)) $this->locate($this->createLink($type, 'create', '', '', '', $this->session->project));
|
||||
|
||||
$openApp = $this->app->openApp;
|
||||
if($openApp != 'doc') $this->loadModel($openApp)->setMenu($objectID);
|
||||
@@ -948,6 +993,7 @@ class doc extends control
|
||||
$this->view->doc = $docID ? $doc : '';
|
||||
$this->view->type = $type;
|
||||
$this->view->object = $object;
|
||||
$this->view->objectType = $type;
|
||||
$this->view->libID = $libID;
|
||||
$this->view->lib = isset($libs[$libID]) ? $libs[$libID] : array();
|
||||
$this->view->libs = $this->doc->getLibsByObject($type, $objectID);
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
.main-col .detail-title {display: flex;}
|
||||
.main-col .detail-title .title {margin-right: 10px;}
|
||||
.main-col .detail-title .info {flex: 1 1 0;}
|
||||
.main-col .detail-title .actions i {font-size: 15px; color: #8c8c8c; margin-left: 2px;}
|
||||
#sidebar {width: 250px;}
|
||||
#sidebar>.cell {width: 220px;}
|
||||
.main-col .detail-title .actions i {font-size: 15px; color: #8c8c8c; margin-left: 5px;}
|
||||
#sidebar {width: 280px;}
|
||||
#sidebar>.cell {width: 265px;}
|
||||
#sidebar>.sidebar-toggle {left: 5px; right: auto;}
|
||||
.hide-sidebar #sidebar>.sidebar-toggle>.icon:before {content: "\e314";}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
function ajaxDeleteDoc(link, replaceID, notice)
|
||||
{
|
||||
if(confirm(notice))
|
||||
{
|
||||
$.get(link, function(data)
|
||||
{
|
||||
location.href = JSON.parse(data).locate;
|
||||
})
|
||||
}
|
||||
}
|
||||
+48
-14
@@ -535,10 +535,13 @@ class docModel extends model
|
||||
/* 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";
|
||||
|
||||
$result = $this->loadModel('common')->removeDuplicate('doc', $doc, $condition);
|
||||
if($result['stop']) return array('status' => 'exists', 'id' => $result['duplicate']);
|
||||
if($doc->title)
|
||||
{
|
||||
$condition = "lib = '$doc->lib' AND module = $doc->module";
|
||||
$result = $this->loadModel('common')->removeDuplicate('doc', $doc, $condition);
|
||||
if($result['stop']) return array('status' => 'exists', 'id' => $result['duplicate']);
|
||||
}
|
||||
|
||||
$lib = $this->getLibByID($doc->lib);
|
||||
$doc = $this->loadModel('file')->processImgURL($doc, $this->config->doc->editor->create['id'], $this->post->uid);
|
||||
@@ -1218,6 +1221,32 @@ class docModel extends model
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($objectType == 'execution')
|
||||
{
|
||||
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('type')->eq('execution')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi()
|
||||
->orderBy('order_asc')
|
||||
->fetchAll('id');
|
||||
|
||||
$orderedExecutions = array();
|
||||
foreach($executions as $id => $execution)
|
||||
{
|
||||
if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM == $this->app->user->account)
|
||||
{
|
||||
$myObjects[$id] = $execution->name;
|
||||
}
|
||||
else if($execution->status != 'done' and $execution->status != 'closed' and !($execution->PM == $this->app->user->account))
|
||||
{
|
||||
$normalObjects[$id] = $execution->name;
|
||||
}
|
||||
else if($execution->status == 'done' or $execution->status == 'closed')
|
||||
{
|
||||
$closedObjects[$id] = $execution->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $myObjects + $normalObjects + $closedObjects;
|
||||
}
|
||||
@@ -1666,13 +1695,13 @@ class docModel extends model
|
||||
/**
|
||||
* Build document module index page create document button.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildCreateButton4Doc($type, $objectID, $libID)
|
||||
public function buildCreateButton4Doc($objectType, $objectID, $libID)
|
||||
{
|
||||
$html = "<div class='dropdown' id='createDropdown'>";
|
||||
$html .= "<button class='btn btn-primary' type='button' data-toggle='dropdown'><i class='icon icon-plus'></i>" . $this->lang->doc->create . " <span class='caret'></span></button>";
|
||||
@@ -1681,14 +1710,14 @@ class docModel extends model
|
||||
{
|
||||
$class = strpos($this->config->doc->officeTypes, $typeKey) !== false ? 'iframe' : '';
|
||||
$html .= "<li>";
|
||||
$html .= html::a(helper::createLink('doc', 'create', "type=$type&objectID=$objectID&libID=$libID&moduleID=0&type=$typeKey"), $typeName, '', "class='$class' data-app='{$this->app->openApp}'");
|
||||
$html .= html::a(helper::createLink('doc', 'create', "objectType=$objectType&objectID=$objectID&libID=$libID&moduleID=0&type=$typeKey"), $typeName, '', "class='$class' data-app='{$this->app->openApp}'");
|
||||
$html .= "</li>";
|
||||
|
||||
}
|
||||
if(common::hasPriv('doc', 'createLib'))
|
||||
{
|
||||
$html .= '<li class="divider"></li>';
|
||||
$html .= '<li>' . html::a(helper::createLink('doc', 'createLib', "type=$type&objectID=$objectID"), $this->lang->doc->createLib, '', "class='iframe' data-width='70%'") . '</li>';
|
||||
$html .= '<li>' . html::a(helper::createLink('doc', 'createLib', "type=$objectType&objectID=$objectID"), $this->lang->doc->createLib, '', "class='iframe' data-width='70%'") . '</li>';
|
||||
}
|
||||
$html .= "</ul></div>";
|
||||
|
||||
@@ -1864,14 +1893,17 @@ EOF;
|
||||
|
||||
$output = '';
|
||||
|
||||
$output = "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$objects[$objectID]}'><span class='text'>{$objects[$objectID]}</span> <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "<div class='table-col'><div class='list-group'>";
|
||||
foreach($objects as $key => $object)
|
||||
if($this->app->openApp == 'doc')
|
||||
{
|
||||
$output .= html::a(inlink('objectLibs', "type=$type&objectID=$key"), $object);
|
||||
$output = "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$objects[$objectID]}'><span class='text'>{$objects[$objectID]}</span> <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "<div class='table-col'><div class='list-group'>";
|
||||
foreach($objects as $key => $object)
|
||||
{
|
||||
$output .= html::a(inlink('objectLibs', "type=$type&objectID=$key"), $object, '', "data-app='{$this->app->openApp}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
|
||||
if(!empty($libs))
|
||||
{
|
||||
@@ -1880,7 +1912,7 @@ EOF;
|
||||
$output .= "<div class='table-col'><div class='list-group'>";
|
||||
foreach($libs as $key => $lib)
|
||||
{
|
||||
$output .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$key"), $lib->name);
|
||||
$output .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$key"), $lib->name, '', "data-app='{$this->app->openApp}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
}
|
||||
@@ -1931,6 +1963,8 @@ EOF;
|
||||
|
||||
if(isset($moduleDocs[0]))
|
||||
{
|
||||
if(!isset($treeMenu[0])) $treeMenu[0] = '';
|
||||
|
||||
foreach($moduleDocs[0] as $doc)
|
||||
{
|
||||
if(!$docID) $docID = $doc->id;
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
</div>
|
||||
<div class="actions">
|
||||
<?php
|
||||
if(common::hasPriv('doc', 'edit')) echo html::a(inlink('edit', "docID=$doc->id"), '<i class="icon-edit"></i>', '', "title='{$lang->doc->edit}'");
|
||||
if(common::hasPriv('doc', 'edit')) echo html::a(inlink('edit', "docID=$doc->id&comment=false&objectType=$objectType&objectID=$object->id&libID=$libID"), '<i class="icon-edit"></i>', '', "title='{$lang->doc->edit}'");
|
||||
if(common::hasPriv('doc', 'delete'))
|
||||
{
|
||||
$deleteURL = $this->createLink('doc', 'delete', "docID=$doc->id&confirm=yes");
|
||||
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"docList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->doc->delete}'");
|
||||
$deleteURL = $this->createLink('doc', 'delete', "docID=$doc->id&confirm=yes&from=lib");
|
||||
echo html::a("javascript:ajaxDeleteDoc(\"$deleteURL\", \"docList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->doc->delete}'");
|
||||
}
|
||||
?>
|
||||
<?php $star = strpos($doc->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
|
||||
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$doc->id&objectType=doc");?>" title="<?php echo $lang->doc->collect;?>" class='ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-content article-content no-margin no-padding">
|
||||
<div class="detail-content article-content">
|
||||
<?php
|
||||
if($doc->type == 'url')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user