From ff6f014f292fe2bf6d224e2aa8395b6a0d223879 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 26 Feb 2013 14:27:02 +0530 Subject: [PATCH] added get_value, fixed appframe from Single --- .../doctype/profile/locale/_messages_doc.json | 1 + .../module_def/core/locale/_messages_doc.json | 1 + public/js/wn/locale/_messages_js.json | 1 - public/js/wn/ui/appframe.js | 8 +-- webnotes/client.py | 8 ++- webnotes/widgets/page.py | 54 ------------------- 6 files changed, 14 insertions(+), 59 deletions(-) diff --git a/core/doctype/profile/locale/_messages_doc.json b/core/doctype/profile/locale/_messages_doc.json index 2f69bc47a6..9879e8ea91 100644 --- a/core/doctype/profile/locale/_messages_doc.json +++ b/core/doctype/profile/locale/_messages_doc.json @@ -57,6 +57,7 @@ "Male", "Bio will be displayed in blog section etc.", "File List", + "portugu\u00eas brasileiro", "Send Invite Email", "Login Before", "Last Name", diff --git a/core/module_def/core/locale/_messages_doc.json b/core/module_def/core/locale/_messages_doc.json index 62e41d6060..7b8783cf60 100644 --- a/core/module_def/core/locale/_messages_doc.json +++ b/core/module_def/core/locale/_messages_doc.json @@ -7,6 +7,7 @@ "Workflow state represents the current state of a document.", "Workflow Action Master", "Property Setter overrides a standard DocType or Field property", + "ToDo", "User Properties", "Represents the states allowed in one document and role assigned to change the state.", "Profile Represents a User in the system.", diff --git a/public/js/wn/locale/_messages_js.json b/public/js/wn/locale/_messages_js.json index 2586f84fbe..4582fdb59f 100644 --- a/public/js/wn/locale/_messages_js.json +++ b/public/js/wn/locale/_messages_js.json @@ -121,7 +121,6 @@ "Can only be exported by users with role 'Report Manager'", "Document Status transition from ", "Not linked", - "Run", "Select Type", "Calendar", "Send Me A Copy", diff --git a/public/js/wn/ui/appframe.js b/public/js/wn/ui/appframe.js index 8f9268dfc8..99cdc4cd22 100644 --- a/public/js/wn/ui/appframe.js +++ b/public/js/wn/ui/appframe.js @@ -83,12 +83,14 @@ wn.ui.AppFrame = Class.extend({ new_doc(doctype); } } - }, - { + }] + if(!locals.DocType[doctype].issingle) { + views.push({ icon: "icon-list", route: "List/" + doctype, type: "list" - }]; + }); + }; if(locals.DocType[doctype].__calendar_js) { views.push({ icon: "icon-calendar", diff --git a/webnotes/client.py b/webnotes/client.py index 28a12edbf0..dfef660a2f 100644 --- a/webnotes/client.py +++ b/webnotes/client.py @@ -31,7 +31,13 @@ def get(doctype, name=None, filters=None): if not name: raise Exception, "No document found for given filters" return [d.fields for d in webnotes.bean(doctype, name).doclist] - + +@webnotes.whitelist() +def get_value(doctype, fieldname, filters=None): + if fieldname and fieldname.startswith("["): + fieldname = json.loads(fieldname) + return webnotes.conn.get_value(doctype, json.loads(filters), fieldname) + @webnotes.whitelist() def insert(doclist): if isinstance(doclist, basestring): diff --git a/webnotes/widgets/page.py b/webnotes/widgets/page.py index 26fde7407e..2df8353b13 100644 --- a/webnotes/widgets/page.py +++ b/webnotes/widgets/page.py @@ -27,60 +27,6 @@ import webnotes.model.code conn = webnotes.conn -class Page: - """ - A page class helps in loading a Page in the system. On loading - - * Page will import Client Script from other pages where specified by `$import(page_name)` - * Execute dynamic HTML if the `content` starts with `#python` - """ - def __init__(self, name): - self.name = name - - def get_from_files(self, doc): - """ - Loads page info from files in module - """ - from webnotes.modules import get_module_path, scrub - import os - - path = os.path.join(get_module_path(doc.module), 'page', scrub(doc.name)) - - # script - fpath = os.path.join(path, scrub(doc.name) + '.js') - if os.path.exists(fpath): - with open(fpath, 'r') as f: - doc.fields['__script'] = f.read() - - # css - fpath = os.path.join(path, scrub(doc.name) + '.css') - if os.path.exists(fpath): - with open(fpath, 'r') as f: - doc.style = f.read() - - # html - fpath = os.path.join(path, scrub(doc.name) + '.html') - if os.path.exists(fpath): - with open(fpath, 'r') as f: - doc.content = f.read() - - - def load(self): - """ - Returns :term:`doclist` of the `Page` - """ - doclist = webnotes.model.doc.get('Page', self.name) - doc = doclist[0] - - # load from module - if doc.module: - self.get_from_files(doc) - - # process - self.process_content(doc) - - return doclist - @webnotes.whitelist() def get(name): """