]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19690 - eliminate the $OUTPUT->initialise_deprecated_cfg_pixpath horrible hack.
authortjhunt <tjhunt>
Thu, 2 Jul 2009 11:23:47 +0000 (11:23 +0000)
committertjhunt <tjhunt>
Thu, 2 Jul 2009 11:23:47 +0000 (11:23 +0000)
Replace $CFG->pixpath with $OUPTUT->old_icon_url(...) instead.

16 files changed:
lib/formslib.php
lib/outputlib.php
lib/weblib.php
mod/chat/gui_ajax/update.php
question/category_class.php
repository/alfresco/repository.class.php
repository/boxnet/repository.class.php
repository/draft/repository.class.php
repository/filepicker.php
repository/filesystem/repository.class.php
repository/lib.php
repository/local/repository.class.php
repository/mahara/repository.class.php
repository/s3/repository.class.php
repository/url/repository.class.php
repository/webdav/repository.class.php

index 92e0abbd98bcbcbd92d3cea18b369ffcec900db2..06e5c0fc0b34e9fa6a3061ba0d5c74861f7eab2b 100644 (file)
@@ -1063,7 +1063,6 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
      */
     function MoodleQuickForm($formName, $method, $action, $target='', $attributes=null){
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
 
         static $formcounter = 1;
 
index 1c65c1909bb967e447999eb834e2dc61b233f342..a9a2e3765f2d1bd63d0196d5ae306635a3084eee 100644 (file)
@@ -1932,21 +1932,6 @@ class moodle_core_renderer extends moodle_renderer_base {
     public function container_end() {
         return $this->opencontainers->pop('container');
     }
-
-    /**
-     * At the moment we frequently have a problem with $CFG->pixpath not being
-     * initialised when it is needed. Unfortunately, there is no nice way to handle
-     * this. I think we need to replace $CFG->pixpath with something like $OUTPUT->icon(...).
-     * However, until then, we need a way to force $CFG->pixpath to be initialised,
-     * to fix the error messages, and that is what this function if for.
-     */
-    public function initialise_deprecated_cfg_pixpath() {
-        // Actually, we don't have to do anything here. Just calling any method
-        // of $OBJECT  is enough. However, if the only reason you are calling
-        // an $OUTPUT method is to get $CFG->pixpath initialised, please use this
-        // method, so we can find them and clean them up later once we have
-        // found a better replacement for $CFG->pixpath.
-    }
 }
 
 
index 56c52ea156d374974ba7336c895460bb26698b13..f7c6c469e5f5627a26a0c5a18173d72df05f76a0 100644 (file)
@@ -4652,7 +4652,6 @@ function editorhelpbutton(){
 function helpbutton($page, $title, $module='moodle', $image=true, $linktext=false, $text='', $return=false,
                      $imagetext='') {
     global $CFG, $COURSE, $OUTPUT;
-    $OUTPUT->initialise_deprecated_cfg_pixpath();
 
     //warning if ever $text parameter is used
     //$text option won't work properly because the text needs to be always cleaned and,
@@ -4694,7 +4693,7 @@ function helpbutton($page, $title, $module='moodle', $image=true, $linktext=fals
             $linkobject .= $imagetext;
         } else {
             $linkobject .= '<img class="iconhelp" alt="'.s(strip_tags($tooltip)).'" src="'.
-                $CFG->pixpath .'/help.gif" />';
+                $OUTPUT->old_icon_url('help') . '" />';
         }
     } else {
         $linkobject .= $tooltip;
index 8c1276847c283645071217935fca1db6b9e40376..26442f9e926001c312b1beaaf0679a5ad0e2ec19 100755 (executable)
@@ -54,8 +54,6 @@ if (!$cm = get_coursemodule_from_instance('chat', $chatuser->chatid, $course->id
 // setup $PAGE so that format_text will work properly
 $PAGE->set_cm($cm, $course, $chat);
 
-$OUTPUT->initialise_deprecated_cfg_pixpath();
-
 if($CFG->chat_use_cache){
     $cache = new file_cache();
     $users = $cache->get('user');
index 3d783b8b80d19891bf0b50ed00b96ce4961a3e75..5bfca76f2432933f9e4efcd5e3f611c7e40e9b7f 100644 (file)
@@ -173,7 +173,6 @@ class question_category_object {
         $this->str->cancel         = get_string('cancel');
         $this->str->editcategories = get_string('editcategories', 'quiz');
         $this->str->page           = get_string('page');
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $this->pixpath = $CFG->pixpath;
 
         $this->pageurl = $pageurl;
index 4399649751cd9acec27a8790fd87ec81fae38596..2e19ffa513528ee5876deeae1f10816a25b73b37 100755 (executable)
@@ -100,7 +100,6 @@ class repository_alfresco extends repository {
 
     public function get_listing($uuid = '', $path = '') {
         global $CFG, $SESSION, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $ret = array();
         $ret['dynload'] = true;
         $ret['list'] = array();
@@ -129,7 +128,7 @@ class repository_alfresco extends repository {
                         'children'=>array());
                 } elseif ($child->child->type == $file_filter) {
                     $ret['list'][] = array('title'=>$child->child->cm_name,
-                        'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $child->child->cm_name),
+                        'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $child->child->cm_name))),
                         'source'=>$child->child->id);
                 }
             }
index d43f57dd153a9089abed91b8e66e8dbbf42b8729..5e04cb13ca6548a79e1ba574ed1e0a82c5f3c73c 100755 (executable)
@@ -138,7 +138,6 @@ class repository_boxnet extends repository {
      */
     public function search($search_text) {
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $list = array();
         $ret  = array();
         $tree = $this->box->getAccountTree();
@@ -155,7 +154,7 @@ class repository_boxnet extends repository {
                             'date'=>$filedates[$n],
                             'source'=>'http://box.net/api/1.0/download/'
                                 .$this->auth_token.'/'.$fileids[$n],
-                            'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $v));
+                            'thumbnail'=>$OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $v))));
                 }
             }
         }
index 87b0506170197764d67d2ef3886acb8a4d121627..f04b1cc35d96c8ab85dd97d8fe16c21166f038fc 100755 (executable)
@@ -33,7 +33,6 @@ class repository_draft extends repository {
      */
     public function get_listing($path = '', $page = '') {
         global $CFG, $USER, $itemid, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $ret = array();
         $ret['dynload'] = true;
         $ret['nosearch'] = true;
index 49220a103a41d4ceb73b1dd26452cffd5d741770..d8f0633b1e2f54fd3e714202d0711b3f9df01fb0 100755 (executable)
@@ -22,7 +22,6 @@ require_once('lib.php');
 set_time_limit(0);
 
 require_login();
-$OUTPUT->initialise_deprecated_cfg_pixpath();
 
 $page        = optional_param('page', '',          PARAM_RAW);    // page
 $client_id   = optional_param('client_id', SITEID, PARAM_RAW);    // client ID
index bda865687f4ef03c23f1e62c9d9f921047c93407..25f2bea3823d2d3b4f781fbb3226276e20a2cea8 100644 (file)
@@ -30,8 +30,6 @@ class repository_filesystem extends repository {
     }
     public function get_listing($path = '', $page = '') {
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
-
         $list = array();
         $list['list'] = array();
         // process breacrumb trail
@@ -66,7 +64,7 @@ class repository_filesystem extends repository {
                             'source' => $path.'/'.$file,
                             'size' => filesize($this->root_path.$file),
                             'date' => time(),
-                            'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $this->root_path.$file)
+                            'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $this->root_path.$file)))
                         );
                     } else {
                         if (!empty($path)) {
index d46b70a4b304dbf280b6412c13579ebacd55838d..1a07ae0849d1698ca1526f417e6457ceb7183804 100644 (file)
@@ -737,7 +737,6 @@ abstract class repository {
      */
     public static function move_to_filepool($path, $name, $itemid, $filearea = 'user_draft') {
         global $DB, $CFG, $USER, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $context = get_context_instance(CONTEXT_USER, $USER->id);
         $now = time();
         $entry = new object();
@@ -770,7 +769,7 @@ abstract class repository {
                 return array('url'=>$ret->get_url(),
                     'id'=>$file->get_itemid(),
                     'file'=>$file->get_filename(),
-                    'icon'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $path)
+                    'icon'=>$OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $path)))
                 );
             } else {
                 return null;
@@ -897,7 +896,6 @@ abstract class repository {
      */
     public static function build_tree($fileinfo, $search, $dynamicmode, &$list) {
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
 
         $filecount = 0;
         $children = $fileinfo->get_children();
index 63a858cd550b3892975f6a8735e593560448439c..3e6fd5ab3904422d9fe6bf03c8e68efb235b36bf 100755 (executable)
@@ -47,7 +47,6 @@ class repository_local extends repository {
      */
     public function get_listing($encodedpath = '', $page = '', $search = '') {
         global $CFG, $USER, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $ret = array();
         $ret['dynload'] = true;
         $ret['nosearch'] = true;
index a2d341ab821a1f9fe6f0936bb9117207c3a73d10..10dc68372edee044c5dcde4fecdf5c222b82e477 100644 (file)
@@ -129,7 +129,6 @@ class repository_mahara extends repository {
      */
     public function get_listing($path = null, $page = 1, $search = '') {
         global $CFG, $DB, $USER, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
 
         ///check that Mahara has a good version
         ///We also check that the "get file list" method has been activated (if it is not
@@ -215,7 +214,7 @@ class repository_mahara extends repository {
                 if ($file['artefacttype'] == 'image') {
                     $thumbnail = $host->wwwroot."/artefact/file/download.php?file=".$file['id']."&size=70x55";
                 } else {
-                    $thumbnail = $CFG->pixpath .'/f/'. mimeinfo('icon32', $file['title']);
+                    $thumbnail = $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $file['title'])));
                 }
                 $list[] = array( 'title'=>$file['title'], 'date'=>$file['mtime'], 'source'=>$file['id'], 'thumbnail' => $thumbnail);
             }
index 69aa46e52e1720bade285389e34b65f29f550b67..aaf9b3879a6899396031ddb766a985874ead3a62 100644 (file)
@@ -13,7 +13,6 @@ class repository_s3 extends repository {
     }
     public function get_listing($path = '', $page = '') {
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $list = array();
         $list['list'] = array();
         // the management interface url
@@ -46,7 +45,7 @@ class repository_s3 extends repository {
                     'size'=>$file['size'],
                     'date'=>userdate($file['time']),
                     'source'=>$path.'/'.$file['name'],
-                    'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $file['name'])
+                    'thumbnail'=>$OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $file['name'])))
                     );
             }
         }
index 01d89a2e6cb20ea9e984c3ad422a93249880ef6f..4a99f1368f847856e6b8e8562da708bc9a9710b6 100755 (executable)
@@ -80,7 +80,6 @@ EOD;
      */
     public function get_listing($path='', $page='') {
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $ret = array();
         $curl = new curl;
         $msg = $curl->head($this->file_url);
@@ -102,7 +101,7 @@ EOD;
                 $ret['list'][] = array(
                     'title'=>$filename,
                     'source'=>$this->file_url,
-                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $filename)
+                    'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $filename)))
                     );
             }
         }
@@ -110,7 +109,6 @@ EOD;
     }
     public function analyse_page($baseurl, $content, &$list) {
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $urls = extract_html_urls($content);
         $images = $urls['img']['src'];
         $pattern = '#img(.+)src="?\'?([[:alnum:]:?=&@/._+-]+)"?\'?#i';
@@ -122,8 +120,7 @@ EOD;
                     'thumbnail'=>url_to_absolute($baseurl, $url),
                     'thumbnail_height'=>84,
                     'thumbnail_width'=>84
-                    //'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $url)
-                    );
+                );
             }
         }
     }
index 0706dca6b735f880f50fed89e654c7599fb13c05..c6755877f4bd34be4475f98c1275f226b5e7bdc5 100644 (file)
@@ -64,7 +64,6 @@ class repository_webdav extends repository {
     }
     public function get_listing($path='', $page = '') {
         global $CFG, $OUTPUT;
-        $OUTPUT->initialise_deprecated_cfg_pixpath();
         $list = array();
         $ret  = array();
         $ret['dynload'] = true;
@@ -122,7 +121,7 @@ class repository_webdav extends repository {
                 $size = !empty($v['getcontentlength'])? $v['getcontentlength']:'';
                 $ret['list'][] = array(
                     'title'=>$title,
-                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $title),
+                    'thumbnail' => $OUTPUT->old_icon_url('f/'. str_replace(array('.png', '.gif'), '', mimeinfo('icon32', $title))),
                     'size'=>$size,
                     'date'=>$filedate,
                     'source'=>$v['href']