Skip to content

Commit

Permalink
Merge branch 'wip-MDL-33218-master' of git://github.com/barbararamiro…
Browse files Browse the repository at this point in the history
…/moodle
  • Loading branch information
danpoltawski committed Jun 4, 2012
2 parents f27735e + 7c3e665 commit 1cf8400
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 106 deletions.
53 changes: 26 additions & 27 deletions files/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,9 @@ private function fm_js_template_listfilename() {
*/
private function fm_js_template_mkdir() {
$rv = '
<div class="fp-mkdir-dlg">
<p>New folder name:</p>
<input type="text"><br/>
<a class="{!}fp-dlg-butcreate fp-panel-button" href="#">'.get_string('create').'</a>
<div class="filemanager fp-mkdir-dlg">
<div class="fp-mkdir-dlg-text">'.get_string('newfoldername','repository').'<br/><input type="text" /></div>
<a class="{!}fp-dlg-butcreate fp-panel-button" href="#">'.get_string('makeafolder').'</a>
<a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
Expand Down Expand Up @@ -382,15 +381,15 @@ private function fm_js_template_fileselectlayout() {
<tr class="{!}fp-saveas"><td class="mdl-right"><label>'.get_string('name', 'moodle').'</label>:</td>
<td class="mdl-left"><input type="text"/></td></tr>
<tr class="{!}fp-author"><td class="mdl-right"><label>'.get_string('author', 'repository').'</label>:</td>
<td class="mdl-left"><input type="text" /></td></tr>
<td class="mdl-left"><input type="text"/></td></tr>
<tr class="{!}fp-license"><td class="mdl-right"><label>'.get_string('chooselicense', 'repository').'</label>:</td>
<td class="mdl-left"><select></select></td></tr>
<tr class="{!}fp-path"><td class="mdl-right"><label>'.get_string('path', 'moodle').'</label>:</td>
<td class="mdl-left"><select></select></td></tr>
<tr class="{!}fp-original"><td class="mdl-right"><label>'.get_string('original', 'repository').'</label>:</td>
<td class="mdl-left"><span class="fp-originloading">'.$icon_progress.' '.$strloading.'</span><span class="fp-value"/></td></tr>
<td class="mdl-left"><span class="fp-originloading">'.$icon_progress.' '.$strloading.'</span><span class="fp-value"></span></td></tr>
<tr class="{!}fp-reflist"><td class="mdl-right"><label>'.get_string('referenceslist', 'repository').'</label>:</td>
<td class="mdl-left"><p class="{!}fp-refcount"/><span class="fp-reflistloading">'.$icon_progress.' '.$strloading.'</span><ul class="fp-value"/></td></tr>
<td class="mdl-left"><p class="{!}fp-refcount"></p><span class="fp-reflistloading">'.$icon_progress.' '.$strloading.'</span><ul class="fp-value"></ul></td></tr>
</table>
</form>
<p class="{!}fp-thumbnail"></p>
Expand All @@ -401,10 +400,10 @@ private function fm_js_template_fileselectlayout() {
</p>
</form>
<div class="fp-fileinfo">
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"/></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"/></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"/></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"/></div>
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"></span></div>
</div>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
Expand Down Expand Up @@ -515,15 +514,15 @@ private function fp_js_template_generallayout() {
<div class="file-picker fp-generallayout">
<div class="fp-repo-area">
<ul class="fp-list">
<li class="{!}fp-repo"><a href="#"><img class="{!}fp-repo-icon" width="16" height="16" />&nbsp;<span class="{!}fp-repo-name" /span></a></li>
<li class="{!}fp-repo"><a href="#"><img class="{!}fp-repo-icon" width="16" height="16" />&nbsp;<span class="{!}fp-repo-name"></span></a></li>
</ul>
</div>
<div class="fp-repo-items">
<div class="fp-navbar">
<div>
<div class="{!}fp-toolbar">
<div class="{!}fp-tb-back"><a href="#">'.get_string('back', 'repository').'</a></div>
<div class="{!}fp-tb-search fp-search"><form/></div>
<div class="{!}fp-tb-search"><form></form></div>
<div class="{!}fp-tb-refresh"><a href="#"><img src="'.$this->pix_url('a/refresh').'" /></a></div>
<div class="{!}fp-tb-logout"><img src="'.$this->pix_url('a/logout').'" /><a href="#"></a></div>
<div class="{!}fp-tb-manage"><a href="#"><img src="'.$this->pix_url('a/setting').'" /> '.get_string('manageurl', 'repository').'</a></div>
Expand All @@ -534,7 +533,7 @@ private function fp_js_template_generallayout() {
<a class="{!}fp-vb-details" href="#"></a>
<a class="{!}fp-vb-tree" href="#"></a>
</div>
<div class="fp-clear-right"></div>
<div class="fp-clear-left"></div>
</div>
<div class="fp-pathbar">
<span class="{!}fp-path-folder"><a class="{!}fp-path-folder-name" href="#"></a></span>
Expand Down Expand Up @@ -690,12 +689,12 @@ private function fp_js_template_selectlayout() {
</form>
<p class="{!}fp-thumbnail"></p>
<div class="fp-fileinfo">
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"/></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"/></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"/></div>
<div class="{!}fp-license">'.get_string('license', 'moodle').': <span class="fp-value"/></div>
<div class="{!}fp-author">'.get_string('author', 'repository').': <span class="fp-value"/></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"/></div>
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-license">'.get_string('license', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-author">'.get_string('author', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"></span></div>
</div>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
Expand Down Expand Up @@ -736,7 +735,7 @@ private function fp_js_template_uploadform() {
<td class="mdl-left"><input type="text"/></td></tr>
<tr class="{!}fp-setlicense">
<td class="mdl-right"><label>'.get_string('chooselicense', 'repository').'</label>:</td>
<td class="mdl-left"><select/></td></tr>
<td class="mdl-left"><select></select></td></tr>
</table>
</form>
<div><button class="{!}fp-upload-btn">'.get_string('upload', 'repository').'</button></div>
Expand Down Expand Up @@ -771,7 +770,7 @@ private function fp_js_template_loading() {
*/
private function fp_js_template_error() {
$rv = '
<div class="fp-content-error" ><div class="{!}fp-error" /></div>';
<div class="fp-content-error" ><div class="{!}fp-error"></div></div>';
return preg_replace('/\{\!\}/', '', $rv);
}

Expand Down Expand Up @@ -817,7 +816,7 @@ private function fp_js_template_processexistingfile() {
<p class="{!}fp-dlg-text"></p>
<a class="{!}fp-dlg-butoverwrite fp-panel-button" href="#">'.get_string('overwrite', 'repository').'</a>
<a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
<a class="{!}fp-dlg-butrename fp-panel-button" href="#"/>
<a class="{!}fp-dlg-butrename fp-panel-button" href="#"></a>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}
Expand Down Expand Up @@ -860,11 +859,11 @@ private function fp_js_template_loginform() {
<td align="right"><label></label></td>
<td align="left"><select></select></td></tr>
<tr class="{!}fp-login-input">
<td class="label"><label /></td>
<td class="label"><label></label></td>
<td class="input"><input/></td></tr>
<tr class="{!}fp-login-radiogroup">
<td align="right" width="30%" valign="top"><label /></td>
<td align="left" valign="top"><p class="{!}fp-login-radio"><input /> <label /></p></td></tr>
<td align="right" width="30%" valign="top"><label></label></td>
<td align="left" valign="top"><p class="{!}fp-login-radio"><input /> <label></label></p></td></tr>
</table>
<p><button class="{!}fp-login-submit">'.get_string('submit', 'repository').'</button></p>
</form>
Expand Down Expand Up @@ -896,7 +895,7 @@ public function filepicker_js_templates() {
* Default contents is one text input field with name="s"
*/
public function repository_default_searchform() {
$str = '<input class="search-entry" name="s" value="Search" />';
$str = '<div class="fp-def-search"><input name="s" value='.get_string('search', 'repository').' /></div>';
return $str;
}
}
Expand Down
1 change: 1 addition & 0 deletions lang/en/repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
$string['manageurl'] = 'Manage';
$string['manageuserrepository'] = 'Manage individual repository';
$string['moving'] = 'Moving';
$string['newfoldername'] = 'New folder name:';
$string['noenter'] = 'Nothing entered';
$string['nofilesattached'] = 'No files attached';
$string['nofilesavailable'] = 'No files available';
Expand Down
25 changes: 11 additions & 14 deletions lib/form/filemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ M.form_filemanager.init = function(Y, options) {
this.pathbar.removeChild(this.pathnode);
}
// initialize 'select file' panel
this.selectnode = Y.Node.create(M.form_filemanager.templates.fileselectlayout);
this.selectnode = Y.Node.createWithFilesSkin(M.form_filemanager.templates.fileselectlayout);
this.selectnode.generateID();
Y.one(document.body).appendChild(this.selectnode);
this.selectui = new Y.Panel({
srcNode : this.selectnode,
zIndex : 600000,
Expand Down Expand Up @@ -234,27 +233,27 @@ M.form_filemanager.init = function(Y, options) {
header = M.str.moodle.info;
}
if (!this.msg_dlg) {
var node = Y.Node.create(M.form_filemanager.templates.message);
this.filemanager.appendChild(node);
this.msg_dlg_node = Y.Node.createWithFilesSkin(M.form_filemanager.templates.message);
var nodeid = this.msg_dlg_node.generateID();

this.msg_dlg = new Y.Panel({
srcNode : node,
srcNode : this.msg_dlg_node,
zIndex : 800000,
centered : true,
modal : true,
visible : false,
render : true
});
this.msg_dlg.plug(Y.Plugin.Drag,{handles:['.yui3-widget-hd']});
node.one('.fp-msg-butok').on('click', function(e) {
this.msg_dlg.plug(Y.Plugin.Drag,{handles:['#'+nodeid+' .yui3-widget-hd']});
this.msg_dlg_node.one('.fp-msg-butok').on('click', function(e) {
e.preventDefault();
this.msg_dlg.hide();
}, this);
}

this.msg_dlg.set('headerContent', header);
this.filemanager.one('.fp-msg').removeClass('fp-msg-info').removeClass('fp-msg-error').addClass('fp-msg-'+type)
this.filemanager.one('.fp-msg .fp-msg-text').setContent(msg);
this.msg_dlg_node.removeClass('fp-msg-info').removeClass('fp-msg-error').addClass('fp-msg-'+type)
this.msg_dlg_node.one('.fp-msg-text').setContent(msg);
this.msg_dlg.show();
},
setup_buttons: function() {
Expand Down Expand Up @@ -302,8 +301,7 @@ M.form_filemanager.init = function(Y, options) {
});
}
if (!this.mkdir_dialog) {
var node = Y.Node.create(M.form_filemanager.templates.mkdir);
this.filemanager.appendChild(node);
var node = Y.Node.createWithFilesSkin(M.form_filemanager.templates.mkdir);
this.mkdir_dialog = new Y.Panel({
srcNode : node,
zIndex : 800000,
Expand Down Expand Up @@ -679,10 +677,9 @@ M.form_filemanager.init = function(Y, options) {
show_confirm_dialog: function(dialog_options) {
// instead of M.util.show_confirm_dialog(e, dialog_options);
if (!this.confirm_dlg) {
this.confirm_dlg_node = Y.Node.create(M.form_filemanager.templates.confirmdialog);
this.confirm_dlg_node = Y.Node.createWithFilesSkin(M.form_filemanager.templates.confirmdialog);
var node = this.confirm_dlg_node;
node.generateID();
Y.one(document.body).appendChild(node);
this.confirm_dlg = new Y.Panel({
srcNode : node,
zIndex : 800000,
Expand Down Expand Up @@ -867,7 +864,7 @@ M.form_filemanager.init = function(Y, options) {
this.selectui.fileinfo = node;
selectnode.one('.fp-saveas input').set('value', node.fullname);
var foldername = this.get_parent_folder_name(node);
selectnode.all('.fp-author input').set('value', node.author);
selectnode.all('.fp-author input').set('value', node.author ? node.author : '');
selectnode.all('.fp-license select option[selected]').set('selected', false);
selectnode.all('.fp-license select option[value='+node.license+']').set('selected', true);
selectnode.all('.fp-path select option[selected]').set('selected', false);
Expand Down
24 changes: 15 additions & 9 deletions repository/filepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,17 @@ YUI.add('moodle-core_filepicker', function(Y) {
}

}

/**
* creates a node and adds it to the div with id #filesskin. This is needed for CSS to be able
* to overwrite YUI skin styles (instead of using !important that does not work in IE)
*/
Y.Node.createWithFilesSkin = function(node) {
if (!Y.one('#filesskin')) {
Y.one(document.body).appendChild(Y.Node.create('<div/>').set('id', 'filesskin'));
}
return Y.one('#filesskin').appendChild(Y.Node.create(node));
}
}, '@VERSION@', {
requires:['base', 'node', 'yui2-treeview', 'panel', 'cookie', 'datatable', 'datatable-sort']
});
Expand Down Expand Up @@ -692,10 +703,9 @@ M.core_filepicker.init = function(Y, options) {
this.selectui.hide();
}
if (!this.process_dlg) {
this.process_dlg_node = Y.Node.create(M.core_filepicker.templates.processexistingfile);
this.process_dlg_node = Y.Node.createWithFilesSkin(M.core_filepicker.templates.processexistingfile);
var node = this.process_dlg_node;
node.generateID();
Y.one(document.body).appendChild(node);
this.process_dlg = new Y.Panel({
srcNode : node,
headerContent: M.str.repository.fileexistsdialogheader,
Expand Down Expand Up @@ -736,9 +746,8 @@ M.core_filepicker.init = function(Y, options) {
header = M.str.moodle.info;
}
if (!this.msg_dlg) {
this.msg_dlg_node = Y.Node.create(M.core_filepicker.templates.message);
this.msg_dlg_node = Y.Node.createWithFilesSkin(M.core_filepicker.templates.message);
this.msg_dlg_node.generateID();
Y.one(document.body).appendChild(this.msg_dlg_node);

this.msg_dlg = new Y.Panel({
srcNode : this.msg_dlg_node,
Expand Down Expand Up @@ -1215,10 +1224,8 @@ M.core_filepicker.init = function(Y, options) {
},
render: function() {
var client_id = this.options.client_id;
this.fpnode = Y.Node.create(M.core_filepicker.templates.generallayout).
this.fpnode = Y.Node.createWithFilesSkin(M.core_filepicker.templates.generallayout).
set('id', 'filepicker-'+client_id);
this.selectnode = Y.Node.create(M.core_filepicker.templates.selectlayout);
Y.one(document.body).appendChild(this.fpnode);
this.mainui = new Y.Panel({
srcNode : this.fpnode,
headerContent: M.str.repository.filepicker,
Expand All @@ -1239,9 +1246,8 @@ M.core_filepicker.init = function(Y, options) {
this.mainui.set('y', 0);
}
// create panel for selecting a file (initially hidden)
this.selectnode = Y.Node.create(M.core_filepicker.templates.selectlayout).
this.selectnode = Y.Node.createWithFilesSkin(M.core_filepicker.templates.selectlayout).
set('id', 'filepicker-select-'+client_id);
Y.one(document.body).appendChild(this.selectnode);
this.selectui = new Y.Panel({
srcNode : this.selectnode,
zIndex : 600000,
Expand Down
Loading

0 comments on commit 1cf8400

Please sign in to comment.