diff --git a/VERSION b/VERSION index c3cbd4cc..37b52e94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.3 (2011-12-09 20:46:02) stable +Version 1.99.3 (2011-12-09 20:55:52) stable diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 2033d154..5e912165 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -1,9 +1,9 @@ # coding: utf8 -EXPERIMENTAL_STUFF = False +EXPERIMENTAL_STUFF = True if EXPERIMENTAL_STUFF: - is_mobile=request.user_agent().is_mobile + is_mobile = True #request.user_agent().is_mobile if is_mobile: response.view = response.view.replace( 'default/','default.mobile/') diff --git a/applications/admin/models/buttons.py b/applications/admin/models/buttons.py index 33a8811a..d33f2bff 100644 --- a/applications/admin/models/buttons.py +++ b/applications/admin/models/buttons.py @@ -2,8 +2,17 @@ import os +def A_button(*a,**b): + b['_data-role'] = 'button' + b['_data-inline'] = 'true' + return A(*a,**b) + def button(href, label): - return A(SPAN(label),_class='button',_href=href) + if request.user_agent().is_mobile: + ret = A_button(SPAN(label), _href=href) + else: + ret = A(SPAN(label),_class='button',_href=href) + return ret def button_enable(href, app): if os.path.exists(os.path.join(apath(app,r=request),'DISABLED')): @@ -14,7 +23,11 @@ def button_enable(href, app): return A(label,_class='button',_id=id,callback=href,target=id) def sp_button(href, label): - return A(SPAN(label),_class='button special',_href=href) + if request.user_agent().is_mobile: + ret = A_button(SPAN(label), _href=href) + else: + ret = A(SPAN(label),_class='button special',_href=href) + return ret def helpicon(): return IMG(_src=URL('static', 'images/help.png'), _alt='help') diff --git a/applications/admin/views/default.mobile/about.html b/applications/admin/views/default.mobile/about.html index 46499408..6772b80c 100644 --- a/applications/admin/views/default.mobile/about.html +++ b/applications/admin/views/default.mobile/about.html @@ -4,10 +4,10 @@

{{=T("About application")}} "{{=app}}"

{{=T("About")}} {{=app}}

-

{{=button(URL('edit/%s/ABOUT' % (app)), T('Edit'))}}

-
{{=about}}
+

{{=button(URL('edit/%s/ABOUT' % (app)), T('Edit'))}}

+
{{=about}}

{{=T('License for')}} {{=app}}

-

{{=button(URL('edit/%s/LICENSE' % (app)), T('Edit'))}}

-
{{=license}}
+

{{=button(URL('edit/%s/LICENSE' % (app)), T('Edit'))}}

+
{{=license}}
diff --git a/applications/admin/views/default.mobile/change_password.html b/applications/admin/views/default.mobile/change_password.html index 4d43a5b4..fa60e871 100644 --- a/applications/admin/views/default.mobile/change_password.html +++ b/applications/admin/views/default.mobile/change_password.html @@ -1,10 +1,10 @@ -{{extend 'layout.html'}} +{{extend 'default.mobile/layout.html'}} {{block sectionclass}}change_password{{end}}

Change Admin Password

-
+
{{=form}}
diff --git a/applications/admin/views/default.mobile/delete.html b/applications/admin/views/default.mobile/delete.html index 2e53ab7e..2249e1ca 100644 --- a/applications/admin/views/default.mobile/delete.html +++ b/applications/admin/views/default.mobile/delete.html @@ -1,8 +1,8 @@ -{{extend 'layout.html'}} +{{extend 'default.mobile/layout.html'}} {{block sectionclass}}delete{{end}} -
+

{{=T('Are you sure you want to delete file "%s"?', filename)}}

{{=FORM(INPUT(_type='submit',_name='nodelete',_value=T('Abort')),INPUT(_type='hidden',_name='sender',_value=sender), _class="inline")}}{{=FORM(INPUT(_type='submit',_name='delete',_value=T('Delete')),INPUT(_type='hidden',_name='sender',_value=sender), _class="inline")}}

