Пример #1
0
    def setNewOrder(self, item1, item2):
        item1 = json.read(item1)
        item2 = json.read(item2)

        Model.MenuItems.setNewOrder(item1['id'], item1['order'])
        Model.MenuItems.setNewOrder(item2['id'], item2['order'])

        res = json.write({
            'item1_json':
            Model.MenuItems.getItemById(item1['id']).toJSON(),
            'item2_json':
            Model.MenuItems.getItemById(item2['id']).toJSON()
        })
        return res
Пример #2
0
 def savePluginOptions(self, plugin, values):
     values = json.read(values)
     options = getPluginManager().getPluginOptions(plugin)
     for index, option in enumerate(options):
         option.value = values[index]
         option.save()
     return "ok"
Пример #3
0
    def setTitle(self, data):
        data = json.read(data)

        #Update Page with new title
        Model.Pages.setPageTitle(data['page_id'], data['new_val'])

        AmiCache.expireCurrentPage()
        return "ok"
Пример #4
0
    def deleteComments(self, ids, ident=""):
        ids = json.read(ids)

        if len(ids) > 0:
            first_id = ids[0]
            c = BlogCommentModel.getById(first_id)
            self._expireCommentCache(first_id)

            for id in ids:
                BlogCommentModel.delete(id)

        return 'ok'
Пример #5
0
    def changeTemplate(self, id):
        try:
            exec "from templates.%s import template as m" % json.read(id)
            old_template_name = getConfig().CURRENT_TEMPLATE.NAME
            getConfig().CURRENT_TEMPLATE = m

            AmiCache.expireAllPages()

            rc = server.getRootController()

            site_template = m.SiteTemplate()
            site_edit_template = SiteEditTemplate(m.SiteTemplate)

            site_template.markChildren()

            rc.root_obj.template = site_template
            rc.root_obj.siteedit.template = site_edit_template
            initTemplate(site_template, 'addToSiteTemplate')
            initTemplate(site_edit_template, 'addToSiteEditTemplate')

            server.setTemplateStaticPaths(rc, old_template_name)

        except Exception, inst:
            print "'%s' is not a valid template" % inst
Пример #6
0
 def delete(self, id):
     id = json.read(id)
     Model.MenuItems.delete(int(id))
     return "ok"