def load_project(self, data): if data.has_key('error'): window.alert(data['error']) if data.has_key('action'): if data['action'] == 'reload': window.location.reload() else: window.location = js(data['action']) models = self.organize_models(data['_models']) self.parent.load(loader=self.msg, **models) self.msg.total += 3 self.msg.increment() self.msg.setMessage('Getting Media list') ajax.send('media/list', {}, self.load_media)
def new_(self, button, event): ajax.send(self.asset_type + '/new', {'pid':self.parent.pid}, self.onNew)
def __init__(self, parent, project): self.parent = parent ajax.send('project/load', {'project':project}, self.load_project) self.msg = widgets.NumProgressBar('Loading project', 'Retrieving project data from server', 3)
def removeImage(self, model): ajax.send('media/remove', {'type':'image', 'pk':model['pk']})