diff --git a/applications/admin/views/default.mobile/delete_plugin.html b/applications/admin/views/default.mobile/delete_plugin.html index 1e96be2a..610cb127 100644 --- a/applications/admin/views/default.mobile/delete_plugin.html +++ b/applications/admin/views/default.mobile/delete_plugin.html @@ -1,8 +1,8 @@ -{{extend 'layout.html'}} +{{extend 'default.mobile/layout.html'}} {{block sectionclass}}delete_plugin{{end}} -
+

{{=T('Are you sure you want to delete plugin "%s"?', plugin)}}

{{=FORM(INPUT(_type='submit',_name='nodelete',_value=T('NO')))}}

{{=FORM(INPUT(_type='submit',_name='delete',_value=T('YES')))}}

diff --git a/applications/admin/views/default.mobile/design.html b/applications/admin/views/default.mobile/design.html index dcd59f72..f33b588c 100644 --- a/applications/admin/views/default.mobile/design.html +++ b/applications/admin/views/default.mobile/design.html @@ -1,40 +1,88 @@ {{extend 'default.mobile/layout.html'}} +{{ +def A_info(*a,**b): + b['_data-role'] = 'button' + b['_data-icon'] = 'info' + b['_data-theme'] = 'b' + return A(*a,**b) + +def A_gear(*a,**b): + b['_data-role'] = 'button' + b['_data-icon'] = 'gear' + return A(*a,**b) + +def A_delete(*a,**b): + b['_data-role'] = 'button' + b['_data-icon'] = 'delete' + return A(*a,**b) + +def A_check(*a,**b): + b['_data-role'] = 'button' + b['_data-icon'] = 'check' + return A(*a,**b) + +def all(items): + return reduce(lambda a,b:a and b,items,True) +def peekfile(path,file): + return A_info(file.replace('\\\\','/'),_href=URL('peek', args=(app, path, file))) +def editfile(path,file): + return A_gear(SPAN(T('Edit')),_href=URL('edit', args=(app, path, file))) +def testfile(path,file): + return A_check(SPAN(T('Run tests')), _href=URL('test', args=(app, file))) +def editlanguagefile(path,file): + return A_gear(SPAN(T('Edit')),_href=URL('edit_language', args=(app, path, file))) +def file_upload_form(location): + form=FORM(T("upload file:")," ", + INPUT(_type="file",_name="file")," ",T("and rename it:")," ", + INPUT(_type="text",_name="filename",requires=IS_NOT_EMPTY), + INPUT(_type="hidden",_name="location",_value=location), + INPUT(_type="hidden",_name="sender",_value=URL('design',args=app)), + INPUT(_type="submit",_value=T("upload")),_action=URL('upload_file')) + return form +def file_create_form(location): + form=FORM(T("create file with filename:")," ", + INPUT(_type="text",_name="filename",requires=IS_NOT_EMPTY), + INPUT(_type="hidden",_name="location",_value=location), + INPUT(_type="hidden",_name="sender",_value=URL('design',args=app)), + INPUT(_type="submit",_value=T("Create")),_action=URL('create_file')) + return form +def upload_plugin_form(app): + form=FORM(T("upload plugin file:")," ", + INPUT(_type="file",_name="pluginfile"), + INPUT(_type="submit",_value=T("upload"))) + return form +def deletefile(arglist): + return A_delete(SPAN(T('Delete')), _href=URL('delete',args=arglist,vars=dict(sender=request.function+'/'+app))) +}} {{block sectionclass}}design {{=app}}{{end}} - +
+ +

{{=T("Models")}} - {{=helpicon()}} {{=T("The data representation, define database tables and sets")}}

-
+
{{if not models:}}

{{=T("There are no models")}}

{{else:}} -
+
{{=button(URL(a=app,c='appadmin',f='index'), T('database administration'))}} {{if os.access(os.path.join(request.folder,'..',app,'databases','sql.log'),os.R_OK):}} {{=button(URL('peek/%s/databases/sql.log'%app), 'sql.log')}} {{pass}}
{{pass}} - -
    {{for m in models:}} -
  • - + + {{=peekfile('models',m)}} {{=editfile('models',m)}} {{=deletefile([app, 'models', m])}} - - {{=peekfile('models',m)}} - - - {{if len(defines[m]):}}{{=T("defines tables")}} {{pass}}{{=XML(', '.join([B(table).xml() for table in defines[m]]))}} - -
  • +
    {{pass}} -
