* finish task #2798.
This commit is contained in:
+11
-4
@@ -175,10 +175,12 @@ class doc extends control
|
||||
/**
|
||||
* Create a library.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createLib()
|
||||
public function createLib($type = '', $objectID = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -197,6 +199,8 @@ class doc extends control
|
||||
$this->view->users = $this->user->getPairs('nocode');
|
||||
$this->view->products = $this->product->getPairs('nocode');
|
||||
$this->view->projects = $this->project->getPairs('nocode');
|
||||
$this->view->type = $type;
|
||||
$this->view->objectID = $objectID;
|
||||
die($this->display());
|
||||
}
|
||||
|
||||
@@ -616,7 +620,8 @@ class doc extends control
|
||||
{
|
||||
$this->view->product = $this->product->getById($product);
|
||||
$libName = $this->view->product->name;
|
||||
$crumb = html::a(inlink('objectLibs', "type=product&objectID=$product"), $this->view->product->name);
|
||||
$crumb = html::a(inlink('allLibs', "type=product"), $this->lang->productCommon) . $this->lang->arrow;
|
||||
$crumb .= html::a(inlink('objectLibs', "type=product&objectID=$product"), $this->view->product->name);
|
||||
$crumb .= $this->lang->arrow . html::a(inlink('allLibs', "type=$type&product=$product"), $this->lang->doclib->main[$type]);
|
||||
}
|
||||
|
||||
@@ -676,7 +681,8 @@ class doc extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
$crumb = html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name);
|
||||
$crumb = html::a(inlink('allLibs', "type=$type"), $type == 'product' ? $this->lang->productCommon : $this->lang->projectCommon) . $this->lang->arrow;
|
||||
$crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name);
|
||||
$this->doc->setMenu($libID = 0, $moduleID = 0, $crumb);
|
||||
}
|
||||
|
||||
@@ -726,7 +732,8 @@ class doc extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
$crumb = html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name);
|
||||
$crumb = html::a(inlink('allLibs', "type=$type"), $type == 'product' ? $this->lang->productCommon : $this->lang->projectCommon) . $this->lang->arrow;
|
||||
$crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name);
|
||||
$this->doc->setMenu($libID = 0, $moduleID = 0, $crumb);
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
.lib {width:130px; margin-bottom:10px;}
|
||||
.addbtn{padding-top:22px;height:63px; border:1px dashed #ddd; width:60px;}
|
||||
.addbtn .icon-plus {font-size: 18px; display: block; opacity: 0.5; transition: opacity .2s; text-shadow: 1px 1px 3px rgba(0,0,0,.2);}
|
||||
.addbtn:hover .icon-plus {opacity: .9; animation: flash-icon 1s linear alternate infinite}
|
||||
|
||||
+21
-15
@@ -3,21 +3,27 @@ $(function()
|
||||
$('#libType').change(function()
|
||||
{
|
||||
var libType = $(this).val();
|
||||
if(libType == 'product')
|
||||
{
|
||||
$('table tr.product').removeClass('hidden');
|
||||
$('table tr.project').addClass('hidden');
|
||||
}
|
||||
else if(libType == 'project')
|
||||
{
|
||||
$('table tr.product').addClass('hidden');
|
||||
$('table tr.project').removeClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('table tr.product').addClass('hidden');
|
||||
$('table tr.project').addClass('hidden');
|
||||
}
|
||||
changeByLibType(libType);
|
||||
})
|
||||
changeByLibType($('#libType').val());
|
||||
toggleAcl($('#acl').val());
|
||||
});
|
||||
|
||||
function changeByLibType(libType)
|
||||
{
|
||||
if(libType == 'product')
|
||||
{
|
||||
$('table tr.product').removeClass('hidden');
|
||||
$('table tr.project').addClass('hidden');
|
||||
}
|
||||
else if(libType == 'project')
|
||||
{
|
||||
$('table tr.product').addClass('hidden');
|
||||
$('table tr.project').removeClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('table tr.product').addClass('hidden');
|
||||
$('table tr.project').addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
+11
-6
@@ -1182,17 +1182,22 @@ class docModel extends model
|
||||
die(js::locate('back'));
|
||||
}
|
||||
|
||||
$type = $lib->product ? 'product' : 'custom';
|
||||
$type = $lib->project ? 'project' : $type;
|
||||
|
||||
$mainLib = $type == 'product' ? $this->lang->productCommon : $this->lang->doc->customAB;
|
||||
$mainLib = $type == 'project' ? $this->lang->projectCommon : $mainLib;
|
||||
$crumb = html::a(helper::createLink('doc', 'allLibs', "type=$type"), $mainLib) . $this->lang->arrow;
|
||||
if($lib->product or $lib->project)
|
||||
{
|
||||
$table = $lib->product ? TABLE_PRODUCT : TABLE_PROJECT;
|
||||
$objectID = $lib->product ? $lib->product : $lib->project;
|
||||
$object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
$lib->name = $object->name . ' / ' . $lib->name;
|
||||
$table = $lib->product ? TABLE_PRODUCT : TABLE_PROJECT;
|
||||
$objectID = $lib->product ? $lib->product : $lib->project;
|
||||
$object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
if($object) $crumb .= html::a(helper::createLink('doc', 'objectLibs', "type=$type&objectID=$objectID"), $object->name) . $this->lang->arrow;
|
||||
}
|
||||
|
||||
|
||||
$parents = $moduleID ? $this->loadModel('tree')->getParents($moduleID) : array();
|
||||
$crumb = html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=all¶m=0&orderBy=id_desc"), $lib->name);
|
||||
$crumb .= html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=all¶m=0&orderBy=id_desc"), $lib->name);
|
||||
foreach($parents as $module) $crumb .= $this->lang->arrow . html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=byModule¶m=$module->id&orderBy=id_desc"), $module->name);
|
||||
return $crumb;
|
||||
}
|
||||
|
||||
@@ -23,15 +23,15 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo $lang->doc->libType?></th>
|
||||
<td><?php echo html::select('libType', $lang->doc->libTypeList, 'product', "class='form-control'")?></td>
|
||||
<td><?php echo html::select('libType', $lang->doc->libTypeList, $type, "class='form-control'")?></td>
|
||||
</tr>
|
||||
<tr class='product'>
|
||||
<th><?php echo $lang->doc->product?></th>
|
||||
<td><?php echo html::select('product', $products, '', "class='form-control chosen'")?></td>
|
||||
<td><?php echo html::select('product', $products, $type == 'product' ? $objectID : '', "class='form-control chosen'")?></td>
|
||||
</tr>
|
||||
<tr class='project hidden'>
|
||||
<th><?php echo $lang->doc->project?></th>
|
||||
<td><?php echo html::select('project', $projects, '', "class='form-control chosen'")?></td>
|
||||
<td><?php echo html::select('project', $projects, $type == 'project' ? $objectID : '', "class='form-control chosen'")?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->doclib->name?></th>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<div class='lib-name' title='<?php echo $libName?>'><?php echo $libName?></div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php if(common::hasPriv('doc', 'createLib')) echo html::a(inlink('createLib', "type=$type&objectID={$object->id}"), "<i class='icon icon-plus'></i>", '', "class='lib addbtn' data-toggle='modal' data-type='iframe' title='{$lang->doc->createLib}'")?>
|
||||
</div>
|
||||
</div>
|
||||
<?php js::set('type', 'doc');?>
|
||||
|
||||
Reference in New Issue
Block a user