def main(): from class_plugins import Plugins from class_macro import Macros from VEE_resources import create_plugin_dir def invoke_dispather(macros): from VEE_vmacro_dispatcher import InvokeDispatcher from VEE_std_lib import v_currentpage invoke_disp = InvokeDispatcher() invoke_disp.page = self invoke_disp.growl = self.growl invoke_disp.xmldialog = self.xmldialog invoke_disp.macros = macros current_page = v_currentpage() current_page.page_name = self.name invoke_disp.current_page = current_page invoke_disp.run() plugin_id = session["plugin_id"] = request.arguments.get("keyField", "") cell_name = request.arguments.get("headerData", "") if plugin_id: plugin = Plugins.get_by_id(plugin_id) if cell_name and plugin: if cell_name == "Update": self.dialog_update_plugin.text_description.action( "setText", ["Plugin to update - %s" % (plugin.name)]) self.dialog_update_plugin.form.formtext_pluginid.action( "setValue", [plugin.id]) self.dialog_update_plugin.action("show", [""]) elif cell_name == "Export": self.action("goTo", ["/plugins?op=export"]) elif cell_name == "Open": create_plugin_dir(plugin.guid) self.action("goTo", ["/plugin_details?id=%s" % plugin_id]) elif cell_name == "Delete": session["plugin_id"] = plugin_id self.dialog_uninstall.action("show", []) elif cell_name == "MD5": self.dialog_md5.text_md5.action("setText", [plugin.get_md5()]) self.dialog_md5.action("show", []) elif cell_name == "Config": from class_macro import Macros macros = Macros.get_config_macro(plugin.guid) if macros: invoke_dispather(macros)
def main(): from class_plugins import Plugins plugin_id = request.shared_variables[ "plugin_id" ] plugin = Plugins.get_by_id( plugin_id ) if plugin: from class_macro import Macros macros = Macros.get_config_macro( plugin.guid ) if macros: invoke_dispather( macros )
def set_data(self, data): plugins = [] for plugin in data: config_macros = Macros.get_config_macro(plugin.guid) plugins.append({"id": plugin.id, "Picture" : "<img src='/get_image?id="+plugin.picture+"' width='48'/>" if plugin.picture else "<img src='/abfbe7cf-76ac-46ba-9ba8-6c89933d7cae.png' />", "Plugin_info" : "<h1>" +plugin.name + "</h1><h2>by " + plugin.author + "</h2><p class='clearfix'></p><p>" + plugin.description + "</p><p>Version " + plugin.version + "</p>", "Update" : "<a href=''><img src='/7452291d-f0c0-444c-997f-ba3064ddc0c7.res'/>Update</a>", "Export" : "<a href=''><img src='/cb4d01af-36f7-418d-94d8-e8a0546e5877.res'/>Export</a>", "Open" : "<a href=''><img src='/3827f2ea-edca-491a-bc5f-a765776dd109.res'/>Open</a>", "Delete" : "<a href=''>Uninstall</a>", "MD5" : "<a href=''>Get MD5</a>", "Config" : ("<a href=''>Config</a>" if config_macros else "")} if not plugin.protected else {"id": plugin.id, "Picture" : "<img src='/get_image?id="+plugin.picture+"' width='48'/>" if plugin.picture else "<img src='/abfbe7cf-76ac-46ba-9ba8-6c89933d7cae.png' />", "Plugin_info" : "<h1>" +plugin.name + "</h1><h2>by " + plugin.author + "</h2><p class='clearfix'></p><p>" + plugin.description + "</p><p>Version " + plugin.version + "</p><p>Protected</p>" , "Update" : "<a href=''><img src='/7452291d-f0c0-444c-997f-ba3064ddc0c7.res'/>Update</a>", "Export" : "", "Open" : "", "Delete" : "<a href=''>Uninstall</a>", "MD5" : "<a href=''>Get MD5</a>", "Config" : ("<a href=''>Config</a>" if config_macros else "")}) self.__plugins_list = json.dumps(plugins)