diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 50419c9192..35ee5b44f1 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -381,7 +381,10 @@ def scrub(txt): def get_module_path(module, *joins): module = scrub(module) return get_pymodule_path(local.module_app[module] + "." + module, *joins) - + +def get_app_path(app_name, *joins): + return get_pymodule_path(app_name, *joins) + def get_pymodule_path(modulename, *joins): joins = [scrub(part) for part in joins] return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__), *joins) diff --git a/webnotes/boot.py b/webnotes/boot.py index a4c4c4d7f2..f52cc810ca 100644 --- a/webnotes/boot.py +++ b/webnotes/boot.py @@ -39,8 +39,10 @@ def get_bootinfo(): # home page bootinfo.modules = {} for app in webnotes.get_installed_apps(): - desktop_icons_path = webnotes.get_pymodule_path(app, "desktop.json") - bootinfo.modules.update(json.loads(webnotes.read_file(desktop_icons_path) or "{}")) + try: + bootinfo.modules.update(webnotes.get_attr(app + ".config.desktop.data") or {}) + except ImportError, e: + pass bootinfo.hidden_modules = webnotes.conn.get_global("hidden_modules") bootinfo.doctype_icons = dict(webnotes.conn.sql("""select name, icon from diff --git a/webnotes/config/__init__.py b/webnotes/config/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webnotes/desktop.json b/webnotes/config/desktop.py similarity index 78% rename from webnotes/desktop.json rename to webnotes/config/desktop.py index 28d06d2b59..c4529dd7eb 100644 --- a/webnotes/desktop.json +++ b/webnotes/config/desktop.py @@ -1,22 +1,24 @@ -{ +from webnotes import _ + +data = { "Calendar": { "color": "#2980b9", "icon": "icon-calendar", - "label": "Calendar", + "label": _("Calendar"), "link": "Calendar/Event", "type": "view" }, "Messages": { "color": "#9b59b6", "icon": "icon-comments", - "label": "Messages", + "label": _("Messages"), "link": "messages", "type": "page" }, "To Do": { "color": "#f1c40f", "icon": "icon-check", - "label": "To Do", + "label": _("To Do"), "link": "List/ToDo", "doctype": "ToDo", "type": "list" @@ -31,6 +33,7 @@ "color": "#888", "icon": "icon-download", "link": "applications", - "type": "page" + "type": "page", + "label": _("Installer") } } \ No newline at end of file diff --git a/webnotes/config/setup.py b/webnotes/config/setup.py new file mode 100644 index 0000000000..83a88b0f8a --- /dev/null +++ b/webnotes/config/setup.py @@ -0,0 +1,111 @@ +from webnotes import _ + +data = [ + { + "label": _("Users and Permissions"), + "icon": "icon-group", + "items": [ + { + "type": "doctype", + "name": "Profile", + "description": _("System and Website Users") + }, + { + "type": "doctype", + "name": "Role", + "description": _("User Roles") + }, + { + "type": "page", + "name": "permission-manager", + "label": "Permission Manager", + "icon": "icon-lock", + "description": _("Set Permissions on Document Types and Roles") + }, + { + "type": "page", + "name": "user-properties", + "label": "User Properties", + "icon": "icon-user", + "description": _("Set Defaults and Restrictions for Users") + } + ] + }, + { + "label": _("Workflow"), + "icon": "icon-random", + "items": [ + { + "type": "doctype", + "name": "Workflow", + "description": _("Define workflows for forms.") + }, + { + "type": "doctype", + "name": "Workflow State", + "description": _("States for workflow (e.g. Draft, Approved, Cancelled).") + }, + { + "type": "doctype", + "name": "Workflow Action", + "description": _("Actions for workflow (e.g. Approve, Cancel).") + }, + ] + }, + { + "label": _("Tools"), + "icon": "icon-wrench", + "items": [ + { + "type": "page", + "name": "data-import-tool", + "label": _("Import / Export Data"), + "icon": "icon-upload", + "description": _("Import / Export Data from .csv files.") + }, + { + "type": "page", + "name": "modules_setup", + "label": _("Show / Hide Modules"), + "icon": "icon-upload", + "description": _("Show or hide modules globally.") + }, + { + "type": "doctype", + "name": "Naming Series", + "description": _("Set numbering series for transactions.") + }, + { + "type": "doctype", + "name": "Rename Tool", + "description": _("Rename many items by uploading a .csv file.") + }, + { + "type": "doctype", + "name": "File Data", + "description": _("Manage uploaded files.") + } + ] + }, + { + "label": _("Customize"), + "icon": "icon-glass", + "items": [ + { + "type": "doctype", + "name": "Customize Form", + "description": _("Change field properties (hide, readonly, permission etc.)") + }, + { + "type": "doctype", + "name": "Custom Field", + "description": _("Add fields to forms.") + }, + { + "type": "doctype", + "name": "Custom Script", + "description": _("Add custom javascript to forms.") + } + ] + } +] \ No newline at end of file diff --git a/webnotes/core/page/applications/applications.js b/webnotes/core/page/applications/applications.js index 2a60fcb992..1389d4cb61 100644 --- a/webnotes/core/page/applications/applications.js +++ b/webnotes/core/page/applications/applications.js @@ -2,6 +2,7 @@ wn.pages['applications'].onload = function(wrapper) { wn.ui.make_app_page({ parent: wrapper, title: wn._('Application Installer'), + icon: "icon-download", single_column: true }); diff --git a/webnotes/core/page/setup/__init__.py b/webnotes/core/page/setup/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webnotes/core/page/setup/setup.js b/webnotes/core/page/setup/setup.js new file mode 100644 index 0000000000..c929be3b5d --- /dev/null +++ b/webnotes/core/page/setup/setup.js @@ -0,0 +1,106 @@ +// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +// MIT License. See license.txt + +wn.pages['Setup'].onload = function(wrapper) { + if(msg_dialog && msg_dialog.display) msg_dialog.hide(); + wn.ui.make_app_page({ + parent: wrapper, + title: wn._('Setup'), + single_column: true + }); + + wrapper.appframe.add_module_icon("Setup"); + wrapper.appframe.set_title_right(wn._("Refresh"), function() { + wn.setup.make(wrapper); + }); + + wn.setup.make(wrapper); + +} + +wn.setup = { + make: function(wrapper) { + wn.call({ + method: "webnotes.core.page.setup.setup.get", + callback: function(r) { + wn.setup.render(r.message, $(wrapper).find(".layout-main").empty()) + } + }) + }, + render: function(data, wrapper) { + $('
\ +
\ + \ +
\ +
\ +
\ +
').appendTo(wrapper); + + var $sections = wrapper.find(".nav-pills"); + $.each(data, function(i, d) { + d._label = d.label.toLowerCase().replace(/ /g, "_"); + $nav = $sections.find('[data-label="'+d._label+'"]'); + + if(!$sections.find('[data-label="'+d._label+'"]').length) { + $nav = $('
  • ' + + wn._(d.label)+'
  • ') + .attr("data-label", d._label) + .appendTo($sections); + $content = $('
    ') + .toggle(false) + .attr("id", d._label) + .appendTo(wrapper.find(".contents")) + $('
    ').appendTo($content).html(' ' + + d.label); + $list = $('