# HG changeset patch # User dukebody # Date 1256564782 -3600 # Node ID 5e63e72aed1080c9e1aba6948d9fb79cd7ea3c48 # Parent 53a382ea07aa77aa3b6cfe6041864f6938725ffb Restructure the folders layout to allow easier static serving with a real webserver in the future. diff -r 53a382ea07aa -r 5e63e72aed10 web/hgbook/urls.py --- a/web/hgbook/urls.py Mon Oct 26 14:12:27 2009 +0100 +++ b/web/hgbook/urls.py Mon Oct 26 14:46:22 2009 +0100 @@ -21,10 +21,7 @@ sys.modules[__name__].__file__) + '/../html')}), (r'^support/(?P.*)$', 'django.views.static.serve', {'document_root': os.path.realpath(os.path.dirname( - sys.modules[__name__].__file__) + '/../javascript')}), - (r'^styles/(?P.*)$', 'django.views.static.serve', - {'document_root': os.path.realpath(os.path.dirname( - sys.modules[__name__].__file__) + '/../styles')}), + sys.modules[__name__].__file__) + '/../support')}), # Uncomment this for admin: (r'^admin/(.*)', admin.site.root), diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/caution.png Binary file web/icons/caution.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/favicon.png Binary file web/icons/favicon.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/important.png Binary file web/icons/important.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/note.png Binary file web/icons/note.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/remark.png Binary file web/icons/remark.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/rss.png Binary file web/icons/rss.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/shell.png Binary file web/icons/shell.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/source.png Binary file web/icons/source.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/tip.png Binary file web/icons/tip.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/icons/warning.png Binary file web/icons/warning.png has changed diff -r 53a382ea07aa -r 5e63e72aed10 web/javascript/form-min.js --- a/web/javascript/form-min.js Mon Oct 26 14:12:27 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -(function($){$.fn.ajaxSubmit=function(_2){if(typeof _2=="function"){_2={success:_2};}_2=$.extend({url:this.attr("action")||window.location,type:this.attr("method")||"GET"},_2||{});var _3={};$.event.trigger("form.pre.serialize",[this,_2,_3]);if(_3.veto){return this;}var a=this.formToArray(_2.semantic);if(_2.data){for(var n in _2.data){a.push({name:n,value:_2.data[n]});}}if(_2.beforeSubmit&&_2.beforeSubmit(a,this,_2)===false){return this;}$.event.trigger("form.submit.validate",[a,this,_2,_3]);if(_3.veto){return this;}var q=$.param(a);if(_2.type.toUpperCase()=="GET"){_2.url+=(_2.url.indexOf("?")>=0?"&":"?")+q;_2.data=null;}else{_2.data=q;}var _7=this,callbacks=[];if(_2.resetForm){callbacks.push(function(){_7.resetForm();});}if(_2.clearForm){callbacks.push(function(){_7.clearForm();});}if(!_2.dataType&&_2.target){var _8=_2.success||function(){};callbacks.push(function(_9){if(this.evalScripts){$(_2.target).attr("innerHTML",_9).evalScripts().each(_8,arguments);}else{$(_2.target).html(_9).each(_8,arguments);}});}else{if(_2.success){callbacks.push(_2.success);}}_2.success=function(_a,_b){for(var i=0,max=callbacks.length;i");var io=$io[0];var op8=$.browser.opera&&window.opera.version()<9;if($.browser.msie||op8){io.src="javascript:false;document.write(\"\");";}$io.css({position:"absolute",top:"-1000px",left:"-1000px"});var xhr={responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){}};var g=_11.global;if(g&&!$.active++){$.event.trigger("ajaxStart");}if(g){$.event.trigger("ajaxSend",[xhr,_11]);}var _18=0;var _19=0;setTimeout(function(){$io.appendTo("body");io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,false);var _1a=_10.encoding?"encoding":"enctype";var t=_7.attr("target");_7.attr({target:id,method:"POST",action:_11.url});_10[_1a]="multipart/form-data";if(_11.timeout){setTimeout(function(){_19=true;cb();},_11.timeout);}_10.submit();_7.attr("target",t);},10);function cb(){if(_18++){return;}io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,false);var ok=true;try{if(_19){throw "timeout";}var _1d,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;if(_11.dataType=="json"||_11.dataType=="script"){var ta=doc.getElementsByTagName("textarea")[0];_1d=ta?ta.value:xhr.responseText;if(_11.dataType=="json"){eval("data = "+_1d);}else{$.globalEval(_1d);}}else{if(_11.dataType=="xml"){_1d=xhr.responseXML;if(!_1d&&xhr.responseText!=null){_1d=toXml(xhr.responseText);}}else{_1d=xhr.responseText;}}}catch(e){ok=false;$.handleError(_11,xhr,"error",e);}if(ok){_11.success(_1d,"success");if(g){$.event.trigger("ajaxSuccess",[xhr,_11]);}}if(g){$.event.trigger("ajaxComplete",[xhr,_11]);}if(g&&!--$.active){$.event.trigger("ajaxStop");}if(_11.complete){_11.complete(xhr,ok?"success":"error");}setTimeout(function(){$io.remove();xhr.responseXML=null;},100);}function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(s);}else{doc=(new DOMParser()).parseFromString(s,"text/xml");}return (doc&&doc.documentElement&&doc.documentElement.tagName!="parsererror")?doc:null;}}};$.fn.ajaxSubmit.counter=0;$.fn.ajaxForm=function(_21){return this.ajaxFormUnbind().submit(submitHandler).each(function(){this.formPluginId=$.fn.ajaxForm.counter++;$.fn.ajaxForm.optionHash[this.formPluginId]=_21;$(":submit,input:image",this).click(clickHandler);});};$.fn.ajaxForm.counter=1;$.fn.ajaxForm.optionHash={};function clickHandler(e){var _23=this.form;_23.clk=this;if(this.type=="image"){if(e.offsetX!=undefined){_23.clk_x=e.offsetX;_23.clk_y=e.offsetY;}else{if(typeof $.fn.offset=="function"){var _24=$(this).offset();_23.clk_x=e.pageX-_24.left;_23.clk_y=e.pageY-_24.top;}else{_23.clk_x=e.pageX-this.offsetLeft;_23.clk_y=e.pageY-this.offsetTop;}}}setTimeout(function(){_23.clk=_23.clk_x=_23.clk_y=null;},10);}function submitHandler(){var id=this.formPluginId;var _26=$.fn.ajaxForm.optionHash[id];$(this).ajaxSubmit(_26);return false;}$.fn.ajaxFormUnbind=function(){this.unbind("submit",submitHandler);return this.each(function(){$(":submit,input:image",this).unbind("click",clickHandler);});};$.fn.formToArray=function(_27){var a=[];if(this.length==0){return a;}var _29=this[0];var els=_27?_29.getElementsByTagName("*"):_29.elements;if(!els){return a;}for(var i=0,max=els.length;i= 0 ? '&' : '?') + q; - options.data = null; // data is null for 'get' - } - else - options.data = q; // data is the query string for 'post' - - var $form = this, callbacks = []; - if (options.resetForm) callbacks.push(function() { $form.resetForm(); }); - if (options.clearForm) callbacks.push(function() { $form.clearForm(); }); - - // perform a load on the target only if dataType is not provided - if (!options.dataType && options.target) { - var oldSuccess = options.success || function(){}; - callbacks.push(function(data) { - if (this.evalScripts) - $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments); - else // jQuery v1.1.4 - $(options.target).html(data).each(oldSuccess, arguments); - }); - } - else if (options.success) - callbacks.push(options.success); - - options.success = function(data, status) { - for (var i=0, max=callbacks.length; i < max; i++) - callbacks[i](data, status, $form); - }; - - // are there files to upload? - var files = $('input:file', this).fieldValue(); - var found = false; - for (var j=0; j < files.length; j++) - if (files[j]) - found = true; - - if (options.iframe || found) // options.iframe allows user to force iframe mode - fileUpload(); - else - $.ajax(options); - - // fire 'notify' event - $.event.trigger('form.submit.notify', [this, options]); - return this; - - - // private function for handling file uploads (hat tip to YAHOO!) - function fileUpload() { - var form = $form[0]; - var opts = $.extend({}, $.ajaxSettings, options); - - var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++; - var $io = $('