Index: moodle/mod/lamslesson/mod_form.php =================================================================== diff -u -r5977cea84c5550b8300ed41bf8ce6482ef7b6326 -r044bc381a9c59ee083f5271b39a36096b1f740a2 --- moodle/mod/lamslesson/mod_form.php (.../mod_form.php) (revision 5977cea84c5550b8300ed41bf8ce6482ef7b6326) +++ moodle/mod/lamslesson/mod_form.php (.../mod_form.php) (revision 044bc381a9c59ee083f5271b39a36096b1f740a2) @@ -101,20 +101,14 @@ js_writer::set_variable('currentsequence', $currentsequence)); $authorpreviewbutton .= html_writer::script('', $CFG->wwwroot.'/mod/lamslesson/preview.js'); - - $authorpreviewbutton .= html_writer::start_tag('div', array('id' => 'buttons', 'style' => 'float:right;')); + $authorpreviewbutton .= html_writer::start_tag('div', array('id' => 'buttons', 'style' => 'float:right')); + // Preview button - $authorpreviewbutton .= html_writer::start_tag('span', array('id' => 'previewbutton', 'style' => 'visibility:hidden;', 'class' => 'yui3-button yui3-link-button')); - $authorpreviewbutton .= html_writer::start_tag('span', array('class' => 'first-child')); - $authorpreviewbutton .= html_writer::link('#nogo', $openpreviewlabel, array('onclick' => js_writer::function_call('openPreview', array('1' => $previewurl, '2' => 'preview', '3' => 0)))); - $authorpreviewbutton .= html_writer::end_tag('span'); - $authorpreviewbutton .= html_writer::end_tag('span'); - //Authoring button - $authorpreviewbutton .= html_writer::start_tag('span', array('id' => 'authorbutton', 'class' => 'yui3-button yui3-link-button')); - $authorpreviewbutton .= html_writer::start_tag('span', array('class' => 'first-child')); - $authorpreviewbutton .= html_writer::link('#nogo', $openauthorlabel, array('onclick' => js_writer::function_call('openAuthor', array('1' => $authorurl, '2' => 'author', '3' => 0)))); - $authorpreviewbutton .= html_writer::end_tag('span'); - $authorpreviewbutton .= html_writer::end_tag('span'); + $authorpreviewbutton .= html_writer::link('#nogo', $openpreviewlabel, array('onclick' => js_writer::function_call('openPreview', array('1' => $previewurl, '2' => 'preview', '3' => 1280, '4' => 720)), 'id' => 'previewbutton', 'style' => 'visibility:hidden;', 'class' => 'btn btn-primary')); + + //Authoring button + $authorpreviewbutton .= html_writer::link('#nogo', $openauthorlabel, array('onclick' => js_writer::function_call('PopupCenter', array('1' => $authorurl, '2' => 'author', '3' => 1280, '4' => 720)), 'class' => 'btn btn-primary', 'id' => 'authorbutton')); + $authorpreviewbutton .= html_writer::end_tag('div'); } Index: moodle/mod/lamslesson/preview.js =================================================================== diff -u -rae5e990cc15af5507fbc326ab637c058893d79fb -r044bc381a9c59ee083f5271b39a36096b1f740a2 --- moodle/mod/lamslesson/preview.js (.../preview.js) (revision ae5e990cc15af5507fbc326ab637c058893d79fb) +++ moodle/mod/lamslesson/preview.js (.../preview.js) (revision 044bc381a9c59ee083f5271b39a36096b1f740a2) @@ -5,25 +5,29 @@ * LAMS Foundation (http://lamsfoundation.org) */ -function openAuthor(url,name,fullscreen) { - authorWin = window.open(url,name,options); - if (fullscreen) { - authorWin.moveTo(0,0); - authorWin.resizeTo(screen.availWidth,screen.availHeight); - } - authorWin.focus(); - return false; +function PopupCenter(url, title, w, h) { + // Credit: http://www.xtf.dk/2011/08/center-new-popup-window-even-on.html + // Fixes dual-screen position Most browsers Firefox + var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX; + var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY; + + var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; + var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + + var left = ((width / 2) - (w / 2)) + dualScreenLeft; + var top = ((height / 2) - (h / 2)) + dualScreenTop; + var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + + // Puts focus on the newWindow + if (window.focus) { + newWindow.focus(); + } } -function openPreview(url,name,fullscreen) { +function openPreview(url,name, w, h) { url = url + "&ldId=" + document.getElementsByName("sequence_id")[0].value; url = url + "&course=" + course; - previewWin = window.open(url,name,options); - if (fullscreen) { - previewWin.moveTo(0,0); - previewWin.resizeTo(screen.availWidth,screen.availHeight); - } - previewWin.focus(); + PopupCenter(url,name, w, h); return false; } Index: moodle/mod/lamslesson/styles.css =================================================================== diff -u -r24183dc4f6936f3122920cc99678b1231701a3ea -r044bc381a9c59ee083f5271b39a36096b1f740a2 --- moodle/mod/lamslesson/styles.css (.../styles.css) (revision 24183dc4f6936f3122920cc99678b1231701a3ea) +++ moodle/mod/lamslesson/styles.css (.../styles.css) (revision 044bc381a9c59ee083f5271b39a36096b1f740a2) @@ -7,14 +7,10 @@ .path-mod-lamslesson .note {border:solid 1px #DEDEDE;background:#FFFFCC url([[pix:t/stop]]) 8px 16px no-repeat;color:#222222;padding:10px;text-align:center;} /* Button styles */ -#authorbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:i/admin]]) 5% 50% no-repeat;} -#learnerbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:t/go]]) 8% 50% no-repeat;} -#monitorbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:a/search]]) 5% 50% no-repeat;} -#previewbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:a/search]]) 5% 50% no-repeat;} #validatebutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:i/admin]]) 5% 50% no-repeat;} #offsetbutton a {text-decoration:none;padding-left: 2.25em;background: url([[pix:i/log]]) 5% 50% no-repeat;} -/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. This file is from: http://developer.yahoo.com/yui/examples/treeview/assets/css/folders/tree.css and has been modified to be used within Moodle 2 Themes @@ -24,60 +20,61 @@ .ygtvtn { background: url([[pix:y/tn]]) 0 0 no-repeat; width:17px; height:22px; } /* first or middle sibling, collapsable */ -.ygtvtm { background: url([[pix:y/tm]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvtm { background: url([[pix:f/folder]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* first or middle sibling, collapsable, hover */ -.ygtvtmh { background: url([[pix:y/tmh]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvtmh { background: url([[pix:f/folder-open]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* first or middle sibling, expandable */ -.ygtvtp { background: url([[pix:y/tp]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvtp { background: url([[pix:f/folder]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* first or middle sibling, expandable, hover */ -.ygtvtph { background: url([[pix:y/tph]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvtph { background: url([[pix:f/folder-open]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* last sibling, no children */ .ygtvln { background: url([[pix:y/ln]]) 0 0 no-repeat; width:17px; height:22px; } /* Last sibling, collapsable */ -.ygtvlm { background: url([[pix:y/lm]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvlm { background: url([[pix:f/folder-open]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* Last sibling, collapsable, hover */ -.ygtvlmh { background: url([[pix:y/lmh]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvlmh { background: url([[pix:f/folder-open]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* Last sibling, expandable */ -.ygtvlp { background: url([[pix:y/lp]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvlp { background: url([[pix:f/folder]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* Last sibling, expandable, hover */ -.ygtvlph { background: url([[pix:y/lph]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } +.ygtvlph { background: url([[pix:f/folder-open]]) 0 0 no-repeat; width:34px; height:22px; cursor:pointer } /* Loading icon */ .ygtvloading { background: url([[pix:y/loading]]) 0 0 no-repeat; width:16px; height:22px; } -/* the style for the empty cells that are used for rendering the depth +/* the style for the empty cells that are used for rendering the depth * of the node */ .ygtvdepthcell { background: url([[pix:y/vline]]) 0 0 no-repeat; width:17px; height:22px; } .ygtvblankdepthcell { width:17px; height:22px; } /* the style of the div around each node */ -.ygtvitem { } +.ygtvitem { } .ygtvitem table{ margin-bottom:0; } .ygtvitem td { border:none;padding:0; -} +} /* the style of the div around each node's collection of children */ -.ygtvchildren { } -* html .ygtvchildren { height:1%; } +.ygtvchildren { } +* html .ygtvchildren { height:1%; } /* the style of the text label in ygTextNode */ -.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { - margin-left:2px; - text-decoration: none; +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + margin-left:2px; + text-decoration: none; } + Index: moodle/mod/lamslesson/view.php =================================================================== diff -u -r5977cea84c5550b8300ed41bf8ce6482ef7b6326 -r044bc381a9c59ee083f5271b39a36096b1f740a2 --- moodle/mod/lamslesson/view.php (.../view.php) (revision 5977cea84c5550b8300ed41bf8ce6482ef7b6326) +++ moodle/mod/lamslesson/view.php (.../view.php) (revision 044bc381a9c59ee083f5271b39a36096b1f740a2) @@ -95,18 +95,21 @@ echo $OUTPUT->box_start('generalbox', 'intro'); if ($canparticipate || $canmanage) { $learnerurl = lamslesson_get_url($USER->username, $USER->firstname, $USER->lastname, $USER->email, $USER->lang, $USER->country, $lamslesson->lesson_id, $course->id, $course->fullname, $course->timecreated, LAMSLESSON_PARAM_LEARNER_STRICT_METHOD); + $popupaction = new popup_action('click', $learnerurl, 'openlesson', array('height' => 720, 'width' => 1280)); + echo '