*/ GalleryCoreApi::requireOnce('modules/customfield/classes/CustomFieldHelper.class'); /** * @package CustomField * @subpackage UserInterface */ class CustomFieldSiteAdminController extends GalleryController { /** * @see GalleryController::handleRequest */ function handleRequest($form) { /* Make sure we have adequate permissions */ $ret = GalleryCoreApi::assertUserIsSiteAdministrator(); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } list ($ret, $status) = CustomFieldHelper::handleAdminAction($form); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Figure out where to redirect upon success */ $results['redirect']['view'] = 'core.SiteAdmin'; $results['redirect']['subView'] = 'customfield.CustomFieldSiteAdmin'; $results['status'] = $status; $results['error'] = array(); return array(null, $results); } } /** * @package CustomField * @subpackage UserInterface */ class CustomFieldSiteAdminView extends GalleryView { /** * @see GalleryView::loadTemplate */ function loadTemplate(&$template, &$form) { $ret = GalleryCoreApi::assertUserIsSiteAdministrator(); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } if ($form['formName'] != 'CustomFieldSiteAdmin') { $form['formName'] = 'CustomFieldSiteAdmin'; $ret = CustomFieldHelper::loadAdminForm($form); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null); } } $template->setVariable('controller', 'customfield.CustomFieldSiteAdmin'); return array(null, array('body' => 'modules/customfield/templates/CustomFieldSiteAdmin.tpl')); } } ?>