|
a/Allura/allura/ext/admin/admin_main.py |
|
b/Allura/allura/ext/admin/admin_main.py |
|
... |
|
... |
125 |
admin_url = c.project.url()+'admin/'
|
125 |
admin_url = c.project.url()+'admin/'
|
126 |
if len(links):
|
126 |
if len(links):
|
127 |
links.append(SitemapEntry('Project'))
|
127 |
links.append(SitemapEntry('Project'))
|
128 |
links += [
|
128 |
links += [
|
129 |
SitemapEntry('Metadata', admin_url+'overview', className='nav_child'),
|
129 |
SitemapEntry('Metadata', admin_url+'overview', className='nav_child'),
|
130 |
SitemapEntry('Homepage', admin_url+'homepage', className='nav_child'),
|
|
|
131 |
SitemapEntry('Screenshots', admin_url+'screenshots', className='nav_child'),
|
130 |
SitemapEntry('Screenshots', admin_url+'screenshots', className='nav_child'),
|
132 |
SitemapEntry('Categorization', admin_url+'trove', className='nav_child')
|
131 |
SitemapEntry('Categorization', admin_url+'trove', className='nav_child')
|
133 |
]
|
132 |
]
|
134 |
if has_access(c.project, 'admin')():
|
133 |
if has_access(c.project, 'admin')():
|
135 |
links.append(SitemapEntry('Permissions', admin_url+'permissions/', className='nav_child'))
|
134 |
links.append(SitemapEntry('Permissions', admin_url+'permissions/', className='nav_child'))
|
|
... |
|
... |
170 |
|
169 |
|
171 |
@without_trailing_slash
|
170 |
@without_trailing_slash
|
172 |
@expose('jinja:allura.ext.admin:templates/project_overview.html')
|
171 |
@expose('jinja:allura.ext.admin:templates/project_overview.html')
|
173 |
def overview(self, **kw):
|
172 |
def overview(self, **kw):
|
174 |
c.markdown_editor = W.markdown_editor
|
173 |
c.markdown_editor = W.markdown_editor
|
175 |
c.label_edit = W.label_edit
|
|
|
176 |
categories = M.ProjectCategory.query.find(dict(parent_id=None)).sort('label').all()
|
174 |
categories = M.ProjectCategory.query.find(dict(parent_id=None)).sort('label').all()
|
177 |
show_export_control = asbool(config.get('show_export_control', False))
|
175 |
show_export_control = asbool(config.get('show_export_control', False))
|
178 |
return dict(categories=categories,show_export_control=show_export_control)
|
176 |
return dict(categories=categories,show_export_control=show_export_control)
|
179 |
|
|
|
180 |
@without_trailing_slash
|
|
|
181 |
@expose('jinja:allura.ext.admin:templates/project_homepage.html')
|
|
|
182 |
def homepage(self, **kw):
|
|
|
183 |
c.markdown_editor = W.markdown_editor
|
|
|
184 |
return dict()
|
|
|
185 |
|
177 |
|
186 |
@without_trailing_slash
|
178 |
@without_trailing_slash
|
187 |
@expose('jinja:allura.ext.admin:templates/project_screenshots.html')
|
179 |
@expose('jinja:allura.ext.admin:templates/project_screenshots.html')
|
188 |
def screenshots(self, **kw):
|
180 |
def screenshots(self, **kw):
|
189 |
c.screenshot_admin = W.screenshot_admin
|
181 |
c.screenshot_admin = W.screenshot_admin
|
|
... |
|
... |
191 |
return dict()
|
183 |
return dict()
|
192 |
|
184 |
|
193 |
@without_trailing_slash
|
185 |
@without_trailing_slash
|
194 |
@expose('jinja:allura.ext.admin:templates/project_trove.html')
|
186 |
@expose('jinja:allura.ext.admin:templates/project_trove.html')
|
195 |
def trove(self):
|
187 |
def trove(self):
|
|
|
188 |
c.label_edit = W.label_edit
|
196 |
base_troves = M.TroveCategory.query.find(dict(trove_parent_id=0)).sort('fullname').all()
|
189 |
base_troves = M.TroveCategory.query.find(dict(trove_parent_id=0)).sort('fullname').all()
|
197 |
topic_trove = M.TroveCategory.query.get(trove_parent_id=0,shortname='topic')
|
190 |
topic_trove = M.TroveCategory.query.get(trove_parent_id=0,shortname='topic')
|
198 |
license_trove = M.TroveCategory.query.get(trove_parent_id=0,shortname='license')
|
191 |
license_trove = M.TroveCategory.query.get(trove_parent_id=0,shortname='license')
|
199 |
return dict(base_troves=base_troves,license_trove=license_trove,topic_trove=topic_trove)
|
192 |
return dict(base_troves=base_troves,license_trove=license_trove,topic_trove=topic_trove)
|
200 |
|
193 |
|
|
... |
|
... |
204 |
c.markdown_editor = W.markdown_editor
|
197 |
c.markdown_editor = W.markdown_editor
|
205 |
c.label_edit = W.label_edit
|
198 |
c.label_edit = W.label_edit
|
206 |
c.mount_delete = W.mount_delete
|
199 |
c.mount_delete = W.mount_delete
|
207 |
c.admin_modal = W.admin_modal
|
200 |
c.admin_modal = W.admin_modal
|
208 |
c.install_modal = W.install_modal
|
201 |
c.install_modal = W.install_modal
|
209 |
mounts = []
|
202 |
mounts = c.project.ordered_mounts()
|
210 |
for sub in c.project.direct_subprojects:
|
|
|
211 |
mounts.append({'ordinal':sub.ordinal,'sub':sub})
|
|
|
212 |
for ac in c.project.app_configs:
|
|
|
213 |
if ac.tool_name != 'search':
|
|
|
214 |
ordinal = 'ordinal' in ac.options and ac.options['ordinal'] or 0
|
|
|
215 |
mounts.append({'ordinal':ordinal,'ac':ac})
|
|
|
216 |
mounts = sorted(mounts, key=lambda e: e['ordinal'])
|
|
|
217 |
return dict(
|
203 |
return dict(
|
218 |
mounts=mounts,
|
204 |
mounts=mounts,
|
219 |
installable_tools=AdminApp.installable_tools_for(c.project),
|
205 |
installable_tools=AdminApp.installable_tools_for(c.project),
|
220 |
roles=M.ProjectRole.query.find(dict(project_id=c.project.root_project._id)).sort('_id').all(),
|
206 |
roles=M.ProjectRole.query.find(dict(project_id=c.project.root_project._id)).sort('_id').all(),
|
221 |
categories=M.ProjectCategory.query.find(dict(parent_id=None)).sort('label').all())
|
207 |
categories=M.ProjectCategory.query.find(dict(parent_id=None)).sort('label').all())
|
222 |
|
208 |
|
|
|
209 |
@expose()
|
|
|
210 |
@require_post()
|
|
|
211 |
def update_labels(self, labels=None, labels_old=None, **kw):
|
|
|
212 |
c.project.labels = labels.split(',')
|
|
|
213 |
redirect('trove')
|
|
|
214 |
|
223 |
@without_trailing_slash
|
215 |
@without_trailing_slash
|
224 |
@expose()
|
216 |
@expose()
|
225 |
def clone(self,
|
217 |
def clone(self,
|
226 |
repo_type=None, source_url=None,
|
218 |
repo_type=None, source_url=None,
|
227 |
mount_point=None, mount_label=None,
|
219 |
mount_point=None, mount_label=None,
|
|
... |
|
... |
328 |
icon.filename, icon.file, content_type=icon.type,
|
320 |
icon.filename, icon.file, content_type=icon.type,
|
329 |
square=True, thumbnail_size=(48,48),
|
321 |
square=True, thumbnail_size=(48,48),
|
330 |
thumbnail_meta=dict(project_id=c.project._id,category='icon'))
|
322 |
thumbnail_meta=dict(project_id=c.project._id,category='icon'))
|
331 |
g.post_event('project_updated')
|
323 |
g.post_event('project_updated')
|
332 |
redirect('overview')
|
324 |
redirect('overview')
|
333 |
|
|
|
334 |
@expose()
|
|
|
335 |
@require_post()
|
|
|
336 |
@validate(validators=dict(description=UnicodeString()))
|
|
|
337 |
def update_homepage(self, description=None, homepage_title=None, **kw):
|
|
|
338 |
require_access(c.project, 'update')
|
|
|
339 |
if description != c.project.description:
|
|
|
340 |
h.log_action(log, 'change project description').info('')
|
|
|
341 |
c.project.description = description
|
|
|
342 |
if homepage_title != c.project.homepage_title:
|
|
|
343 |
h.log_action(log, 'change project homepage title').info('')
|
|
|
344 |
c.project.homepage_title = homepage_title
|
|
|
345 |
g.post_event('project_updated')
|
|
|
346 |
redirect('homepage')
|
|
|
347 |
|
325 |
|
348 |
@expose('json:')
|
326 |
@expose('json:')
|
349 |
def get_trove_children(self, trove_id, **kw):
|
327 |
def get_trove_children(self, trove_id, **kw):
|
350 |
cats = M.TroveCategory.query.find(dict(trove_parent_id=int(trove_id))).sort('fullname').all()
|
328 |
cats = M.TroveCategory.query.find(dict(trove_parent_id=int(trove_id))).sort('fullname').all()
|
351 |
return dict(cats = [dict(id=c.trove_cat_id,label=c.fullname) for c in cats])
|
329 |
return dict(cats = [dict(id=c.trove_cat_id,label=c.fullname) for c in cats])
|