8 Y.all('select.postratingmenu').each(this.attach_rating_events, this);
10 //hide the submit buttons
11 this.Y.all('input.postratingmenusubmit').setStyle('display', 'none');
14 attach_rating_events : function(selectnode) {
15 selectnode.on('change', this.submit_rating, this, selectnode);
18 submit_rating : function(e, selectnode){
19 var theinputs = selectnode.ancestor('form').all('.ratinginput');
22 var inputssize = theinputs.size();
23 for ( var i=0; i<inputssize; i++ )
25 if(theinputs.item(i).get("name")!="returnurl") {//dont include return url for ajax requests
26 thedata[theinputs.item(i).get("name")] = theinputs.item(i).get("value");
30 this.Y.io.queue.stop();
31 this.transaction.push({transaction:this.Y.io.queue(M.cfg.wwwroot+'/rating/rate_ajax.php', {
33 data : build_querystring(thedata),
35 complete : function(tid, outcome, args) {
42 var data = this.Y.JSON.parse(outcome.responseText);
44 //if the user has access to the aggregate then update it
45 if (data.itemid) { //do not test data.aggregate or data.count otherwise it doesn't refresh value=0 or no value
46 var itemid = data.itemid;
48 var node = this.Y.one('#ratingaggregate'+itemid);
49 node.set('innerHTML',data.aggregate);
51 //empty the count value if no ratings
52 var node = this.Y.one('#ratingcount'+itemid);
54 node.set('innerHTML',"("+data.count+")");
56 node.set('innerHTML',"");
65 alert(e.message+" "+outcome.responseText);
72 //query : this.query.get('value')
74 }),complete:false,outcome:null});
75 this.Y.io.queue.start();