-
{{=file_create_form('%s/models/' % app)}}
+
{{=file_create_form('%s/models/' % app)}}
+
@@ -44,218 +92,165 @@ 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")}}

-
+
{{if not controllers:}}

{{=T("There are no controllers")}}

{{else:}} -
+
{{=button(URL(r=request,c='shell',f='index',args=app), T("shell"))}} {{=button(URL('test',args=app), T("test"))}} {{=button(URL('edit',args=[app,'cron','crontab']), T("crontab"))}}
{{pass}} -
    {{for c in controllers:}} -
  • - + + {{=peekfile('controllers',c)}} {{=editfile('controllers',c)}} {{=deletefile([app, 'controllers', c])}} {{=testfile('controllers',c)}} +
    - - {{=peekfile('controllers',c)}} - - - {{if functions[c]:}}{{=T("exposes")}} {{pass}}{{=XML(', '.join([A(f,_href=URL(a=app,c=c[:-3],f=f)).xml() for f in functions[c]]))}} - -
  • {{pass}} -
-
{{=file_create_form('%s/controllers/' % app)}}
+
{{=file_create_form('%s/controllers/' % app)}}
+
- -

+
+

{{=T("Views")}} - {{=helpicon()}} {{=T("The presentations layer, views are also known as templates")}}

-
-
+
+
{{=button(LAYOUTS_APP, T("download layouts"))}}
{{if not views:}}

{{=T("There are no views")}}

{{pass}} -
    {{for c in views:}} -
  • - + + {{=peekfile('views',c)}} {{=editfile('views',c)}} {{=deletefile([app, 'views', c])}} +
    - - {{=peekfile('views',c)}} - - - {{if extend.has_key(c):}}{{=T("extends")}} {{=extend[c]}} {{pass}} - {{if include[c]:}}{{=T("includes")}} {{pass}}{{=XML(', '.join([B(f).xml() for f in include[c]]))}} - -
  • {{pass}} -
-
{{=file_create_form('%s/views/' % app)}}
+
{{=file_create_form('%s/views/' % app)}}
+
- -

+
+

{{=T("Languages")}} - {{=helpicon()}} {{=T("Translation strings for the application")}}

-
-
+
+
{{=button(URL('update_languages/'+app), T('update all languages'))}}
- {{if not languages:}}

{{=T("There are no translators, only default language is supported")}}

{{pass}} -
    + {{if not languages:}}

    {{=T("There are no translators")}}

    {{pass}} {{for file in languages:}} -
  • - + + {{=peekfile('languages',file)}} {{=editlanguagefile('languages',file)}} {{=deletefile([app, 'languages', file])}} +
    - - {{=peekfile('languages',file)}} - -
  • {{pass}} -
-
{{=file_create_form('%s/languages/' % app)}}{{=T('(something like "it-it")')}}
+
{{=file_create_form('%s/languages/' % app)}}
+
- -

+
+

{{=T("Static files")}} - {{=helpicon()}} {{=T("These files are served without processing, your images go here")}} -

-
-
-
+

+
{{if not statics:}}

{{=T("There are no static files")}}

{{pass}} -
    +
      {{ - path=[] + from collections import OrderedDict + tree=OrderedDict() for file in statics+['']: - items=file.split('/') - file_path=items[:-1] - filename=items[-1] - while path!=file_path: - if len(file_path)>=len(path) and all([v==file_path[k] for k,v in enumerate(path)]): - path.append(file_path[len(path)]) - thispath='static__'+'__'.join(path) - }} -
    • - {{=path[-1]}}/ -
    • - {{ - pass - pass - if filename: - }}
    • - - {{=editfile('static',file)}} {{=deletefile([app,'static',file])}} - - - {{=filename}} - -
    • {{ - pass + items=file.partition('/') + if not items[0] in tree: + tree[items[0]] = [] + pass + tree[items[0]].append(items[2]) pass }} + {{for k, v in tree.iteritems():}} + {{if k:}} +
    • {{=k}} +
        +
        + {{if len(v) == 1 and v[0] =='':}} + + {{=peekfile('static', k)}} + {{=editfile('static', k)}} + {{=deletefile([app, 'static', k])}} +
        +
        +
      + {{continue}} + {{for f in v:}} + + {{=peekfile('static/'+k, f)}} + {{=editfile('static/'+k, f)}} + {{=deletefile([app, 'static/'+k, f])}} +
      +
      + {{pass}} +
    + {{pass}} -
