public function tree($modules = null) { if (is_null($modules)) { $modules = $this->getOption('modulesToList'); } $officeConfig = PEAR::getStaticProperty('m_office', 'options'); $moduleconf = $officeConfig['modules']; $diff = array_diff(array_keys($_GET), array('module')); $o = array(); foreach ($modules as $id => $module) { if (is_array($module)) { if (!can('tab', $id)) { continue; } $res = array('name' => $id, 'icon' => $moduleconf[$id]['icon']); $res['submodules'] = $this->tree($module); if (in_array($_REQUEST['module'], $module)) { $res['expanded'] = true; } } else { if (!can('tab', $module)) { continue; } $res = array('name' => $module, 'icon' => $moduleconf[$module]['icon'], 'url' => M_Office::URL($module, array(), $diff)); if ($_REQUEST['module'] == $module || $_REQUEST['module'] == $module . 'helper') { $res['active'] = true; } } $o[] = $res; } return $o; }
public function __construct($do, $delete) { parent::__construct(); foreach ($delete as $deleteId) { $deldo = DB_DataObject::factory($do->tableName()); $deldo->get($deleteId); if ($deldo->delete()) { $this->say(__('Record # %s was deleted', array($deleteId))); } unset($deldo); } $this->say(__('The selected records were deleted')); M_Office_Util::refresh(M_Office::URL($this->_initRequest($_POST))); return; }
public function doExecAdd() { $form = new MyQuickForm('addform', 'POST', M_Office::URL()); $p = DB_DataObject::factory('photo'); $p->record_table = $_GET['table']; $p->record_id = $_GET['record']; $fb = MyFB::create($p); $fb->useForm($form); $fb->getForm(); if ($form->validate()) { // trigger_error('form validate') $form->process(array($fb, 'processForm'), false); $this->assign('success', 1); } $this->assign('form', $form); }
/** * In case of a multi-page action, redirects to the next step */ public function nextStep($result) { list($step, $timeout) = $this->getStepInfo(); M_Office_Util::postRedirect(M_Office::URL(array('__start' => $result->next)), $_POST, array('actionstep_' . $this->actionName, 'actionstep'), array('start' => $result->next, 'timeout' => $timeout * 1000, 'total' => $result->total, 'actionName' => $this->getActionTitle())); }
public function run() { $this->ajaxAuth = true; if ($this->getOption('auth')) { $this->ajaxAuth = false; $subController = new M_Office_Auth($_REQUEST['database']); if (!key_exists('adminPrivileges', $_SESSION) || key_exists('logout', $_REQUEST)) { $this->assign('username', User::getInstance('office')->getProperty('username')); $this->ajaxAuth = true; } elseif (!User::getInstance('office')->isLoggedIn()) { $this->ajaxAuth = false; } else { $subController->initOptions(); $this->assign('username', User::getInstance('office')->getProperty('username')); } } $not = Notifier::getInstance(); $not->addListener($this); if ($this->getOption('auth') && !User::getInstance('office')->isLoggedIn()) { if (self::isAjaxRequest()) { $this->assign('__action', 'ajaxlogin'); } return; } if (key_exists('updateSuccess', $_REQUEST)) { $this->say(__('Record was successfully updated')); M_Office_Util::clearRequest(array('updateSuccess' => 1)); } if (isset($_REQUEST['module'])) { $info = M_Office_Util::getModuleInfo($_REQUEST['module']); $module = $_REQUEST['module']; if (!$info) { if (strpos($_REQUEST['module'], ':')) { $info = array('type' => 'dyn', 'title' => 'Plugin'); $module = $tab[1]; } elseif (preg_match('`^(.+)helper$`', $_REQUEST['module'], $tab)) { $info = array('type' => 'dyn', 'title' => __("modules.{$tab[1]}helper.title")); $module = $_REQUEST['module']; } else { throw new NotFoundException(__('error.module_not_found', array($_REQUEST['module']))); } } } if ($this->isAjaxRequest() && $this->ajaxAuth && $info['type'] != 'dyn') { $this->output = ''; unset($this->localOutput); } if (isset($_REQUEST['debug']) && MODE == 'development') { $debug = (int) $_REQUEST['debug'] % 3; DB_DataObject::debugLevel($debug); ini_set('display_errors', 1); } if ($_REQUEST['livesearch']) { $aj = new M_Office_livesearch($_REQUEST['searchtext'], $_REQUEST['expand']); $this->output = $aj->processRequest(); return; } elseif ($_REQUEST['treesort']) { $aj = new M_Office_treesort(); $this->output = $aj->processRequest(); return; } elseif ($_REQUEST['liveedit']) { $aj = new M_Office_liveedit($_REQUEST['liveedit']); $this->output = $aj->processRequest(); return; } elseif (key_exists('ajaxfromtable', $_REQUEST)) { $table = $_REQUEST['module']; $do = DB_DataObject::factory($table); $do->get($_REQUEST['filterField'], $_REQUEST['filterValue']); $aj = new M_Office_ajaxFromTable($do, $_REQUEST['module'], $_REQUEST['module'], $_REQUEST['filterField'], $_REQUEST['filterValue']); $this->output = $aj->processRequest(); return; } if (isset($_REQUEST['module'])) { if (!$info) { $info = M_Office_Util::getModuleInfo($_REQUEST['module']); } switch ($info['type']) { case 'db': // TODO ajouter ce path en avant-dernier et non en dernier Mreg::get('tpl')->addPath(APP_ROOT . 'app/' . APP_NAME . '/templates/' . $info['table'] . '/', 'after'); Mreg::get('tpl')->addPath(APP_ROOT . 'app/' . APP_NAME . '/templates/' . $_REQUEST['module'] . '/', 'after'); $subController = new M_Office_ShowTable($_REQUEST['module'], $filter); break; case 'dyn': // home module = available for everyone $allowAccess = $_REQUEST['module'] == 'home' || M_Office_Util::getGlobalOption('view', 'showtable', $_REQUEST['module']); if (!$allowAccess) { Log::warn('User is NOT allowed to access ' . $_REQUEST['module']); M_Office_Util::refresh(M_Office::URL(array(), array_keys($_REQUEST))); } else { Log::info('User is allowed to access ' . $_REQUEST['module']); } $subController = Module::factory($_REQUEST['module'], M::getPaths('module')); $subController->executeAction($_REQUEST['action'] ? $_REQUEST['action'] : 'index'); $this->assign('__action', 'dyn'); $layout = $subController->getConfig('layout', $_REQUEST['action'] ? $_REQUEST['action'] : 'index'); if ($layout == '__self') { M_Office::$dsp = '__defaut/ajaxindex'; } elseif ($layout) { M_Office::$dsp = $layout; } $this->assign('output', $subController->output(null, '__self')); break; } $this->assign('currentmodule', $_REQUEST['module']); } else { $subController = new M_Office_FrontEndHome(); } }
?> _<?php echo $record->pk(); ?> "><?php _e('%s images', array($cnt)); ?> </a> - <a id="addphotolink_<?php echo $record->tableName(); ?> _<?php echo $record->pk(); ?> " href="<?php echo M_Office::URL('otfimage:photohelper/add', array('record' => $record->pk(), 'table' => $record->tableName())); ?> "><?php _e('Add image'); ?> </a> <?php echo $this->getCapture('imagelist'); ?> <?php $this->startCapture('js'); ?> if(typeof(initpheditor)=='function') { initpheditor('<?php
public function doExecRedirect() { $redirmodule = $_REQUEST['targetmodule']; $extag = explode(',', $_REQUEST['ex_tag']); $intag = explode(',', $_REQUEST['int_tag']); foreach ($extag as $tagname) { $t = DB_DataObject::factory('tag'); $t->strip = $tagname; if ($t->find(true)) { $extagid[$t->id] = 1; } } foreach ($intag as $tagname) { $t = DB_DataObject::factory('tag'); $t->strip = $tagname; if ($t->find(true)) { $intagid[$t->id] = 1; } } $this->redirect(M_Office::URL(array('module' => $redirmodule, 'exc__tags' => $extagid, '_tags' => $intagid), array('targetmodule', 'ex_tag', 'int_tag'))); }
" /> <button class="btn-xs btn-danger"><i class="fa fa-times"></i></button> </form> <?php echo $tag; ?> </span> <?php } ?> <span class="badge badge-primary"> <form method="post" action="<?php echo M_Office::URL('tag:taghelper/addbystrip', array('focustable' => $focus->tableName(), 'focusid' => $focus->pk(), 'focusmodule' => $module)); ?> "> <input type="hidden" name="target" value="<?php echo M_Office::URL(); ?> " /> <input type="text" name="strip" id="addtag_<?php echo $focus->tableName(); ?> _<?php echo $focus->pk(); ?> " size="20"/> <button class="btn btn-xs btn-primary"><i class="fa fa-plus"></i></button> </form> </span> </div> <?php echo $this->c('tag:taghelper', 'autocomplete', array('field' => 'addtag_' . $focus->tableName() . '_' . $focus->pk()));
<h1><?php _e('Plugins:Tag Manager'); ?> </h1> <ul> <li><a href="<?php echo M_Office::URL('tag:admin/cloud'); ?> ">View cloud</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/merger'); ?> ">Tag merger</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/manager'); ?> ">Tag manager (archiving and deletion)</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/applier'); ?> ">Tag applier / remover</a></li> <li><a href="<?php echo M_Office::URL('tag:admin/stats'); ?> ">Statistics</a></li> </ul>
public function testWithNamePrefix() { T::setLang('fr'); $t = DB_DataObject::factory('formtest'); $t->fb_elementNamePrefix = 'test'; $fb = MyFB::create($t); $form = new MyQuickForm('testform', 'POST', M_Office::URL()); $post = array_merge($form->exportValues(), array('testtitre_group' => array('testtitre_fr' => 'Test titre', 'testtitre_en' => 'title', 'testtitre_es' => 'titulo'), 'testdescription_group' => array('testdescription_fr' => 'Nouv desc 2 FR', 'testdescription_en' => null, 'testdescription_es' => 'Nueva desc 2 ES'), 'testpays' => 'ma', 'testtestuser_id' => 1, '_qf__' . $form->getAttribute('name') => 1, 'testi18n_id_fr' => '', 'testi18n_id_en' => '', 'testi18n_id_es' => '', 'testid' => '')); $get = $_GET; $request = array_merge($get, $post); $form->initRequest($get, $post, $request); $fb->useForm($form); $fb->getForm(); $form->validate(); $form->process(array($fb, 'processForm'), false); T::setLang('es'); $t2 = DB_DataObject::factory('formtest'); $t2->get($t->id); $this->assertEqual($t2->titre, 'titulo'); T::setLang('en'); $t2 = DB_DataObject::factory('formtest'); $t2->get($t->id); $this->assertEqual($t2->titre, 'title'); }
?> </td> <td><?php echo $tag->nbtagged(); ?> </td> <td><?php echo $tag->nbwasAdded(); ?> times</td> <td><?php echo $tag->nbwasRemoved(); ?> times</td> <td><a class="del" href="<?php echo M_Office::URL('tag:admin/delete', array('id' => $tag->id)); ?> "><img src="/images/icons/cross.png" /></a></td> </tr> <?php } ?> </tbody> </table> <?php $this->startCapture('js'); ?> $('.tagmanager a.del').click(function(){ return confirm('Are you sure ???? THIS CANNOT BE UNDONE !!'); })