* finish task#1670.

* finish task#1671.
 * finish task#1672.
 * finish task#1674.
 * finish task#1675.
 * finish task#1676.
 * finish task#1668.
This commit is contained in:
azhi
2013-08-07 10:40:10 +08:00
parent 4358fd24b3
commit 145c55b447
10 changed files with 214 additions and 96 deletions

View File

@@ -11,38 +11,86 @@
*/
class custom extends control
{
/**
* __construct
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
}
public function index($module = 'story', $field = 'priList')
/**
* Index
*
* @access public
* @return void
*/
public function index()
{
die(js::locate(inlink('setCustom')));
}
/**
* Custom
*
* @param string $module
* @param string $field
* @access public
* @return void
*/
public function setCustom($module = 'story', $field = 'priList')
{
if($module == 'user' and $field == 'priList') $field = 'roleList';
$lang = $this->app->getClientLang();
$this->app->loadLang($module);
$fieldList = $this->lang->$module->$field;
if(!empty($_POST))
{
$this->custom->deleteItems("{$lang}.{$module}.{$field}");
foreach($_POST['keys'] as $index => $key)
{
// $value = $_POST['values'][$index];
// if(isset($fieldList[$key]) and $fieldList[$key] == $value) continue;
$this->custom->setItem("{$lang}.{$module}.{$field}.{$key}", $value);
$value = $_POST['values'][$index];
$system = $_POST['systems'][$index];
$this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value);
}
if(!dao::getError()) die(js::reload('parent'));
}
$this->view->standardList = $this->custom->getStandardList($module, $field);
$this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->custom->story;
$this->view->position[] = $this->lang->custom->common;
$this->view->position[] = $this->lang->custom->$module;
$this->view->fieldList = $fieldList;
$this->view->dbFields = $this->custom->getItems("{$lang}.{$module}.{$field}");
$this->view->field = $field;
$this->view->module = $module;
$this->view->canAdd = strpos($this->config->custom->$module->canAdd, $field) !== false;
$this->display();
}
/**
* Restore the default lang. Delete the related items.
*
* @param string $module
* @param string $field
* @param string $confirm
* @access public
* @return void
*/
public function restore($module, $field, $confirm = 'no')
{
if($confirm == 'no')
{
die(js::confirm($this->lang->custom->confirmRestore, inlink('restore', "module=$module&field=$field&confirm=yes")));
}
$lang = $this->app->getClientLang();
$this->custom->deleteItems("{$lang}.{$module}.{$field}");
die(js::reload('parent'));
}
}