Example #1
0
 public static function enable()
 {
     Backend::addScript(SITE_LINK . '/js/jquery.js');
     Backend::addScript(SITE_LINK . '/js/wmd.component.js');
     Backend::addScript(SITE_LINK . '/js/wmd/wmd.js');
     Backend::addStyle(SITE_LINK . '/css/wmd.css');
 }
Example #2
0
 public function html_list($result)
 {
     Backend::add('Sub Title', $result->getMeta('name'));
     Backend::add('TabLinks', $this->getTabLinks(Controller::$action));
     Backend::addScript(SITE_LINK . '/js/jquery.js');
     Backend::addScript(SITE_LINK . '/js/image_list.js');
     Backend::addStyle(SITE_LINK . '/css/image_list.css');
     Backend::addContent(Render::renderFile('image.list.tpl.php', array('db_object' => $result)));
 }
Example #3
0
 public function html_search($result)
 {
     if (!$result instanceof DBObject) {
         Controller::whoops('Invalid Object Returned');
         return $result;
     }
     Backend::add('TabLinks', $this->getTabLinks('list'));
     if (!Backend::get('Sub Title')) {
         Backend::add('Sub Title', 'Searching ' . $result->getMeta('name'));
     }
     Backend::add('term', Controller::$parameters[0]);
     Backend::addScript(SITE_LINK . 'js/jquery.js');
     Backend::addScript(SITE_LINK . 'js/table_list.js');
     $template_file = array($result->getArea() . '.search_results.tpl.php', $result->getArea() . '/search_results.tpl.php');
     if (!Render::checkTemplateFile($template_file[0]) && !Render::checkTemplateFile($template_file[1])) {
         $template_file = 'std_search_results.tpl.php';
     }
     Backend::addContent(Render::file($template_file, array('db_object' => $result)));
     return $result;
 }
Example #4
0
 function html_manage($result)
 {
     Backend::add('Sub Title', 'Manage Components');
     Backend::add('result', $result);
     Links::add('Admin', '?q=admin/index', 'secondary');
     Backend::addScript(SITE_LINK . 'js/jquery.js');
     Backend::addScript(SITE_LINK . 'js/component.manage.js');
     Backend::addContent(Render::file('component.manage.tpl.php'));
 }
Example #5
0
 /**
  * This function adds all styles and scripts to the HTML. It also retrieves primary and secondary links from the App
  *
  */
 public static function hook_post_display($data, $controller)
 {
     Backend::addScript(SITE_LINK . '/js/backend.js');
     //TODO Add site_link, and other vars, as JS vars
     Backend::addScriptContent('var site_link = \'' . SITE_LINK . '\';');
     //TODO if someone can land a script file in the correct place, he can insert JS at will...
     $comp_script = '/js/' . Controller::$area . '.component.js';
     $comp_style = '/css/' . Controller::$area . '.component.css';
     if (file_exists(WEB_FOLDER . $comp_script)) {
         Backend::addScript(SITE_LINK . $comp_script);
     }
     if (file_exists(WEB_FOLDER . $comp_style)) {
         Backend::addStyle(SITE_LINK . $comp_style);
     }
     //Make sure that jquery and backend is right at the top
     $scripts = array_unique(array_filter(Backend::getScripts()));
     $against = array();
     if (in_array(SITE_LINK . '/js/jquery.js', $scripts)) {
         $against[] = SITE_LINK . '/js/jquery.js';
     }
     if (in_array(SITE_LINK . '/js/backend.js', $scripts)) {
         $against[] = SITE_LINK . '/js/backend.js';
     }
     $scripts = array_unique(array_merge($against, $scripts));
     Backend::add('Styles', array_unique(array_filter(Backend::getStyles())));
     Backend::add('Scripts', $scripts);
     Backend::add('ScriptContent', array_unique(array_filter(Backend::getScriptContent())));
     $primary = Links::get('primary');
     $secondary = Links::get('secondary');
     $tertiary = Links::get('tertiary');
     $app_class = ConfigValue::get('settings.Class', 'Application');
     if (class_exists($app_class, true) && method_exists($app_class, 'getLinks')) {
         $app_pri = call_user_func(array($app_class, 'getLinks'), 'primary');
         $app_sec = call_user_func(array($app_class, 'getLinks'), 'secondary');
         $app_tri = call_user_func(array($app_class, 'getLinks'), 'tertiary');
     } else {
         $app_pri = false;
         $app_sec = false;
         $app_tri = false;
     }
     $primary = array_merge($primary, is_array($app_pri) ? $app_pri : array());
     $secondary = array_merge($secondary, is_array($app_sec) ? $app_sec : array());
     $tertiary = array_merge($tertiary, is_array($app_tri) ? $app_tri : array());
     Backend::add('primary_links', $primary);
     Backend::add('secondary_links', $secondary);
     Backend::add('tertiary_links', $tertiary);
     return $data;
 }