function testNoMissingParams()
 {
     global $ATTACHED_MESSAGES, $ATTACHED_MESSAGES_RAW;
     $lists = find_all_previews__by_screen();
     foreach ($lists as $function => $tpls) {
         $template = $tpls[0];
         $hook = NULL;
         if (is_file(get_file_base() . '/_tests/screens_tested/nonemissing__' . $function)) {
             continue;
         }
         // To make easier to debug through
         if (function_exists('set_time_limit')) {
             @set_time_limit(0);
         }
         $ATTACHED_MESSAGES = new ocp_tempcode();
         $ATTACHED_MESSAGES_RAW = array();
         $out1 = render_screen_preview($template, $hook, $function);
         $put_out = !$ATTACHED_MESSAGES->is_empty() || count($ATTACHED_MESSAGES_RAW) > 0;
         $this->assertFalse($put_out, 'Messages put out by ' . $function . '  (' . strip_tags($ATTACHED_MESSAGES->evaluate()) . ')');
         if (!$put_out) {
             fclose(fopen(get_file_base() . '/_tests/screens_tested/nonemissing__' . $function, 'wb'));
             sync_file(get_file_base() . '/_tests/screens_tested/nonemissing__' . $function);
             fix_permissions(get_file_base() . '/_tests/screens_tested/nonemissing__' . $function);
         }
         unset($out1);
     }
 }
Beispiel #2
0
 /**
  * Shows the list of templates
  *
  * @return tempcode		The UI
  */
 function list_screen_previews()
 {
     $title = get_page_title('SCREEN_PREVIEWS');
     $GLOBALS['HELPER_PANEL_PIC'] = '';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = '';
     if (function_exists('set_time_limit')) {
         @set_time_limit(120);
     }
     require_code('lorem');
     // Find all templates
     $templates = array();
     $dh = opendir(get_file_base() . '/themes/default/templates');
     while (($f = readdir($dh)) !== false) {
         if (strtolower(substr($f, -4)) == '.tpl') {
             $templates[] = $f;
         }
     }
     sort($templates);
     // Find all previews (map of templates to previews)
     $all_previews = find_all_previews__by_template();
     // And by screen
     $all_previews__by_screen = find_all_previews__by_screen();
     // Find other things we may want to preview
     $comcode_files = find_comcodes();
     $html_files = find_html();
     // Loop over to display it all
     $displayed_already = array();
     $lis = new ocp_tempcode();
     $lis_admin = new ocp_tempcode();
     foreach ($templates as $t) {
         // If we have a preview for it
         if (array_key_exists($t, $all_previews)) {
             if (!array_key_exists($all_previews[$t][1], $displayed_already)) {
                 $func = $all_previews[$t][1];
                 $preview_url = build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $t, 'hook' => $all_previews[$t][0], 'function' => $func), '_SELF');
                 $template_used = "(" . implode(', ', $all_previews__by_screen[$func]) . ")";
                 $tpl_x = do_template('TEMPLATE_LIST', array('URL' => $preview_url, 'COLOR' => 'green', 'TEMPLATE' => preg_replace('#^tpl_preview\\_\\_#', '', $func), 'LIST' => $template_used));
                 if (preg_match('#^tpl_preview\\_\\_administrative\\_\\_#', $func) != 0) {
                     $lis_admin->attach($tpl_x);
                 } else {
                     $lis->attach($tpl_x);
                 }
                 $displayed_already[$func] = true;
             }
         } elseif (substr($t, 0, 11) != 'JAVASCRIPT_' && $t != 'JAVASCRIPT.tpl') {
             $tpl_x = do_template('TEMPLATE_LIST', array('URL' => '', 'COLOR' => 'red', 'TEMPLATE' => $t, 'LIST' => ''));
             $lis->attach($tpl_x);
         }
     }
     // Prepare all to display...
     $post = new ocp_tempcode();
     /* $lis (the main previews) will be displayed in the main INDEX_SCREEN content */
     /* LISTING ADMIN PREVIEWS */
     $post->attach(do_template('TEMPLATE_LIST_WRAP', array('LI' => $lis_admin, 'TITLE' => do_lang('ADMIN_SCREENS'))));
     /* LISTING COMCODE FILES   */
     $com_li = new ocp_tempcode();
     foreach ($comcode_files as $zone => $pages) {
         if ($zone == 'pages') {
             $zone = "";
         }
         foreach ($pages as $page => $type) {
             if (!is_string($page)) {
                 $page = strval($page);
             }
             $file = $page . '.txt';
             $url = build_url(array('page' => $page), $zone);
             $com_li->attach(do_template('TEMPLATE_LIST', array('URL' => $url, 'COLOR' => '', 'TEMPLATE' => $file, 'LIST' => '')));
         }
     }
     $post->attach(do_template('TEMPLATE_LIST_WRAP', array('LI' => $com_li, 'TITLE' => do_lang('COMCODE_PAGES'))));
     /* LISTING HTML FILES   */
     $htm_li = new ocp_tempcode();
     foreach ($html_files as $zone => $pages) {
         foreach ($pages as $page => $type) {
             $file = $page . '.htm';
             $url = build_url(array('page' => $page), $zone);
             $htm_li->attach(do_template('TEMPLATE_LIST', array('URL' => $url, 'COLOR' => '', 'TEMPLATE' => $file, 'LIST' => '')));
         }
     }
     $post->attach(do_template('TEMPLATE_LIST_WRAP', array('LI' => $htm_li, 'TITLE' => do_lang('HTML_PAGES'))));
     return do_template('INDEX_SCREEN', array('TITLE' => $title, 'CONTENT' => $lis, 'POST' => $post, 'PRE' => ''));
 }