$formcontent .= html_writer::end_tag('div'); // types
$formcontent .= html_writer::start_tag('div', array('class' => 'submitbuttons'));
- $formcontent .= html_writer::tag('input', '',
- array('type' => 'submit', 'name' => 'submitbutton', 'id' => 'submitbutton', 'value' => get_string('next')));
$formcontent .= html_writer::tag('input', '',
array('type' => 'submit', 'name' => 'addcancel', 'id' => 'addcancel', 'value' => get_string('cancel')));
+ $formcontent .= html_writer::tag('input', '',
+ array('type' => 'submit', 'name' => 'submitbutton', 'id' => 'submitbutton', 'value' => get_string('add')));
$formcontent .= html_writer::end_tag('div');
$formcontent .= html_writer::end_tag('form');
$string['addnousersrecip'] = 'Add users who haven\'t accessed this {$a} to recipient list';
$string['addpagehere'] = 'Add page here';
$string['addresource'] = 'Add a resource...';
-$string['addresourceoractivity'] = 'Add a resource or activity';
+$string['addresourceoractivity'] = 'Add an activity or resource';
$string['address'] = 'Address';
$string['addstudent'] = 'Add student';
$string['addsubcategory'] = 'Add a sub-category';
var bb = this.overlay.get('boundingBox');
var dialogue = this.container.one('.alloptions');
- // Set the dialogue height
- this.calculate_height(dialogue);
-
// These will trigger a check_options call to display the correct help
this.container.on('click', this.check_options, this);
this.container.on('key_up', this.check_options, this);
// Display the overlay
this.overlay.show();
+ // Re-centre the dialogue after we've shown it.
+ this.center_dialogue(dialogue);
+
// Finally, focus the first radio element - this enables form selection via the keyboard
this.container.one('.option input[type=radio]').focus();
* @param dialogue Y.Node The dialogue
* @return void
*/
- calculate_height : function(dialogue) {
- var winheight = this.overlay.get('boundingBox').get('winHeight');
+ center_dialogue : function(dialogue) {
+ var bb = this.overlay.get('boundingBox');
+
+ var winheight = bb.get('winHeight');
+ var offsettop = 0;
// Try and set a sensible max-height -- this must be done before setting the top
// Set a default height of 640px
// Set a fixed position if the window is large enough
if (newheight > this.get('minheight')) {
- this.overlay.get('boundingBox').setStyle('position', 'fixed');
+ bb.setStyle('position', 'fixed');
} else {
- this.overlay.get('boundingBox').setStyle('position', 'absolute');
+ bb.setStyle('position', 'absolute');
+ offsettop = Y.one('window').get('scrollTop');
}
// Take off 15px top and bottom for borders, plus 40px each for the title and button area before setting the
// new max-height
+ var totalheight = newheight;
newheight = newheight - (15 + 15 + 40 + 40);
dialogue.setStyle('max-height', newheight + 'px');
+ dialogue.setStyle('height', newheight + 'px');
// Re-calculate the location now that we've changed the size
- this.overlay.centerDialogue();
+ var dialoguetop = Math.max(12, ((winheight - totalheight) / 2)) + offsettop;
+
+ // We need to set the height for the yui3-widget - can't work
+ // out what we're setting at present -- shoud be the boudingBox
+ bb.setStyle('top', dialoguetop + 'px');
},
handle_key_press : function(e) {
if (e.keyCode == 27) {