Example #1
0
 public function handleCommand(Zikula_Form_View $view, &$args)
 {
     $url = ModUtil::url('Content', 'admin', 'main');
     if ($args['commandName'] == 'editPage') {
         $url = ModUtil::url('Content', 'admin', 'editPage', array('pid' => $args['commandArgument']));
     } else {
         if ($args['commandName'] == 'newSubPage') {
             $url = ModUtil::url('Content', 'admin', 'newPage', array('pid' => $args['commandArgument'], 'loc' => 'sub'));
         } else {
             if ($args['commandName'] == 'newPage') {
                 $url = ModUtil::url('Content', 'admin', 'newPage', array('pid' => $args['commandArgument']));
             } else {
                 if ($args['commandName'] == 'clonePage') {
                     $url = ModUtil::url('Content', 'admin', 'clonepage', array('pid' => $args['commandArgument']));
                 } else {
                     if ($args['commandName'] == 'pageDrop') {
                         $srcId = FormUtil::getPassedValue('contentTocDragSrcId', null, 'POST');
                         $dstId = FormUtil::getPassedValue('contentTocDragDstId', null, 'POST');
                         list($dummy, $srcId) = explode('_', $srcId);
                         list($dummy, $dstId) = explode('_', $dstId);
                         $ok = ModUtil::apiFunc('Content', 'Page', 'pageDrop', array('srcId' => $srcId, 'dstId' => $dstId));
                         if (!$ok) {
                             return $this->view->registerError(null);
                         }
                     } else {
                         if ($args['commandName'] == 'decIndent') {
                             $pageId = (int) $args['commandArgument'];
                             $ok = ModUtil::apiFunc('Content', 'Page', 'decreaseIndent', array('pageId' => $pageId));
                             if (!$ok) {
                                 return $this->view->registerError(null);
                             }
                         } else {
                             if ($args['commandName'] == 'incIndent') {
                                 $pageId = (int) $args['commandArgument'];
                                 $ok = ModUtil::apiFunc('Content', 'Page', 'increaseIndent', array('pageId' => $pageId));
                                 if (!$ok) {
                                     return $this->view->registerError(null);
                                 }
                             } else {
                                 if ($args['commandName'] == 'deletePage') {
                                     $pageId = (int) $args['commandArgument'];
                                     $ok = ModUtil::apiFunc('Content', 'Page', 'deletePage', array('pageId' => $pageId));
                                     if ($ok === false) {
                                         return $this->view->registerError(null);
                                     }
                                 } else {
                                     if ($args['commandName'] == 'history') {
                                         $pageId = (int) $args['commandArgument'];
                                         $url = ModUtil::url('Content', 'admin', 'history', array('pid' => $pageId));
                                     } else {
                                         if ($args['commandName'] == 'sortPagesBelowByTitle') {
                                             $pageId = (int) $args['commandArgument'];
                                             $ok = ModUtil::apiFunc('Content', 'Page', 'orderPages', array('pageId' => $pageId));
                                             if ($ok === false) {
                                                 return $this->view->registerError(null);
                                             }
                                         } else {
                                             if ($args['commandName'] == 'toggleExpand') {
                                                 $pageId = FormUtil::getPassedValue('contentTogglePageId', null, 'POST');
                                                 Content_Util::contentMainEditExpandToggle($pageId);
                                             } else {
                                                 if ($args['commandName'] == 'expandAll') {
                                                     Content_Util::contentMainEditExpandAll();
                                                 } else {
                                                     if ($args['commandName'] == 'expandAllBelow') {
                                                         Content_Util::contentMainEditExpandAll($args['commandArgument']);
                                                     } else {
                                                         if ($args['commandName'] == 'collapseAll') {
                                                             Content_Util::contentMainEditCollapseAll();
                                                         } else {
                                                             if ($args['commandName'] == 'collapseAllBelow') {
                                                                 Content_Util::contentMainEditCollapseAll($args['commandArgument']);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->view->redirect($url);
     return true;
 }