-
{{=file_create_form('%s/static/' % app)}} + {{pass}} + +
{{=file_create_form('%s/static/' % app)}} {{=file_upload_form('%s/static/' % app)}}
+
- -

- {{=T("Modules")}} - {{=helpicon()}} {{=T("Additional code for your application")}} -

-
-
-
+
+

+ {{=T("Modules")}}

+
{{if not modules:}}

{{=T("There are no modules")}}

{{pass}} -
    {{for m in modules:}} -
  • - + + {{=peekfile('modules',m)}} {{=editfile('modules',m)}} {{if m!='__init__.py':}}{{=deletefile([app, 'modules', m])}}{{pass}} - - {{=peekfile('modules',m)}} - -
  • {{pass}} -
-
{{=file_create_form('%s/modules/' % app)}} +
{{=file_create_form('%s/modules/' % app)}} {{=file_upload_form('%s/modules/' % app)}}
+
- -

+
+

{{=T("Plugins")}} - {{=helpicon()}} {{=T("To create a plugin, name a file/folder plugin_[name]")}}

-
-
+
+
{{=button(PLUGINS_APP, T('download plugins'))}}
-
-
{{if plugins:}} -
    +
    {{for plugin in plugins:}} -
  • - {{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin', args=[app, plugin]))}} -
  • + {{=button(URL('plugin', args=[app, plugin]), 'plugin_%s' % plugin)}} {{pass}} -
+
{{else:}}

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

{{pass}} -
{{=upload_plugin_form(app)}}
+
{{=upload_plugin_form(app)}}
+
- - +
diff --git a/applications/admin/views/default.mobile/downgrade_web2py.html b/applications/admin/views/default.mobile/downgrade_web2py.html index 0078e60c..a47f6878 100644 --- a/applications/admin/views/default.mobile/downgrade_web2py.html +++ b/applications/admin/views/default.mobile/downgrade_web2py.html @@ -1,13 +1,13 @@ -{{extend 'layout.html'}} +{{extend 'default.mobile/layout.html'}} {{block sectionclass}}upgrade{{end}}

{{=T('web2py downgrade')}}

-

{{=T('ATTENTION:')}} {{=T('This is an experimental feature and it needs more testing. If you decide to downgrade you do it at your own risk')}}
+

{{=T('ATTENTION:')}} {{=T('This is an experimental feature and it needs more testing. If you decide to downgrade you do it at your own risk')}}
{{=T('If start the downgrade, be patient, it may take a while to rollback')}}

-
+
{{=FORM(INPUT(_type='submit',_name='nodowngrade',_value=T('Cancel')), _class='inline')}} {{=FORM(INPUT(_type='submit',_name='downgrade',_value=T('Downgrade')), _class='inline')}}
diff --git a/applications/admin/views/default.mobile/edit.html b/applications/admin/views/default.mobile/edit.html index 646c9f82..c31bb0f9 100644 --- a/applications/admin/views/default.mobile/edit.html +++ b/applications/admin/views/default.mobile/edit.html @@ -22,7 +22,7 @@ jQuery(document).ready(function(){ {{block sectionclass}}edit {{filename}}{{end}} {{if functions:}} -

+

{{=B(T('exposes:'))}}{{=XML(', '.join([A(f,_href=URL(a=app,c=controller,f=f)).xml() for f in functions]))}} @@ -35,7 +35,7 @@ jQuery(document).ready(function(){

- + {{=IMG(_src=URL('static', 'images/save_icon.png'), _alt=T('Save'))}} {{=T('Saved file hash:')}} @@ -46,8 +46,8 @@ jQuery(document).ready(function(){ {{else:}} {{pass}} - - + +
diff --git a/applications/admin/views/default.mobile/edit_language.html b/applications/admin/views/default.mobile/edit_language.html index 7d38c45a..4780e142 100644 --- a/applications/admin/views/default.mobile/edit_language.html +++ b/applications/admin/views/default.mobile/edit_language.html @@ -1,4 +1,4 @@ -{{extend 'layout.html'}} +{{extend 'default.mobile/layout.html'}}