* Refactoring list page.
This commit is contained in:
@@ -499,7 +499,7 @@ $lang->kanban->menu = new stdclass();
|
||||
/* Doc menu. */
|
||||
$lang->doc->menu = new stdclass();
|
||||
$lang->doc->menu->dashboard = array('link' => "{$lang->dashboard}|doc|index");
|
||||
$lang->doc->menu->my = array('link' => "{$lang->doc->mySpace}|doc|browse|browseTyp=openedbyme", 'alias' => 'my');
|
||||
$lang->doc->menu->my = array('link' => "{$lang->doc->mySpace}|doc|browse|browseTyp=mine", 'alias' => 'my');
|
||||
$lang->doc->menu->product = array('link' => "{$lang->doc->productSpace}|doc|productSpace|", 'alias' => 'productspace');
|
||||
$lang->doc->menu->project = array('link' => "{$lang->doc->projectSpace}|doc|projectSpace|", 'alias' => 'projectspace');
|
||||
$lang->doc->menu->api = array('link' => "{$lang->doc->apiSpace}|api|index", 'alias' => 'api');
|
||||
|
||||
+16
-27
@@ -55,17 +55,19 @@ class doc extends control
|
||||
/**
|
||||
* Browse docs.
|
||||
*
|
||||
* @param string|int $libID product|execution or the int id of custom library
|
||||
* @param string $browseType
|
||||
* @param int $param
|
||||
* @param string $type mine
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @param string $browseType all|draft|bysearch
|
||||
* @param int $param
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function browse($type = 'mine', $libID = 0, $moduleID = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
/* Save session, load module. */
|
||||
$uri = $this->app->getURI(true);
|
||||
@@ -77,9 +79,7 @@ class doc extends control
|
||||
|
||||
/* Set browseType.*/
|
||||
$browseType = strtolower($browseType);
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
$libID = ($browseType == 'bylib') ? (int)$param : 0;
|
||||
$queryID = $browseType == 'bysearch' ? (int)$param : 0;
|
||||
|
||||
/* Set header and position. */
|
||||
$this->view->title = $this->lang->doc->common;
|
||||
@@ -91,21 +91,7 @@ class doc extends control
|
||||
/* Append id for secend sort. */
|
||||
$sort = common::appendOrder($orderBy);
|
||||
|
||||
if($browseType == 'collectedbyme')
|
||||
{
|
||||
$this->app->rawMethod = 'collect';
|
||||
}
|
||||
elseif($browseType == 'openedbyme')
|
||||
{
|
||||
$this->app->rawMethod = 'my';
|
||||
}
|
||||
elseif($browseType == 'byediteddate')
|
||||
{
|
||||
$this->app->rawMethod = 'recent';
|
||||
}
|
||||
|
||||
$libs = $this->doc->getLibsByObject('mine', 0);
|
||||
$libTree = $this->doc->getLibTree($libID, $libs, 'mine', 0);
|
||||
list($libs, $libID, $object, $objectID, $objectDropdown) = $this->doc->setMenuByType('mine', 0, $libID);
|
||||
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->docs = $this->doc->getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager);
|
||||
@@ -114,12 +100,13 @@ class doc extends control
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->libID = $libID;
|
||||
$this->view->libTree = $libTree;
|
||||
$this->view->lib = $this->doc->getLibById($libID);
|
||||
$this->view->libTree = $this->doc->getLibTree($libID, $libs, 'mine', 0);
|
||||
$this->view->pager = $pager;
|
||||
$this->view->type = 'mine';
|
||||
$this->view->objectID = 0;
|
||||
$this->view->canExport = 0;
|
||||
$this->view->libType = 'mine';
|
||||
$this->view->libType = 'lib';
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -140,7 +127,9 @@ class doc extends control
|
||||
if(!dao::isError())
|
||||
{
|
||||
if($type == 'project' and $this->post->project) $objectID = $this->post->project;
|
||||
|
||||
if($type == 'product' and $this->post->product) $objectID = $this->post->product;
|
||||
|
||||
if($type == 'execution' and $this->post->execution) $objectID = $this->post->execution;
|
||||
if($type == 'custom') $objectID = 0;
|
||||
|
||||
|
||||
+23
-1
@@ -307,9 +307,31 @@ $(document).ready(function()
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* locateNewLib
|
||||
*
|
||||
* @param string $type product|project|execution|custom|mine
|
||||
* @param int $objectID
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function locateNewLib(type, objectID, libID)
|
||||
{
|
||||
location.href = createLink('doc', 'tableContents', 'type=' + type + '&objectID=' + objectID + '&libID=' + libID);
|
||||
var method = 'tableContents';
|
||||
var params = 'type=' + type + '&objectID=' + objectID + '&libID=' + libID;
|
||||
if(type == 'product' || type == 'project')
|
||||
{
|
||||
method = type + 'Space';
|
||||
params = 'objectID=' + objectID + '&libID=' + libID;
|
||||
}
|
||||
else if(type == 'mine')
|
||||
{
|
||||
method = 'browse';
|
||||
params = 'type=mine&libID=' + libID;
|
||||
}
|
||||
|
||||
location.href = createLink('doc', method, params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+10
-10
@@ -1141,7 +1141,7 @@ class docModel extends model
|
||||
*/
|
||||
public function checkPrivLib($object, $extra = '')
|
||||
{
|
||||
if($this->app->user->admin) return true;
|
||||
if($this->app->user->admin and $object->type != 'mine') return true;
|
||||
|
||||
if($object->acl == 'open') return true;
|
||||
|
||||
@@ -2638,15 +2638,7 @@ class docModel extends model
|
||||
if($this->app->tab == 'doc' and $type == 'execution') $type = 'project';
|
||||
|
||||
$objectDropdown = '';
|
||||
if($type == 'custom')
|
||||
{
|
||||
$libs = $this->getLibsByObject('custom', 0, '', $appendLib);
|
||||
if($libID == 0 and !empty($libs)) $libID = reset($libs)->id;
|
||||
|
||||
$object = new stdclass();
|
||||
$object->id = 0;
|
||||
}
|
||||
else
|
||||
if(in_array($type, array('project', 'product', 'execution')))
|
||||
{
|
||||
$objects = $this->getOrderedObjects($type);
|
||||
$objectID = $this->loadModel($type)->saveState($objectID, $objects);
|
||||
@@ -2665,6 +2657,14 @@ class docModel extends model
|
||||
return print(js::locate(helper::createLink($type, $methodName, $param)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$libs = $this->getLibsByObject($type, 0, '', $appendLib);
|
||||
if($libID == 0 and !empty($libs)) $libID = reset($libs)->id;
|
||||
|
||||
$object = new stdclass();
|
||||
$object->id = 0;
|
||||
}
|
||||
|
||||
$tab = strpos(',doc,product,project,execution,', ",{$this->app->tab},") !== false ? $this->app->tab : 'doc';
|
||||
if($tab != 'doc' and method_exists($type . 'Model', 'setMenu'))
|
||||
|
||||
Reference in New Issue
Block a user