added get_value, fixed appframe from Single

This commit is contained in:
Rushabh Mehta 2013-02-26 14:27:02 +05:30
parent e2e3459806
commit ff6f014f29
6 changed files with 14 additions and 59 deletions

View file

@ -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",

View file

@ -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.",

View file

@ -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",

View file

@ -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",

View file

@ -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):

View file

@ -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):
"""