admin design shows private files, thanks Alan
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-07-20 17:37:48) dev
|
Version 2.00.0 (2012-07-21 13:29:17) dev
|
||||||
|
|||||||
@@ -854,6 +854,11 @@ def design():
|
|||||||
modules = modules=[x.replace('\\','/') for x in modules]
|
modules = modules=[x.replace('\\','/') for x in modules]
|
||||||
modules.sort()
|
modules.sort()
|
||||||
|
|
||||||
|
# Get all private files
|
||||||
|
privates = listdir(apath('%s/private/' % app, r=request), '[^\.#].*')
|
||||||
|
privates = [x.replace('\\','/') for x in privates]
|
||||||
|
privates.sort()
|
||||||
|
|
||||||
# Get all static files
|
# Get all static files
|
||||||
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*')
|
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*')
|
||||||
statics = [x.replace('\\','/') for x in statics]
|
statics = [x.replace('\\','/') for x in statics]
|
||||||
@@ -908,6 +913,7 @@ def design():
|
|||||||
modules=filter_plugins(modules,plugins),
|
modules=filter_plugins(modules,plugins),
|
||||||
extend=extend,
|
extend=extend,
|
||||||
include=include,
|
include=include,
|
||||||
|
privates=filter_plugins(privates,plugins),
|
||||||
statics=filter_plugins(statics,plugins),
|
statics=filter_plugins(statics,plugins),
|
||||||
languages=languages,
|
languages=languages,
|
||||||
plurals=plurals,
|
plurals=plurals,
|
||||||
@@ -924,7 +930,7 @@ def delete_plugin():
|
|||||||
redirect(URL('design', args=app, anchor=request.vars.id))
|
redirect(URL('design', args=app, anchor=request.vars.id))
|
||||||
elif 'delete' in request.vars:
|
elif 'delete' in request.vars:
|
||||||
try:
|
try:
|
||||||
for folder in ['models','views','controllers','static','modules']:
|
for folder in ['models','views','controllers','static','modules', 'private']:
|
||||||
path=os.path.join(apath(app,r=request),folder)
|
path=os.path.join(apath(app,r=request),folder)
|
||||||
for item in os.listdir(path):
|
for item in os.listdir(path):
|
||||||
if item.rsplit('.',1)[0] == plugin_name:
|
if item.rsplit('.',1)[0] == plugin_name:
|
||||||
@@ -994,6 +1000,11 @@ def plugin():
|
|||||||
modules = modules=[x.replace('\\','/') for x in modules]
|
modules = modules=[x.replace('\\','/') for x in modules]
|
||||||
modules.sort()
|
modules.sort()
|
||||||
|
|
||||||
|
# Get all private files
|
||||||
|
privates = listdir(apath('%s/private/' % app, r=request), '[^\.#].*')
|
||||||
|
privates = [x.replace('\\','/') for x in privates]
|
||||||
|
privates.sort()
|
||||||
|
|
||||||
# Get all static files
|
# Get all static files
|
||||||
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*')
|
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*')
|
||||||
statics = [x.replace('\\','/') for x in statics]
|
statics = [x.replace('\\','/') for x in statics]
|
||||||
@@ -1023,6 +1034,7 @@ def plugin():
|
|||||||
modules=filter_plugins(modules),
|
modules=filter_plugins(modules),
|
||||||
extend=extend,
|
extend=extend,
|
||||||
include=include,
|
include=include,
|
||||||
|
privates=filter_plugins(privates),
|
||||||
statics=filter_plugins(statics),
|
statics=filter_plugins(statics),
|
||||||
languages=languages,
|
languages=languages,
|
||||||
crontab=crontab)
|
crontab=crontab)
|
||||||
@@ -1142,10 +1154,11 @@ def create_file():
|
|||||||
# coding: utf8
|
# coding: utf8
|
||||||
from gluon import *\n""")[1:]
|
from gluon import *\n""")[1:]
|
||||||
|
|
||||||
elif path[-8:] == '/static/':
|
elif (path[-8:] == '/static/') or (path[-9:] == '/private/'):
|
||||||
if request.vars.plugin and not filename.startswith('plugin_%s/' % request.vars.plugin):
|
if request.vars.plugin and not filename.startswith('plugin_%s/' % request.vars.plugin):
|
||||||
filename = 'plugin_%s/%s' % (request.vars.plugin, filename)
|
filename = 'plugin_%s/%s' % (request.vars.plugin, filename)
|
||||||
text = ''
|
text = ''
|
||||||
|
|
||||||
else:
|
else:
|
||||||
redirect(request.vars.sender+anchor)
|
redirect(request.vars.sender+anchor)
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ def deletefile(arglist, vars={}):
|
|||||||
{{=button('#languages', T("languages"))}}
|
{{=button('#languages', T("languages"))}}
|
||||||
{{=button('#static', T("static"))}}
|
{{=button('#static', T("static"))}}
|
||||||
{{=button('#modules', T("modules"))}}
|
{{=button('#modules', T("modules"))}}
|
||||||
|
{{=button('#private', T("private files"))}}
|
||||||
{{=button('#plugins', T("plugins"))}}
|
{{=button('#plugins', T("plugins"))}}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
@@ -318,6 +319,57 @@ for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functi
|
|||||||
{{=file_upload_form('%s/modules/' % app, 'modules')}}</div>
|
{{=file_upload_form('%s/modules/' % app, 'modules')}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- PRIVATE -->
|
||||||
|
|
||||||
|
<h3 id="private" onclick="collapse('private_inner');" class="component">
|
||||||
|
{{=T("Private files")}}
|
||||||
|
<span class="tooltip">{{=helpicon()}} <span>{{=T("These files are not served, they are only available from within your app")}}</span></span>
|
||||||
|
</h3>
|
||||||
|
<div id="private_inner" class="component_contents">
|
||||||
|
<div class="controls comptools">
|
||||||
|
</div>
|
||||||
|
{{if not privates:}}<p><strong>{{=T("There are no private files")}}</strong></p>{{pass}}
|
||||||
|
<ul>
|
||||||
|
{{
|
||||||
|
path=[]
|
||||||
|
for file in privates+['']:
|
||||||
|
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='private__'+'__'.join(path)
|
||||||
|
}}
|
||||||
|
<li class="folder">
|
||||||
|
<a href="javascript:collapse('{{=thispath}}');" class="file">{{=path[-1]}}/</a>
|
||||||
|
<ul id="{{=thispath}}" style="display: none;" class="sublist">{{
|
||||||
|
else:
|
||||||
|
path = path[:-1]
|
||||||
|
}}
|
||||||
|
</ul></li>
|
||||||
|
{{
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
if filename:
|
||||||
|
}}<li>
|
||||||
|
<span class="filetools controls">
|
||||||
|
{{=editfile('private',file, dict(id="private"))}} {{=deletefile([app,'private',file], dict(id="private",id2="private"))}}
|
||||||
|
</span>
|
||||||
|
<span class="file">
|
||||||
|
{{=filename}}
|
||||||
|
</span>
|
||||||
|
</li>{{
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
}}
|
||||||
|
{{pass}}
|
||||||
|
</ul>
|
||||||
|
<div class="controls formfield">{{=file_create_form('%s/private/' % app, 'private')}}
|
||||||
|
{{=file_upload_form('%s/private/' % app, 'private')}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- PLUGINS -->
|
<!-- PLUGINS -->
|
||||||
|
|
||||||
<h3 id="plugins" onclick="collapse('plugins_inner');" class="component">
|
<h3 id="plugins" onclick="collapse('plugins_inner');" class="component">
|
||||||
|
|||||||
Reference in New Issue
Block a user