From 523c8134396d3f605e3bd56d5c0edb1a1a8134c4 Mon Sep 17 00:00:00 2001 From: Massimo Date: Fri, 8 Mar 2013 16:30:11 -0600 Subject: [PATCH] fixed some layout problems --- VERSION | 2 +- applications/admin/controllers/default.py | 12 +- applications/admin/models/menu.py | 2 +- .../admin/static/css/bootstrap_essentials.css | 21 +- applications/admin/views/default/design.html | 87 +++--- applications/admin/views/default/edit.html | 2 +- applications/admin/views/default/plugin.html | 6 +- applications/admin/views/default/site.html | 290 +++++++++--------- applications/admin/views/default/ticket.html | 2 +- applications/admin/views/layout.html | 1 + .../admin/views/mercurial/commit.html | 1 - applications/examples/controllers/default.py | 3 +- .../examples/views/default/index.html | 2 +- gluon/admin.py | 12 +- gluon/fileutils.py | 4 +- gluon/main.py | 14 +- 16 files changed, 248 insertions(+), 213 deletions(-) diff --git a/VERSION b/VERSION index a1cbb5d2..b43e6a87 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.2-stable+timestamp.2013.03.08.12.05.24 +Version 2.4.2-stable+timestamp.2013.03.08.16.29.39 diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 618b9ff6..50d96371 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -148,9 +148,7 @@ def check_version(): elif platform.system().lower() in ('windows', 'win32', 'win64') and os.path.exists("web2py.exe"): return SPAN('You should upgrade to version %s.%s.%s' % version_number[:3]) else: - return sp_button(URL('upgrade_web2py'), T('upgrade now')) \ - + XML(' %s.%s.%s' - % version_number[:3]) + return sp_button(URL('upgrade_web2py'), T('upgrade now to %s') % version_number.split('-')[0]) def logout(): @@ -205,14 +203,12 @@ def site(): is_appname = IS_VALID_APPNAME() form_create = SQLFORM.factory(Field('name', requires=is_appname), - table_name='appcreate', - _class='well well-small') + table_name='appcreate') form_update = SQLFORM.factory(Field('name', requires=is_appname), Field('file', 'upload', uploadfield=False), Field('url'), Field('overwrite', 'boolean'), - table_name='appupdate', - _class='well well-small') + table_name='appupdate') form_create.process() form_update.process() @@ -1430,7 +1426,7 @@ def errors(): hash2error[hash]['count'] += 1 except KeyError: error_lines = error['traceback'].split("\n") - last_line = error_lines[-2] + last_line = error_lines[-2] if len(error_lines)>1 else 'unknown' error_causer = os.path.split(error['layer'])[1] hash2error[hash] = dict(count=1, pickel=error, causer=error_causer, diff --git a/applications/admin/models/menu.py b/applications/admin/models/menu.py index eb4b9030..b04f191e 100644 --- a/applications/admin/models/menu.py +++ b/applications/admin/models/menu.py @@ -23,7 +23,7 @@ if request.vars.app or request.args: if os.path.exists('applications/examples'): response.menu.append( - (T('Help'), False, URL('examples', 'default', 'index'))) + (T('Help'), False, URL('examples', 'default', 'examples'))) else: response.menu.append((T('Help'), False, 'http://web2py.com/examples')) diff --git a/applications/admin/static/css/bootstrap_essentials.css b/applications/admin/static/css/bootstrap_essentials.css index e4cc91f1..d8c6d232 100644 --- a/applications/admin/static/css/bootstrap_essentials.css +++ b/applications/admin/static/css/bootstrap_essentials.css @@ -99,7 +99,7 @@ margin-bottom:7px; { clear:right; margin-top:2em; -border-top:1px dotted; +border-top:1px solid #d1d1d1; padding:0 1em; } .pwdchange>.button{margin-bottom:10px;} @@ -188,14 +188,15 @@ vertical-align:middle; .celled { display:inline-block; -padding: 4px 0 0 0; +padding: 0 0 0 4px; vertical-align:top; margin-top:4px; width:700px; } .folder { -border-left: 1px dotted #AAA; +list-style-type:none; +#border-left: 1px dotted #AAA; } .folder li { @@ -819,4 +820,18 @@ background-color:#FC0; { width:165px; } +} + +h4.editableapp, +h4.currentapp { + padding: 5px 0 5px 54px; + display: inline; +} + +h4.editableapp { + background: #fff url(../images/folder.png) no-repeat; +} + +h4.currentapp { + background: #fff url(../images/folder_locked.png) no-repeat; } \ No newline at end of file diff --git a/applications/admin/views/default/design.html b/applications/admin/views/default/design.html index c983fb31..c0cf0f8f 100644 --- a/applications/admin/views/default/design.html +++ b/applications/admin/views/default/design.html @@ -7,7 +7,7 @@ def peekfile(path,file,vars={},title=None): return A(file.replace('\\\\','/'),_title=title,_href=URL('peek', args=args, vars=vars)) def editfile(path,file,vars={}): args=(path,file) if 'app' in vars else (app,path,file) - return A(SPAN(T('Edit')),_class='button editbutton btn',_href=URL('edit', args=args, vars=vars)) + return A(SPAN(T('Edit')),_class='button editbutton btn btn-mini',_href=URL('edit', args=args, vars=vars)) def testfile(path,file): return A(TAG[''](IMG(_src=URL('static', 'images/test_icon.png'), _alt=T('test')), SPAN(T("Run tests in this file (to run all files, you may also use the button labelled 'test')"))), @@ -17,9 +17,9 @@ def testfile(path,file): **{'_data-placement':'right', '_data-original-title':T("Run tests in this file (to run all files, you may also use the button labelled 'test')")}) def editlanguagefile(path,file,vars={}): - return A(SPAN(T('Edit')),_class='button editbutton btn',_href=URL('edit_language', args=(app, path, file), vars=vars)) + return A(SPAN(T('Edit')),_class='button editbutton btn btn-mini',_href=URL('edit_language', args=(app, path, file), vars=vars)) def editpluralsfile(path,file,vars={}): - return A(SPAN(T('Edit')),_class='button editbutton btn',_href=URL('edit_plurals', args=(app, path, file), vars=vars)) + return A(SPAN(T('Edit')),_class='button editbutton btn btn-mini',_href=URL('edit_plurals', args=(app, path, file), vars=vars)) def file_upload_form(location, anchor=None): form=FORM( LABEL(T("upload file:")), @@ -92,7 +92,7 @@ def deletefile(arglist, vars={}):

{{=T("Models")}} - + {{=helpicon()}} {{=T("The data representation, define database tables and sets")}}  top @@ -125,9 +125,10 @@ def deletefile(arglist, vars={}): {{pass}}
-
-
{{=file_create_form('%s/models/' % app, 'models')}}
-
+ +
@@ -140,7 +141,7 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi

{{=T("Controllers")}} - + {{=helpicon()}} {{=T("The application logic, each URL path is mapped in one exposed function in the controller")}}  top @@ -172,16 +173,17 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi {{pass}}
-
-
{{=file_create_form('%s/controllers/' % app, 'controllers')}}
-
+ +

{{=T("Views")}} - + {{=helpicon()}} {{=T("The presentations layer, views are also known as templates")}}  top @@ -211,16 +213,17 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi {{pass}}
-
-
{{=file_create_form('%s/views/' % app, 'views')}}
-
+ +

{{=T("Languages")}} - + {{=helpicon()}} {{=T("Translation strings for the application")}}  top @@ -274,16 +277,17 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi {{pass}}
-
-
{{=file_create_form('%s/languages/' % app, 'languages', T('(something like "it-it")'))}}
-
+ +

{{=T("Static")}} - + {{=helpicon()}} {{=T("These files are served without processing, your images go here")}}  top @@ -328,17 +332,18 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi {{pass}}
-
-
{{=file_create_form('%s/static/' % app, 'static')}}{{=T('or alternatively')}}
-
{{=file_upload_form('%s/static/' % app, 'static')}}
-
+ +

{{=T("Modules")}} - + {{=helpicon()}} {{=T("Additional code for your application")}}  top @@ -363,17 +368,18 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi {{pass}}
-
-
{{=file_create_form('%s/modules/' % app, 'modules')}}{{=T('or alternatively')}}
-
{{=file_upload_form('%s/modules/' % app, 'modules')}}
-
+ +

{{=T("Private files")}} - + {{=helpicon()}} {{=T("These files are not served, they are only available from within your app")}}  top @@ -419,17 +425,18 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi {{pass}}
-
-
{{=file_create_form('%s/private/' % app, 'private')}}{{=T('or alternatively')}}
-
{{=file_upload_form('%s/private/' % app, 'private')}}
-
+ +

{{=T("Plugins")}} - + {{=helpicon()}} {{=T("To create a plugin, name a file/folder plugin_[name]")}}  top @@ -451,10 +458,12 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi

{{=T('There are no plugins')}}

{{pass}}
-
-
{{=upload_plugin_form(app, 'plugins')}}
-
-
+ + - {{session.check_version=False}} - {{else:}} - {{=button("javascript:ajax('"+URL('check_version')+"',[],'check_version')", T('Check for upgrades'))}} - {{=button(URL('default','reload_routes'), T('Reload routes'))}} -

- {{pass}} -

{{=T("Running on %s", request.env.server_software)}}

- {{if session.is_mobile=='auto':}} -

{{=A(T('Try the mobile interface'),_href=URL('plugin_jqmobile','about'))}}

- {{pass}} - - {{pass}} - {{if MULTI_USER_MODE and is_manager():}} - -
-

{{=T("Multi User Mode")}}

-

- {{=button(URL('bulk_register'),T('Bulk Register'))}} - {{=button(URL('manage_students',vars={'order':'auth_user.id'}),T('Manage Students'))}} -

-
- {{pass}} - -
-

{{=T("New application wizard")}}

-

{{=button(URL('wizard','index'), T('Start wizard'))}} - {{=T("(requires internet access)")}}

-
- -
-

{{=T("New simple application")}}

- {{=form_create.custom.begin}} - {{=LABEL(T("Application name:"))}} - {{=form_create.custom.widget.name}} -
- {{=form_create.custom.end}} -
- -
-

{{=T("Upload and install packed application")}}

- {{=form_update.custom.begin}} - - {{=form_update.custom.widget.name}} - - {{=form_update.custom.widget.file}} - - {{=form_update.custom.widget.url}}({{=T('can be a git repo')}}) -
- - -
- {{=form_update.custom.end}} -
- -
-

{{=T("Deploy")}}

-

- {{=button(URL('gae','deploy'), T('Deploy on Google App Engine'))}} - {{=button(URL('openshift','deploy'),T('Deploy to OpenShift'))}} -

-
-
- {{if TWITTER_HASH:}} - -
-

{{=T("%s Recent Tweets"%TWITTER_HASH)}}

-
{{=T('loading...')}}
- -
- {{pass}} - - +
+
+

{{=T("Installed applications")}}

+ + {{for a in apps:}} + {{buttons = []}} + + + + {{pass}} +
+ {{if a==request.application:}} +

{{=a}} ({{=T('currently running')}})

+ {{else:}} +

{{=A(a,_href=URL(a,'default','index'))}}

+ {{if MULTI_USER_MODE and db.app(name=a):}}(created by {{="%(first_name)s %(last_name)s" % db.auth_user[db.app(name=a).owner]}}){{pass}} + {{if not os.path.exists('applications/%s/compiled' % a):}} + {{buttons.append((URL('design',args=a), T("Edit")))}} + {{else:}} + {{buttons.append((URL(a,'appadmin','index'), T("appadmin")))}} + {{pass}} + {{buttons.append((URL('about',args=a), T("About")))}} + {{pass}} + {{buttons.append((URL('errors',args=a), T("Errors")))}} + {{buttons.append((URL('cleanup',args=a), T("Clean")))}} + {{buttons.append((URL('pack',args=a), T("Pack all")))}} + {{if not os.path.exists('applications/%s/compiled' % a):}} + {{buttons.append((URL('compile_app',args=a), T("Compile")))}} + {{else:}} + {{buttons.append((URL('pack',args=(a, 'compiled')), T("Pack compiled")))}} + {{if glob.glob('applications/%s/controllers/*.py' % a):}} + {{buttons.append((URL('remove_compiled_app',args=a), T("Remove compiled")))}} + {{pass}} + {{pass}} + {{if os.path.exists(os.path.join(apath(r=request),a,'.git')): }} + {{buttons.append((URL('git_pull',args=a), T("Git Pull")))}} + {{buttons.append((URL('git_push',args=a), T("Git Push")))}} + {{pass}} + {{if a!=request.application:}} + {{buttons.append((URL('uninstall',args=a), T("Uninstall")))}} + {{pass}} +
+
+ + {{=T('Manage')}} + + + +
+ {{=button_enable(URL('enable',args=a), a)}} +
+
+
+ + diff --git a/applications/admin/views/default/ticket.html b/applications/admin/views/default/ticket.html index 40a84969..cb0588e4 100644 --- a/applications/admin/views/default/ticket.html +++ b/applications/admin/views/default/ticket.html @@ -10,7 +10,7 @@ web2py™ - {{=myversion}} + Version {{=myversion}} {{if snapshot:}} diff --git a/applications/admin/views/layout.html b/applications/admin/views/layout.html index f9c2e84c..c8f96a55 100644 --- a/applications/admin/views/layout.html +++ b/applications/admin/views/layout.html @@ -8,6 +8,7 @@ {{=response.title or URL()}} {{ response.files.append(URL('static','css/bootstrap.min.css')) + #response.files.append(URL('static','css/styles.css')) response.files.append(URL('static','css/bootstrap_essentials.css')) # response.files.append(URL('static','css/bootstrap_adapters.css')) response.files.append(URL('static','css/bootstrap-responsive.min.css')) diff --git a/applications/admin/views/mercurial/commit.html b/applications/admin/views/mercurial/commit.html index fc96aef5..e1a989e0 100644 --- a/applications/admin/views/mercurial/commit.html +++ b/applications/admin/views/mercurial/commit.html @@ -7,7 +7,6 @@ for application "{{=request.args[0]}}"

Commit form

{{=form}} - {{if repo['.'].rev()>=0:}}

Last Revision

diff --git a/applications/examples/controllers/default.py b/applications/examples/controllers/default.py index 7063a6fd..1e0ba274 100644 --- a/applications/examples/controllers/default.py +++ b/applications/examples/controllers/default.py @@ -76,8 +76,7 @@ def license(): def version(): - return 'Version %s.%s.%s (%s) %s' % request.env.web2py_version - + return 'Version '+request.env.web2py_version @cache('examples', time_expire=cache_expire) def examples(): diff --git a/applications/examples/views/default/index.html b/applications/examples/views/default/index.html index 2f2584e8..9be2e21a 100644 --- a/applications/examples/views/default/index.html +++ b/applications/examples/views/default/index.html @@ -37,7 +37,7 @@ random.shuffle(quotes)

WEB2PYTM WEB FRAMEWORK

Free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python. LGPLv3 License. -Current version: {{="%s.%s.%s (%s) %s" % request.env.web2py_version}}

+Current version: {{=request.env.web2py_version}}

{{block extra}}
diff --git a/gluon/admin.py b/gluon/admin.py index c82e890c..ba035e1f 100644 --- a/gluon/admin.py +++ b/gluon/admin.py @@ -373,12 +373,16 @@ def check_new_version(myversion, version_URL): the most up-to-version available """ try: - from urllib import urlopen - version = parse_version(urlopen(version_URL).read()) - except Exception: + from urllib import urlopen + version = urlopen(version_URL).read() + pversion = parse_version(version) + pmyversion = parse_version(myversion) + except Exception,e: + import traceback + print traceback.format_exc() return -1, myversion - if version > myversion: + if pversion[:3]+pversion[-6:] > pmyversion[:3]+pmyversion[-6:]: return True, version else: return False, version diff --git a/gluon/fileutils.py b/gluon/fileutils.py index c67a6e11..b6e6c5d1 100644 --- a/gluon/fileutils.py +++ b/gluon/fileutils.py @@ -47,8 +47,8 @@ __all__ = [ def parse_semantic(version="Version 1.99.0-rc.1+timestamp.2011.09.19.08.23.26"): "http://semver.org/" - re_version = re.compile('Version (\d+)\.(\d+)\.(\d+)(\-(?P
[^\s+]*))?(\+(?P\S*))')
-    m = re_version.match(version)
+    re_version = re.compile('(\d+)\.(\d+)\.(\d+)(\-(?P
[^\s+]*))?(\+(?P\S*))')
+    m = re_version.match(version.strip().split()[-1])
     if not m:
         return None
     a, b, c = int(m.group(1)), int(m.group(2)), int(m.group(3))
diff --git a/gluon/main.py b/gluon/main.py
index 5a9814ef..47b38eaa 100644
--- a/gluon/main.py
+++ b/gluon/main.py
@@ -102,16 +102,14 @@ requests = 0    # gc timer
 # pattern used to validate client address
 regex_client = re.compile('[\w\-:]+(\.[\w\-]+)*\.?')  # ## to account for IPV6
 
-#try:
-if 1:
+try:
     version_info = open(pjoin(global_settings.gluon_parent, 'VERSION'), 'r')
-    raw_version_string = version_info.read().strip()
+    raw_version_string = version_info.read().split()[-1].strip()
     version_info.close()
-    global_settings.web2py_version = parse_version(raw_version_string)
-#except:
-#    raise RuntimeError("Cannot determine web2py version")
-
-web2py_version = global_settings.web2py_version
+    global_settings.web2py_version = raw_version_string
+    web2py_version = global_settings.web2py_version
+except:
+    raise RuntimeError("Cannot determine web2py version")
 
 try:
     import rocket