Esempio n. 1
0
 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");
 }
Esempio n. 2
0
 /**
  * 清空当前页设计数据
  * 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");
 }
Esempio n. 3
0
 /**
  * (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');
 }
Esempio n. 4
0
 public function deleteAction()
 {
     $portalid = (int) $this->getInput('id', 'get');
     $portal = $this->_getPortalDs()->getPortal($portalid);
     $pageInfo = $this->_getPageDs()->getPageByTypeAndUnique(PwDesignPage::PORTAL, $portalid);
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $pageBo = new PwDesignPageBo($pageInfo['page_id']);
     if ($pageInfo) {
         $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');
         $moduleDs->deleteByPageId($pageInfo['page_id']);
         // module&& data && push
         $list = Wekit::load('design.PwDesignModule')->getByPageid($this->pageid);
         foreach ($list as $id => $v) {
             $dataDs->deleteByModuleId($id);
             $pushDs->deleteByModuleId($id);
             $imageSrv->clearFolder($id);
         }
         //structure
         $ds = $this->_getStructureDs();
         foreach ($names as $name) {
             $ds->deleteStruct($name);
         }
         //segment
         $this->_getSegmentDs()->deleteSegmentByPageid($pageInfo['page_id']);
         $this->_getPageDs()->deletePage($pageInfo['page_id']);
         $this->_getPermissionsDs()->deleteByTypeAndDesignId(PwDesignPermissions::TYPE_PAGE, $pageInfo['page_id']);
     }
     $this->_getDesignService()->clearTemplate($pageBo->pageid, $pageBo->getTplPath());
     if ($this->_getPortalDs()->deletePortal($portalid)) {
         if ($portal['cover']) {
             $ext = strrchr($portal['cover'], ".");
             $filename = 'portal/' . $portalid . $ext;
             Pw::deleteAttach($filename);
         }
         $this->showMessage("operate.success");
     }
     $this->showMessage("operate.fail");
 }
Esempio n. 5
0
 public function dataAction()
 {
     $cron = false;
     $_data = array();
     $page = (int) $this->getInput('page', 'get');
     $pageid = (int) $this->getInput('pageid', 'get');
     $moduleid = (int) $this->getInput('moduleid', 'get');
     $start = (int) $this->getInput('start', 'get');
     $start >= 100 && ($start = 100);
     $module = Wekit::load('design.PwDesignModule')->getModule($moduleid);
     $perpage = 20;
     if (!$module) {
         $this->showMessage("operate.fail");
     }
     //返回成功信息
     $time = Pw::getTime();
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $pageBo = new PwDesignPageBo();
     $ds = Wekit::load('design.PwDesignData');
     $vo = Wekit::load('design.srv.vo.PwDesignDataSo');
     $vo->setModuleId($moduleid);
     $vo->setReservation(0);
     $vo->orderbyViewOrder(true);
     $vo->orderbyDataid(true);
     $data = $ds->searchData($vo, $perpage, $start);
     $this->_getLikeContentService();
     foreach ($data as $k => $v) {
         $_data[$k] = unserialize($v['extend_info']);
         $_data[$k]['fromtype'] = $v['from_app'] == 'thread' ? PwLikeContent::THREAD : 0;
         $_data[$k]['fromid'] = $v['from_id'];
         if ($v['end_time'] > 0 && $v['end_time'] < $time) {
             $cron = true;
         }
         foreach ($_data[$k] as $_k => $_v) {
             $_data[$k][$_k] = WindSecurity::escapeHTML($_v);
         }
     }
     if ($cron || count($data) < 1) {
         $pageBo->updateDesignCron(array($moduleid));
     }
     $this->setOutput($_data, 'data');
     $this->showMessage('operate.success');
 }
Esempio n. 6
0
 public function editstyleAction()
 {
     $styleid = $this->getInput('styleid', 'get');
     $portalid = (int) $this->getInput('portalid', 'get');
     $ds = $this->_getPortalDs();
     $portal = $ds->getPortal($portalid);
     if (!$portal) {
         $this->showError("operate.fail");
     }
     $styleDs = Wekit::load('APPS:appcenter.service.PwStyle');
     $style = $styleDs->getStyle($styleid);
     if (!$style || $style['style_type'] != 'portal') {
         $this->showError("operate.fail");
     }
     $pageInfo = $this->_getPageDs()->getPageByTypeAndUnique(PwDesignPage::PORTAL, $portalid);
     if (!$pageInfo) {
         $this->showError("operate.fail");
     }
     //导入文件
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $pageBo = new PwDesignPageBo($pageInfo['page_id']);
     $this->clearPage($pageInfo);
     Wind::import('SRV:design.srv.PwDesignImportZip');
     $srv = new PwDesignImportZip($pageBo);
     if (!$srv->appcenterToLocal($style['alias'])) {
         $this->showError("operate.fail");
     }
     Wind::import('SRV:design.dm.PwDesignPortalDm');
     $dm = new PwDesignPortalDm($portalid);
     $dm->setTemplate($pageBo->getTplPath());
     $ds->updatePortal($dm);
     $this->_getDesignService()->clearCompile();
     //更新数据
     Wind::import('SRV:design.srv.data.PwAutoData');
     foreach ($srv->newIds as $id) {
         if (!$id) {
             continue;
         }
         $autoSrv = new PwAutoData($id);
         $autoSrv->addAutoData();
     }
     $this->showMessage("operate.success");
 }
Esempio n. 7
0
 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");
 }
 /**
  * 门户流程控制
  * Enter description here ...
  */
 protected function runDesign()
 {
     $pageName = $unique = '';
     $pk = 0;
     if ($this->_mca == 'bbs/read/run') {
         return true;
     }
     //帖子阅读页在ReadController里处理
     $sysPage = Wekit::load('design.srv.router.PwDesignRouter')->get();
     if (!isset($sysPage[$this->_mca])) {
         return false;
     }
     list($pageName, $unique) = $sysPage[$this->_mca];
     $unique && ($pk = $this->getInput($unique, 'get'));
     if (!$pk) {
         return false;
     }
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $bo = new PwDesignPageBo();
     $pageid = $bo->getPageId($this->_mca, $pageName, $pk);
     $pageid && ($this->forward->getWindView()->compileDir = 'DATA:compile.design.' . $pageid);
     return true;
 }
Esempio n. 9
0
 /**
  * 对模块进行删除
  * 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");
 }
Esempio n. 10
0
 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));
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
 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");
 }
Esempio n. 13
0
 protected function runReadDesign($fid = 0)
 {
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $bo = new PwDesignPageBo();
     $pageid = $bo->getPageId('bbs/read/run', '帖子阅读页', $fid);
     $pageid && ($this->forward->getWindView()->compileDir = 'DATA:compile.design.' . $pageid);
     return true;
 }