diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index f47b136395e..659e7570710 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -8,11 +8,11 @@ # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Please edit this list and import only required elements from __future__ import unicode_literals @@ -35,59 +35,78 @@ convert_to_lists = webnotes.conn.convert_to_lists class DocType: - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist - - # Get Customer Details along with its primary contact details - # ============================================================== - def get_customer_details(self): - details =sql("select address, territory, customer_group,customer_name from `tabCustomer` where name=%s and docstatus!=2",(self.doc.customer),as_dict=1) - if details: - ret = { - 'customer_address' : details and details[0]['address'] or '', - 'territory' : details and details[0]['territory'] or '', - 'customer_group' : details and details[0]['customer_group'] or '', - 'customer_name' : details and details[0]['customer_name'] or '' - } - #get primary contact details(this is done separately coz. , if join query used & no primary contact thn it would not be able to fetch customer details) - contact_det = sql("select contact_name, phone, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact=1 and docstatus!=2" %(self.doc.customer), as_dict = 1) - ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or '' - ret['contact_no'] = contact_det and contact_det[0]['phone'] or '' - ret['email_id'] = contact_det and contact_det[0]['email_id'] or '' - return ret - else: - msgprint("Customer : %s does not exist in system." % (self.doc.customer)) - raise Exception - - # Get customer's contact person details - # ============================================================== - def get_contact_details(self): - contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc,contact_person,self.doc.customer), as_dict=1) - if contact: - ret = { - 'contact_no' : contact and contact[0]['contact_no'] or '', - 'email_id' : contact and contact[0]['email_id'] or '' - } - return ret - else: - msgprint("Contact Person : %s does not exist in the system." % (self.doc,contact_person)) - raise Exception - - #calculate gross profit - #============================================= - def get_gross_profit(self): - pft, per_pft =0, 0 - pft = flt(self.doc.project_value) - flt(self.doc.est_material_cost) - #if pft > 0: - per_pft = (flt(pft) / flt(self.doc.project_value)) * 100 - ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft} - return ret - - # validate - #================================================ - def validate(self): - if self.doc.project_start_date and self.doc.completion_date: - if getdate(self.doc.completion_date) < getdate(self.doc.project_start_date): - msgprint("Expected Completion Date can not be less than Project Start Date") - raise Exception + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist + + # Get Customer Details along with its primary contact details + # ============================================================== + def get_customer_details(self): + details =sql("select address, territory, customer_group,customer_name from `tabCustomer` where name=%s and docstatus!=2",(self.doc.customer),as_dict=1) + if details: + ret = { + 'customer_address' : details and details[0]['address'] or '', + 'territory' : details and details[0]['territory'] or '', + 'customer_group' : details and details[0]['customer_group'] or '', + 'customer_name' : details and details[0]['customer_name'] or '' + } + #get primary contact details(this is done separately coz. , if join query used & no primary contact thn it would not be able to fetch customer details) + contact_det = sql("select contact_name, phone, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact=1 and docstatus!=2" %(self.doc.customer), as_dict = 1) + ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or '' + ret['contact_no'] = contact_det and contact_det[0]['phone'] or '' + ret['email_id'] = contact_det and contact_det[0]['email_id'] or '' + return ret + else: + msgprint("Customer : %s does not exist in system." % (self.doc.customer)) + raise Exception + + # Get customer's contact person details + # ============================================================== + def get_contact_details(self): + contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc,contact_person,self.doc.customer), as_dict=1) + if contact: + ret = { + 'contact_no' : contact and contact[0]['contact_no'] or '', + 'email_id' : contact and contact[0]['email_id'] or '' + } + return ret + else: + msgprint("Contact Person : %s does not exist in the system." % (self.doc,contact_person)) + raise Exception + + #calculate gross profit + #============================================= + def get_gross_profit(self): + pft, per_pft =0, 0 + pft = flt(self.doc.project_value) - flt(self.doc.est_material_cost) + #if pft > 0: + per_pft = (flt(pft) / flt(self.doc.project_value)) * 100 + ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft} + return ret + + # validate + #================================================ + def validate(self): + if self.doc.project_start_date and self.doc.completion_date: + if getdate(self.doc.completion_date) < getdate(self.doc.project_start_date): + msgprint("Expected Completion Date can not be less than Project Start Date") + raise Exception + + def on_update(self): + # update milestones + webnotes.conn.sql("""delete from tabEvent where ref_type='Project' and ref_name=%s""", + self.doc.name) + for d in self.doclist: + if d.doctype=='Project Milestone' and d.docstatus!=2: + self.add_calendar_event(d.milestone, d.milestone_date) + + def add_calendar_event(self, milestone, date): + """ Add calendar event for task in calendar of Allocated person""" + event = Document('Event') + event.description = milestone + ' for ' + self.doc.name + event.event_date = date + event.event_hour = '10:00' + event.event_type = 'Public' + event.ref_type = 'Project' + event.ref_name = self.doc.name + event.save(1) diff --git a/erpnext/projects/doctype/project/project.txt b/erpnext/projects/doctype/project/project.txt index 527201e17da..43cab3958e5 100644 --- a/erpnext/projects/doctype/project/project.txt +++ b/erpnext/projects/doctype/project/project.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:05', + 'creation': '2012-05-03 18:41:42', 'docstatus': 0, - 'modified': '2012-03-27 14:36:05', + 'modified': '2012-08-07 15:48:47', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -29,7 +29,7 @@ 'show_in_menu': 0, 'subject': u' ', 'tag_fields': u'status', - 'version': 33 + 'version': 1 }, # These values are common for all DocField @@ -43,12 +43,17 @@ # These values are common for all DocPerm { + 'cancel': 1, + 'create': 1, 'doctype': u'DocPerm', 'name': '__common__', 'parent': u'Project', 'parentfield': u'permissions', 'parenttype': u'DocType', - 'read': 1 + 'permlevel': 0, + 'read': 1, + 'role': u'Projects User', + 'write': 1 }, # DocType, Project @@ -59,33 +64,7 @@ # DocPerm { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'All', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Projects User', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' + 'doctype': u'DocPerm' }, # DocField @@ -100,6 +79,15 @@ 'permlevel': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb_project_status', + 'fieldtype': u'Column Break', + 'label': u'Status', + 'permlevel': 0 + }, + # DocField { 'description': u'Project will get saved and will be searchable with project name given', @@ -163,71 +151,10 @@ # DocField { 'doctype': u'DocField', - 'fieldname': u'project_value', - 'fieldtype': u'Currency', - 'label': u'Project Value', - 'no_copy': 0, - 'oldfieldname': u'project_value', - 'oldfieldtype': u'Currency', - 'permlevel': 0, - 'reqd': 1, - 'search_index': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'gross_margin_value', - 'fieldtype': u'Currency', - 'label': u'Gross Margin Value', - 'no_copy': 0, - 'oldfieldname': u'gross_margin_value', - 'oldfieldtype': u'Currency', - 'permlevel': 0, - 'reqd': 1, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'per_gross_margin', - 'fieldtype': u'Currency', - 'label': u'Gross Margin %', - 'no_copy': 0, - 'oldfieldname': u'per_gross_margin', - 'oldfieldtype': u'Currency', - 'permlevel': 0, - 'reqd': 1, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'est_material_cost', - 'fieldtype': u'Currency', - 'label': u'Estimated Material Cost', - 'no_copy': 0, - 'oldfieldname': u'est_material_cost', - 'oldfieldtype': u'Currency', - 'permlevel': 0, - 'search_index': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'project_type', - 'fieldtype': u'Data', - 'label': u'Project Type', - 'no_copy': 0, - 'oldfieldname': u'project_type', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'search_index': 0 + 'fieldname': u'cb_project_dates', + 'fieldtype': u'Column Break', + 'label': u'Dates', + 'permlevel': 0 }, # DocField @@ -273,51 +200,41 @@ # DocField { 'doctype': u'DocField', - 'fieldname': u'amended_from', - 'fieldtype': u'Data', - 'hidden': 1, - 'label': u'Amended From', - 'no_copy': 1, - 'oldfieldname': u'amended_from', + 'fieldname': u'project_type', + 'fieldtype': u'Select', + 'label': u'Project Type', + 'no_copy': 0, + 'oldfieldname': u'project_type', 'oldfieldtype': u'Data', - 'permlevel': 1, - 'print_hide': 0, + 'options': u'Internal\nExternal\nOther', + 'permlevel': 0, 'search_index': 0 }, # DocField { + 'colour': u'White:FFF', + 'description': u'Important dates and commitments in your project life cycle', 'doctype': u'DocField', - 'fieldname': u'amemdment_date', - 'fieldtype': u'Date', - 'hidden': 1, - 'label': u'Amemdment Date', - 'no_copy': 1, - 'oldfieldname': u'amemdment_date', - 'oldfieldtype': u'Date', - 'permlevel': 1, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'project_details', + 'fieldname': u'sb_milestones', 'fieldtype': u'Section Break', - 'label': u'Project Details', + 'label': u'Milestones', 'oldfieldtype': u'Section Break', - 'options': u'Simple', 'permlevel': 0 }, # DocField { 'doctype': u'DocField', - 'fieldname': u'column_break0', - 'fieldtype': u'Column Break', - 'oldfieldtype': u'Column Break', + 'fieldname': u'project_milestones', + 'fieldtype': u'Table', + 'label': u'Project Milestones', + 'no_copy': 0, + 'oldfieldname': u'project_milestones', + 'oldfieldtype': u'Table', + 'options': u'Project Milestone', 'permlevel': 0, - 'width': u'50%' + 'search_index': 0 }, # DocField @@ -325,6 +242,7 @@ 'doctype': u'DocField', 'fieldname': u'section_break0', 'fieldtype': u'Section Break', + 'label': u'Project Details', 'oldfieldtype': u'Section Break', 'options': u'Simple', 'permlevel': 0 @@ -343,6 +261,85 @@ 'search_index': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'project_details', + 'fieldtype': u'Section Break', + 'label': u'Project Costing', + 'oldfieldtype': u'Section Break', + 'options': u'Simple', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'project_value', + 'fieldtype': u'Currency', + 'label': u'Project Value', + 'no_copy': 0, + 'oldfieldname': u'project_value', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'reqd': 1, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'est_material_cost', + 'fieldtype': u'Currency', + 'label': u'Estimated Material Cost', + 'no_copy': 0, + 'oldfieldname': u'est_material_cost', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'column_break0', + 'fieldtype': u'Column Break', + 'label': u'Margin', + 'oldfieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'gross_margin_value', + 'fieldtype': u'Currency', + 'label': u'Gross Margin Value', + 'no_copy': 0, + 'oldfieldname': u'gross_margin_value', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'reqd': 1, + 'search_index': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'per_gross_margin', + 'fieldtype': u'Currency', + 'label': u'Gross Margin %', + 'no_copy': 0, + 'oldfieldname': u'per_gross_margin', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'reqd': 1, + 'search_index': 0 + }, + # DocField { 'doctype': u'DocField', @@ -474,32 +471,6 @@ 'search_index': 0 }, - # DocField - { - 'colour': u'White:FFF', - 'description': u'Important dates and commitments in your project life cycle', - 'doctype': u'DocField', - 'fieldname': u'milestones', - 'fieldtype': u'Section Break', - 'label': u'Milestones', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'project_milestones', - 'fieldtype': u'Table', - 'label': u'Project Milestones', - 'no_copy': 0, - 'oldfieldname': u'project_milestones', - 'oldfieldtype': u'Table', - 'options': u'Project Milestone', - 'permlevel': 0, - 'search_index': 0 - }, - # DocField { 'doctype': u'DocField', @@ -517,12 +488,15 @@ # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'file_list', 'fieldtype': u'Small Text', + 'hidden': 1, 'label': u'File List', 'no_copy': 1, 'permlevel': 0, + 'print_hide': 1, 'search_index': 0 } ] \ No newline at end of file diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 5cc52702294..c8447fce7a1 100644 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -217,7 +217,7 @@ class DocType: """ Add calendar event for task in calendar of Allocated person""" event = Document('Event') event.owner = self.doc.allocated_to - event.description = self.doc.name + event.description = self.doc.subject event.event_date = self.doc.exp_start_date and self.doc.exp_start_date or '' event.event_hour = self.doc.event_hour and self.doc.event_hour or '10:00' event.event_type = 'Private' diff --git a/erpnext/projects/page/projects/projects.css b/erpnext/projects/page/projects/projects.css new file mode 100644 index 00000000000..2fc9c27d145 --- /dev/null +++ b/erpnext/projects/page/projects/projects.css @@ -0,0 +1,6 @@ +.gantt { + -moz-box-sizing: border-box; + border: 14px solid #DDDDDD; + border-radius: 6px 6px 6px 6px; + margin: 20px auto; +} \ No newline at end of file diff --git a/erpnext/projects/page/projects/projects.html b/erpnext/projects/page/projects/projects.html index c09eebae0c2..e69de29bb2d 100644 --- a/erpnext/projects/page/projects/projects.html +++ b/erpnext/projects/page/projects/projects.html @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/erpnext/projects/page/projects/projects.js b/erpnext/projects/page/projects/projects.js index 9fec3c9bb6e..7dc93586779 100644 --- a/erpnext/projects/page/projects/projects.js +++ b/erpnext/projects/page/projects/projects.js @@ -22,258 +22,50 @@ pscript.queries_bg_dict = { 'Pending Review':'YELLOW' } -pscript.onload_Projects = function() { - var d = $i('projects_div'); +pscript.onload_Projects = function(wrapper) { + wn.ui.make_app_page({parent:wrapper, title:'Gantt Chart: All Tasks', single_column:true}); - new PageHeader(d, 'Gantt Chart'); - new GanttChart($a(d, 'div', '', { margin:'16px'})); -} - - -// Gantt Chart -// ========================================================================== - -GanttChart = function(parent) { - this.wrapper = $a(parent, 'div'); - //this.head = new PageHeader(this.wrapper, 'Gantt Chart'); - - this.toolbar_area = $a(this.wrapper, 'div','',{padding:'16px', border:'1px solid #AAF', }); $bg(this.toolbar_area, '#EEF'); $br(this.toolbar_area, '3px'); - this.toolbar_tab = make_table(this.toolbar_area, 1, 4, '100%', ['25%', '25%','25%', '25%']); - this.grid_area = $a(this.wrapper, 'div', '', {margin: '16px 0px'}); - this.no_task_message = $a(this.wrapper, 'div', 'help_box', - {textAign:'center', fontSize:'14px'}, 'Select your criteria and click on "Make" to show the Gantt Chart') - - this.get_init_data(); - //this.make_grid(); -} - -GanttChart.prototype.get_init_data = function() { - var me = this; - var callback = function(r,rt) { - me.pl = r.message.pl.sort(); - me.rl = r.message.rl.sort(); - - me.make_toolbar(); - } - $c_obj('Project Control','get_init_data','', callback); -} - -GanttChart.prototype.make_filter = function(label, idx) { - var w = $a($td(this.toolbar_tab,0,idx), 'div','',{marginBottom:'8px'}); - var l = $a(w, 'div','',{fontSize:'11px'}); l.innerHTML = label; - return w; -} - -GanttChart.prototype.make_select = function(label, options,idx) { - var w = this.make_filter(label,idx); - var s = $a(w, 'select','',{width:'100px'}); add_sel_options(s, add_lists(['All'],options)); - return s; -} - -GanttChart.prototype.make_date = function(label,idx) { - var w = this.make_filter(label,idx); - var i = $a(w, 'input'); - - var user_fmt = wn.boot.sysdefaults.date_format; - if(!this.user_fmt)this.user_fmt = 'dd-mm-yy'; - - $(i).datepicker({ - dateFormat: user_fmt.replace('yyyy','yy'), - altFormat:'yy-mm-dd', - changeYear: true - }); + $(wrapper).find('.layout-main').html('
Loading...
') - return i; -} - -GanttChart.prototype.make_toolbar = function() { - - // resource / project - this.r_sel = this.make_select('Resource', this.rl, 0); - this.p_sel = this.make_select('Project', this.pl, 1); - // start / end - this.s_date = this.make_date('Start Date', 2); this.s_date.value = date.str_to_user(date.month_start()); - this.e_date = this.make_date('End Date', 3); this.e_date.value = date.str_to_user(date.month_end()); + wn.require('js/lib/jQuery.Gantt/css/style.css'); + wn.require('js/lib/jQuery.Gantt/js/jquery.fn.gantt.min.js'); - // button - var me = this; - $btn(this.toolbar_area, 'Make', function() { me.refresh(); }, null, 'green', 1); - this.print_btn = $btn(this.toolbar_area, 'Print', function() { me.print(); }, {display:'none'},null); -} - -GanttChart.prototype.print = function() { - $(this.grid_area).printElement(); -} - -GanttChart.prototype.get_data = function() { - var me = this; - var callback = function(r, rt) { - me.tasks = r.message; - if(me.tasks.length) { - $dh(me.no_task_message); - $ds(me.grid_area); - me.show_tasks(); - $di(me.print_btn); - } else { - // nothign to show - $dh(me.grid_area); - $ds(me.no_task_message); - $dh(me.print_btn); - me.no_task_message.innerHTML = 'Nothing allocated for the above criteria' - } - } - $c_obj('Project Control','get_tasks', - [date.user_to_str(this.s_date.value), - date.user_to_str(this.e_date.value), - sel_val(this.p_sel), - sel_val(this.r_sel)].join('~~~') - , callback) -} - -GanttChart.prototype.make_grid = function() { - // clear earlier chart - this.grid_area.innerHTML = ''; - this.grid = new GanttGrid(this, this.s_date.value, this.e_date.value); -} - -GanttChart.prototype.refresh = function() { - this.get_data(); -} - -GanttChart.prototype.show_tasks = function() { - this.make_grid(); - for(var i=0; i').appendTo($(wrapper).find('.layout-main')); + gantt_area.gantt({ + source: source, + navigate: "scroll", + scale: "weeks", + minScale: "weeks", + maxScale: "months", + onItemClick: function(data) { + alert("Item clicked - show some details"); + }, + onAddClick: function(dt, rowId) { + //alert("Empty space clicked - add an item!"); + } + }); + } - if(d.getDate()==today.getDate() && d.getMonth()==today.getMonth() && d.getYear() == today.getYear()) { - $y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'}) - } - var d = date.str_to_obj(date.add_days(this.start_date, 1)); - } - this.start_date = date.str_to_obj(date.user_to_str(this.s_date)); -} - - - -GanttGrid.prototype.get_x = function(dt) { - var d = date.str_to_obj(dt); // convert to obj - return flt(date.get_diff(d, this.start_date)+1) / flt(date.get_diff(this.end_date, this.start_date)+1) * 100; -} - -// ========================================================================== - -GanttTask = function(grid, data, idx) { - // start_date, end_date, name, status - this.start_date = data[3]; - this.end_date = data[4]; - - // label - this.label = $a(grid.y_labels, 'div', '', {'top':(idx*40) + 'px', overflow:'hidden', position:'absolute', 'width':'100%', height: '40px'}); - var l1 = $a($a(this.label, 'div'), 'span', 'link_type'); l1.innerHTML = data[0]; l1.dn = data[7]; l1.onclick = function() { loaddoc('Task', this.dn) }; - var l2 = $a(this.label, 'div', '', {fontSize:'10px'}); l2.innerHTML = data[1]; - - // bar - var col = pscript.queries_bg_dict[data[5]]; - if(data[6]!='Open') col = pscript.queries_bg_dict[data[6]]; - if(!col) col = 'BLUE'; - - this.body = $a(grid.task_area, 'div','',{backgroundColor:col, height:'12px', position:'absolute'}); - - //bar info - this.body_info = $a(this.body, 'div','',{backgroundColor:'#CCC', position:'absolute', zIndex:20}); - - var x1 = grid.get_x(this.start_date); - var x2 = grid.get_x(this.end_date); - - if(x1<=0)x1=0; - else x1 -=100/flt(date.get_diff(grid.end_date, grid.start_date)+1); - if(x2>=100)x2=100; -// else x2+=100/flt(date.get_diff(grid.end_date, grid.start_date)+1); - - $y(this.body, { - top: idx * 40 + 14 + 'px', - left: x1 + '%', - width: (x2-x1) + '%', - zIndex: 1, - cursor:'pointer' }) - - // divider - if(idx) { - var d1 = $a(grid.task_area, 'div','',{borderBottom: '1px solid #AAA', position:'absolute', width:'100%', top:(idx*40) + 'px'}); - var d2 = $a(grid.y_labels, 'div','',{borderBottom: '1px solid #AAA', position:'absolute', width:'100%', top:(idx*40) + 'px'}); - } - - this.make_tooltip(data); -} - -GanttTask.prototype.make_tooltip = function(d) { - $(this.body).click(function() { - var t = '
'; - if(d[0]) t += 'Task: ' + d[0]; - if(d[5]) t += '
Priority: ' + d[5]; - if(d[6]) t += '
Status: ' + d[6]; - if(d[1]) t += '
Allocated To: ' + d[1]; - if(d[2]) t += '
Project: ' + d[2]; - if(d[3]) t += '
From: ' + date.str_to_user(d[3]); - if(d[4]) t += '
To: ' + date.str_to_user(d[4]); - t += '
'; - - msgprint(t) - }) - -} - - - - +} \ No newline at end of file diff --git a/erpnext/projects/page/projects/projects.py b/erpnext/projects/page/projects/projects.py new file mode 100644 index 00000000000..8f170def251 --- /dev/null +++ b/erpnext/projects/page/projects/projects.py @@ -0,0 +1,25 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import webnotes + +@webnotes.whitelist() +def get_tasks(): + return webnotes.conn.sql("""select name, project, subject, exp_start_date, exp_end_date, + description from tabTask where + project is not null + and exp_start_date is not null + and exp_end_date is not null""", as_dict=True) \ No newline at end of file diff --git a/erpnext/projects/page/projects/projects_static.html b/erpnext/projects/page/projects/projects_static.html deleted file mode 100644 index 05775457ba1..00000000000 --- a/erpnext/projects/page/projects/projects_static.html +++ /dev/null @@ -1 +0,0 @@ -Projects \ No newline at end of file diff --git a/erpnext/selling/doctype/lead/lead.txt b/erpnext/selling/doctype/lead/lead.txt index 056fc16bae1..9c74de987ec 100644 --- a/erpnext/selling/doctype/lead/lead.txt +++ b/erpnext/selling/doctype/lead/lead.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-06-05 20:03:20', - 'docstatus': 0, - 'modified': '2012-08-03 10:49:22', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-06-05 20:03:20', + u'docstatus': 0, + u'modified': '2012-08-06 14:49:48', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType @@ -16,10 +16,10 @@ 'allow_trash': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', - 'doctype': 'DocType', + u'doctype': u'DocType', 'document_type': u'Master', 'module': u'Selling', - 'name': '__common__', + u'name': u'__common__', 'search_fields': u'lead_name,lead_owner,status', 'section_style': u'Tabbed', 'server_code_error': u' ', @@ -31,8 +31,8 @@ # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Lead', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -40,8 +40,8 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Lead', 'parentfield': u'permissions', 'parenttype': u'DocType', @@ -50,90 +50,14 @@ # DocType, Lead { - 'doctype': 'DocType', - 'name': u'Lead' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Guest', - 'write': 1 + u'doctype': u'DocType', + u'name': u'Lead' }, # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'basic_info', 'fieldtype': u'Section Break', 'label': u'Basic Info', @@ -143,7 +67,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break0', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -155,7 +79,7 @@ { 'colour': u'White:FFF', 'description': u'To manage multiple series please go to Setup > Manage Series', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'naming_series', 'fieldtype': u'Select', 'label': u'Naming Series', @@ -170,7 +94,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'lead_name', 'fieldtype': u'Data', 'in_filter': 1, @@ -186,7 +110,7 @@ { 'colour': u'White:FFF', 'description': u'Name of organization from where lead has come', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'company_name', 'fieldtype': u'Data', 'in_filter': 1, @@ -202,7 +126,8 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + 'description': u'Source of the lead. If via a campaign, select "Campaign"', + u'doctype': u'DocField', 'fieldname': u'source', 'fieldtype': u'Select', 'in_filter': 1, @@ -210,7 +135,7 @@ 'no_copy': 1, 'oldfieldname': u'source', 'oldfieldtype': u'Select', - 'options': u"\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWebsite", + 'options': u'\nAdvertisement\nBlog\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite', 'permlevel': 0, 'reqd': 1, 'search_index': 0, @@ -221,7 +146,8 @@ { 'colour': u'White:FFF', 'depends_on': u"eval:doc.source == 'Existing Customer'", - 'doctype': u'DocField', + 'description': u'Source of th', + u'doctype': u'DocField', 'fieldname': u'customer', 'fieldtype': u'Link', 'hidden': 0, @@ -237,7 +163,7 @@ 'colour': u'White:FFF', 'depends_on': u"eval:doc.source == 'Campaign'", 'description': u'Enter campaign name if the source of lead is campaign.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'campaign_name', 'fieldtype': u'Link', 'hidden': 0, @@ -250,7 +176,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break1', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -261,7 +187,7 @@ { 'colour': u'White:FFF', 'default': u'Open', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'status', 'fieldtype': u'Select', 'in_filter': 1, @@ -279,7 +205,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'type', 'fieldtype': u'Select', 'in_filter': 1, @@ -293,7 +219,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'remark', 'fieldtype': u'Small Text', 'label': u'Remark', @@ -304,7 +230,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'communication_history', 'fieldtype': u'Section Break', 'label': u'Communication History', @@ -315,7 +241,7 @@ { 'allow_on_submit': 0, 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'communication_html', 'fieldtype': u'HTML', 'label': u'Communication HTML', @@ -326,7 +252,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_info', 'fieldtype': u'Section Break', 'label': u'Contact Info', @@ -337,7 +263,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'phone', 'fieldtype': u'Data', 'label': u'Phone', @@ -349,7 +275,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'mobile_no', 'fieldtype': u'Data', 'label': u'Mobile No.', @@ -360,7 +286,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'email_id', 'fieldtype': u'Data', 'label': u'Email Id', @@ -372,7 +298,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'fax', 'fieldtype': u'Data', 'label': u'Fax', @@ -383,7 +309,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'website', 'fieldtype': u'Data', 'label': u'Website', @@ -396,7 +322,7 @@ { 'colour': u'White:FFF', 'description': u'To manage Territory, click here', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'territory', 'fieldtype': u'Link', 'label': u'Territory', @@ -409,7 +335,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break2', 'fieldtype': u'Column Break', 'permlevel': 0 @@ -417,7 +343,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_line1', 'fieldtype': u'Data', 'label': u'Address Line 1', @@ -430,7 +356,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_line2', 'fieldtype': u'Data', 'label': u'Address Line 2', @@ -442,7 +368,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'city', 'fieldtype': u'Data', 'label': u'City', @@ -455,7 +381,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'country', 'fieldtype': u'Select', 'label': u'Country', @@ -471,7 +397,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'state', 'fieldtype': u'Data', 'label': u'State', @@ -484,7 +410,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'pincode', 'fieldtype': u'Data', 'label': u'Pin Code', @@ -497,7 +423,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'more_info', 'fieldtype': u'Section Break', 'label': u'More Info', @@ -508,7 +434,7 @@ # DocField { 'default': u'__user', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'lead_owner', 'fieldtype': u'Link', 'in_filter': 1, @@ -522,7 +448,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'market_segment', 'fieldtype': u'Select', 'hidden': 0, @@ -538,7 +464,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'industry', 'fieldtype': u'Link', 'label': u'Industry', @@ -550,7 +476,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'request_type', 'fieldtype': u'Select', 'label': u'Request Type', @@ -562,7 +488,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'fiscal_year', 'fieldtype': u'Select', 'hidden': 1, @@ -576,7 +502,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break3', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -588,7 +514,7 @@ { 'allow_on_submit': 0, 'depends_on': u"eval:doc.status == 'Lead Lost'", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'order_lost_reason', 'fieldtype': u'Link', 'hidden': 0, @@ -604,7 +530,7 @@ 'allow_on_submit': 0, 'colour': u'White:FFF', 'description': u'Your sales person who will contact the lead in future', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_by', 'fieldtype': u'Link', 'hidden': 0, @@ -624,7 +550,7 @@ 'allow_on_submit': 0, 'colour': u'White:FFF', 'description': u'Your sales person will get a reminder on this date to contact the lead', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_date', 'fieldtype': u'Date', 'in_filter': 1, @@ -642,7 +568,7 @@ 'colour': u'White:FFF', 'depends_on': u'eval:!doc.__islocal', 'description': u'Date on which the lead was last contacted', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'last_contact_date', 'fieldtype': u'Date', 'label': u'Last Contact Date', @@ -655,7 +581,8 @@ # DocField { - 'doctype': u'DocField', + 'colour': u'White:FFF', + u'doctype': u'DocField', 'fieldname': u'company', 'fieldtype': u'Link', 'label': u'Company', @@ -663,12 +590,12 @@ 'oldfieldtype': u'Link', 'options': u'Company', 'permlevel': 0, - 'reqd': 1 + 'reqd': 0 }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'trash_reason', 'fieldtype': u'Small Text', 'label': u'Trash Reason', @@ -681,7 +608,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'unsubscribed', 'fieldtype': u'Check', 'label': u'Unsubscribed', @@ -690,10 +617,86 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'blog_subscriber', 'fieldtype': u'Check', 'label': u'Blog Subscriber', 'permlevel': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Guest', + 'write': 1 } ] \ No newline at end of file diff --git a/erpnext/startup/schedule_handlers.py b/erpnext/startup/schedule_handlers.py index 424482b2af4..f3eb05a8245 100644 --- a/erpnext/startup/schedule_handlers.py +++ b/erpnext/startup/schedule_handlers.py @@ -28,10 +28,6 @@ def execute_all(): # pull emails from support.doctype.support_ticket import get_support_mails run_fn(get_support_mails) - - # run recurring invoices - from accounts.doctype.gl_control.gl_control import manage_recurring_invoices - run_fn(manage_recurring_invoices) # bulk email from webnotes.utils.email_lib.bulk import flush @@ -42,6 +38,10 @@ def execute_daily(): from setup.doctype.email_digest.email_digest import send run_fn(send) + # run recurring invoices + from accounts.doctype.gl_control.gl_control import manage_recurring_invoices + run_fn(manage_recurring_invoices) + # send bulk emails from webnotes.utils.email_lib.bulk import clear_outbox run_fn(clear_outbox) diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 60104645b02..67a7486e40b 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -100,10 +100,6 @@ erpnext.startup.start = function() { if(wn.control_panel.custom_startup_code) eval(wn.control_panel.custom_startup_code); } - - - $('body').append('') } diff --git a/erpnext/utilities/page/calendar/calendar.js b/erpnext/utilities/page/calendar/calendar.js index 9aa5df87dc3..3d3519b4022 100644 --- a/erpnext/utilities/page/calendar/calendar.js +++ b/erpnext/utilities/page/calendar/calendar.js @@ -83,6 +83,7 @@ Calendar.prototype.show_event = function(ev, cal_ev) { d.make_body([ ['HTML','Heading'] ,['Text','Description'] + ,['HTML', 'Ref Link'] ,['Check', 'Public Event'] ,['Check', 'Cancel Event'] ,['HTML', 'Event Link'] @@ -111,12 +112,17 @@ Calendar.prototype.show_event = function(ev, cal_ev) { this.widgets['Public Event'].checked = true; this.widgets['Event Link'].innerHTML = ''; + this.widgets['Ref Link'].innerHTML = ''; - // link - var div = $a(this.widgets['Event Link'], 'div', 'link_type', {margin:'4px 0px'}); - div.onclick = function() { me.event_dialog.hide(); loaddoc('Event', me.event_dialog.ev.name); } - div.innerHTML = 'View Event details, add or edit participants'; - + if(this.ev.ref_type) { + $(repl('Reference: %(ref_type)s: %(ref_name)s', this.ev)) + .appendTo(this.widgets['Ref Link']) + } + + $(repl('More Options', this.ev)) + .appendTo(this.widgets['Event Link']) } // event save diff --git a/erpnext/utilities/page/markdown_reference/markdown_reference.html b/erpnext/utilities/page/markdown_reference/markdown_reference.html index 5af414f275f..cdf646cad3c 100644 --- a/erpnext/utilities/page/markdown_reference/markdown_reference.html +++ b/erpnext/utilities/page/markdown_reference/markdown_reference.html @@ -6,7 +6,7 @@
-
+

Phrase Emphasis

*italic*   **bold**
 _italic_   __bold__
diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js
index 1ab89827787..89c1ed8024b 100644
--- a/erpnext/utilities/page/todo/todo.js
+++ b/erpnext/utilities/page/todo/todo.js
@@ -144,10 +144,10 @@ erpnext.todo.make_dialog = function(det) {
 			width: 480,
 			title: 'To Do', 
 			fields: [
-				{fieldtype:'Date', fieldname:'date', label:'Event Date', reqd:1},
 				{fieldtype:'Text', fieldname:'description', label:'Description', 
 					reqd:1, description:'Use markdown to \
 						format content'},
+				{fieldtype:'Date', fieldname:'date', label:'Event Date', reqd:1},
 				{fieldtype:'Check', fieldname:'checked', label:'Completed'},
 				{fieldtype:'Select', fieldname:'priority', label:'Priority', reqd:1, 'options':['Medium','High','Low'].join('\n')},
 				{fieldtype:'Button', fieldname:'save', label:'Save'}
diff --git a/erpnext/website/blog.py b/erpnext/website/blog.py
index 1ebea29d7ce..f0e9b711b76 100644
--- a/erpnext/website/blog.py
+++ b/erpnext/website/blog.py
@@ -17,7 +17,8 @@ def get_blog_list(args=None):
 		select
 			cache.name as name, cache.html as content,
 			blog.owner as owner, blog.creation as published,
-			blog.title as title
+			blog.title as title, (select count(name) from `tabComment` where
+				comment_doctype='Blog' and comment_docname=blog.name) as comments
 		from `tabWeb Cache` cache, `tabBlog` blog
 		where cache.doc_type = 'Blog' and blog.page_name = cache.name
 		order by published desc, name asc"""
@@ -104,7 +105,24 @@ def add_comment(args=None):
 	
 	# get html of comment row
 	comment_html = website.web_cache.build_html(template_args)
-
+	
+	# notify commentors 
+	commentors = [d[0] for d in webnotes.conn.sql("""select comment_by from tabComment where
+		comment_doctype='Blog' and comment_docname=%s and
+		ifnull(unsubscribed, 0)=0""", args.get('comment_docname'))]
+	
+	blog = webnotes.conn.sql("""select * from tabBlog where name=%s""", 
+		args.get('comment_docname'), as_dict=1)[0]
+	
+	from webnotes.utils.email_lib.bulk import send
+	send(recipients=commentors + [blog['owner']], 
+		doctype='Comment', 
+		email_field='comment_by', 
+		first_name_field="comment_by_fullname",
+		last_name_field="NA", 
+		subject='New Comment on Blog: ' + blog['title'], 
+		message='

%(comment)s

By %(comment_by_fullname)s

' % args) + return comment_html @webnotes.whitelist(allow_guest=True) @@ -119,7 +137,8 @@ def add_subscriber(): lead = Document('Lead', name[0][0]) else: lead = Document('Lead') - + + if not lead.source: lead.source = 'Blog' lead.unsubscribed = 0 lead.blog_subscriber = 1 lead.lead_name = full_name diff --git a/erpnext/website/templates/js/blog.js b/erpnext/website/templates/js/blog.js index 78dd3b774fd..76b9fb66ec5 100644 --- a/erpnext/website/templates/js/blog.js +++ b/erpnext/website/templates/js/blog.js @@ -22,10 +22,19 @@ wn.pages['{{ name }}'].onload = function(wrapper) { hide_refresh: true, no_toolbar: true, render_row: function(parent, data) { + if(!data.comments) { + data.comment_text = 'No comments yet.' + } else if (data.comments=1) { + data.comment_text = '1 comment.' + } else { + data.comment_text = data.comments + ' comments.' + } + if(data.content && data.content.length==1000) { data.content += repl('... (read on)', data); } parent.innerHTML = repl('

%(title)s

\ +
%(comment_text)s
\ %(content)s

', data); }, page_length: 10 diff --git a/public/css/all-app.css b/public/css/all-app.css index fe41bef55bf..487290b62a2 100644 --- a/public/css/all-app.css +++ b/public/css/all-app.css @@ -1969,7 +1969,7 @@ span, div, td, input, textarea, button, select { } -pre { +.markdown pre { background-color: #F5F5F5; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 4px 4px 4px 4px; @@ -1982,7 +1982,7 @@ pre { word-wrap: break-word; } -code, pre { +.markdown code, .markdown pre { border-radius: 3px 3px 3px 3px; color: #333333; font-family: Menlo,Monaco,Consolas,"Courier New",monospace; diff --git a/public/css/all-web.css b/public/css/all-web.css index 7ae3ff69744..fca3485b427 100644 --- a/public/css/all-web.css +++ b/public/css/all-web.css @@ -1830,7 +1830,7 @@ span, div, td, input, textarea, button, select { } -pre { +.markdown pre { background-color: #F5F5F5; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 4px 4px 4px 4px; @@ -1843,7 +1843,7 @@ pre { word-wrap: break-word; } -code, pre { +.markdown code, .markdown pre { border-radius: 3px 3px 3px 3px; color: #333333; font-family: Menlo,Monaco,Consolas,"Courier New",monospace; diff --git a/public/js/all-app.js b/public/js/all-app.js index bfd16e9d152..dc506fd3088 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -1801,10 +1801,9 @@ this.cleanup_refresh(this);} _f.Frm.prototype.cleanup_refresh=function(){var me=this;if(me.fields_dict['amended_from']){if(me.doc.amended_from){unhide_field('amended_from');unhide_field('amendment_date');}else{hide_field('amended_from');hide_field('amendment_date');}} if(me.fields_dict['trash_reason']){if(me.doc.trash_reason&&me.doc.docstatus==2){unhide_field('trash_reason');}else{hide_field('trash_reason');}} if(me.meta.autoname&&me.meta.autoname.substr(0,6)=='field:'&&!me.doc.__islocal){var fn=me.meta.autoname.substr(6);cur_frm.toggle_display(fn,false);}} -_f.Frm.prototype.refresh_dependency=function(){var me=this;var doc=locals[this.doctype][this.docname];var dep_dict={};var has_dep=false;for(fkey in me.fields){var f=me.fields[fkey];f.dependencies_clear=true;var guardian=f.df.depends_on;if(guardian){if(!dep_dict[guardian]) -dep_dict[guardian]=[];dep_dict[guardian][dep_dict[guardian].length]=f;has_dep=true;}} +_f.Frm.prototype.refresh_dependency=function(){var me=this;var doc=locals[this.doctype][this.docname];var has_dep=false;for(fkey in me.fields){var f=me.fields[fkey];f.dependencies_clear=true;if(f.df.depends_on){has_dep=true;}} if(!has_dep)return;for(var i=me.fields.length-1;i>=0;i--){var f=me.fields[i];f.guardian_has_value=true;if(f.df.depends_on){var v=doc[f.df.depends_on];if(f.df.depends_on.substr(0,5)=='eval:'){f.guardian_has_value=eval(f.df.depends_on.substr(5));}else if(f.df.depends_on.substr(0,3)=='fn:'){f.guardian_has_value=me.runclientscript(f.df.depends_on.substr(3),me.doctype,me.docname);}else{if(v||(v==0&&!v.substr)){}else{f.guardian_has_value=false;}} -if(f.guardian_has_value){if(f.grid)f.grid.show();else $ds(f.wrapper);}else{if(f.grid)f.grid.hide();else $dh(f.wrapper);}}}} +if(f.guardian_has_value){f.df.hidden=false;f.refresh()}else{f.df.hidden=true;f.refresh()}}}} _f.Frm.prototype.setnewdoc=function(docname){if(this.opendocs[docname]){this.docname=docname;return;} Meta.make_local_dt(this.doctype,docname);this.docname=docname;var me=this;var viewname=docname;if(this.meta.issingle)viewname=this.doctype;this.runclientscript('onload',this.doctype,this.docname);this.is_editable[docname]=1;if(this.meta.read_only_onload)this.is_editable[docname]=0;this.opendocs[docname]=true;} _f.Frm.prototype.edit_doc=function(){this.is_editable[this.docname]=true;this.refresh();} @@ -1913,7 +1912,7 @@ if(cur_frm.editable&&cur_frm.doc.docstatus>0){if(this.df.allow_on_submit&&cur_fr if(this.df['default'].toLowerCase()=='no add rows'){this.grid.can_add_rows=false;}} if(st=='Write'){this.grid.show();}else if(st=='Read'){this.grid.show();}else{this.grid.hide();} this.grid.refresh();} -_f.TableField.prototype.set=function(v){};_f.TableField.prototype.set_input=function(v){};_f.CodeField=function(){};_f.CodeField.prototype=new Field();_f.CodeField.prototype.make_input=function(){var me=this;this.label_span.innerHTML=this.df.label;if(this.df.fieldtype=='Text Editor'){this.input=$a(this.input_area,'text_area','',{fontSize:'12px'});this.myid=wn.dom.set_unique_id(this.input);$(me.input).tinymce({script_url:'js/lib/tiny_mce_33/tiny_mce.js',theme:"advanced",plugins:"style,inlinepopups,table",extended_valid_elements:"div[id|dir|class|align|style]",width:'100%',height:'360px',theme_advanced_buttons1:"bold,italic,underline,strikethrough,hr,|,justifyleft,justifycenter,justifyright,|,formatselect,fontselect,fontsizeselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,code,|,forecolor,backcolor,|,tablecontrols",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",content_css:"js/lib/tiny_mce_33/custom_content.css?q=1",oninit:function(){me.init_editor();}});this.input.set_input=function(v){if(me.editor){me.editor.setContent(v);}else{$(me.input).val(v);}} +_f.TableField.prototype.set=function(v){};_f.TableField.prototype.set_input=function(v){};_f.CodeField=function(){};_f.CodeField.prototype=new Field();_f.CodeField.prototype.make_input=function(){var me=this;this.label_span.innerHTML=this.df.label;if(this.df.fieldtype=='Text Editor'){this.input=$a(this.input_area,'text_area','',{fontSize:'12px'});this.myid=wn.dom.set_unique_id(this.input);$(me.input).tinymce({script_url:'js/lib/tiny_mce_33/tiny_mce.js',theme:"advanced",plugins:"style,inlinepopups,table,advimage",extended_valid_elements:"div[id|dir|class|align|style]",width:'100%',height:'360px',theme_advanced_buttons1:"bold,italic,underline,strikethrough,hr,|,justifyleft,justifycenter,justifyright,|,formatselect,fontselect,fontsizeselect,|,image",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,code,|,forecolor,backcolor,|,tablecontrols",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",content_css:"js/lib/tiny_mce_33/custom_content.css?q=1",oninit:function(){me.init_editor();}});this.input.set_input=function(v){if(me.editor){me.editor.setContent(v);}else{$(me.input).val(v);}} this.input.onchange=function(){me.set(me.editor.getContent());me.run_trigger();} this.get_value=function(){return me.editor.getContent();}}else{wn.require('js/lib/ace/ace.js');$(this.input_area).css('border','1px solid #aaa');this.pre=$a(this.input_area,'pre','',{position:'relative',height:'400px',width:'100%'});this.input={};this.myid=wn.dom.set_unique_id(this.pre);this.editor=ace.edit(this.myid);if(me.df.options=='Markdown'||me.df.options=='HTML'){wn.require('js/lib/ace/mode-html.js');var HTMLMode=require("ace/mode/html").Mode;me.editor.getSession().setMode(new HTMLMode());} else if(me.df.options=='Javascript'){wn.require('js/lib/ace/mode-javascript.js');var JavascriptMode=require("ace/mode/javascript").Mode;me.editor.getSession().setMode(new JavascriptMode());} @@ -2265,9 +2264,7 @@ if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil. This ERPNext subscription has expired. \
',{expiry_string:expiry_string}));}} erpnext.set_about();if(wn.control_panel.custom_startup_code) -eval(wn.control_panel.custom_startup_code);} -$('body').append('')} +eval(wn.control_panel.custom_startup_code);}} erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;} if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}} show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);show_in_circle('unanswered_questions',r.message.unanswered_questions);}else{clearInterval(wn.updates.id);}} diff --git a/public/js/all-web.js b/public/js/all-web.js index 979f8e9477d..e231046e4da 100644 --- a/public/js/all-web.js +++ b/public/js/all-web.js @@ -725,9 +725,7 @@ if(wn.boot.expires_on&&in_list(user_roles,'System Manager')){var today=dateutil. This ERPNext subscription has expired. \
',{expiry_string:expiry_string}));}} erpnext.set_about();if(wn.control_panel.custom_startup_code) -eval(wn.control_panel.custom_startup_code);} -$('body').append('')} +eval(wn.control_panel.custom_startup_code);}} erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;} if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}} show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);show_in_circle('unanswered_questions',r.message.unanswered_questions);}else{clearInterval(wn.updates.id);}} diff --git a/public/js/kb_common.js b/public/js/kb_common.js index bbd57f10e6b..97ad5deb8e5 100644 --- a/public/js/kb_common.js +++ b/public/js/kb_common.js @@ -16,7 +16,7 @@ EditableText=function(args){$.extend(this,args);var me=this;me.$w=$(repl('
\ [edit]\ \ - \ \ Cancel\