[virtualcommons-svn] commit/vcweb: all...@sod19.asu.edu: getting rid of submit disable; validation
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-06-07 07:22:12
|
1 new changeset in vcweb: http://bitbucket.org/virtualcommons/vcweb/changeset/ca62a1198db5/ changeset: ca62a1198db5 branches: user: all...@sod19.asu.edu date: 2011-06-07 09:21:36 summary: getting rid of submit disable; validation failure disables the button and then there's no way to submit affected #: 3 files (1.2 KB) --- a/vcweb/forestry/templates/forestry/chat.html Tue Jun 07 00:17:08 2011 -0700 +++ b/vcweb/forestry/templates/forestry/chat.html Tue Jun 07 00:21:36 2011 -0700 @@ -44,11 +44,11 @@ </script> {% endblock %} {% block title %} -Forestry Chat Round +Forestry Communication Round {% endblock %} {% block page %} -<h3>Chat</h3> +<h3>Communication Round</h3><div class='alert infoIcon ui-corner-all'> You are <b>participant {{ participant_group_relationship.participant_number }}.</b> You can now chat about any aspect of the experiment with the other members of your group with two restrictions: --- a/vcweb/forestry/templates/forestry/participate.html Tue Jun 07 00:17:08 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Tue Jun 07 00:21:36 2011 -0700 @@ -33,7 +33,6 @@ } }); $('#forestry-form').submit(function() { - $('#submit').button("disable"); var harvestDecisionValue = $('#harvest-decision-id').val(); // FIXME: this isn't getting sent through properly before the submit occurs. // Should work out communicating directly from Django to the tornadio process. --- a/vcweb/static/js/dajaxice.core.js Tue Jun 07 00:17:08 2011 -0700 +++ b/vcweb/static/js/dajaxice.core.js Tue Jun 07 00:21:36 2011 -0700 @@ -1,1 +1,100 @@ -var Dajaxice={vcweb:{core:{experiment_controller:function(b,a){Dajaxice.call("vcweb.core.experiment_controller",b,a)}}},get_cookie:function(a){var e=null;if(document.cookie&&document.cookie!=""){var d=document.cookie.split(";");for(var c=0;c<d.length;c++){var b=d[c].toString().replace(/^\s+/,"").replace(/\s+$/,"");if(b.substring(0,a.length+1)==(a+"=")){e=decodeURIComponent(b.substring(a.length+1));break}}}return e},call:function(dajaxice_function,dajaxice_callback,argv){var send_data=[];is_callback_a_function=(typeof(dajaxice_callback)=="function");if(!is_callback_a_function){send_data.push("callback="+dajaxice_callback)}send_data.push("argv="+encodeURIComponent(JSON.stringify(argv)));send_data=send_data.join("&");var oXMLHttpRequest=new XMLHttpRequest;oXMLHttpRequest.open("POST","/dajaxice/"+dajaxice_function+"/");oXMLHttpRequest.setRequestHeader("X-Requested-With","XMLHttpRequest");oXMLHttpRequest.setRequestHeader("X-CSRFToken",Dajaxice.get_cookie("csrftoken"));oXMLHttpRequest.onreadystatechange=function(){if(this.readyState==XMLHttpRequest.DONE){if(is_callback_a_function){try{dajaxice_callback(JSON.parse(this.responseText))}catch(exception){dajaxice_callback(this.responseText)}}else{eval(this.responseText)}}};oXMLHttpRequest.send(send_data)}};Dajaxice.EXCEPTION="DAJAXICE_EXCEPTION";window.Dajaxice=Dajaxice;(function(){function a(){this._object=f?new f:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function d(b){a.onreadystatechange&&a.onreadystatechange.apply(b);b.dispatchEvent({type:"readystatechange",bubbles:false,cancelable:false,timeStamp:new Date+0})}function m(b){var i=b.responseXML,h=b.responseText;if(g&&h&&i&&!i.documentElement&&b.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){i=new window.ActiveXObject("Microsoft.XMLDOM");i.async=false;i.validateOnParse=false;i.loadXML(h)}if(i){if(g&&i.parseError!=0||!i.documentElement||i.documentElement&&i.documentElement.tagName=="parsererror"){return null}}return i}function n(b){try{b.responseText=b._object.responseText}catch(k){}try{b.responseXML=m(b._object)}catch(j){}try{b.status=b._object.status}catch(h){}try{b.statusText=b._object.statusText}catch(i){}}function c(b){b._object.onreadystatechange=new window.Function}var f=window.XMLHttpRequest,e=!!window.controllers,g=window.document.all&&!window.opera;if(e&&f.wrapped){a.wrapped=f.wrapped}a.UNSENT=0;a.OPENED=1;a.HEADERS_RECEIVED=2;a.LOADING=3;a.DONE=4;a.prototype.readyState=a.UNSENT;a.prototype.responseText="";a.prototype.responseXML=null;a.prototype.status=0;a.prototype.statusText="";a.prototype.onreadystatechange=null;a.onreadystatechange=null;a.onopen=null;a.onsend=null;a.onabort=null;a.prototype.open=function(h,p,l,i,k){delete this._headers;if(arguments.length<3){l=true}this._async=l;var j=this,b=this.readyState,o;if(g&&l){o=function(){if(b!=a.DONE){c(j);j.abort()}};window.attachEvent("onunload",o)}a.onopen&&a.onopen.apply(this,arguments);if(arguments.length>4){this._object.open(h,p,l,i,k)}else{arguments.length>3?this._object.open(h,p,l,i):this._object.open(h,p,l)}if(!e&&!g){this.readyState=a.OPENED;d(this)}this._object.onreadystatechange=function(){if(!(e&&!l)){j.readyState=j._object.readyState;n(j);if(j._aborted){j.readyState=a.UNSENT}else{if(j.readyState==a.DONE){c(j);g&&l&&window.detachEvent("onunload",o)}b!=j.readyState&&d(j);b=j.readyState}}}};a.prototype.send=function(b){a.onsend&&a.onsend.apply(this,arguments);if(b&&b.nodeType){b=window.XMLSerializer?(new window.XMLSerializer).serializeToString(b):b.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._object.send(b);if(e&&!this._async){this.readyState=a.OPENED;for(n(this);this.readyState<a.DONE;){this.readyState++;d(this);if(this._aborted){return}}}};a.prototype.abort=function(){a.onabort&&a.onabort.apply(this,arguments);if(this.readyState>a.UNSENT){this._aborted=true}this._object.abort();c(this)};a.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};a.prototype.getResponseHeader=function(b){return this._object.getResponseHeader(b)};a.prototype.setRequestHeader=function(b,h){if(!this._headers){this._headers={}}this._headers[b]=h;return this._object.setRequestHeader(b,h)};a.prototype.addEventListener=function(b,k,j){for(var h=0,i;i=this._listeners[h];h++){if(i[0]==b&&i[1]==k&&i[2]==j){return}}this._listeners.push([b,k,j])};a.prototype.removeEventListener=function(b,k,j){for(var h=0,i;i=this._listeners[h];h++){if(i[0]==b&&i[1]==k&&i[2]==j){break}}i&&this._listeners.splice(h,1)};a.prototype.dispatchEvent=function(b){b={type:b.type,target:this,currentTarget:this,eventPhase:2,bubbles:b.bubbles,cancelable:b.cancelable,timeStamp:b.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};if(b.type=="readystatechange"&&this.onreadystatechange){(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[b])}for(var i=0,h;h=this._listeners[i];i++){if(h[0]==b.type&&!h[2]){(h[1].handleEvent||h[1]).apply(this,[b])}}};a.prototype.toString=function(){return"[object XMLHttpRequest]"};a.toString=function(){return"[XMLHttpRequest]"};if(!window.Function.prototype.apply){window.Function.prototype.apply=function(b,h){h||(h=[]);b.__func=this;b.__func(h[0],h[1],h[2],h[3],h[4]);delete b.__func}}window.XMLHttpRequest=a})();if(!this.JSON){this.JSON={}}(function(){function k(a){return a<10?"0"+a:a}function n(a){o.lastIndex=0;return o.test(a)?'"'+a.replace(o,function(c){var d=q[c];return typeof d==="string"?d:"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function l(a,c){var d,f,i=g,e,b=c[a];if(b&&typeof b==="object"&&typeof b.toJSON==="function"){b=b.toJSON(a)}if(typeof j==="function"){b=j.call(c,a,b)}switch(typeof b){case"string":return n(b);case"number":return isFinite(b)?String(b):"null";case"boolean":case"null":return String(b);case"object":if(!b){return"null"}g+=m;e=[];if(Object.prototype.toString.apply(b)==="[object Array]"){f=b.length;for(a=0;a<f;a+=1){e[a]=l(a,b)||"null"}c=e.length===0?"[]":g?"[\n"+g+e.join(",\n"+g)+"\n"+i+"]":"["+e.join(",")+"]";g=i;return c}if(j&&typeof j==="object"){f=j.length;for(a=0;a<f;a+=1){d=j[a];if(typeof d==="string"){if(c=l(d,b)){e.push(n(d)+(g?": ":":")+c)}}}}else{for(d in b){if(Object.hasOwnProperty.call(b,d)){if(c=l(d,b)){e.push(n(d)+(g?": ":":")+c)}}}}c=e.length===0?"{}":g?"{\n"+g+e.join(",\n"+g)+"\n"+i+"}":"{"+e.join(",")+"}";g=i;return c}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var p=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g,m,q={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if(typeof JSON.stringify!=="function"){JSON.stringify=function(a,c,d){var f;m=g="";if(typeof d==="number"){for(f=0;f<d;f+=1){m+=" "}}else{if(typeof d==="string"){m=d}}if((j=c)&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number")){throw new Error("JSON.stringify")}return l("",{"":a})}}if(typeof JSON.parse!=="function"){JSON.parse=function(a,c){function d(f,i){var e,b,h=f[i];if(h&&typeof h==="object"){for(e in h){if(Object.hasOwnProperty.call(h,e)){b=d(h,e);if(b!==undefined){h[e]=b}else{delete h[e]}}}}return c.call(f,i,h)}p.lastIndex=0;if(p.test(a)){a=a.replace(p,function(f){return"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){a=eval("("+a+")");return typeof c==="function"?d({"":a},""):a}throw new SyntaxError("JSON.parse")}}})(); \ No newline at end of file +var Dajaxice = { + + vcweb: { + + + + + + core: { + + experiment_controller: function(callback_function, argv){ + Dajaxice.call('vcweb.core.experiment_controller', callback_function, argv); + } + + + + } + + + + } + , + + get_cookie: function(name) + { + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = cookies[i].toString().replace(/^\s+/, "").replace(/\s+$/, ""); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + }, + + call: function(dajaxice_function, dajaxice_callback, argv) + { + var send_data = []; + is_callback_a_function = (typeof(dajaxice_callback) == 'function'); + + if (!is_callback_a_function){ + /* Backward compatibility for old callback as string usage. */ + send_data.push('callback='+dajaxice_callback); + } + + send_data.push('argv='+encodeURIComponent(JSON.stringify(argv))); + send_data = send_data.join('&'); + var oXMLHttpRequest = new XMLHttpRequest; + oXMLHttpRequest.open('POST', '/dajaxice/'+dajaxice_function+'/'); + oXMLHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + oXMLHttpRequest.setRequestHeader("X-CSRFToken",Dajaxice.get_cookie('csrftoken')); + oXMLHttpRequest.onreadystatechange = function() { + if (this.readyState == XMLHttpRequest.DONE) { + if (is_callback_a_function){ + try{ + dajaxice_callback(JSON.parse(this.responseText)); + } + catch(exception){ + dajaxice_callback(this.responseText); + } + } + else{ + /* Backward compatibility for old callback as string usage. */ + eval(this.responseText); + } + } + } + oXMLHttpRequest.send(send_data); + } +}; +Dajaxice.EXCEPTION = "DAJAXICE_EXCEPTION"; +window['Dajaxice'] = Dajaxice; + + + +(function(){function b(){this._object=i?new i:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function k(a){b.onreadystatechange&&b.onreadystatechange.apply(a);a.dispatchEvent({type:"readystatechange",bubbles:false,cancelable:false,timeStamp:new Date+0})}function p(a){var c=a.responseXML,d=a.responseText;if(h&&d&&c&&!c.documentElement&&a.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){c=new window.ActiveXObject("Microsoft.XMLDOM");c.async=false;c.validateOnParse=false; +c.loadXML(d)}if(c)if(h&&c.parseError!=0||!c.documentElement||c.documentElement&&c.documentElement.tagName=="parsererror")return null;return c}function o(a){try{a.responseText=a._object.responseText}catch(c){}try{a.responseXML=p(a._object)}catch(d){}try{a.status=a._object.status}catch(g){}try{a.statusText=a._object.statusText}catch(e){}}function l(a){a._object.onreadystatechange=new window.Function}var i=window.XMLHttpRequest,j=!!window.controllers,h=window.document.all&&!window.opera;if(j&&i.wrapped)b.wrapped= +i.wrapped;b.UNSENT=0;b.OPENED=1;b.HEADERS_RECEIVED=2;b.LOADING=3;b.DONE=4;b.prototype.readyState=b.UNSENT;b.prototype.responseText="";b.prototype.responseXML=null;b.prototype.status=0;b.prototype.statusText="";b.prototype.onreadystatechange=null;b.onreadystatechange=null;b.onopen=null;b.onsend=null;b.onabort=null;b.prototype.open=function(a,c,d,g,e){delete this._headers;if(arguments.length<3)d=true;this._async=d;var f=this,m=this.readyState,n;if(h&&d){n=function(){if(m!=b.DONE){l(f);f.abort()}};window.attachEvent("onunload", +n)}b.onopen&&b.onopen.apply(this,arguments);if(arguments.length>4)this._object.open(a,c,d,g,e);else arguments.length>3?this._object.open(a,c,d,g):this._object.open(a,c,d);if(!j&&!h){this.readyState=b.OPENED;k(this)}this._object.onreadystatechange=function(){if(!(j&&!d)){f.readyState=f._object.readyState;o(f);if(f._aborted)f.readyState=b.UNSENT;else{if(f.readyState==b.DONE){l(f);h&&d&&window.detachEvent("onunload",n)}m!=f.readyState&&k(f);m=f.readyState}}}};b.prototype.send=function(a){b.onsend&&b.onsend.apply(this, +arguments);if(a&&a.nodeType){a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._object.send(a);if(j&&!this._async){this.readyState=b.OPENED;for(o(this);this.readyState<b.DONE;){this.readyState++;k(this);if(this._aborted)return}}};b.prototype.abort=function(){b.onabort&&b.onabort.apply(this,arguments);if(this.readyState>b.UNSENT)this._aborted=true;this._object.abort();l(this)}; +b.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};b.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)};b.prototype.setRequestHeader=function(a,c){if(!this._headers)this._headers={};this._headers[a]=c;return this._object.setRequestHeader(a,c)};b.prototype.addEventListener=function(a,c,d){for(var g=0,e;e=this._listeners[g];g++)if(e[0]==a&&e[1]==c&&e[2]==d)return;this._listeners.push([a,c,d])};b.prototype.removeEventListener=function(a, +c,d){for(var g=0,e;e=this._listeners[g];g++)if(e[0]==a&&e[1]==c&&e[2]==d)break;e&&this._listeners.splice(g,1)};b.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};if(a.type=="readystatechange"&&this.onreadystatechange)(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var c=0,d;d= +this._listeners[c];c++)if(d[0]==a.type&&!d[2])(d[1].handleEvent||d[1]).apply(this,[a])};b.prototype.toString=function(){return"[object XMLHttpRequest]"};b.toString=function(){return"[XMLHttpRequest]"};if(!window.Function.prototype.apply)window.Function.prototype.apply=function(a,c){c||(c=[]);a.__func=this;a.__func(c[0],c[1],c[2],c[3],c[4]);delete a.__func};window.XMLHttpRequest=b})(); + + + + +if(!this.JSON)this.JSON={}; +(function(){function k(a){return a<10?"0"+a:a}function n(a){o.lastIndex=0;return o.test(a)?'"'+a.replace(o,function(c){var d=q[c];return typeof d==="string"?d:"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function l(a,c){var d,f,i=g,e,b=c[a];if(b&&typeof b==="object"&&typeof b.toJSON==="function")b=b.toJSON(a);if(typeof j==="function")b=j.call(c,a,b);switch(typeof b){case "string":return n(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b);case "object":if(!b)return"null"; +g+=m;e=[];if(Object.prototype.toString.apply(b)==="[object Array]"){f=b.length;for(a=0;a<f;a+=1)e[a]=l(a,b)||"null";c=e.length===0?"[]":g?"[\n"+g+e.join(",\n"+g)+"\n"+i+"]":"["+e.join(",")+"]";g=i;return c}if(j&&typeof j==="object"){f=j.length;for(a=0;a<f;a+=1){d=j[a];if(typeof d==="string")if(c=l(d,b))e.push(n(d)+(g?": ":":")+c)}}else for(d in b)if(Object.hasOwnProperty.call(b,d))if(c=l(d,b))e.push(n(d)+(g?": ":":")+c);c=e.length===0?"{}":g?"{\n"+g+e.join(",\n"+g)+"\n"+i+"}":"{"+e.join(",")+"}"; +g=i;return c}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var p=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, +o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g,m,q={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if(typeof JSON.stringify!=="function")JSON.stringify=function(a,c,d){var f;m=g="";if(typeof d==="number")for(f=0;f<d;f+=1)m+=" ";else if(typeof d==="string")m=d;if((j=c)&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw new Error("JSON.stringify");return l("", +{"":a})};if(typeof JSON.parse!=="function")JSON.parse=function(a,c){function d(f,i){var e,b,h=f[i];if(h&&typeof h==="object")for(e in h)if(Object.hasOwnProperty.call(h,e)){b=d(h,e);if(b!==undefined)h[e]=b;else delete h[e]}return c.call(f,i,h)}p.lastIndex=0;if(p.test(a))a=a.replace(p,function(f){return"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, +"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){a=eval("("+a+")");return typeof c==="function"?d({"":a},""):a}throw new SyntaxError("JSON.parse");}})(); + Repository URL: https://bitbucket.org/virtualcommons/vcweb/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |