* @return array
*/
function repository_get_client($context, $id = '', $accepted_filetypes = '*', $returnvalue = '*') {
- global $CFG, $USER;
+ global $CFG, $USER, $PAGE;
$ft = new file_type_to_ext();
$image_file_ext = json_encode($ft->get_file_ext(array('image')));
.fp-login-form{text-align:center}
.fp-searchbar{float:right}
.fp-viewbar{width:300px;float:left}
-.fp-toolbar{padding: .8em;background: #FFFFCC;color:white;text-align:center;margin: 3px}
+.fp-toolbar{padding: .8em;background: #FFFFCC;text-align:center;margin: 3px}
.fp-toolbar a{padding: 0 .5em}
.fp-list{list-style-type:none;padding:0;float:left;width:100%;margin:0;}
.fp-list li{border-bottom:1px dotted gray;margin-bottom: 1em;}
</style>
<![endif]-->
EOD;
-
+ $PAGE->requires->yui_lib('yahoo');
+ $PAGE->requires->yui_lib('dom');
+ $PAGE->requires->yui_lib('element');
+ $PAGE->requires->yui_lib('event');
+ $PAGE->requires->yui_lib('json');
+ $PAGE->requires->yui_lib('treeview');
+ $PAGE->requires->yui_lib('dragdrop');
+ $PAGE->requires->yui_lib('container');
+ $PAGE->requires->yui_lib('resize');
+ $PAGE->requires->yui_lib('layout');
+ $PAGE->requires->yui_lib('connection');
+ $PAGE->requires->yui_lib('button');
+ $PAGE->requires->yui_lib('selector');
require_js(array(
- 'yui_yahoo',
- 'yui_dom',
- 'yui_event',
- 'yui_element',
- 'yui_treeview',
- 'yui_dragdrop',
- 'yui_container',
- 'yui_resize',
- 'yui_layout',
- 'yui_connection',
- 'yui_json',
- 'yui_button',
- 'yui_selector',
'repository/repository.src.js'
));
$lang = array();
$lang['popup'] = get_string('popup', 'repository');
$lang['upload'] = get_string('upload', 'repository').'...';
$lang['uploading'] = get_string('uploading', 'repository');
+ $lang['xhtml'] = get_string('xhtmlerror', 'repository');
$lang = json_encode($lang);
$options = array();
field_id = ' id="'+login[k].id+'"';
}
if (login[k].label) {
- str += '<td align="right"><label'+label_id+'>'+login[k].label+'</label> </td>';
+ str += '<td align="right"><label'+label_id+'>'+login[k].label+'</label> </td>';
+ } else {
+ str += '<td></td>';
}
if(login[k].value) {
field_value = ' value="'+login[k].value+'"';
}
}
str += '</div>';
- panel.get('element').innerHTML = str;
+ try {
+ panel.get('element').innerHTML = str;
+ } catch(e) {
+ alert(e.toString()+fp_lang.xhtml);
+ }
cached_id=id;
cached_repo_id=data.repo_id;
}
repository_client.loading = function(id, type, name) {
var panel = new YAHOO.util.Element('panel-'+id);
panel.get('element').innerHTML = '';
- var content = document.createElement('div');
- content.style.textAlign='center';
- var para = document.createElement('P');
- var img = document.createElement('IMG');
+ var str = '<div style="text-align:center">';
if(type=='load') {
- img.src = moodle_cfg.pixpath+'/i/loading.gif';
- para.innerHTML = fp_lang.loading;
+ str += '<img src="'+moodle_cfg.pixpath+'/i/loading.gif" />';
+ str += '<p>'+fp_lang.loading+'</p>';
}else{
- img.src = moodle_cfg.pixpath+'/i/progressbar.gif';
- para.innerHTML = fp_lang.copying+' <strong>'+name+'</strong>';
+ str += '<img src="'+moodle_cfg.pixpath+'/i/progressbar.gif" />';
+ str += '<p>'+fp_lang.copying+' <strong>'+name+'</strong></p>';
+ }
+ str += '</div>';
+ try {
+ panel.get('element').innerHTML = str;
+ } catch(e) {
+ alert('sadjfjsalfkj '+ e.toString());
}
- content.appendChild(para);
- content.appendChild(img);
- panel.get('element').appendChild(content);
}
repository_client.view_as_list = function(client_id, data) {
if (typeof client_id == 'object') {
this.fp[client_id].view_staus = 0;
var fs = this.fp[client_id].fs;
if(fs.pages) {
- str += '<div class="fp-paging" id="paging-'+id+'-"'+client_id+'>';
+ str += '<div class="fp-paging" id="paging-'+id+'-'+client_id+'">';
if(!fs.search_result){
var action = 'req';
} else {
return;
}
if(!fs.nosearch) {
+ var img = document.createElement('img');
+ img.src = moodle_cfg.pixpath+'/a/search.png';
var search = document.createElement('A');
search.href = '###';
- search.innerHTML = '<img src="'+moodle_cfg.pixpath+'/a/search.png" /> '+fp_lang.search;
+ search.appendChild(document.createTextNode(fp_lang.search));
+ oDiv.appendChild(img);
oDiv.appendChild(search);
search.onclick = function() {
repository_client.search_form(client_id, fs.repo_id);
}
// weather we use cache for this instance, this button will reload listing anyway
if(!fs.norefresh) {
+ var img = document.createElement('img');
+ img.src = moodle_cfg.pixpath+'/a/refresh.png';
var ccache = document.createElement('A');
- ccache.href = '###';
- ccache.innerHTML = '<img src="'+moodle_cfg.pixpath+'/a/refresh.png" /> '+fp_lang.refresh;
+ ccache.href = "###";
+ ccache.appendChild(document.createTextNode(fp_lang.refresh));
+ oDiv.appendChild(img);
oDiv.appendChild(ccache);
ccache.onclick = function() {
var params = [];