public function dorunAction() { $pageid = (int) $this->getInput('pageid', 'post'); Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($pageid); $pageInfo = $pageBo->getPage(); if (!$pageInfo) { $this->showError("operate.fail"); } if ($pageBo->getLock()) { $this->showError('DESIGN:page.edit.other.user'); } $ext = strtolower(substr(strrchr($_FILES['file']['name'], '.'), 1)); if (!$ext || !in_array($ext, array('txt', 'zip'))) { $this->showMessage("DESIGN::upload.fail"); } if ($ext == 'zip') { //$this->showError("DESIGN:page.emport.fail"); $this->clearPage($pageInfo); $this->doZip($pageBo); } else { $this->doTxt($pageInfo); } $this->_getDesignService()->clearCompile(); $this->showMessage("operate.success"); }
/** * (non-PHPdoc) * @see src/library/base/PwBaseController::beforeAction() */ public function beforeAction($handlerAdapter) { parent::beforeAction($handlerAdapter); $moduleid = $this->getInput('moduleid'); Wind::import('SRV:design.bo.PwDesignModuleBo'); $this->bo = new PwDesignModuleBo($moduleid); $module = $this->bo->getModule(); if (!$module || $module['page_id'] < 1) { $this->showError('operate.fail'); } $this->pageid = $module['page_id']; Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($module['page_id']); if ($pageBo->getLock()) { $this->showError('DESIGN:page.edit.other.user'); } $this->setOutput($moduleid, 'moduleid'); }
/** * 对模块进行删除 * PS:不是真正的删除,记录为isused = 0状态 */ public function deleteAction() { $moduleid = (int) $this->getInput('moduleid', 'post'); $module = $this->_getModuleDs()->getModule($moduleid); if (!$module || $module['page_id'] < 1) { $this->showError('operate.fail'); } Wekit::load('design.PwDesignPermissions'); $permissions = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid); if ($permissions < PwDesignPermissions::IS_DESIGN) { $this->showError("DESIGN:permissions.fail"); } Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($module['page_id']); if ($pageBo->getLock()) { $this->showError('DESIGN:page.edit.other.user'); } Wind::import('SRV:design.dm.PwDesignModuleDm'); $dm = new PwDesignModuleDm($moduleid); $dm->setIsused(0); $resource = $this->_getModuleDs()->updateModule($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } //if (!$this->_getModuleDs()->deleteModule($moduleid)) $this->showMessage("operate.fail"); $this->_getDataDs()->deleteByModuleId($moduleid); Wekit::load('design.PwDesignPush')->deleteByModuleId($moduleid); //删除导入数据的模版内容 $dir = Wind::getRealDir('THEMES:portal.local.'); $path = $dir . $pageBo->getTplPath() . '/template/'; $files = WindFolder::read($path, WindFolder::READ_FILE); foreach ($files as $file) { $filePath = $path . $file; $content = WindFile::read($filePath); if (!$content) { continue; } $tmp = preg_replace('/\\<pw-list\\s*id=\\"' . $moduleid . '\\"\\s*>(.+)<\\/pw-list>/isU', '', $content); if ($tmp != $content) { WindFile::write($filePath, $tmp); } } $this->showMessage("operate.success"); }
public function doexitAction() { $pageid = (int) $this->getInput('pageid', 'post'); $uri = $this->getInput('uri', 'post'); $pageDs = $this->_getPageDs(); $pageInfo = $pageDs->getPage($pageid); if (!$pageInfo) { $this->showError("operate.fail"); } $permissions = $this->_getPermissionsService()->getPermissionsForPage($this->loginUser->uid, $pageid); if ($permissions < PwDesignPermissions::NEED_CHECK) { $this->showError("DESIGN:permissions.fail"); } Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($pageid); if ($pageBo->getLock()) { $this->showError('DESIGN:page.edit.other.user'); } $srv = $this->_getRestoreService(); $srv->doRestoreSnap($pageid); //编辑模式解锁 Wind::import('SRV:design.dm.PwDesignPageDm'); $dm = new PwDesignPageDm($pageid); $dm->setDesignLock(0, 0); $this->_getPageDs()->updatePage($dm); $this->_getDesignService()->clearCompile(); //$this->setOutput(urldecode($uri), 'data'); $this->showMessage("operate.success", urldecode($uri)); }