public function doeditAction() { $tpl = $this->getInput('tpl', 'post'); $compid = (int) $this->getInput('compid', 'post'); $tpl = $this->_getDesignService()->filterTemplate($tpl); if (!$this->_getDesignService()->checkTemplate($tpl)) { $this->showError("DESIGN:template.error"); } $property = $this->bo->getProperty(); $limit = $this->compileFor($tpl); $property['limit'] = $limit ? $limit : $property['limit']; Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($this->bo->moduleid); $dm->setModuleTpl($tpl)->setCompid($compid)->setProperty($property); $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } $module = $this->bo->getModule(); Wekit::load('design.srv.PwSegmentService')->updateSegmentByPageId($module['page_id']); Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($this->bo->moduleid); $srv->addAutoData(); $this->_getDesignService()->clearCompile(); if ($module['module_type'] == PwDesignModule::TYPE_SCRIPT) { $this->showMessage("operate.success", "design/module/run?type=api", true); } else { $this->showMessage("operate.success"); } }
public function doeditAction() { $tpl = $this->getInput('tpl', 'post'); $compid = (int) $this->getInput('compid', 'post'); $tpl = $this->_getDesignService()->filterTemplate($tpl); if (!$this->_getDesignService()->checkTemplate($tpl)) { $this->showError("DESIGN:template.error"); } $property = $this->bo->getProperty(); $limit = $this->compileFor($tpl); $property['limit'] = $limit ? $limit : $property['limit']; Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($this->bo->moduleid); $dm->setModuleTpl($tpl)->setCompid($compid)->setProperty($property); $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } //更新模版 $module = $this->bo->getModule(); if ($module['module_type'] == PwDesignModule::TYPE_IMPORT) { Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($this->pageid); $pageInfo = $pageBo->getPage(); Wind::import('SRV:design.srv.PwPortalCompile'); $compile = new PwPortalCompile($pageBo); if ($pageInfo['page_type'] == PwDesignPage::PORTAL) { $compile->replaceList($this->bo->moduleid, $tpl); } elseif ($pageInfo['page_type'] == PwDesignPage::SYSTEM) { !$module['segment'] && ($module['segment'] = ''); $compile->replaceList($this->bo->moduleid, $tpl, $module['segment']); } } //更机数据 Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($this->bo->moduleid); $srv->addAutoData(); $this->showMessage("operate.success"); }
public function doeditAction() { $other = array('html', 'searchbar', 'image'); $model = $this->getInput('model', 'post'); $moduleid = $this->getInput('moduleid', 'post'); if (!$moduleid) { $this->showError('operate.fail'); } Wind::import('SRV:design.bo.PwDesignModuleBo'); $moduleBo = new PwDesignModuleBo($moduleid); $_model = $moduleBo->getModel(); if ($model != $_model) { $this->_getDataDs()->deleteByModuleId($moduleid); $this->_getPushDs()->deleteByModuleId($moduleid); } !$model && ($model = $_model); $module = $moduleBo->getModule(); if (!$module || $module['page_id'] < 1) { $this->showError('operate.fail'); } Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($module['page_id']); if ($pageBo->getLock()) { $this->showError('DESIGN:page.edit.other.user'); } Wekit::load('design.PwDesignPermissions'); $permissions = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $module['page_id']); if ($permissions < PwDesignPermissions::IS_ADMIN && !in_array($module['model_flag'], $other)) { $this->showError("DESIGN:permissions.fail"); } if ($permissions < PwDesignPermissions::IS_PUSH) { $this->showError("DESIGN:permissions.fail"); } $name = trim($this->getInput('module_name', 'post')); if (empty($name)) { $this->showError('DESIGN:module.name.empty'); } $cache = $this->getInput('cache', 'post'); $property = $this->getInput('property', 'post'); if ($property['limit'] > 200) { $this->showError('DESIGN:maxlimit.error'); } $cls = sprintf('PwDesign%sDataService', ucwords($model)); Wind::import('SRV:design.srv.model.' . $model . '.' . $cls); $service = new $cls(); if (method_exists($service, 'decorateSaveProperty')) { $property = $service->decorateSaveProperty($property); if ($property instanceof PwError) { $this->showError($property->getError()); } } Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($moduleid); $dm->setFlag($model)->setName($name)->setProperty($property)->setCache($cache); if (isset($property['html_tpl'])) { $dm->setModuleTpl($property['html_tpl']); } $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($moduleid); $srv->addAutoData(); $this->showMessage("operate.success"); }
public function doeditAction() { $model = $this->getInput('model', 'post'); $moduleid = $this->getInput('moduleid', 'post'); if (!$moduleid) { $this->showError('operate.fail'); } Wind::import('SRV:design.bo.PwDesignModuleBo'); $moduleBo = new PwDesignModuleBo($moduleid); $_model = $moduleBo->getModel(); if ($model != $_model) { $this->_getDataDs()->deleteByModuleId($moduleid); $this->_getPushDs()->deleteByModuleId($moduleid); } !$model && ($model = $_model); $module = $moduleBo->getModule(); if (!$module) { $this->showError('operate.fail'); } $name = trim($this->getInput('module_name', 'post')); if (empty($name)) { $this->showError('DESIGN:module.name.empty'); } $cache = $this->getInput('cache', 'post'); $property = $this->getInput('property', 'post'); if ($property['limit'] > 200) { $this->showError('DESIGN:maxlimit.error'); } $cls = sprintf('PwDesign%sDataService', ucwords($model)); Wind::import('SRV:design.srv.model.' . $model . '.' . $cls); $service = new $cls(); if (method_exists($service, 'decorateSaveProperty')) { $property = $service->decorateSaveProperty($property); if ($property instanceof PwError) { $this->showError($property->getError()); } } Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($moduleid); $dm->setFlag($model)->setName($name)->setProperty($property)->setCache($cache); if ($property['html_tpl']) { $dm->setModuleTpl($property['html_tpl']); } $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } Wekit::load('design.srv.PwSegmentService')->updateSegmentByPageId($module['page_id']); $this->_getDesignService()->clearCompile(); Wind::import('SRV:design.srv.data.PwAutoData'); $srv = new PwAutoData($moduleid); $srv->addAutoData(); $this->showMessage("operate.success"); }
protected function updateList($section) { if (preg_match_all('/\\<pw-list\\s*id=\\"(\\d+)\\"\\s*[>|\\/>](.+)<\\/pw-list>/isU', $section, $matches)) { Wind::import('SRV:design.dm.PwDesignModuleDm'); $ds = Wekit::load('design.PwDesignModule'); foreach ($matches[1] as $k => $v) { $dm = new PwDesignModuleDm($v); $dm->setModuleTpl($matches[2][$k]); $ds->updateModule($dm); } } return $section; }