Merge branch 'MDL-46860-master' of git://github.com/ryanwyllie/moodle

This commit is contained in:
David Monllao 2015-08-12 10:45:29 +08:00
commit 01fdb048cf
4 changed files with 20 additions and 7 deletions

View File

@ -1299,18 +1299,26 @@ M.core_filepicker.init = function(Y, options) {
var client_id = this.options.client_id; var client_id = this.options.client_id;
var fpid = "filepicker-"+ client_id; var fpid = "filepicker-"+ client_id;
var labelid = 'fp-dialog-label_'+ client_id; var labelid = 'fp-dialog-label_'+ client_id;
var width = 873;
var draggable = true;
this.fpnode = Y.Node.createWithFilesSkin(M.core_filepicker.templates.generallayout). this.fpnode = Y.Node.createWithFilesSkin(M.core_filepicker.templates.generallayout).
set('id', 'filepicker-'+client_id).set('aria-labelledby', labelid); set('id', 'filepicker-'+client_id).set('aria-labelledby', labelid);
if (this.in_iframe()) {
width = Math.floor(window.innerWidth * 0.95);
draggable = false;
}
this.mainui = new M.core.dialogue({ this.mainui = new M.core.dialogue({
extraClasses : ['filepicker'], extraClasses : ['filepicker'],
draggable : true, draggable : draggable,
bodyContent : this.fpnode, bodyContent : this.fpnode,
headerContent: '<h3 id="'+ labelid +'">'+ M.util.get_string('filepicker', 'repository') +'</h3>', headerContent: '<h3 id="'+ labelid +'">'+ M.util.get_string('filepicker', 'repository') +'</h3>',
centered : true, centered : true,
modal : true, modal : true,
visible : false, visible : false,
width : '873px', width : width+'px',
responsiveWidth : 873, responsiveWidth : 768,
height : '558px', height : '558px',
zIndex : this.options.zIndex zIndex : this.options.zIndex
}); });
@ -1947,6 +1955,10 @@ M.core_filepicker.init = function(Y, options) {
M.util.set_user_preference('filepicker_' + name, value); M.util.set_user_preference('filepicker_' + name, value);
this.options.userprefs[name] = value; this.options.userprefs[name] = value;
} }
},
in_iframe: function () {
// If we're not the top window then we're in an iFrame
return window.self !== window.top;
} }
}); });
var loading = Y.one('#filepicker-loading-'+options.client_id); var loading = Y.one('#filepicker-loading-'+options.client_id);

View File

@ -461,9 +461,9 @@ a.ygtvspacer:hover {color:transparent;text-decoration:none;}
/** /**
* Responsive styles for the filepicker * Responsive styles for the filepicker
*/ */
@media (max-width:873px) { @media (max-width:767px) {
.file-picker .fp-repo-area {width:100%;height:auto;max-height:220px;y-scroll:auto;float:none;border:0px;} .file-picker .fp-repo-area {width:100%;height:auto;max-height:220px;y-scroll:auto;float:none;border:0px;}
.file-picker .fp-repo-items {width:100%;float:none;} .file-picker .fp-repo-items {width:100%;float:none;margin-left:0;}
.file-picker .fp-login-form .fp-login-input .label {text-align:left;} .file-picker .fp-login-form .fp-login-input .label {text-align:left;}
.dir-rtl .file-picker .fp-login-form .fp-login-input .label {text-align:right;} .dir-rtl .file-picker .fp-login-form .fp-login-input .label {text-align:right;}
.file-picker .fp-content form td {display:block;width:100%;text-align:left;} .file-picker .fp-content form td {display:block;width:100%;text-align:left;}

View File

@ -52,7 +52,7 @@
} }
} }
@media (max-width: 873px) { @media (max-width: 767px) {
.file-picker .fp-repo-area { .file-picker .fp-repo-area {
width: 100%; width: 100%;
height: auto; height: auto;
@ -64,6 +64,7 @@
.file-picker .fp-repo-items { .file-picker .fp-repo-items {
width: 100%; width: 100%;
float: none; float: none;
margin-left: 0;
} }
.file-picker .fp-login-form .fp-login-input label { .file-picker .fp-login-form .fp-login-input label {
text-align: left; text-align: left;

File diff suppressed because one or more lines are too long