From d72d5c64e2edebb63a7f9f23c0de102c0f628f78 Mon Sep 17 00:00:00 2001 From: ilvalle Date: Thu, 19 Dec 2013 09:52:38 +0100 Subject: [PATCH 01/19] fix issue 1825 --- applications/admin/static/js/web2py_bootstrap.js | 6 +++--- applications/examples/static/js/web2py_bootstrap.js | 6 +++--- applications/welcome/static/js/web2py_bootstrap.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/applications/admin/static/js/web2py_bootstrap.js b/applications/admin/static/js/web2py_bootstrap.js index edcb3628..7206cb1b 100644 --- a/applications/admin/static/js/web2py_bootstrap.js +++ b/applications/admin/static/js/web2py_bootstrap.js @@ -20,14 +20,14 @@ jQuery(function(){ function hoverMenu(){ jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){ adjust_height_of_collapsed_nav(); - mi = jQuery(this).addClass('open'); + var mi = jQuery(this).addClass('open'); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400); }, function(){ - mi = jQuery(this); + var mi = jQuery(this); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')}); }); } hoverMenu(); // first page load jQuery(window).resize(hoverMenu); // on resize event jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');}); -}); \ No newline at end of file +}); diff --git a/applications/examples/static/js/web2py_bootstrap.js b/applications/examples/static/js/web2py_bootstrap.js index edcb3628..7206cb1b 100644 --- a/applications/examples/static/js/web2py_bootstrap.js +++ b/applications/examples/static/js/web2py_bootstrap.js @@ -20,14 +20,14 @@ jQuery(function(){ function hoverMenu(){ jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){ adjust_height_of_collapsed_nav(); - mi = jQuery(this).addClass('open'); + var mi = jQuery(this).addClass('open'); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400); }, function(){ - mi = jQuery(this); + var mi = jQuery(this); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')}); }); } hoverMenu(); // first page load jQuery(window).resize(hoverMenu); // on resize event jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');}); -}); \ No newline at end of file +}); diff --git a/applications/welcome/static/js/web2py_bootstrap.js b/applications/welcome/static/js/web2py_bootstrap.js index edcb3628..7206cb1b 100644 --- a/applications/welcome/static/js/web2py_bootstrap.js +++ b/applications/welcome/static/js/web2py_bootstrap.js @@ -20,14 +20,14 @@ jQuery(function(){ function hoverMenu(){ jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){ adjust_height_of_collapsed_nav(); - mi = jQuery(this).addClass('open'); + var mi = jQuery(this).addClass('open'); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400); }, function(){ - mi = jQuery(this); + var mi = jQuery(this); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')}); }); } hoverMenu(); // first page load jQuery(window).resize(hoverMenu); // on resize event jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');}); -}); \ No newline at end of file +}); From 53f44086528764ab0e843b9a1d13f6145862396e Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 19 Dec 2013 20:25:48 -0600 Subject: [PATCH 02/19] fixed web2py.css 100% thanks DeanK --- VERSION | 2 +- applications/welcome/static/css/web2py.css | 2 +- gluon/contrib/populate.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index bee3b373..1c2f9528 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.8.2-stable+timestamp.2013.12.17.16.49.17 +Version 2.8.2-stable+timestamp.2013.12.19.20.24.40 diff --git a/applications/welcome/static/css/web2py.css b/applications/welcome/static/css/web2py.css index 30d97035..dfba3fdd 100644 --- a/applications/welcome/static/css/web2py.css +++ b/applications/welcome/static/css/web2py.css @@ -36,7 +36,7 @@ audio {width:200px} .hidden {display:none;visibility:visible} .right {float:right; text-align:right} .left {float:left; text-align:left} -.center {width:100; text-align:center; vertical-align:middle} +.center {width:100%; text-align:center; vertical-align:middle} /** end **/ /* Sticky footer begin */ diff --git a/gluon/contrib/populate.py b/gluon/contrib/populate.py index 122a4d64..2930d119 100644 --- a/gluon/contrib/populate.py +++ b/gluon/contrib/populate.py @@ -266,5 +266,5 @@ def populate_generator(table, default=True, compute=False, contents={}): if __name__ == '__main__': ell = Learner() - ell.loadd(eval(IUP)) + ell.loadd(IUP) print ell.generate(1000, prefix=None) From c4a68e9e5a59ea6542e4087576c285d99dc92858 Mon Sep 17 00:00:00 2001 From: petergovers Date: Fri, 20 Dec 2013 20:33:29 +0100 Subject: [PATCH 03/19] Changed rpxAccount login_form due to end-of-life for Janrain IFRAME/embedded widget --- gluon/contrib/login_methods/rpx_account.py | 47 ++++++++++++---------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/gluon/contrib/login_methods/rpx_account.py b/gluon/contrib/login_methods/rpx_account.py index 0cd1c56a..0116f4a1 100644 --- a/gluon/contrib/login_methods/rpx_account.py +++ b/gluon/contrib/login_methods/rpx_account.py @@ -98,27 +98,32 @@ class RPXAccount(object): def login_form(self): request = self.request args = request.args - if self.embed: - JANRAIN_URL = \ - "https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s" - rpxform = IFRAME( - _src=JANRAIN_URL % ( - self.domain, self.token_url, self.language), - _scrolling="no", - _frameborder="no", - _style="width:400px;height:240px;") - else: - JANRAIN_URL = \ - "https://%s.rpxnow.com/openid/v2/signin?token_url=%s" - rpxform = DIV(SCRIPT(_src="https://rpxnow.com/openid/v2/widget", - _type="text/javascript"), - SCRIPT("RPXNOW.overlay = true;", - "RPXNOW.language_preference = '%s';" % self.language, - "RPXNOW.realm = '%s';" % self.domain, - "RPXNOW.token_url = '%s';" % self.token_url, - "RPXNOW.show();", - _type="text/javascript")) - return rpxform + rpxform = """ + +
""" % dict(token_url=self.token_url, domain=self.domain) + return XML(rpxform) def use_janrain(auth, filename='private/janrain.key', **kwargs): From afe3f306e723f6b0bc90d8831e0aa6efb9a515f3 Mon Sep 17 00:00:00 2001 From: petergovers Date: Fri, 20 Dec 2013 21:27:56 +0100 Subject: [PATCH 04/19] Revert "Changed rpxAccount login_form due to end-of-life for Janrain IFRAME/embedded widget" This reverts commit c4a68e9e5a59ea6542e4087576c285d99dc92858. --- gluon/contrib/login_methods/rpx_account.py | 47 ++++++++++------------ 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/gluon/contrib/login_methods/rpx_account.py b/gluon/contrib/login_methods/rpx_account.py index 0116f4a1..0cd1c56a 100644 --- a/gluon/contrib/login_methods/rpx_account.py +++ b/gluon/contrib/login_methods/rpx_account.py @@ -98,32 +98,27 @@ class RPXAccount(object): def login_form(self): request = self.request args = request.args - rpxform = """ - -
""" % dict(token_url=self.token_url, domain=self.domain) - return XML(rpxform) + if self.embed: + JANRAIN_URL = \ + "https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s" + rpxform = IFRAME( + _src=JANRAIN_URL % ( + self.domain, self.token_url, self.language), + _scrolling="no", + _frameborder="no", + _style="width:400px;height:240px;") + else: + JANRAIN_URL = \ + "https://%s.rpxnow.com/openid/v2/signin?token_url=%s" + rpxform = DIV(SCRIPT(_src="https://rpxnow.com/openid/v2/widget", + _type="text/javascript"), + SCRIPT("RPXNOW.overlay = true;", + "RPXNOW.language_preference = '%s';" % self.language, + "RPXNOW.realm = '%s';" % self.domain, + "RPXNOW.token_url = '%s';" % self.token_url, + "RPXNOW.show();", + _type="text/javascript")) + return rpxform def use_janrain(auth, filename='private/janrain.key', **kwargs): From 24283e7eeb289456b2fc17453b84fe79bce234ac Mon Sep 17 00:00:00 2001 From: petergovers Date: Fri, 20 Dec 2013 21:28:47 +0100 Subject: [PATCH 05/19] Modified RPXAccount to be backward compatible with older Web2py versions --- gluon/contrib/login_methods/rpx_account.py | 47 ++++++++++++---------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/gluon/contrib/login_methods/rpx_account.py b/gluon/contrib/login_methods/rpx_account.py index 0cd1c56a..d8c47eb6 100644 --- a/gluon/contrib/login_methods/rpx_account.py +++ b/gluon/contrib/login_methods/rpx_account.py @@ -98,27 +98,32 @@ class RPXAccount(object): def login_form(self): request = self.request args = request.args - if self.embed: - JANRAIN_URL = \ - "https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s" - rpxform = IFRAME( - _src=JANRAIN_URL % ( - self.domain, self.token_url, self.language), - _scrolling="no", - _frameborder="no", - _style="width:400px;height:240px;") - else: - JANRAIN_URL = \ - "https://%s.rpxnow.com/openid/v2/signin?token_url=%s" - rpxform = DIV(SCRIPT(_src="https://rpxnow.com/openid/v2/widget", - _type="text/javascript"), - SCRIPT("RPXNOW.overlay = true;", - "RPXNOW.language_preference = '%s';" % self.language, - "RPXNOW.realm = '%s';" % self.domain, - "RPXNOW.token_url = '%s';" % self.token_url, - "RPXNOW.show();", - _type="text/javascript")) - return rpxform + rpxform = """ + +
""" % (self.token_url, self.domain, self.domain) + return XML(rpxform) def use_janrain(auth, filename='private/janrain.key', **kwargs): From 257733e0cc9e60e9815f4733e8abcef42b4b4916 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Fri, 20 Dec 2013 15:09:50 -0600 Subject: [PATCH 06/19] fixed a bug in models_to_run, thanks Anthony --- VERSION | 2 +- gluon/compileapp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 1c2f9528..137d2c06 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.8.2-stable+timestamp.2013.12.19.20.24.40 +Version 2.8.2-stable+timestamp.2013.12.20.15.08.47 diff --git a/gluon/compileapp.py b/gluon/compileapp.py index d0f5bc10..cec75ea2 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -528,7 +528,7 @@ def run_models_in(environment): models_to_run = None for model in models: if response.models_to_run != models_to_run: - regex = models_to_run = response.models_to_run + regex = models_to_run = response.models_to_run[:] if isinstance(regex, list): regex = re_compile('|'.join(regex)) if models_to_run: From 88ce19d99f6b1585f2a5e5f5c9f51d2d4bdf2795 Mon Sep 17 00:00:00 2001 From: ilvalle Date: Sat, 21 Dec 2013 15:32:20 +0100 Subject: [PATCH 07/19] Save current working session in online editor --- applications/admin/controllers/default.py | 24 ++++++++++++++--- applications/admin/languages/it.py | 3 ++- applications/admin/settings.cfg | 6 ++--- applications/admin/static/js/ajax_editor.js | 2 +- applications/admin/views/default/edit.html | 26 +++++++++++++++++++ .../admin/views/default/editor_sessions.html | 14 ++++++++++ gluon/tools.py | 2 +- 7 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 applications/admin/views/default/editor_sessions.html diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 2e616459..1cebd27a 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -574,10 +574,10 @@ def edit(): # Load json only if it is ajax edited... app = get_app(request.vars.app) app_path = apath(app, r=request) - editor_defaults={'theme':'web2py', 'editor': 'default', 'closetag': 'true', 'codefolding': 'false', 'tabwidth':'4', 'indentwithtabs':'false', 'linenumbers':'true', 'highlightline':'true'} + preferences={'theme':'web2py', 'editor': 'default', 'closetag': 'true', 'codefolding': 'false', 'tabwidth':'4', 'indentwithtabs':'false', 'linenumbers':'true', 'highlightline':'true'} config = Config(os.path.join(request.folder, 'settings.cfg'), - section='editor', default_values=editor_defaults) - preferences = config.read() + section='editor', default_values={}) + preferences.update(config.read()) if not(request.ajax) and not(is_mobile): # return the scaffolding, the rest will be through ajax requests @@ -589,7 +589,7 @@ def edit(): if request.post_vars: #save new preferences post_vars = request.post_vars.items() # Since unchecked checkbox are not serialized, we must set them as false by hand to store the correct preference in the settings - post_vars+= [(opt, 'false') for opt in editor_defaults if opt not in request.post_vars ] + post_vars+= [(opt, 'false') for opt in preferences if opt not in request.post_vars ] if config.save(post_vars): response.headers["web2py-component-flash"] = T('Preferences saved correctly') else: @@ -814,6 +814,22 @@ def todolist(): return {'todo':output, 'app': app} +def editor_sessions(): + config = Config(os.path.join(request.folder, 'settings.cfg'), + section='editor_sessions', default_values={}) + preferences = config.read() + + if request.vars.session_name and request.vars.files: + session_name = request.vars.session_name + files = request.vars.files + preferences.update({session_name:','.join(files)}) + if config.save(preferences.items()): + response.headers["web2py-component-flash"] = T('Session saved correctly') + else: + response.headers["web2py-component-flash"] = T('Session saved on session only') + + return response.render('default/editor_sessions.html', {'editor_sessions':preferences}) + def resolve(): """ """ diff --git a/applications/admin/languages/it.py b/applications/admin/languages/it.py index c2b1b567..957a6087 100644 --- a/applications/admin/languages/it.py +++ b/applications/admin/languages/it.py @@ -1,4 +1,4 @@ -# coding: utf8 +# -*- coding: utf-8 -*- { '!langcode!': 'it', '!langname!': 'Italiano', @@ -303,6 +303,7 @@ 'to previous version.': 'torna a versione precedente', 'To create a plugin, name a file/folder plugin_[name]': 'Per creare un plugin, chiamare un file o cartella plugin_[nome]', 'toggle breakpoint': 'toggle breakpoint', +'Toggle comment': 'Toggle comment', 'Toggle Fullscreen': 'Toggle Fullscreen', 'Traceback': 'Traceback', 'translation strings for the application': "stringhe di traduzioni per l'applicazione", diff --git a/applications/admin/settings.cfg b/applications/admin/settings.cfg index a278e05f..4127b27c 100644 --- a/applications/admin/settings.cfg +++ b/applications/admin/settings.cfg @@ -1,10 +1,10 @@ [DEFAULT] -theme = web2py -closetag = true -editor = default [editor] theme = web2py editor = default closetag = true +[editor_sessions] +welcome = welcome/models/db.py,welcome/controllers/default.py,welcome/views/default/index.html + diff --git a/applications/admin/static/js/ajax_editor.js b/applications/admin/static/js/ajax_editor.js index 8a7916a4..9e002397 100644 --- a/applications/admin/static/js/ajax_editor.js +++ b/applications/admin/static/js/ajax_editor.js @@ -260,7 +260,7 @@ function load_file(url, lineno) { if(typeof (json['plain_html']) !== undefined) { if($('#' + json['id']).length === 0 || json['force'] === true) { // Create a tab and put the code in it - var tab_header = '
  • ' + json['realfilename'] + '
  • '; + var tab_header = '
  • ' + json['realfilename'] + '
  • '; var tab_body = '
    ' + json['plain_html'] + '
    '; if(json['force'] === false) { $('#myTabContent').append($(tab_body)); // First load the body diff --git a/applications/admin/views/default/edit.html b/applications/admin/views/default/edit.html index 4e0aeac2..650752ca 100644 --- a/applications/admin/views/default/edit.html +++ b/applications/admin/views/default/edit.html @@ -208,6 +208,9 @@ $(document).on('click', 'a.font_button', function (e) {
    + +{{=LOAD('default', 'editor_sessions', ajax=True, _class='btn-group')}} + @@ -314,5 +317,28 @@ $(document).ready(function() { load_file(datum.link); $(this).val(''); }); + /* handlers to manage editor sessions + */ + $(document).on('click', '#save_session', function(e) { + e.preventDefault(); + var session_name=prompt("Session name","{{=app}}"); + + if (session_name!==null) { + files = $("[data-path]").map(function(){return $(this).data("path");}).get(); + data = JSON.stringify({ files: files, session_name:session_name}); + $.ajaxSetup({contentType: "application/json"}); + $.web2py.ajax_page("POST", "{{=URL('default', 'editor_sessions')}}", data, 'manage_sessions'); + } + }); + $(document).on('click', '#saved_sessions a[data-files]', function(e) { + e.preventDefault(); + files = $(this).data('files'); + array_files = files.split(','); + $.each(array_files, function(index, value) { + url = "{{=URL('default','edit')}}/" + value; + load_file(url); + }); + }); + diff --git a/applications/admin/views/default/editor_sessions.html b/applications/admin/views/default/editor_sessions.html new file mode 100644 index 00000000..fa904582 --- /dev/null +++ b/applications/admin/views/default/editor_sessions.html @@ -0,0 +1,14 @@ +
    + Saved session + +
    + diff --git a/gluon/tools.py b/gluon/tools.py index b0d4d3a5..131b7a8e 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -5893,7 +5893,7 @@ class Wiki(object): class Config(object): def __init__( self, - filename, + filename, section, default_values={} ): From 1a959baa728e1d59dc695a39cb99b8bae7c08129 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 23 Dec 2013 21:37:27 -0600 Subject: [PATCH 08/19] fixed problem with static_version in admin, issue 1832 --- VERSION | 2 +- applications/admin/models/0.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 137d2c06..233d8829 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.8.2-stable+timestamp.2013.12.20.15.08.47 +Version 2.8.2-stable+timestamp.2013.12.23.21.36.22 diff --git a/applications/admin/models/0.py b/applications/admin/models/0.py index 669ffd27..8ba7420e 100644 --- a/applications/admin/models/0.py +++ b/applications/admin/models/0.py @@ -45,4 +45,4 @@ if 'adminLanguage' in request.cookies and not (request.cookies['adminLanguage'] T.force(request.cookies['adminLanguage'].value) #set static_version -response.static_version = '2.7.3' +response.static_version = open('VERSION').read().split(' ',1)[1].split('-')[0] From 08639e669161654ac96b0680bc0c57dbdefcbf06 Mon Sep 17 00:00:00 2001 From: niphlod Date: Fri, 27 Dec 2013 21:28:43 +0100 Subject: [PATCH 09/19] removed debug print statements --- applications/admin/views/default/editor_sessions.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/applications/admin/views/default/editor_sessions.html b/applications/admin/views/default/editor_sessions.html index fa904582..b457b7a7 100644 --- a/applications/admin/views/default/editor_sessions.html +++ b/applications/admin/views/default/editor_sessions.html @@ -3,9 +3,6 @@