This commit is contained in:
Yagami
2018-09-18 10:26:00 +08:00
6 changed files with 28 additions and 17 deletions
+3 -2
View File
@@ -910,8 +910,9 @@ class actionModel extends model
}
elseif($action->objectType == 'module')
{
$module = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->eq($action->objectID)->fetch();
$this->loadModel('tree')->checkUnique($module->root, $module->type, $module->parent, array($module->name), array($module->branch));
$module = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->eq($action->objectID)->fetch();
$repeatName = $this->loadModel('tree')->checkUnique($module);
if($repeatName) die(js::alert(sprintf($this->lang->tree->repeatName, $repeatName)));
}
/* Update deleted field in object table. */
+1 -1
View File
@@ -75,7 +75,7 @@
<div class="table-footer">
<div class="table-actions btn-toolbar" style=''>
<?php echo html::linkButton($lang->action->hideAll, inlink('hideAll'), 'hiddenwin');?>
<span class='text'><?php echo $lang->action->trashTips;?></span>
<span class='table-statistic'><?php echo $lang->action->trashTips;?></span>
</div>
<?php $pager->show('right', 'pagerjs');?>
</div>
+3 -3
View File
@@ -79,7 +79,7 @@ class custom extends control
$this->view->showDeleted = isset($this->config->user->showDeleted) ? $this->config->user->showDeleted : '0';
}
if(strtolower($_SERVER['REQUEST_METHOD']) == "post")
if(strtolower($this->server->request_method) == "post")
{
if($module == 'story' and $field == 'review')
{
@@ -270,7 +270,7 @@ class custom extends control
{
if(empty($moduleName)) $moduleName = current($this->config->custom->requiredModules);
if($_SERVER['REQUEST_METHOD'] == 'POST')
if($this->server->request_method == 'POST')
{
$this->custom->saveRequiredFields($moduleName);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
@@ -328,7 +328,7 @@ class custom extends control
public function ajaxSaveCustomFields($module, $section, $key)
{
$account = $this->app->user->account;
if($_SERVER['REQUEST_METHOD'] == 'POST')
if($this->server->request_method == 'POST')
{
$fields = $this->post->fields;
if(is_array($fields)) $fields = join(',', $fields);
-1
View File
@@ -22,7 +22,6 @@ $sessionString .= session_name() . '=' . session_id();
/* Download a file, append the mouse to the link. Thus we call decide to open the file in browser no download it. */
function downloadFile(fileID, extension, imageWidth, fileTitle)
{
console.log(fileID, extension, imageWidth);
if(!fileID) return;
var fileTypes = 'txt,jpg,jpeg,gif,png,bmp';
var sessionString = '<?php echo $sessionString;?>';
+1 -4
View File
@@ -380,11 +380,8 @@ class product extends control
if(!$product) die(js::error($this->lang->notFound) . js::locate('back'));
$product->desc = $this->loadModel('file')->setImgSize($product->desc);
$this->product->setMenu($this->products, $productID);
$plans = $this->loadModel('productplan')->getList($productID, 0, 'unexpired', null, 'begin');
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 30, 1);
@@ -399,7 +396,7 @@ class product extends control
$this->view->lines = array('') + $this->loadModel('tree')->getLinePairs();
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, $productID);
$this->view->plans = $plans;
$this->view->plans = $this->loadModel('productplan')->getList($productID, 0, 'unexpired', null, 'begin');
$this->display();
}
+20 -6
View File
@@ -1230,7 +1230,13 @@ class treeModel extends model
$childs = $data->modules;
$parentModuleID = $data->parentModuleID;
$this->checkUnique($rootID, $type, $parentModuleID, $childs);
$module = new stdClass();
$module->root = $rootID;
$module->type = $type;
$module->parent = $parentModuleID;
$repeatName = $this->checkUnique($module, $childs);
if($repeatName) die(js::alert(sprintf($this->lang->tree->repeatName, $repeatName)));
$parentModule = $this->getByID($parentModuleID);
$branches = isset($data->branch) ? $data->branch : array();
@@ -1299,7 +1305,10 @@ class treeModel extends model
{
$module = fixer::input('post')->get();
$self = $this->getById($moduleID);
$this->checkUnique($self->root, $self->type, $self->parent, array("id{$self->id}" => $module->name), array("id{$self->id}" => $self->branch));
$repeatName = $this->checkUnique($self, array("id{$self->id}" => $module->name), array("id{$self->id}" => $self->branch));
if($repeatName) die(js::alert(sprintf($this->lang->tree->repeatName, $repeatName)));
$parent = $this->getById($this->post->parent);
$childs = $this->getAllChildId($moduleID);
$module->name = strip_tags(trim($module->name));
@@ -1477,11 +1486,16 @@ class treeModel extends model
* @access public
* @return bool
*/
public function checkUnique($rootID, $viewType, $parentModuleID, $modules = array(), $branches = array())
public function checkUnique($module, $modules = array(), $branches = array())
{
if(empty($branches)) $branches = $this->post->branch;
if(empty($branches) and isset($module->branch)) $branches = array($module->branch);
if(empty($branches)) $branches = array(0);
$branches = array_unique($branches);
if(empty($modules) and isset($module->name)) $modules = array($module->name);
$branches = array_unique($branches);
$rootID = $module->root;
$viewType = $module->type;
$parentModuleID = $module->parent;
if($this->isMergeModule($rootID, $viewType) and $viewType != 'task') $viewType .= ',story';
@@ -1513,8 +1527,8 @@ class treeModel extends model
}
$checkedModules .= "$name,";
}
if($repeatName) die(js::alert(sprintf($this->lang->tree->repeatName, $repeatName)));
return true;
if($repeatName) return $repeatName;
return false;
}
/**