1 | {{extend 'default.mobile/layout.html'}} |
---|
2 | {{ |
---|
3 | def A_info(*a,**b): |
---|
4 | b['_data-role'] = 'button' |
---|
5 | b['_data-icon'] = 'info' |
---|
6 | b['_data-theme'] = 'b' |
---|
7 | return A(*a,**b) |
---|
8 | |
---|
9 | def A_gear(*a,**b): |
---|
10 | b['_data-role'] = 'button' |
---|
11 | b['_data-icon'] = 'gear' |
---|
12 | return A(*a,**b) |
---|
13 | |
---|
14 | def A_delete(*a,**b): |
---|
15 | b['_data-role'] = 'button' |
---|
16 | b['_data-icon'] = 'delete' |
---|
17 | return A(*a,**b) |
---|
18 | |
---|
19 | def A_check(*a,**b): |
---|
20 | b['_data-role'] = 'button' |
---|
21 | b['_data-icon'] = 'check' |
---|
22 | return A(*a,**b) |
---|
23 | |
---|
24 | def all(items): |
---|
25 | return reduce(lambda a,b:a and b,items,True) |
---|
26 | def peekfile(path,file): |
---|
27 | return A_info(file.replace('\\\\','/'),_href=URL('peek', args=(app, path, file))) |
---|
28 | def editfile(path,file): |
---|
29 | return A_gear(SPAN(T('Edit')),_href=URL('edit', args=(app, path, file))) |
---|
30 | def testfile(path,file): |
---|
31 | return A_check(SPAN(T('Run tests')), _href=URL('test', args=(app, file))) |
---|
32 | def editlanguagefile(path,file): |
---|
33 | return A_gear(SPAN(T('Edit')),_href=URL('edit_language', args=(app, path, file))) |
---|
34 | def file_upload_form(location): |
---|
35 | form=FORM(T("upload file:")," ", |
---|
36 | INPUT(_type="file",_name="file")," ",T("and rename it:")," ", |
---|
37 | INPUT(_type="text",_name="filename",requires=IS_NOT_EMPTY()), |
---|
38 | INPUT(_type="hidden",_name="location",_value=location), |
---|
39 | INPUT(_type="hidden",_name="sender",_value=URL('design',args=app)), |
---|
40 | INPUT(_type="submit",_value=T("upload")),_action=URL('upload_file')) |
---|
41 | return form |
---|
42 | def file_create_form(location): |
---|
43 | form=FORM(T("create file with filename:")," ", |
---|
44 | INPUT(_type="text",_name="filename",requires=IS_NOT_EMPTY()), |
---|
45 | INPUT(_type="hidden",_name="location",_value=location), |
---|
46 | INPUT(_type="hidden",_name="sender",_value=URL('design',args=app))) |
---|
47 | return form |
---|
48 | def upload_plugin_form(app): |
---|
49 | form=FORM(T("upload plugin file:")," ", |
---|
50 | INPUT(_type="file",_name="pluginfile"), |
---|
51 | INPUT(_type="submit",_value=T("upload"))) |
---|
52 | return form |
---|
53 | def deletefile(arglist): |
---|
54 | return A_delete(SPAN(T('Delete')), _href=URL('delete',args=arglist,vars=dict(sender=request.function+'/'+app))) |
---|
55 | }} |
---|
56 | |
---|
57 | {{block sectionclass}}design {{=app}}{{end}} |
---|
58 | |
---|
59 | <div data-role="collapsible-set" data-content-theme="c"> |
---|
60 | |
---|
61 | <!-- MODELS --> |
---|
62 | <div data-role="collapsible" data-content-theme="c"> |
---|
63 | <h3 id="models"> |
---|
64 | {{=T("Models")}} |
---|
65 | </h3> |
---|
66 | <div id="models_inner"> |
---|
67 | {{if not models:}}<p><strong>{{=T("There are no models")}}</strong></p>{{else:}} |
---|
68 | <div data-role="controlgroup" data-type="horizontal"> |
---|
69 | {{=button(URL(a=app,c='appadmin',f='index'), T('database administration'))}} |
---|
70 | {{if os.access(os.path.join(request.folder,'..',app,'databases','sql.log'),os.R_OK):}} |
---|
71 | {{=button(URL('peek/%s/databases/sql.log'%app), 'sql.log')}} |
---|
72 | {{pass}} |
---|
73 | </div> |
---|
74 | {{pass}} |
---|
75 | {{for m in models:}} |
---|
76 | <span data-role="controlgroup"> |
---|
77 | {{=peekfile('models',m)}} |
---|
78 | {{=editfile('models',m)}} |
---|
79 | {{=deletefile([app, 'models', m])}} |
---|
80 | </span> |
---|
81 | </br> |
---|
82 | {{pass}} |
---|
83 | <div data-role="fieldcontain">{{=file_create_form('%s/models/' % app)}}</div> |
---|
84 | </div> |
---|
85 | </div> |
---|
86 | |
---|
87 | <!-- FIND CONTROLLER FUNCTIONS --> |
---|
88 | {{ |
---|
89 | controller_functions=[] |
---|
90 | for c in controllers: controller_functions+=[c[:-3]+'/%s.html'%x for x in functions[c]] |
---|
91 | }} |
---|
92 | |
---|
93 | <!-- CONTROLLERS --> |
---|
94 | <div data-role="collapsible" data-content-theme="c"> |
---|
95 | <h3 id="controllers"> |
---|
96 | {{=T("Controllers")}} |
---|
97 | </h3> |
---|
98 | <div id="controllers_inner"> |
---|
99 | {{if not controllers:}}<p><strong>{{=T("There are no controllers")}}</strong></p>{{else:}} |
---|
100 | <div data-role="controlgroup" data-type="horizontal"> |
---|
101 | {{=button(URL('test',args=app), T("test"))}} |
---|
102 | {{=button(URL('edit',args=[app,'cron','crontab']), T("crontab"))}} |
---|
103 | </div> |
---|
104 | {{pass}} |
---|
105 | {{for c in controllers:}} |
---|
106 | <span data-role="controlgroup"> |
---|
107 | {{=peekfile('controllers',c)}} |
---|
108 | {{=editfile('controllers',c)}} |
---|
109 | {{=deletefile([app, 'controllers', c])}} |
---|
110 | {{=testfile('controllers',c)}} |
---|
111 | </br> |
---|
112 | </span> |
---|
113 | {{pass}} |
---|
114 | <div data-role="fieldcontain">{{=file_create_form('%s/controllers/' % app)}}</div> |
---|
115 | </div> |
---|
116 | </div> |
---|
117 | |
---|
118 | <!-- VIEWS --> |
---|
119 | <div data-role="collapsible" data-content-theme="c"> |
---|
120 | <h3 id="views"> |
---|
121 | {{=T("Views")}} |
---|
122 | </h3> |
---|
123 | <div id="views_inner"> |
---|
124 | <div data-role="controlgroup" data-type="horizontal"> |
---|
125 | {{=button(LAYOUTS_APP, T("download layouts"))}} |
---|
126 | </div> |
---|
127 | {{if not views:}}<p><strong>{{=T("There are no views")}}</strong></p>{{pass}} |
---|
128 | {{for c in views:}} |
---|
129 | <span data-role="controlgroup"> |
---|
130 | {{=peekfile('views',c)}} |
---|
131 | {{=editfile('views',c)}} |
---|
132 | {{=deletefile([app, 'views', c])}} |
---|
133 | </br> |
---|
134 | </span> |
---|
135 | {{pass}} |
---|
136 | <div data-role="fieldcontain">{{=file_create_form('%s/views/' % app)}}</div> |
---|
137 | </div> |
---|
138 | </div> |
---|
139 | |
---|
140 | <!-- LANGUAGES --> |
---|
141 | <div data-role="collapsible" data-content-theme="c"> |
---|
142 | <h3 id="languages"> |
---|
143 | {{=T("Languages")}} |
---|
144 | </h3> |
---|
145 | <div id="languages_inner"> |
---|
146 | <div data-role="controlgroup" data-type="horizontal"> |
---|
147 | {{=button(URL('update_languages/'+app), T('update all languages'))}} |
---|
148 | </div> |
---|
149 | {{if not languages:}}<p><strong>{{=T("There are no translators")}}</strong></p>{{pass}} |
---|
150 | {{for file in languages:}} |
---|
151 | <span data-role="controlgroup"> |
---|
152 | {{=peekfile('languages',file)}} |
---|
153 | {{=editlanguagefile('languages',file)}} |
---|
154 | {{=deletefile([app, 'languages', file])}} |
---|
155 | </br> |
---|
156 | </span> |
---|
157 | {{pass}} |
---|
158 | <div data-role="fieldcontain">{{=file_create_form('%s/languages/' % app)}}</div> |
---|
159 | </div> |
---|
160 | </div> |
---|
161 | |
---|
162 | <!-- STATIC --> |
---|
163 | <div data-role="collapsible" data-content-theme="c"> |
---|
164 | <h3 id="static"> |
---|
165 | {{=T("Static files")}} |
---|
166 | </h3> |
---|
167 | <div id="static_inner"> |
---|
168 | {{if not statics:}}<p><strong>{{=T("There are no static files")}}</strong></p>{{pass}} |
---|
169 | <ul data-role="listview" data-inset="true"> |
---|
170 | {{ |
---|
171 | tree={} |
---|
172 | for file in statics+['']: |
---|
173 | items=file.partition('/') |
---|
174 | if not items[0] in tree: |
---|
175 | tree[items[0]] = [] |
---|
176 | pass |
---|
177 | tree[items[0]].append(items[2]) |
---|
178 | pass |
---|
179 | }} |
---|
180 | {{for k, v in sorted(tree.items()):}} |
---|
181 | {{if k:}} |
---|
182 | <li><a>{{=k}}</a> |
---|
183 | <ul data-theme='c'> |
---|
184 | </br> |
---|
185 | {{if len(v) == 1 and v[0] =='':}} |
---|
186 | <span data-role="controlgroup"> |
---|
187 | {{=peekfile('static', k)}} |
---|
188 | {{=editfile('static', k)}} |
---|
189 | {{=deletefile([app, 'static', k])}} |
---|
190 | </br> |
---|
191 | </span> |
---|
192 | </ul> |
---|
193 | {{continue}} |
---|
194 | {{for f in v:}} |
---|
195 | <span data-role="controlgroup"> |
---|
196 | {{=peekfile('static/'+k, f)}} |
---|
197 | {{=editfile('static/'+k, f)}} |
---|
198 | {{=deletefile([app, 'static/'+k, f])}} |
---|
199 | </br> |
---|
200 | </span> |
---|
201 | {{pass}} |
---|
202 | </ul> |
---|
203 | </li> |
---|
204 | {{pass}} |
---|
205 | {{pass}} |
---|
206 | </ul> |
---|
207 | <div data-role="fieldcontain">{{=file_create_form('%s/static/' % app)}} |
---|
208 | {{#=file_upload_form('%s/static/' % app)}}</div> |
---|
209 | </div> |
---|
210 | </div> |
---|
211 | |
---|
212 | <!-- MODULES --> |
---|
213 | <div data-role="collapsible" data-content-theme="c"> |
---|
214 | <h3 id="modules"> |
---|
215 | {{=T("Modules")}}</h3> |
---|
216 | <div id="modules_inner"> |
---|
217 | {{if not modules:}}<p><strong>{{=T("There are no modules")}}</strong></p>{{pass}} |
---|
218 | {{for m in modules:}} |
---|
219 | <span data-role="controlgroup"> |
---|
220 | {{=peekfile('modules',m)}} |
---|
221 | {{=editfile('modules',m)}} |
---|
222 | {{if m!='__init__.py':}}{{=deletefile([app, 'modules', m])}}{{pass}} |
---|
223 | </span> |
---|
224 | {{pass}} |
---|
225 | <div data-role="fieldcontain">{{=file_create_form('%s/modules/' % app)}} |
---|
226 | {{#=file_upload_form('%s/modules/' % app)}}</div> |
---|
227 | </div> |
---|
228 | </div> |
---|
229 | |
---|
230 | <!-- PLUGINS --> |
---|
231 | <div data-role="collapsible" data-content-theme="c"> |
---|
232 | <h3 id="plugins" > |
---|
233 | {{=T("Plugins")}} |
---|
234 | </h3> |
---|
235 | <div id="plugins_inner"> |
---|
236 | <div data-role="controlgroup" data-type="horizontal"> |
---|
237 | {{=button(PLUGINS_APP, T('download plugins'))}} |
---|
238 | </div> |
---|
239 | {{if plugins:}} |
---|
240 | <div data-role="controlgroup"> |
---|
241 | {{for plugin in plugins:}} |
---|
242 | {{=button(URL('plugin', args=[app, plugin]), 'plugin_%s' % plugin)}} |
---|
243 | {{pass}} |
---|
244 | </div> |
---|
245 | {{else:}} |
---|
246 | <p><strong>{{=T('There are no plugins')}}</strong></p> |
---|
247 | {{pass}} |
---|
248 | <div data-role="fieldcontain">{{=upload_plugin_form(app)}}</div> |
---|
249 | </div> |
---|
250 | </div> |
---|
251 | |
---|
252 | </div> |
---|
253 | |
---|