widgets Package

auto_master Module

webnotes.widgets.auto_master.add_to_master(fieldname, value)[source]
webnotes.widgets.auto_master.create_auto_masters(dt)[source]
webnotes.widgets.auto_master.get_master_fields(dt)[source]
webnotes.widgets.auto_master.make_auto_master(fieldname)[source]
webnotes.widgets.auto_master.update_auto_masters(doc)[source]

event Module

webnotes.widgets.event.get_cal_events(m_st, m_end)[source]
webnotes.widgets.event.load_month_events()[source]

follow Module

Server side methods for the follower pattern (Follow button used in forms)

webnotes.widgets.follow.email_followers(dt, dn, msg_html=None, msg_text=None)[source]

Send an email to all followers of this object

webnotes.widgets.follow.follow(dt=None, dn=None, user=None, verbose=0)[source]

Add as follower to a particular record. If no parameteres, then take from the http request (form)

webnotes.widgets.follow.get_profile_fields(dt)[source]

returns a list of all profile link fields from the doctype

webnotes.widgets.follow.has_permission(dt, user)[source]

Check to see if the user has permission to follow

webnotes.widgets.follow.is_follower(dt, dn, user)[source]

returns true if given user is a follower

webnotes.widgets.follow.load_followers(dt=None, dn=None)[source]

returns list of followers (Full Names) for a particular object

webnotes.widgets.follow.make_follower(dt, dn, user, verbose)[source]

Add the user as a follower

webnotes.widgets.follow.on_docsave(doc)[source]

Add the owner and all linked Profiles as followers

webnotes.widgets.follow.setup()[source]

Make table for followers - if missing

webnotes.widgets.follow.unfollow(dt=None, dn=None, user=None)[source]

Unfollow a particular record. If no parameteres, then take from the http request (form)

webnotes.widgets.follow.update_followers(dt=None, dn=None, subject=None, update_by=None, doc=None)[source]

Updates the timestamp and subject in follower table (for feed generation)

form Module

Server side handler for “Form” events

webnotes.widgets.form.add_comment()[source]
webnotes.widgets.form.check_guest_access(doc)[source]
webnotes.widgets.form.check_integrity(doc)[source]
webnotes.widgets.form.get_comments(doctype=None, docname=None, limit=5)[source]
webnotes.widgets.form.get_fields()[source]
webnotes.widgets.form.get_print_format()[source]
webnotes.widgets.form.getdoc()[source]

Loads a doclist for a given document. This method is called directly from the client. Requries “doctype”, “docname” as form variables. If “from_archive” is set, it will get from archive. Will also call the “onload” method on the document.

webnotes.widgets.form.getdoctype()[source]
webnotes.widgets.form.load_single_doc(dt, dn, user, prefix)[source]
webnotes.widgets.form.make_comment_table()[source]

Make table for comments - if missing via import module

webnotes.widgets.form.make_csv_output(res, dt)[source]
webnotes.widgets.form.remove_attach()[source]
webnotes.widgets.form.remove_comment()[source]
webnotes.widgets.form.runserverobj()[source]
webnotes.widgets.form.savedocs()[source]

menus Module

Server side methods called from DocBrowser

webnotes.widgets.menus.archive_items()[source]
webnotes.widgets.menus.can_cancel(dt)[source]
webnotes.widgets.menus.delete_items()[source]
webnotes.widgets.menus.get_columns(out, sf, fl, dt, tag_fields)[source]
webnotes.widgets.menus.get_dt_details()[source]

Returns details called by DocBrowser this includes: the filters, columns, subject and tag_fields also if the doctype is of type “submittable”

webnotes.widgets.menus.get_dt_trend(dt)[source]
webnotes.widgets.menus.get_menu_items()[source]

Returns a list of items to show in Options of the Web Notes Toolbar List contains Pages and Single DocTypes

webnotes.widgets.menus.get_trend()[source]
webnotes.widgets.menus.has_result()[source]
webnotes.widgets.menus.is_submittable(dt)[source]

page Module

class webnotes.widgets.page.Page(name)[source]

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
load()[source]

Returns doclist of the Page

load_stylesheet(stylesheet)[source]
webnotes.widgets.page.get(name)[source]

Return the doclist of the Page specified by name

webnotes.widgets.page.getpage()[source]

Load the page from webnotes.form and send it via webnotes.response

page_body Module

webnotes.widgets.page_body.get()[source]

returns the full rendered index.cgi Gets keywords and site_description from the Control Panel

