public function dorunAction() { $charset = $this->getInput('charset', 'get'); $pageid = (int) $this->getInput('pageid', 'get'); if (!in_array($charset, array('gbk', 'utf-8'))) { $charset = Wekit::app()->charset; } Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($pageid); $pageInfo = $pageBo->getPage(); if (!$pageInfo) { $this->showError("operate.fail"); } if ($pageInfo['page_type'] == PwDesignPage::PORTAL) { //$this->showError("DESIGN:page.emport.fail"); $portal = $this->_getPortalDs()->getPortal($pageInfo['page_unique']); if ($portal['template']) { $this->doZip($pageBo, $charset); } else { $this->doTxt($pageInfo, $charset); } } else { $this->doZip($pageBo, $charset); //$this->doTxt($pageInfo); } $this->_getDesignService()->clearCompile(); $this->showMessage("operate.success"); }
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"); }
/** * 清空当前页设计数据 * Enter description here ... * @see ImportController->dorunAction */ public function doclearAction() { $pageid = (int) $this->getInput('id', 'post'); Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($pageid); $pageInfo = $pageBo->getPage(); if (!$pageInfo) { $this->showError("operate.fail"); } $ids = explode(',', $pageInfo['module_ids']); $names = explode(',', $pageInfo['module_names']); $moduleDs = $this->_getModuleDs(); $bakDs = $this->_getBakDs(); $dataDs = $this->_getDataDs(); $pushDs = $this->_getPushDs(); $imageSrv = Wekit::load('design.srv.PwDesignImage'); // module $moduleDs->deleteByPageId($pageid); // data && push foreach ($ids as $id) { $dataDs->deleteByModuleId($id); $pushDs->deleteByModuleId($id); $imageSrv->clearFolder($id); } //structure $ds = $this->_getStructureDs(); foreach ($names as $name) { $ds->deleteStruct($name); } //segment $this->_getSegmentDs()->deleteSegmentByPageid($pageid); $tplPath = $pageBo->getTplPath(); $this->_getDesignService()->clearTemplate($pageid, $tplPath); //bak $bakDs->deleteByPageId($pageid); if ($pageInfo['page_type'] == PwDesignPage::PORTAL) { Wind::import('SRV:design.dm.PwDesignPortalDm'); $dm = new PwDesignPortalDm($pageInfo['page_unique']); $dm->setTemplate($tplPath); $this->_getPortalDs()->updatePortal($dm); $srv = Wekit::load('design.srv.PwDesignService'); $result = $srv->defaultTemplate($pageid, $tplPath); } else { $this->_getPageDs()->deletePage($pageid); } $this->_getDesignService()->clearCompile(); $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"); }
protected function restoreSegment($pageid, $issnap = 0) { $segments = $this->_getBakDs()->getBak(PwDesignBak::SEGMENT, $pageid, $issnap); $ds = $this->_getSegmentDs(); $srv = null; Wind::import('SRV:design.bo.PwDesignPageBo'); $bo = new PwDesignPageBo($pageid); $pageInfo = $bo->getPage(); if ($pageInfo['page_type'] == PwDesignPage::SYSTEM) { Wind::import('SRV:design.srv.PwPortalCompile'); $srv = new PwPortalCompile($bo); } foreach ($segments['bak_info'] as $k => $v) { $ds->replaceSegment($k, $pageid, $v['segment_tpl']); $strr = substr(strrchr($k, "__"), 1); if (isset($srv) && $strr == 'tpl') { $file = substr($k, 0, strlen($k) - 5); $srv->restoreTpl($file, $v['segment_struct']); //门户片段 } } return true; }
public function doeditAction() { $pageid = (int) $this->getInput('pageid', 'post'); $title = $this->getInput('title', 'post'); $struct = $this->bo->getStructure(); if (!$struct) { $this->showMessage("operate.fail"); } Wind::import('SRV:design.dm.PwDesignStructureDm'); $dm = new PwDesignStructureDm(); $dm->setStructTitle($title)->setStructname($this->bo->name); $resource = $this->_getStructureDs()->replaceStruct($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } Wind::import('SRV:design.bo.PwDesignPageBo'); $pageBo = new PwDesignPageBo($pageid); $pageInfo = $pageBo->getPage(); Wind::import('SRV:design.srv.PwPortalCompile'); $compile = new PwPortalCompile($pageBo); if ($pageInfo['page_type'] == PwDesignPage::PORTAL) { $compile->replaceTitle($this->bo->name, $title); } elseif ($pageInfo['page_type'] == PwDesignPage::SYSTEM) { !$struct['segment'] && ($struct['segment'] = ''); $compile->replaceTitle($this->bo->name, $title, $struct['segment']); } $this->setOutput($title, 'data'); $this->showMessage("operate.success"); }