using FORM.dialog

This commit is contained in:
mdipierro
2012-07-28 00:56:06 -05:00
parent 4350ddaec0
commit 7650e6de95
7 changed files with 26 additions and 41 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-07-27 17:25:26) dev
Version 2.00.0 (2012-07-28 00:56:00) dev
+17 -13
View File
@@ -317,20 +317,24 @@ def pack_plugin():
redirect(URL('plugin',args=request.args))
def upgrade_web2py():
if 'upgrade' in request.vars:
dialog = FORM.dialog(T('Upgrade'),
{T('Cancel'):URL('site')})
if dialog.accepted:
(success, error) = upgrade(request)
if success:
session.flash = T('web2py upgraded; please restart it')
else:
session.flash = T('unable to upgrade because "%s"', error)
redirect(URL('site'))
elif 'noupgrade' in request.vars:
redirect(URL('site'))
return dict()
return dict(dialog=dialog)
def uninstall():
app = get_app()
if 'delete' in request.vars:
dialog = FORM.dialog(T('Uninstall'),
{T('Cancel'):URL('site')})
if dialog.accepted:
if MULTI_USER_MODE:
if is_manager() and db(db.app.name==app).delete():
pass
@@ -344,9 +348,7 @@ def uninstall():
else:
session.flash = T('unable to uninstall "%s"', app)
redirect(URL('site'))
elif 'nodelete' in request.vars:
redirect(URL('site'))
return dict(app=app)
return dict(app=app, dialog=dialog)
def cleanup():
@@ -978,9 +980,12 @@ def delete_plugin():
app=request.args(0)
plugin = request.args(1)
plugin_name='plugin_'+plugin
if 'nodelete' in request.vars:
redirect(URL('design', args=app, anchor=request.vars.id))
elif 'delete' in request.vars:
dialog = FORM.dialog(
T('Delete'),
{T('Cancel'):URL('design', args=app)})
if dialog.accepted:
try:
for folder in ['models','views','controllers','static','modules', 'private']:
path=os.path.join(apath(app,r=request),folder)
@@ -997,7 +1002,7 @@ def delete_plugin():
session.flash = T('unable to delete file plugin "%(plugin)s"',
dict(plugin=plugin))
redirect(URL('design', args=request.args(0), anchor=request.vars.id2))
return dict(plugin=plugin)
return dict(dialog=dialog,plugin=plugin)
def plugin():
""" Application design handler """
@@ -1586,7 +1591,6 @@ def reload_routes():
gluon.rewrite.load()
redirect(URL('site'))
def manage_students():
if not (MULTI_USER_MODE and is_manager()):
session.flash = T('Not Authorized')
+2 -2
View File
@@ -2,8 +2,8 @@
{{block sectionclass}}delete{{end}}
<div class="center">
<h2>{{=T('Are you sure you want to delete file "%s"?', filename)}}</h2>
<p>{{=dialog}}</p>
<div class="center">
{{=dialog}}
</div>
@@ -2,9 +2,8 @@
{{block sectionclass}}delete_plugin{{end}}
<div class="center">
<h2>{{=T('Are you sure you want to delete plugin "%s"?', plugin)}}</h2>
<p>{{=FORM(INPUT(_type='submit',_name='nodelete',_value=T('NO')))}}</p>
<p>{{=FORM(INPUT(_type='submit',_name='delete',_value=T('YES')))}}</p>
<div class="center">
{{=dialog}}
</div>
@@ -1,14 +0,0 @@
{{extend 'layout.html'}}
{{block sectionclass}}upgrade{{end}}
<h2>{{=T('web2py downgrade')}}</h2>
<p class="center"><strong class="att">{{=T('ATTENTION:')}}</strong> {{=T('This is an experimental feature and it needs more testing. If you decide to downgrade you do it at your own risk')}}<br />
{{=T('If start the downgrade, be patient, it may take a while to rollback')}}</p>
<div class="center">
{{=FORM(INPUT(_type='submit',_name='nodowngrade',_value=T('Cancel')), _class='inline')}}
{{=FORM(INPUT(_type='submit',_name='downgrade',_value=T('Downgrade')), _class='inline')}}
</div>
@@ -1,10 +1,7 @@
{{extend 'layout.html'}}
<center>
<h2>{{=T('Are you sure you want to uninstall application "%s"?', app)}}</h2>
<table><tr>
<td>{{=FORM(INPUT(_type='submit',_name='nodelete',_value=T('Abort')))}}</td>
<td>{{=FORM(INPUT(_type='submit',_name='delete',_value=T('Uninstall')))}}</td>
</tr></table>
</center>
<div class="center">
{{=dialog}}
</div>
@@ -8,7 +8,6 @@
{{=T('If start the upgrade, be patient, it may take a while to download')}}</p>
<div class="center">
{{=FORM(INPUT(_type='submit',_name='noupgrade',_value=T('Cancel')), _class='inline')}}
{{=FORM(INPUT(_type='submit',_name='upgrade',_value=T('Upgrade')), _class='inline')}}
{{=dialog}}
</div>