From e5f9358cf93803bba8ebfe4cb7bf72ce9791f1cd Mon Sep 17 00:00:00 2001
From: Michele Comitini
Date: Wed, 29 Aug 2012 14:24:14 +0200
Subject: [PATCH] commit merge
---
CHANGELOG | 3 +
Makefile | 2 +-
VERSION | 2 +-
applications/admin/controllers/appadmin.py | 2 +
applications/admin/controllers/default.py | 10 +-
applications/admin/languages/default.py | 122 ++++
.../admin/static/images/sidebar_bullet.png | Bin 718 -> 0 bytes
.../admin/static/js/jquery.timeentry.js | 571 ---------------
applications/admin/views/appadmin.html | 47 +-
applications/admin/views/default/ticket.html | 8 +-
applications/examples/controllers/appadmin.py | 2 +
applications/examples/static/images/gluon.png | Bin 58169 -> 0 bytes
.../examples/static/images/logo3Tones.png | Bin 149438 -> 0 bytes
.../examples/static/images/netdow1.png | Bin 3883 -> 0 bytes
.../examples/static/images/netdow2.png | Bin 3888 -> 0 bytes
.../examples/static/images/netdow3.png | Bin 714 -> 0 bytes
.../examples/static/images/tablet.png | Bin 51003 -> 0 bytes
.../examples/static/images/tipDownloads.png | Bin 5783 -> 0 bytes
.../examples/static/images/tipDownloads2.png | Bin 6085 -> 0 bytes
.../static/images/web2py_logo_light.png | Bin 7786 -> 0 bytes
applications/examples/static/js/common.js | 116 ----
.../examples/static/js/jquery-1.5-min.js | 16 -
.../examples/static/js/jquery.prettyPhoto.js | 69 --
.../powered_by/web2py_sticker_3d8799.png | Bin 548 -> 0 bytes
.../powered_by/web2py_sticker_3d9960.png | Bin 545 -> 0 bytes
.../powered_by/web2py_sticker_463d99.png | Bin 555 -> 0 bytes
.../powered_by/web2py_sticker_73993d.png | Bin 547 -> 0 bytes
.../powered_by/web2py_sticker_993d3d.png | Bin 545 -> 0 bytes
.../powered_by/web2py_sticker_993d98.png | Bin 536 -> 0 bytes
.../powered_by/web2py_sticker_996f3d.png | Bin 544 -> 0 bytes
.../powered_by/web2py_sticker_99963d.png | Bin 550 -> 0 bytes
.../examples/static/web2py_logo_light.png | Bin 7786 -> 0 bytes
applications/examples/views/appadmin.html | 47 +-
applications/welcome/controllers/appadmin.py | 2 +
applications/welcome/languages/cs.py | 14 +-
applications/welcome/languages/default.py | 11 +
applications/welcome/languages/es.py | 14 +-
applications/welcome/languages/fr-ca.py | 14 +-
applications/welcome/languages/fr.py | 14 +-
applications/welcome/languages/hi.py | 14 +-
applications/welcome/languages/hu.py | 14 +-
applications/welcome/languages/it.py | 93 ++-
applications/welcome/languages/nl.py | 14 +-
applications/welcome/languages/pl.py | 14 +-
applications/welcome/languages/pt-br.py | 14 +-
applications/welcome/languages/pt.py | 14 +-
applications/welcome/languages/ro.py | 14 +-
applications/welcome/languages/ru.py | 12 +-
applications/welcome/languages/sk.py | 14 +-
applications/welcome/languages/uk.py | 14 +-
applications/welcome/languages/zh.py | 14 +-
.../welcome/static/images/arrows-ffffff.png | Bin 244 -> 0 bytes
.../static/images/css3buttons_backgrounds.png | Bin 1367 -> 0 bytes
.../static/images/css3buttons_icons.png | Bin 3322 -> 0 bytes
.../welcome/static/images/poweredby.png | Bin 4150 -> 0 bytes
applications/welcome/static/images/shadow.png | Bin 1698 -> 0 bytes
.../static/images/ui-icons_222222_256x240.png | Bin 4369 -> 0 bytes
applications/welcome/views/appadmin.html | 47 +-
gluon/cache.py | 2 +-
gluon/compileapp.py | 81 +--
gluon/globals.py | 109 +--
gluon/html.py | 72 +-
gluon/http.py | 40 +-
gluon/languages.py | 640 ++++++++---------
gluon/main.py | 200 +++---
gluon/portalocker.py | 14 +-
gluon/restricted.py | 23 +-
gluon/rewrite.py | 117 ++--
gluon/rocket.py | 5 +-
gluon/settings.py | 15 +-
gluon/sqlhtml.py | 6 +-
gluon/template.py | 189 ++---
gluon/tests/test_dal.py | 31 +
gluon/tests/test_languages.py | 34 +
gluon/tools.py | 656 +++++++++---------
75 files changed, 1546 insertions(+), 2066 deletions(-)
delete mode 100644 applications/admin/static/images/sidebar_bullet.png
delete mode 100644 applications/admin/static/js/jquery.timeentry.js
delete mode 100644 applications/examples/static/images/gluon.png
delete mode 100644 applications/examples/static/images/logo3Tones.png
delete mode 100644 applications/examples/static/images/netdow1.png
delete mode 100644 applications/examples/static/images/netdow2.png
delete mode 100644 applications/examples/static/images/netdow3.png
delete mode 100644 applications/examples/static/images/tablet.png
delete mode 100644 applications/examples/static/images/tipDownloads.png
delete mode 100644 applications/examples/static/images/tipDownloads2.png
delete mode 100644 applications/examples/static/images/web2py_logo_light.png
delete mode 100644 applications/examples/static/js/common.js
delete mode 100644 applications/examples/static/js/jquery-1.5-min.js
delete mode 100644 applications/examples/static/js/jquery.prettyPhoto.js
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_3d8799.png
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_3d9960.png
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_463d99.png
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_73993d.png
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_993d3d.png
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_993d98.png
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_996f3d.png
delete mode 100644 applications/examples/static/powered_by/web2py_sticker_99963d.png
delete mode 100644 applications/examples/static/web2py_logo_light.png
delete mode 100644 applications/welcome/static/images/arrows-ffffff.png
delete mode 100644 applications/welcome/static/images/css3buttons_backgrounds.png
delete mode 100644 applications/welcome/static/images/css3buttons_icons.png
delete mode 100644 applications/welcome/static/images/poweredby.png
delete mode 100644 applications/welcome/static/images/shadow.png
delete mode 100644 applications/welcome/static/images/ui-icons_222222_256x240.png
diff --git a/CHANGELOG b/CHANGELOG
index 993ebe19..bd6fb9cd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,9 @@
### DAL Improvements
- Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda table:), thanks Jonathan
+- db(...).select(cacheable=True) make select 30% faster
+- db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
+- db(...).count(cache=(cache.ram,3600)) now supported
- MongoDB support in DAL (experimental), thanks Mark Breedveld
- geodal and spatialite, thanks Denes and Fran (experimental)
- db.mytable._before_insert, _after_insert, _before_update, _after_update, _before_delete. _after_delete (list of callbacks)
diff --git a/Makefile b/Makefile
index 864d37ec..4eace126 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@ update:
wget -O gluon/contrib/simplejsonrpc.py http://rad2py.googlecode.com/hg/ide2py/simplejsonrpc.py
echo "remember that pymysql was tweaked"
src:
- echo 'Version 2.00.0 ('`date +%Y-%m-%d\ %H:%M:%S`') dev' > VERSION
+ echo 'Version 2.00.1 ('`date +%Y-%m-%d\ %H:%M:%S`') rc4' > VERSION
### rm -f all junk files
make clean
### clean up baisc apps
diff --git a/VERSION b/VERSION
index 3fd1bc7d..7b48a4bd 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-Version 2.00.0 (2012-08-26 00:00:11) dev
+Version 2.00.1 (2012-08-28 22:14:54) rc4
diff --git a/applications/admin/controllers/appadmin.py b/applications/admin/controllers/appadmin.py
index 126200b9..fa264bae 100644
--- a/applications/admin/controllers/appadmin.py
+++ b/applications/admin/controllers/appadmin.py
@@ -11,6 +11,8 @@ import copy
import gluon.contenttype
import gluon.fileutils
+response.subtitle = 'Database Administration (appadmin)'
+
# ## critical --- make a copy of the environment
global_env = copy.copy(globals())
diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py
index 4f685ba0..1fb8cf9e 100644
--- a/applications/admin/controllers/default.py
+++ b/applications/admin/controllers/default.py
@@ -23,9 +23,9 @@ except ImportError:
GIT_MISSING = 'requires python-git module, but not installed or incompatible version'
from gluon.languages import (regex_language, read_possible_languages,
- read_possible_plurals, lang_sampling,
+ lang_sampling,
read_dict, write_dict, read_plural_dict,
- write_plural_dict)
+ write_plural_dict, PLURAL_RULES)
if DEMO_MODE and request.function in ['change_password','pack','pack_plugin','upgrade_web2py','uninstall','cleanup','compile_app','remove_compiled_app','delete','delete_plugin','create_file','upload_file','update_languages','reload_routes','git_push','git_pull']:
@@ -949,8 +949,8 @@ def design():
# get only existed files
languages = sorted(all_languages)
- plural_rules={}
- all_plurals=read_possible_plurals()
+ plural_rules = {}
+ all_plurals = PLURAL_RULES
for langfile,lang in all_languages.iteritems():
lang=lang.strip()
match_language = regex_language.match(lang)
@@ -961,7 +961,7 @@ def design():
plang = lang_sampling(match_language, all_plurals.keys())
if plang:
plural=all_plurals[plang]
- plural_rules[langfile]=(plural[0],plang,plural[1],plural[3])
+ plural_rules[langfile]=(plural[0],plang,plural[4],plural[3])
else:
plural_rules[langfile]=(0,lang,'plural_rules-%s.py'%lang,'')
diff --git a/applications/admin/languages/default.py b/applications/admin/languages/default.py
index 94b0828c..a9bd0be9 100644
--- a/applications/admin/languages/default.py
+++ b/applications/admin/languages/default.py
@@ -4,5 +4,127 @@
'!langname!': 'English (US)',
'%Y-%m-%d': '%m-%d-%Y',
'%Y-%m-%d %H:%M:%S': '%m-%d-%Y %H:%M:%S',
+'(requires internet access)': '(requires internet access)',
+'(something like "it-it")': '(something like "it-it")',
+'About': 'About',
+'Additional code for your application': 'Additional code for your application',
+'Admin language': 'Admin language',
+'administrative interface': 'administrative interface',
+'Administrator Password:': 'Administrator Password:',
+'and rename it:': 'and rename it:',
+'Application name:': 'Application name:',
+'are not used yet': 'are not used yet',
+'Are you sure you want to delete this object?': 'Are you sure you want to delete this object?',
+'arguments': 'arguments',
'back': '<Px#32;bRa{vGh*8l(w*8xH(n|J^K00(qQO+^RV3kC`?8XIDOIsgCyU`a$lR4C7V
zlFv#TQ5eO)xqs$Q633wprW&WNI)NfW5XNp@_yE#ZDEJIMfzKcmT)8anx{TXekbp=9
zn?Od4Q%PE9CYiaDJNMq{A~v*}{uYPtgL5{Aqm^X|f8d-aNs{Mzp638ynx<)*wr%UW
zzVML66-Ci_Jbrk17>~zM6aj$aIQ4pcZEdYyuRD(OPaq7#(P(sWaq;;0Sd`N#{tf`O
z;Tx*e8jZ%z&JJU2b#)a0w6ZLdBng7x?CdNne$Kp4uiC#5#sHwC{Ly`3+`g~Sm;3ws
z8yg$8Z6hH>9LJqbC(1%&@5J@fs%6)#<(jozwQSc2DXfeUA1h>
ztQpkOiLtUZ;wlM(pePEWlo|{Mr5z%SF(!oQIyEci(!7j9aEuAUxU|E;V4##j7-P=4
zloI}nl#+9fF-DY9*LCB&ic(TaAq3||p5>D)pYS3Vf=elslJQ-|bzMp+qLg}`m&PKx
zX>u`}6^!N6lqD%kSU#N~pC(LGPmQPX^r!3C$37e(t
z316MMtyatTeM+fTmZcEl{{H^p;GiU_|6#o3-64blKq)!7ef{-gT@%&g -1;
- },
-
- /* Reconfigure the settings for a time entry field.
- @param input (element) input field to change
- @param options (object) new settings to add or
- (string) an individual setting name
- @param value (any) the individual setting's value
- */
- _changeTimeEntry: function(input, options, value) {
- var inst = jQuery.data(input, PROP_NAME);
- if (inst) {
- if (typeof options == 'string') {
- var name = options;
- options = {};
- options[name] = value;
- }
- var currentTime = this._extractTime(inst);
- extendRemove(inst.options, options || {});
- if (currentTime)
- this._setTime(inst, new Date(0, 0, 0,
- currentTime[0], currentTime[1], currentTime[2]));
- }
- jQuery.data(input, PROP_NAME, inst);
- },
-
- /* Remove the time entry functionality from an input.
- @param input (element) input field to affect
- */
- _destroyTimeEntry: function(input) {
- jQueryinput = jQuery(input);
- if (!jQueryinput.hasClass(this.markerClassName)) return;
- jQueryinput.removeClass(this.markerClassName).unbind('.timeEntry');
- this._disabledInputs = jQuery.map(this._disabledInputs, function(value) { return (value == input ? null : value); }); // Delete entry
- jQueryinput.parent().replaceWith(jQueryinput);
- jQuery.removeData(input, PROP_NAME);
- },
-
- /* Initialise the current time for a time entry input field.
- @param input (element) input field to update
- @param time (Date) the new time (year/month/day ignored) or null for now
- */
- _setTimeTimeEntry: function(input, time) {
- var inst = jQuery.data(input, PROP_NAME);
- if (inst) this._setTime(inst, time ? (typeof time == 'object' ? new Date(time.getTime()) : time) : null);
- },
-
- /* Retrieve the current time for a time entry input field.
- @param input (element) input field to examine
- @return (Date) current time (year/month/day zero) or null if none
- */
- _getTimeTimeEntry: function(input) {
- var inst = jQuery.data(input, PROP_NAME);
- var currentTime = (inst ? this._extractTime(inst) : null);
- return (!currentTime ? null : new Date(0, 0, 0, currentTime[0], currentTime[1], currentTime[2]));
- },
-
- /* Retrieve the millisecond offset for the current time.
- @param input (element) input field to examine
- @return (number) the time as milliseconds offset or zero if none
- */
- _getOffsetTimeEntry: function(input) {
- var inst = jQuery.data(input, PROP_NAME);
- var currentTime = (inst ? this._extractTime(inst) : null);
- return (!currentTime ? 0 : (currentTime[0] * 3600 + currentTime[1] * 60 + currentTime[2]) * 1000);
- },
-
- /* Initialise time entry.
- @param target (element) the input field or (event) the focus event
- */
- _doFocus: function(target) {
- var input = (target.nodeName && target.nodeName.toLowerCase() == 'input' ? target : this);
- if (jQuery.timeEntry._lastInput == input || jQuery.timeEntry._isDisabledTimeEntry(input)) {
- jQuery.timeEntry._focussed = false;
- return;
- }
- var inst = jQuery.data(input, PROP_NAME);
- jQuery.timeEntry._focussed = true;
- jQuery.timeEntry._lastInput = input;
- jQuery.timeEntry._blurredInput = null;
- jQuery.data(input, PROP_NAME, inst);
- jQuery.timeEntry._parseTime(inst);
- setTimeout(function() { jQuery.timeEntry._showField(inst); }, 10);
- },
-
- /* Note that the field has been exited.
- @param event (event) the blur event
- */
- _doBlur: function(event) {
- jQuery.timeEntry._blurredInput = jQuery.timeEntry._lastInput;
- jQuery.timeEntry._lastInput = null;
- },
-
- /* Select appropriate field portion on click, if already in the field.
- @param event (event) the click event
- */
- _doClick: function(event) {
- var input = event.target;
- var inst = jQuery.data(input, PROP_NAME);
- if (!jQuery.timeEntry._focussed) {
- var fieldSize = 3;
- inst._field = 0;
- if (input.selectionStart != null) { // Use input select range
- for (var field = 0; field <= Math.max(1, inst._secondField, inst._ampmField); field++) {
- var end = (field != inst._ampmField ? (field * fieldSize) + 2 : (inst._ampmField * fieldSize) + 2);
- inst._field = field;
- if (input.selectionStart < end) break;
- }
- } else if (input.createTextRange) { // Check against bounding boxes
- var src = jQuery(event.srcElement);
- var range = input.createTextRange();
- var convert = function(value) {
- return {thin: 2, medium: 4, thick: 6}[value] || value;
- };
- var offsetX = event.clientX + document.documentElement.scrollLeft -
- (src.offset().left + parseInt(convert(src.css('border-left-width')), 10)) -
- range.offsetLeft; // Position - left edge - alignment
- for (var field = 0; field <= Math.max(1, inst._secondField, inst._ampmField); field++) {
- var end = (field != inst._ampmField ? (field * fieldSize) + 2 : (inst._ampmField * fieldSize) + 2);
- range.collapse();
- range.moveEnd('character', end);
- inst._field = field;
- if (offsetX < range.boundingWidth) break; // And compare
- }
- }
- }
- jQuery.data(input, PROP_NAME, inst);
- jQuery.timeEntry._showField(inst);
- jQuery.timeEntry._focussed = false;
- },
-
- /* Handle keystrokes in the field.
- @param event (event) the keydown event
- @return (boolean) true to continue, false to stop processing
- */
- _doKeyDown: function(event) {
- if (event.keyCode >= 48) return true;
- var inst = jQuery.data(event.target, PROP_NAME);
-
- switch (event.keyCode) {
- case 9:
- var its = jQuery(':input');
- its.eq(its.index(this)+(event.shiftKey?-1:+1)).focus();
- break;
- case 37: jQuery.timeEntry._changeField(inst, -1, false); break; // Previous field on left
- case 38: jQuery.timeEntry._adjustField(inst, -1); break; // Increment time field on down
- case 16: if(!event.shiftKey) jQuery.timeEntry._changeField(inst, +1, false); break; // Next field on right
- case 39: jQuery.timeEntry._changeField(inst, +1, false); break; // Next field on right
- case 40: jQuery.timeEntry._adjustField(inst, +1); break; // Decrement time field on up
- case 32: case 46: jQuery.timeEntry._setValue(inst, ''); break; // Clear time on delete
- }
- return false;
- },
-
- /* Disallow unwanted characters.
- @param event (event) the keypress event
- @return (boolean) true to continue, false to stop processing
- */
- _doKeyPress: function(event) {
- var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
- if (chr < ' ') return true;
- var inst = jQuery.data(event.target, PROP_NAME);
- jQuery.timeEntry._handleKeyPress(inst, chr);
- return false;
- },
-
- /* Get a setting value, defaulting if necessary.
- @param inst (object) the instance settings
- @param name (string) the setting name
- @return (any) the setting value
- */
- _get: function(inst, name) {
- return (inst.options[name] != null ? inst.options[name] : jQuery.timeEntry._defaults[name]);
- },
-
- /* Extract the time value from the input field, or default to now.
- @param inst (object) the instance settings
- */
- _parseTime: function(inst) {
- var currentTime = this._extractTime(inst);
- var showSeconds = this._get(inst, 'showSeconds');
- if (currentTime) {
- inst._selectedHour = currentTime[0];
- inst._selectedMinute = currentTime[1];
- inst._selectedSecond = currentTime[2];
- }
- else {
- var now = this._constrainTime(inst);
- inst._selectedHour = now[0];
- inst._selectedMinute = now[1];
- inst._selectedSecond = (showSeconds ? now[2] : 0);
- }
- inst._secondField = (showSeconds ? 2 : -1);
- inst._ampmField = (this._get(inst, 'show24Hours') ? -1 : (showSeconds ? 3 : 2));
- inst._lastChr = '';
- inst._field = Math.max(0, Math.min(Math.max(1, inst._secondField, inst._ampmField), 0));
- if (inst.input.val() != '') this._showTime(inst);
- },
-
- /* Extract the time value from a string as an array of values, or default to null.
- @param inst (object) the instance settings
- @param value (string) the time value to parse
- @return (number[3]) the time components (hours, minutes, seconds)
- or null if no value
- */
- _extractTime: function(inst, value) {
- value = value || inst.input.val();
- var currentTime = value.split(':');
- var ampmNames = this._get(inst, 'ampmNames');
- var show24Hours = this._get(inst, 'show24Hours');
- if (currentTime.length >= 2) {
- var isAM = !show24Hours && (value.indexOf(ampmNames[0]) > -1);
- var isPM = !show24Hours && (value.indexOf(ampmNames[1]) > -1);
- var hour = parseInt(currentTime[0], 10);
- hour = (isNaN(hour) ? 0 : hour);
- hour = ((isAM || isPM) && hour == 12 ? 0 : hour) + (isPM ? 12 : 0);
- var minute = parseInt(currentTime[1], 10);
- minute = (isNaN(minute) ? 0 : minute);
- var second = (currentTime.length >= 3 ?
- parseInt(currentTime[2], 10) : 0);
- second = (isNaN(second) || !this._get(inst, 'showSeconds') ? 0 : second);
- return this._constrainTime(inst, [hour, minute, second]);
- }
- return null;
- },
-
- /* Constrain the given/current time to the time steps.
- @param inst (object) the instance settings
- @param fields (number[3]) the current time components (hours, minutes, seconds)
- @return (number[3]) the constrained time components (hours, minutes, seconds)
- */
- _constrainTime: function(inst, fields) {
- var specified = (fields != null);
- if (!specified) {
- var now = this._determineTime(inst, this._get(inst, 'defaultTime')) || new Date();
- fields = [now.getHours(), now.getMinutes(), now.getSeconds()];
- }
- return fields;
- },
-
- /* Set the selected time into the input field.
- @param inst (object) the instance settings
- */
- _showTime: function(inst) {
- var show24Hours = this._get(inst, 'show24Hours');
- var currentTime = (this._formatNumber(show24Hours ? inst._selectedHour :
- ((inst._selectedHour + 11) % 12) + 1) + ':' +
- this._formatNumber(inst._selectedMinute) +
- (this._get(inst, 'showSeconds') ? ':' +
- this._formatNumber(inst._selectedSecond) : '') +
- (show24Hours ? '' : this._get(inst, 'ampmNames')[(inst._selectedHour < 12 ? 0 : 1)]));
- this._setValue(inst, currentTime);
- this._showField(inst);
- },
-
- /* Highlight the current time field.
- @param inst (object) the instance settings
- */
- _showField: function(inst) {
- var input = inst.input[0];
- if (inst.input.is(':hidden') || jQuery.timeEntry._lastInput != input) return;
- var fieldSize = 3;
- var start = (inst._field == inst._ampmField ? (inst._ampmField * fieldSize) - 1 : (inst._field * fieldSize));
- var end = start + (inst._field == inst._ampmField ? 2 : 2);
- if (input.setSelectionRange) { // Mozilla
- input.setSelectionRange(start, end);
- }
- else if (input.createTextRange) { // IE
- var range = input.createTextRange();
- range.moveStart('character', start);
- range.moveEnd('character', end - inst.input.val().length);
- range.select();
- }
- if (!input.disabled) input.focus();
- },
-
- /* Ensure displayed single number has a leading zero.
- @param value (number) current value
- @return (string) number with at least two digits
- */
- _formatNumber: function(value) {
- return (value < 10 ? '0' : '') + value;
- },
-
- /* Update the input field and notify listeners.
- @param inst (object) the instance settings
- @param value (string) the new value
- */
- _setValue: function(inst, value) {
- if (value != inst.input.val()) inst.input.val(value).trigger('change');
- },
-
- /* Move to previous/next field, or out of field altogether if appropriate.
- @param inst (object) the instance settings
- @param offset (number) the direction of change (-1, +1)
- @param moveOut (boolean) true if can move out of the field
- @return (boolean) true if exitting the field, false if not
- */
- _changeField: function(inst, offset, moveOut) {
- var atFirstLast = (inst.input.val() == '' || inst._field == (offset == -1 ? 0 : Math.max(1, inst._secondField, inst._ampmField)));
- if (!atFirstLast) inst._field += offset;
- this._showField(inst);
- inst._lastChr = '';
- jQuery.data(inst.input[0], PROP_NAME, inst);
- return (atFirstLast && moveOut);
- },
-
- /* Update the current field in the direction indicated.
- @param inst (object) the instance settings
- @param offset (number) the amount to change by
- */
- _adjustField: function(inst, offset) {
- if (inst.input.val() == '') offset = 0;
- this._setTime(inst, new Date(0, 0, 0,
- inst._selectedHour + (inst._field == 0 ? offset : 0) +
- (inst._field == inst._ampmField ? offset * 12 : 0),
- inst._selectedMinute + (inst._field == 1 ? offset : 0),
- inst._selectedSecond + (inst._field == inst._secondField ? offset : 0)));
- },
-
- /* Check against minimum/maximum and display time.
- @param inst (object) the instance settings
- @param time (Date) an actual time or
- (number) offset in seconds from now or
- (string) units and periods of offsets from now
- */
- _setTime: function(inst, time) {
- time = this._determineTime(inst, time);
- var fields = this._constrainTime(inst, time ?
- [time.getHours(), time.getMinutes(), time.getSeconds()] : null);
- time = new Date(0, 0, 0, fields[0], fields[1], fields[2]);
- // Normalise to base date
- var time = this._normaliseTime(time);
- var minTime = this._normaliseTime(this._determineTime(inst, this._get(inst, 'minTime')));
- var maxTime = this._normaliseTime(this._determineTime(inst, this._get(inst, 'maxTime')));
- // Ensure it is within the bounds set
- time = (minTime && time < minTime ? minTime :
- (maxTime && time > maxTime ? maxTime : time));
- inst._selectedHour = time.getHours();
- inst._selectedMinute = time.getMinutes();
- inst._selectedSecond = time.getSeconds();
- this._showTime(inst);
- jQuery.data(inst.input[0], PROP_NAME, inst);
- },
-
- /* Normalise time object to a common date.
- @param time (Date) the original time
- @return (Date) the normalised time
- */
- _normaliseTime: function(time) {
- if (!time) return null;
- time.setFullYear(1900);
- time.setMonth(0);
- time.setDate(0);
- return time;
- },
-
- /* A time may be specified as an exact value or a relative one.
- @param inst (object) the instance settings
- @param setting (Date) an actual time or
- (number) offset in seconds from now or
- (string) units and periods of offsets from now
- @return (Date) the calculated time
- */
- _determineTime: function(inst, setting) {
- var offsetNumeric = function(offset) { // E.g. +300, -2
- var time = new Date();
- time.setTime(time.getTime() + offset * 1000);
- return time;
- };
- var offsetString = function(offset) { // E.g. '+2m', '-4h', '+3h +30m' or '12:34:56PM'
- var fields = jQuery.timeEntry._extractTime(inst, offset); // Actual time?
- var time = new Date();
- var hour = (fields ? fields[0] : time.getHours());
- var minute = (fields ? fields[1] : time.getMinutes());
- var second = (fields ? fields[2] : time.getSeconds());
- if (!fields) {
- var pattern = /([+-]?[0-9]+)\s*(s|S|m|M|h|H)?/g;
- var matches = pattern.exec(offset);
- while (matches) {
- switch (matches[2] || 's') {
- case 's' : case 'S' : second += parseInt(matches[1], 10); break;
- case 'm' : case 'M' : minute += parseInt(matches[1], 10); break;
- case 'h' : case 'H' : hour += parseInt(matches[1], 10); break;
- }
- matches = pattern.exec(offset);
- }
- }
- time = new Date(0, 0, 10, hour, minute, second, 0);
- if (/^!/.test(offset)) { // No wrapping
- if (time.getDate() > 10)
- time = new Date(0, 0, 10, 23, 59, 59);
- else if (time.getDate() < 10)
- time = new Date(0, 0, 10, 0, 0, 0);
- }
- return time;
- };
- return (setting ? (typeof setting == 'string' ? offsetString(setting) :
- (typeof setting == 'number' ? offsetNumeric(setting) : setting)) : null);
- },
-
- /* Update time based on keystroke entered.
- @param inst (object) the instance settings
- @param chr (ch) the new character
- */
- _handleKeyPress: function(inst, chr) {
- if (chr == ':') this._changeField(inst, +1, false);
- else if (chr >= '0' && chr <= '9') { // Allow direct entry of time
- var key = parseInt(chr, 10);
- var value = parseInt(inst._lastChr + chr, 10);
- var show24Hours = this._get(inst, 'show24Hours');
- var hour = (inst._field != 0 ? inst._selectedHour :
- (show24Hours ? (value < 24 ? value : key) :
- (value >= 1 && value <= 12 ? value :
- (key > 0 ? key : inst._selectedHour)) % 12 +
- (inst._selectedHour >= 12 ? 12 : 0)));
- var minute = (inst._field != 1 ? inst._selectedMinute :
- (value < 60 ? value : key));
- var second = (inst._field != inst._secondField ? inst._selectedSecond :
- (value < 60 ? value : key));
- var fields = this._constrainTime(inst, [hour, minute, second]);
- this._setTime(inst, new Date(0, 0, 0, fields[0], fields[1], fields[2]));
- inst._lastChr = chr;
- }
- else if (!this._get(inst, 'show24Hours')) { // Set am/pm based on first char of names
- chr = chr.toLowerCase();
- var ampmNames = this._get(inst, 'ampmNames');
- if ((chr == ampmNames[0].substring(0, 1).toLowerCase() && inst._selectedHour >= 12) ||
- (chr == ampmNames[1].substring(0, 1).toLowerCase() && inst._selectedHour < 12)) {
- var saveField = inst._field;
- inst._field = inst._ampmField;
- this._adjustField(inst, +1);
- inst._field = saveField;
- this._showField(inst);
- }
- }
- }
- });
-
- /* jQuery extend now ignores nulls!
- @param target (object) the object to update
- @param props (object) the new settings
- @return (object) the updated object
- */
- function extendRemove(target, props) {
- jQuery.extend(target, props);
- for (var name in props) if (props[name] == null) target[name] = null;
- return target;
- }
-
- // Commands that don't return a jQuery object
- var getters = ['getOffset', 'getTime', 'isDisabled'];
-
- /* Attach the time entry functionality to a jQuery selection.
- @param command (string) the command to run (optional, default 'attach')
- @param options (object) the new settings to use for these countdown instances (optional)
- @return (jQuery) for chaining further calls
- */
- jQuery.fn.timeEntry = function(options) {
- var otherArgs = Array.prototype.slice.call(arguments, 1);
- if (typeof options == 'string' && jQuery.inArray(options, getters) > -1) {
- return jQuery.timeEntry['_' + options + 'TimeEntry'].apply(jQuery.timeEntry, [this[0]].concat(otherArgs));
- }
- return this.each(function() {
- var nodeName = this.nodeName.toLowerCase();
- if (nodeName == 'input') {
- if (typeof options == 'string')
- jQuery.timeEntry['_' + options + 'TimeEntry'].apply(jQuery.timeEntry, [this].concat(otherArgs));
- else {
- // Check for settings on the control itself
- var inlineSettings = (jQuery.fn.metadata ? jQuery(this).metadata() : {});
- jQuery.timeEntry._connectTimeEntry(this, jQuery.extend(inlineSettings, options));
- }
- }
- });
- };
-
- /* Initialise the time entry functionality. */
- jQuery.timeEntry = new TimeEntry(); // Singleton instance
-
-})(jQuery);
-
diff --git a/applications/admin/views/appadmin.html b/applications/admin/views/appadmin.html
index 1d967c2f..541a18bb 100644
--- a/applications/admin/views/appadmin.html
+++ b/applications/admin/views/appadmin.html
@@ -10,8 +10,9 @@
//-->
{{if request.function=='index':}}
-{{=T("Available databases and tables")}}
+{{=T("Available Databases and Tables")}}
{{if not databases:}}{{=T("No databases in this application")}}{{pass}}
+
{{for db in sorted(databases):}}
{{for table in databases[db].tables:}}
{{qry='%s.%s.id>0'%(db,table)}}
@@ -28,20 +29,24 @@
{{qry=''}}
{{pass}}
{{pass}}
-
- {{=A("%s.%s" % (db,table),_href=URL('select',args=[db],vars=dict(query=qry)))}}
-
- [ {{=A(str(T('insert new'))+' '+table,_href=URL('insert',args=[db,table]))}} ]
-
+
+ |
+ {{=A("%s.%s" % (db,table),_href=URL('select',args=[db],vars=dict(query=qry)))}}
+ |
+
+ {{=A(str(T('New Record')),_href=URL('insert',args=[db,table]),_class="btn")}}
+ |
+
{{pass}}
+
{{pass}}
{{elif request.function=='select':}}
- {{=XML(str(T("database %s select"))%A(request.args[0],_href=URL('index'))) }}
+ {{=XML(str(T("Database %s select"))%A(request.args[0],_href=URL('index'))) }}
- {{if table:}}
- [ {{=A(str(T('insert new %s'))%table,_href=URL('insert',args=[request.args[0],table]))}} ]
- {{=T("Rows in table")}}
+ {{if table:}}
+ {{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn")}}
+ {{=T("Rows in Table")}}
{{else:}}
{{=T("Rows selected")}}
{{pass}}
@@ -51,8 +56,8 @@
{{=T('"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN')}}
{{=T("%s selected", nrows)}}
- {{if start>0:}}[ {{=A(T('previous 100 rows'),_href=URL('select',args=request.args[0],vars=dict(start=start-100)))}} ]{{pass}}
- {{if stop0:}}{{=A(T('previous 100 rows'),_href=URL('select',args=request.args[0],vars=dict(start=start-100)),_class="btn")}}{{pass}}
+ {{if stop
{{linkto=URL('update',args=request.args[0])}}
@@ -61,35 +66,35 @@
{{pass}}
{{=T("Import/Export")}}
- [ {{=T("export as csv file")}} ]
+ {{=T("export as csv file")}}
{{=formcsv or ''}}
{{elif request.function=='insert':}}
-