webnotes.widgets.page_body.get_doc_content(dt, dn)[source]

Gets the HTML content of a document record by using the overridden or standard :method: doclist.to_html

webnotes.widgets.page_body.get_page_content(page)[source]

Gets the HTML content from static_content or content property of a Page

webnotes.widgets.page_body.index_template
HTML Template of index.cgi
webnotes.widgets.page_body.load_default_properties()[source]
webnotes.widgets.page_body.load_page_metatags(doc)[source]
webnotes.widgets.page_body.load_properties()[source]
webnotes.widgets.page_body.replace_id(match)[source]
webnotes.widgets.page_body.scrub_ids(content)[source]

query_builder Module

webnotes.widgets.query_builder.add_match_conditions(q, tl, ur, ud)[source]
webnotes.widgets.query_builder.build_description_simple()[source]
webnotes.widgets.query_builder.build_description_standard(meta, tl)[source]
webnotes.widgets.query_builder.exec_report(code, res, colnames=[], colwidths=[], coltypes=[], coloptions=[], filter_values={}, query='', from_export=0)[source]
webnotes.widgets.query_builder.get_parent_dt(dt)[source]
webnotes.widgets.query_builder.get_search_criteria_list(dt)[source]
webnotes.widgets.query_builder.get_sql_meta(tl)[source]
webnotes.widgets.query_builder.get_sql_tables(q)[source]
webnotes.widgets.query_builder.getmatchcondition(dt, ud, ur)[source]
webnotes.widgets.query_builder.guess_type(m)[source]

Returns fieldtype depending on the MySQLdb Description

webnotes.widgets.query_builder.load_report_list()[source]
webnotes.widgets.query_builder.runquery(q='', ret=0, from_export=0)[source]
webnotes.widgets.query_builder.runquery_csv()[source]

search Module

webnotes.widgets.search.build_for_autosuggest(res)[source]
webnotes.widgets.search.get_std_fields_list(dt, key)[source]
webnotes.widgets.search.getsearchfields()[source]
webnotes.widgets.search.make_query(fields, dt, key, txt, start, length)[source]
webnotes.widgets.search.scrub_custom_query(query, key, txt)[source]
webnotes.widgets.search.search_widget()[source]

tags Module

Server side functions for tagging.

  • Tags can be added to any record (doctype, name) in the system.
  • Items are filtered by tags
  • Top tags are shown in the sidebar (?)
  • Tags are also identified by the tag_fields property of the DocType

Discussion:

Tags are shown in the docbrowser and ideally where-ever items are searched. There should also be statistics available for tags (like top tags etc)

Design:

  • free tags (user_tags) are stored in __user_tags
  • doctype tags are set in tag_fields property of the doctype
  • top tags merges the tags from both the lists (only refreshes once an hour (max))
class webnotes.widgets.tags.DocTags(dt)[source]

Tags for a particular doctype

add(dn, tag)[source]

add a new user tag

create(tag)[source]
get_tag_fields()[source]

returns tag_fields property

get_tags(dn)[source]

returns tag for a particular item

remove(dn, tag)[source]

remove a user tag

setup()[source]

adds the _user_tags column if not exists

setup_tags()[source]

creates the tabTag table if not exists

update(dn, tl)[source]

updates the _user_tag column in the table

class webnotes.widgets.tags.TagCounter(doctype)[source]

Tag Counter stores tag count per doctype in table _tag_cnt

build(dt)[source]

Builds / rebuilds the counting

load_top()[source]
new_tag(tag, cnt=0, dt=None)[source]

Creates a new row for the tag and doctype

setup()[source]

creates the tag cnt table from the DocType

update(tag, diff)[source]

updates tag cnt for a doctype and tag

webnotes.widgets.tags.add_tag()[source]

adds a new tag to a record, and creates the Tag master

webnotes.widgets.tags.check_user_tags(dt)[source]

if the user does not have a tags column, then it creates one

webnotes.widgets.tags.get_top_field_tags(dt)[source]
webnotes.widgets.tags.get_top_tags(args='')[source]

returns the top 10 tags for the doctype from fields (7) and users (3)

webnotes.widgets.tags.remove_tag()[source]

removes tag from the record

todo Module

webnotes.widgets.todo.add_todo(user, date, priority, desc, ref_type, ref_name)[source]
webnotes.widgets.todo.add_todo_item(user, date, priority, desc, ref_type, ref_name)[source]
webnotes.widgets.todo.get_todo_list()[source]
webnotes.widgets.todo.remove_todo(name)[source]