mega patch, text corrections, improved web2py.js, thanks Anthony

This commit is contained in:
Massimo Di Pierro
2012-02-03 11:29:43 -06:00
parent b829109e33
commit 00b51227a0
12 changed files with 82 additions and 42 deletions
+1 -1
View File
@@ -1 +1 @@
Version 1.99.4 (2012-02-02 16:35:38) stable
Version 1.99.4 (2012-02-03 11:29:23) stable
+20 -11
View File
@@ -23,10 +23,6 @@ function ajax(u,s,t) {
String.prototype.reverse = function () { return this.split('').reverse().join('');};
function web2py_ajax_fields(target) {
jQuery('input.integer', target).keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
jQuery('input.double,input.decimal', target).keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
jQuery("input[type='checkbox'].delete", target).live('click',function(){ if(this.checked) if(!confirm(confirm_message)) this.checked=false; });
var date_format = (typeof w2p_ajax_date_format != 'undefined') ? w2p_ajax_date_format : "%Y-%m-%d";
var datetime_format = (typeof w2p_ajax_datetime_format != 'undefined') ? w2p_ajax_datetime_format : "%Y-%m-%d %H:%M:%S";
jQuery("input.date",target).each(function() {Calendar.setup({inputField:this, ifFormat:date_format, showsTime:false });});
@@ -38,17 +34,26 @@ function web2py_ajax_fields(target) {
function web2py_ajax_init(target) {
jQuery('.hidden', target).hide();
jQuery('.error', target).hide().slideDown('slow');
jQuery('.flash', target).click(function(e) { jQuery(this).fadeOut('slow'); e.preventDefault(); });
// jQuery('input[type=submit]').click(function(){var t=jQuery(this);t.hide();t.after('<input class="submit_disabled" disabled="disabled" type="submit" name="'+t.attr("name")+'_dummy" value="'+t.val()+'">')});
web2py_ajax_fields(target);
};
function web2py_event_handlers() {
var doc = jQuery(document)
doc.on('click', '.flash', function(e){jQuery(this).fadeOut('slow'); e.preventDefault();});
doc.on('keyup', 'input.integer', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
doc.on('keyup', 'input.double, input.decimal', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
doc.on('click', "input[type='checkbox'].delete", function(){if(this.checked) if(!confirm(confirm_message)) this.checked=false;});
};
jQuery(function() {
var flash = jQuery('.flash');
flash.hide();
if(flash.html()) flash.slideDown();
web2py_ajax_init(document);
web2py_event_handlers();
});
function web2py_trap_form(action,target) {
jQuery('#'+target+' form').each(function(i){
var form=jQuery(this);
@@ -60,6 +65,7 @@ function web2py_trap_form(action,target) {
});
});
}
function web2py_trap_link(target) {
jQuery('#'+target+' a.w2p_trap').each(function(i){
var link=jQuery(this);
@@ -70,11 +76,12 @@ function web2py_trap_link(target) {
});
});
}
function web2py_ajax_page(method,action,data,target) {
jQuery.ajax({'type':method,'url':action,'data':data,
function web2py_ajax_page(method, action, data, target) {
jQuery.ajax({'type':method, 'url':action, 'data':data,
'beforeSend':function(xhr) {
xhr.setRequestHeader('web2py-component-location',document.location);
xhr.setRequestHeader('web2py-component-element',target);},
xhr.setRequestHeader('web2py-component-location', document.location);
xhr.setRequestHeader('web2py-component-element', target);},
'complete':function(xhr,text){
var html=xhr.responseText;
var content=xhr.getResponseHeader('web2py-component-content');
@@ -94,9 +101,11 @@ function web2py_ajax_page(method,action,data,target) {
}
});
}
function web2py_component(action,target) {
jQuery(function(){ web2py_ajax_page('get',action,null,target); });
jQuery(function(){web2py_ajax_page('get',action,null,target);});
}
function web2py_comet(url,onmessage,onopen,onclose) {
if ("WebSocket" in window) {
var ws = new WebSocket(url);
@@ -6,9 +6,9 @@
- [[Twitter http://twitter.com/#!/web2py]]
- [[User Voice http://web2py.uservoice.com/ popup]]
#### Learning
- [[Interactive Demo http://www.web2py.com/demo_admin popup]]
- [[Quick Examples http://www.web2py.com/examples/default/examples]]
#### Learning and Demos
- [[Admin Demo http://www.web2py.com/demo_admin popup]] (web-based IDE)
- [[Welcome App Demo http://www.web2py.com/welcome]] (scaffolding application)
- [[Videos http://www.web2py.com/examples/default/videos/]]
- [[FAQ http://www.web2py.com/AlterEgo popup]]
@@ -3,5 +3,7 @@
- [[**web2py Online Book (english)** http://web2py.com/book popup]]
- [[web2py Online Book (spanish) http://www.latinuxpress.com/books/drafts/web2py/ popup]]
- [[Buy E-book/Printed Version http://stores.lulu.com/web2py popup]]
- [[web2py Application Development Cookbook http://www.packtpub.com/web2py-application-development-recipes-to-master-python-web-framework-cookbook/book?utm_source=web2py.com&utm_medium=link&utm_content=pod&utm_campaign=mdb_009617]]
- [[Quick Examples http://www.web2py.com/examples/default/examples]]
- [[API http://web2py.com/book/default/chapter/04#API popup]]
- [[Epydoc (source code documentation) http://www.web2py.com/examples/static/epydoc/index.html popup]]
@@ -9,7 +9,7 @@
- **Secure** [[It prevents the most common types of vulnerabilities http://web2py.com/examples/default/security]] including Cross Site Scripting, Injection Flaws, and Malicious File Execution.
- **Enforces good Software Engineering practices** (Model-View-Controller design, Server-side form validation, postbacks) that make the code more readable, scalable, and maintainable.
- **Speaks multiple protocols** HTML/XML, RSS/ATOM, RTF, PDF, JSON, AJAX, XML-RPC, CSV, REST, WIKI, Flash/AMF, and Linked Data (RDF).
- **Includes** a SSL-enabled and streaming-capable web server, a relational database, a web-based integrated development environment and web-based management interface, a Database Abstraction Layer that writes SQL for you in real time, internationalization support, multiple authentication methods, role based access control, an error logging and ticketing system, multiple caching methods for scalability, the jQuery library for AJAX and effects.
- **Includes** an SSL-enabled and streaming-capable web server, a relational database, a web-based integrated development environment and web-based management interface, a Database Abstraction Layer that writes SQL for you in real time, internationalization support, multiple authentication methods, role based access control, an error logging and ticketing system, multiple caching methods for scalability, the jQuery library for AJAX and effects, and a [[scaffolding application http://www.web2py.com/welcome]] to jumpstart development.
The best way to understand web2py is to try it. You can try it online [[here http://www.web2py.com/demo_admin]] (this online version is identical to the actual web2py although some functions are disabled for security reasons).
@@ -37,7 +37,7 @@ sup {
line-height: 2em;
vertical-align: top;
}
ul { list-style: circle outside;}
ul { list-style: circle outside; padding-left: 30px;}
.frame {
border: 3px solid #959595;
+20 -11
View File
@@ -23,10 +23,6 @@ function ajax(u,s,t) {
String.prototype.reverse = function () { return this.split('').reverse().join('');};
function web2py_ajax_fields(target) {
jQuery('input.integer', target).keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
jQuery('input.double,input.decimal', target).keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
jQuery("input[type='checkbox'].delete", target).live('click',function(){ if(this.checked) if(!confirm(confirm_message)) this.checked=false; });
var date_format = (typeof w2p_ajax_date_format != 'undefined') ? w2p_ajax_date_format : "%Y-%m-%d";
var datetime_format = (typeof w2p_ajax_datetime_format != 'undefined') ? w2p_ajax_datetime_format : "%Y-%m-%d %H:%M:%S";
jQuery("input.date",target).each(function() {Calendar.setup({inputField:this, ifFormat:date_format, showsTime:false });});
@@ -38,17 +34,26 @@ function web2py_ajax_fields(target) {
function web2py_ajax_init(target) {
jQuery('.hidden', target).hide();
jQuery('.error', target).hide().slideDown('slow');
jQuery('.flash', target).click(function(e) { jQuery(this).fadeOut('slow'); e.preventDefault(); });
// jQuery('input[type=submit]').click(function(){var t=jQuery(this);t.hide();t.after('<input class="submit_disabled" disabled="disabled" type="submit" name="'+t.attr("name")+'_dummy" value="'+t.val()+'">')});
web2py_ajax_fields(target);
};
function web2py_event_handlers() {
var doc = jQuery(document)
doc.on('click', '.flash', function(e){jQuery(this).fadeOut('slow'); e.preventDefault();});
doc.on('keyup', 'input.integer', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
doc.on('keyup', 'input.double, input.decimal', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
doc.on('click', "input[type='checkbox'].delete", function(){if(this.checked) if(!confirm(confirm_message)) this.checked=false;});
};
jQuery(function() {
var flash = jQuery('.flash');
flash.hide();
if(flash.html()) flash.slideDown();
web2py_ajax_init(document);
web2py_event_handlers();
});
function web2py_trap_form(action,target) {
jQuery('#'+target+' form').each(function(i){
var form=jQuery(this);
@@ -60,6 +65,7 @@ function web2py_trap_form(action,target) {
});
});
}
function web2py_trap_link(target) {
jQuery('#'+target+' a.w2p_trap').each(function(i){
var link=jQuery(this);
@@ -70,11 +76,12 @@ function web2py_trap_link(target) {
});
});
}
function web2py_ajax_page(method,action,data,target) {
jQuery.ajax({'type':method,'url':action,'data':data,
function web2py_ajax_page(method, action, data, target) {
jQuery.ajax({'type':method, 'url':action, 'data':data,
'beforeSend':function(xhr) {
xhr.setRequestHeader('web2py-component-location',document.location);
xhr.setRequestHeader('web2py-component-element',target);},
xhr.setRequestHeader('web2py-component-location', document.location);
xhr.setRequestHeader('web2py-component-element', target);},
'complete':function(xhr,text){
var html=xhr.responseText;
var content=xhr.getResponseHeader('web2py-component-content');
@@ -94,9 +101,11 @@ function web2py_ajax_page(method,action,data,target) {
}
});
}
function web2py_component(action,target) {
jQuery(function(){ web2py_ajax_page('get',action,null,target); });
jQuery(function(){web2py_ajax_page('get',action,null,target);});
}
function web2py_comet(url,onmessage,onopen,onclose) {
if ("WebSocket" in window) {
var ws = new WebSocket(url);
@@ -39,7 +39,7 @@ Current version: {{="%s.%s.%s (%s) %s" % request.env.web2py_version}}</p>
</div>
<div class="one-third column omega">
<h3><a href="{{=URL('documentation')}}">EXTENSIVE DOCS</a></h3>
<p>Start with some <a href="{{=URL('examples')}}">quick examples</a>, then read the <a href="http://web2py.com/book">reference manual</a>, watch <a href="http://vimeo.com/album/178500">videos</a>, and join a <a href="{{=URL('default', 'usergroups')}}">user group</a> for discussion. Take advantage of the <a href="http://web2py.com/layouts">layouts</a>, <a href="http://dev.s-cubism.com/web2py_plugins">plugins</a>, and&nbsp;<a href="http://web2pyslices.com">recipes</a>.</p>
<p>Start with some <a href="{{=URL('examples')}}">quick examples</a>, then read the <a href="http://web2py.com/book" target="_blank">manual</a>, watch <a href="http://vimeo.com/album/178500" target="_blank">videos</a>, and join a <a href="{{=URL('default', 'usergroups')}}">user group</a> for discussion. Take advantage of the <a href="http://web2py.com/layouts" target="_blank">layouts</a>, <a href="http://dev.s-cubism.com/web2py_plugins" target="_blank">plugins</a>, <a href="http://www.web2py.com/appliances" target="_blank">appliances</a>, and <a href="http://web2pyslices.com" target="_blank">recipes</a>.</p>
</div>
</div>
</div>
+1 -1
View File
@@ -87,7 +87,7 @@
</div>
</div>
<div class="sixteen columns announce">
<a href="http://www.infoworld.com/d/open-source-software/bossie-awards-2011-the-best-open-source-application-development-software-171759-0&current=10&last=1#slideshowTop">2011 BOSSIE AWARD FOR OPEN SOURCE DEVELOPMENT SOFTWARE</a>
<a href="http://www.infoworld.com/slideshow/24605/infoworlds-2012-technology-of-the-year-award-winners-183313#slide23"target="_blank">InfoWorld's 2012 Technology of the Year Award Winner</a>
</div>
</div>
</div>
+20 -11
View File
@@ -23,10 +23,6 @@ function ajax(u,s,t) {
String.prototype.reverse = function () { return this.split('').reverse().join('');};
function web2py_ajax_fields(target) {
jQuery('input.integer', target).keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
jQuery('input.double,input.decimal', target).keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
jQuery("input[type='checkbox'].delete", target).live('click',function(){ if(this.checked) if(!confirm(confirm_message)) this.checked=false; });
var date_format = (typeof w2p_ajax_date_format != 'undefined') ? w2p_ajax_date_format : "%Y-%m-%d";
var datetime_format = (typeof w2p_ajax_datetime_format != 'undefined') ? w2p_ajax_datetime_format : "%Y-%m-%d %H:%M:%S";
jQuery("input.date",target).each(function() {Calendar.setup({inputField:this, ifFormat:date_format, showsTime:false });});
@@ -38,17 +34,26 @@ function web2py_ajax_fields(target) {
function web2py_ajax_init(target) {
jQuery('.hidden', target).hide();
jQuery('.error', target).hide().slideDown('slow');
jQuery('.flash', target).click(function(e) { jQuery(this).fadeOut('slow'); e.preventDefault(); });
// jQuery('input[type=submit]').click(function(){var t=jQuery(this);t.hide();t.after('<input class="submit_disabled" disabled="disabled" type="submit" name="'+t.attr("name")+'_dummy" value="'+t.val()+'">')});
web2py_ajax_fields(target);
};
function web2py_event_handlers() {
var doc = jQuery(document)
doc.on('click', '.flash', function(e){jQuery(this).fadeOut('slow'); e.preventDefault();});
doc.on('keyup', 'input.integer', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
doc.on('keyup', 'input.double, input.decimal', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
doc.on('click', "input[type='checkbox'].delete", function(){if(this.checked) if(!confirm(confirm_message)) this.checked=false;});
};
jQuery(function() {
var flash = jQuery('.flash');
flash.hide();
if(flash.html()) flash.slideDown();
web2py_ajax_init(document);
web2py_event_handlers();
});
function web2py_trap_form(action,target) {
jQuery('#'+target+' form').each(function(i){
var form=jQuery(this);
@@ -60,6 +65,7 @@ function web2py_trap_form(action,target) {
});
});
}
function web2py_trap_link(target) {
jQuery('#'+target+' a.w2p_trap').each(function(i){
var link=jQuery(this);
@@ -70,11 +76,12 @@ function web2py_trap_link(target) {
});
});
}
function web2py_ajax_page(method,action,data,target) {
jQuery.ajax({'type':method,'url':action,'data':data,
function web2py_ajax_page(method, action, data, target) {
jQuery.ajax({'type':method, 'url':action, 'data':data,
'beforeSend':function(xhr) {
xhr.setRequestHeader('web2py-component-location',document.location);
xhr.setRequestHeader('web2py-component-element',target);},
xhr.setRequestHeader('web2py-component-location', document.location);
xhr.setRequestHeader('web2py-component-element', target);},
'complete':function(xhr,text){
var html=xhr.responseText;
var content=xhr.getResponseHeader('web2py-component-content');
@@ -94,9 +101,11 @@ function web2py_ajax_page(method,action,data,target) {
}
});
}
function web2py_component(action,target) {
jQuery(function(){ web2py_ajax_page('get',action,null,target); });
jQuery(function(){web2py_ajax_page('get',action,null,target);});
}
function web2py_comet(url,onmessage,onopen,onclose) {
if ("WebSocket" in window) {
var ws = new WebSocket(url);
+11
View File
@@ -20,6 +20,17 @@ from dal import DAL, Field
from sqlhtml import SQLFORM, SQLTABLE
from compileapp import LOAD
# Dummy code to enable code completion in IDE's.
if 0:
from globals import Request, Response, Session
from cache import Cache
from languages import translator
request = Request()
response = Response()
session = Session()
cache = Cache(request)
T = translator(request)
+1 -1
View File
@@ -7769,7 +7769,7 @@ def Rows_unpickler(data):
def Rows_pickler(data):
return Rows_unpickler, \
(cPickle.dumps(data.as_list(storage_to_dict=True,
(cPickle.dumps(data.as_list(storage_to_dict=False,
datetime_to_str=False)),)
copy_reg.pickle(Rows, Rows_pickler, Rows_unpickler)