From 7983d5e7765e4f9ca1e190a8c53849c8dd7f4635 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Mon, 19 Jan 2009 07:07:54 +0000 Subject: [PATCH] "REPOSITORY/MDL-13766, merge js files into one file" --- repository/javascript.php | 71 +++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 26 deletions(-) diff --git a/repository/javascript.php b/repository/javascript.php index 7003f36924..dc8b8925a4 100644 --- a/repository/javascript.php +++ b/repository/javascript.php @@ -4,6 +4,35 @@ // Don't modify this file unless you know how it works // // // /////////////////////////////////////////////////////////////////////////// + +require_once(dirname(dirname(__FILE__)).'/config.php'); +$yui = optional_param('yui', 0, PARAM_RAW); // page or path +if (!empty($yui)) { + repository_get_yui(); +} +function repository_get_yui() { + global $CFG; + header('Expires: '.gmdate('D, d M Y H:i:s', time()+60*24*1000).'GMT'); + header('cache-control: public'); + header('Pragma: '); + $jslist = array( + 'yahoo-dom-event/yahoo-dom-event.js', + 'element/element-beta-min.js', + 'treeview/treeview-min.js', + 'dragdrop/dragdrop-min.js', + 'container/container.js', + 'resize/resize-min.js', + 'layout/layout-min.js', + 'connection/connection-min.js', + 'json/json-min.js', + 'button/button-min.js', + 'selector/selector-beta-min.js' + ); + foreach ($jslist as $js) { + readfile($CFG->httpswwwroot.'/lib/yui/'.$js); + } + exit(); +} /** * Return javascript to create file picker to browse repositories * @global object $CFG @@ -103,19 +132,7 @@ function repository_get_client($context, $accepted_filetypes = '*', $returnvalue EOD; - $js = << - - - - - - - - - - -EOD; + $js = ''; $CFG->repo_yui_loaded = true; } else { $js = ''; @@ -496,19 +513,21 @@ _client.print_footer = function() { } } // weather we use cache for this instance, this button will reload listing anyway - var ccache = document.createElement('A'); - ccache.href = '###'; - ccache.innerHTML = ' $strrefresh'; - oDiv.appendChild(ccache); - ccache.onclick = function() { - var params = []; - params['env']=_client.env; - params['sesskey']='$sesskey'; - params['ctx_id']=$context->id; - params['repo_id']=repository_client_$suffix.repositoryid; - _client.loading('load'); - var trans = YAHOO.util.Connect.asyncRequest('POST', - '$CFG->httpswwwroot/repository/ws.php?action=ccache', repository_client_$suffix.req_cb, _client.postdata(params)); + if(!_client.ds.nofresh) { + var ccache = document.createElement('A'); + ccache.href = '###'; + ccache.innerHTML = ' $strrefresh'; + oDiv.appendChild(ccache); + ccache.onclick = function() { + var params = []; + params['env']=_client.env; + params['sesskey']='$sesskey'; + params['ctx_id']=$context->id; + params['repo_id']=repository_client_$suffix.repositoryid; + _client.loading('load'); + var trans = YAHOO.util.Connect.asyncRequest('POST', + '$CFG->httpswwwroot/repository/ws.php?action=ccache', repository_client_$suffix.req_cb, _client.postdata(params)); + } } if(_client.ds.manage) { var mgr = document.createElement('A'); -- 2.39.5