MDL-30139 enrol: added search button to AJAX enrolment search
authorMark Nelson <markn@moodle.com>
Tue, 13 Nov 2012 09:07:22 +0000 (17:07 +0800)
committerMark Nelson <markn@moodle.com>
Tue, 13 Nov 2012 09:07:22 +0000 (17:07 +0800)
enrol/manual/yui/quickenrolment/assets/skins/sam/quickenrolment.css
enrol/manual/yui/quickenrolment/quickenrolment.js

index ff3543f..e8a4cda 100644 (file)
@@ -64,7 +64,8 @@ Structure of the user enroller panel
 .user-enroller-panel .uep-footer {padding:3px;background-color:#ddd;text-align:center;}
 .user-enroller-panel .uep-search {margin:3px;}
 .user-enroller-panel .uep-search label {padding-right:8px;}
-.user-enroller-panel .uep-search input {width:70%;}
+.user-enroller-panel .uep-search input {width:50%;}
+.user-enroller-panel .uep-search input.uep-search-btn {width:20%;}
 .user-enroller-panel .uep-searchoptions {margin:3px;cursor:pointer;}
 .user-enroller-panel .uep-searchoptions select {margin-left:1em;}
 .user-enroller-panel .collapsibleheading img {margin-right:8px;}
index c047999..81774af 100644 (file)
@@ -5,6 +5,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
         /** Properties **/
         BASE : 'base',
         SEARCH : 'search',
+        SEARCHBTN : 'searchbtn',
         PARAMS : 'params',
         URL : 'url',
         AJAXURL : 'ajaxurl',
@@ -62,6 +63,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
         DURATION : 'duration',
         ACTIVE : 'active',
         SEARCH : 'uep-search',
+        SEARCHBTN : 'uep-search-btn',
         CLOSE : 'close',
         CLOSEBTN : 'close-button'
     };
@@ -109,8 +111,9 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
                                 .setAttribute('src', M.util.image_url('i/loading', 'moodle')))
                             .setStyle('opacity', 0.5)))
                     .append(create('<div class="'+CSS.FOOTER+'"></div>')
-                        .append(create('<div class="'+CSS.SEARCH+'"><label>'+M.str.enrol.usersearch+'</label></div>')
+                        .append(create('<div class="'+CSS.SEARCH+'"><label for="enrolusersearch" class="accesshide">'+M.str.enrol.usersearch+'</label></div>')
                             .append(create('<input type="text" id="enrolusersearch" value="" />'))
+                                .append(create('<input type="button" id="searchbtn" class="'+CSS.SEARCHBTN+'" value="'+M.str.enrol.usersearch+'" />'))
                         )
                         .append(create('<div class="'+CSS.CLOSEBTN+'"></div>')
                             .append(create('<input type="button" value="'+M.str.enrol.finishenrollingusers+'" />'))
@@ -120,6 +123,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
             );
 
             this.set(UEP.SEARCH, this.get(UEP.BASE).one('#enrolusersearch'));
+            this.set(UEP.SEARCHBTN, this.get(UEP.BASE).one('#searchbtn'));
             Y.all('.enrol_manual_plugin input').each(function(node){
                 if (node.getAttribute('type', 'submit')) {
                     node.on('click', this.show, this);
@@ -133,6 +137,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
             this.set(UEP.PARAMS, params);
 
             Y.on('key', this.preSearch, this.get(UEP.SEARCH), 'down:13', this);
+            this.get(UEP.SEARCHBTN).on('click', this.preSearch, this);
 
             Y.one(document.body).append(this.get(UEP.BASE));