diff --git a/build.json b/build.json index ebe4589ef00..d9ec1e731ae 100644 --- a/build.json +++ b/build.json @@ -58,7 +58,6 @@ "lib/css/legacy/grid.css", "lib/css/legacy/listing.css", "lib/css/legacy/report.css", - "lib/css/legacy/calendar.css", "lib/css/legacy/autosuggest.css", "lib/css/legacy/dialog.css", "lib/css/legacy/tabs.css", diff --git a/css/all-app.css b/css/all-app.css index 8ebc41eb936..9382352af1a 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -168,9 +168,9 @@ div.std-footer-item { } .layout_wrapper, .layout-wrapper { - -moz-box-shadow: 1px 1px 6px #AAA; - -webkit-box-shadow: 1px 1px 6px #AAA; - box-shadow: 1px 1px 6px #AAA; + -moz-box-shadow: 1px 1px 8px #555; + -webkit-box-shadow: 1px 1px 8px #555; + box-shadow: 1px 1px 8px #555; background-color: #fff; padding: 15px; } @@ -212,6 +212,21 @@ div.std-footer-item { clear: both; } +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #eee; + border: 1px solid rgba(0, 0, 0, 0.05); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); +} + /* * lib/css/legacy/menus.css */ @@ -903,180 +918,6 @@ table.builder_tab td { width: 33%; padding: 2px; } -/* - * lib/css/legacy/calendar.css - *//**** CALENDAR ****/ - -.caldiv { - position:absolute; - visibility:hidden; - background-color:white; - width: 144px; - z-index: 301; /* always on top(?) */ -} - - - -div.cal_wrapper { } -div.cal_body { - margin: 16px; - background-color: #DDD; - position: relative; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - -div.cal_head { - margin: 16px; - margin-bottom: 0px; -} -div.cal_head div { - font-size: 18px; - color: #666; - padding-top: 8px; -} - -div.cal_view_body { - margin: 16px; -} - -div.cal_view_body_plain { - margin: 16px; -} - -div.cal_month_head { -} - -div.cal_month_body { - border-top: 1px solid #888; -} - -.cal_month_headtable { - /*table-layout:fixed;*/ - width: 100%; -} - -.cal_month_name { - width: 100%; - color: #888; - font-size: 14px; - font-weight: bold; - text-align: center; - padding: 4px; -} - -.cal_month_headtable tr td{ - font-size: 12px; - font-weight: bold; - text-align: center; - padding: 4px; -} - -table.cal_month_table { - border-collapse: collapse; - /*table-layout:fixed;*/ - height: 100%; - width: 100%; -} - -table.cal_month_table td { - width: 14.29%; - height: 20%; - /*overflow:hidden;*/ - padding:0px; -} - -div.cal_month_date { - width:100%; - height:25%; - font-size: 10px; - overflow:hidden; - /*background-color: #EEF;*/ -} - -div.cal_month_date_holiday { - /*background-color: #FFF;*/ -} - -div.cal_month_unit { - width:100%; - height:75%; - overflow:hidden; - cursor:pointer; - /*background-color:#FFF;*/ -} - -div.cal_vu_disabled { - background-color:#FFF; - cursor:default; -} - -table.cal_day_table { - border-collapse: collapse; - width: 100%; -} - -table.cal_day_table td { -} - -div.cal_day_body { - width: 100%; - height: 80%; - overflow-y: auto; - overflow-x: hidden; - border-top: 1px solid #AAA; -} - -div.cal_day_unit{ - width:100%; - cursor:pointer; -} - -table.cal_week_table { - border-collapse: collapse; - width: 100%; -} - -table.cal_week_table td { - width: 12.5%; -} - -div.cal_week_body { - width: 100%; - height: 80%; - overflow-y: auto; - overflow-x: hidden; - border-top: 1px solid #888; -} - -div.cal_week_unit{ - width: 100%; - cursor:pointer; -} - -div.cal_event { - width: 100%; - height: 12px; - overflow: hidden; - font-size: 11px; - color: #00B; - margin-bottom: 2px; - text-decoration: underline; -} - -div.cal_event_Public { - color: GREEN; -} - -div.cal_event_Private { - color: BLUE; -} - -div.cal_event_hover { - text-decoration: underline; -} - /* * lib/css/legacy/autosuggest.css *//* diff --git a/css/all-web.css b/css/all-web.css index d7cb10cbafc..971b7cad55a 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -168,9 +168,9 @@ div.std-footer-item { } .layout_wrapper, .layout-wrapper { - -moz-box-shadow: 1px 1px 6px #AAA; - -webkit-box-shadow: 1px 1px 6px #AAA; - box-shadow: 1px 1px 6px #AAA; + -moz-box-shadow: 1px 1px 8px #555; + -webkit-box-shadow: 1px 1px 8px #555; + box-shadow: 1px 1px 8px #555; background-color: #fff; padding: 15px; } @@ -212,6 +212,21 @@ div.std-footer-item { clear: both; } +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #eee; + border: 1px solid rgba(0, 0, 0, 0.05); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); +} + /* * lib/css/legacy/menus.css */ diff --git a/erpnext/knowledge_base/page/kb_common/kb_common.js b/erpnext/knowledge_base/page/kb_common/kb_common.js index 44193419df7..a734f65ed92 100644 --- a/erpnext/knowledge_base/page/kb_common/kb_common.js +++ b/erpnext/knowledge_base/page/kb_common/kb_common.js @@ -24,7 +24,6 @@ KBItemToolbar = function(args, kb) { this.make = function() { this.wrapper = $a(this.parent, 'div', '', {}); this.line1 = $a(this.wrapper, 'div', '', {color: '#888', fontSize:'11px', margin:'7px 0px'}); - this.line2 = $a(this.wrapper, 'div','',{marginBottom:'7px'}); this.make_timestamp(); this.make_vote(); if(this.with_tags) @@ -45,7 +44,8 @@ KBItemToolbar = function(args, kb) { } this.make_vote = function() { - new KBPoints(this.line2, this.det.points, this.det._users_voted, this.doctype, this.det.name, this.det.owner); + this.line1.innerHTML += ' | ' + new KBPoints(this.line1, this.det.points, this.det._users_voted, this.doctype, this.det.name, this.det.owner); } this.del = function() { @@ -57,7 +57,8 @@ KBItemToolbar = function(args, kb) { } this.make_tags = function() { - this.tags_area = $a(this.line2, 'span', 'kb-tags') + this.line1.innerHTML += ' | ' + this.tags_area = $a(this.line1, 'span', 'kb-tags') this.tags = new TagList(this.tags_area, this.det._user_tags && (this.det._user_tags.split(',')), this.doctype, this.det.name, 0, kb.set_tag_filter) @@ -73,7 +74,7 @@ KBPoints = function(parent, points, voted, dt, dn, owner) { var me = this; voted = voted ? voted.split(',') : []; - this.wrapper = $a(parent, 'span', '', {fontSize: '11px', marginRight: '13px'}); + this.wrapper = $a(parent, 'span', '', {fontSize: '11px', marginRight: '7px', marginLeft: '7px'}); this.render_points = function(p) { if(!this.points_area) @@ -115,16 +116,14 @@ EditableText = function(args) { $.extend(this, args); var me = this; - this.display = $a(me.parent, 'div', me.disp_class, '', me.text); - this.input = $a(me.parent, 'textarea', me.inp_class, {display:'none'}); + this.wrapper = $a(me.parent, 'div'); + this.display = $a(me.wrapper, 'div', me.disp_class, '', me.text); + this.input = $a(me.wrapper, 'textarea', me.inp_class, {display:'none'}); - var div = $a(me.parent, 'div', '', {marginTop:'5px', height:'23px'}); + var div = $a(me.wrapper, 'div', '', {marginTop:'5px', height:'23px'}); // edit text - this.edit_btn = $a(div, 'span', '', {color:'#333', marginLeft:'-2px', cursor:'pointer', padding:'3px', backgroundColor:'#ddd', cssFloat: 'left'}); - $br(this.edit_btn, '3px') - $a(this.edit_btn, 'div', 'wn-icon ic-pencil', {marginBottom:'-2px', cssFloat:'left'} ); - $a(this.edit_btn, 'span', 'link_type', {marginLeft:'3px', color:'#555', fontSize:'11px'}, 'Edit'); + this.edit_btn = $a(div, 'a', '', {cursor:'pointer'}, '[edit]'); this.edit_btn.onclick = function() { me.input.value = me.display.innerHTML; diff --git a/erpnext/knowledge_base/page/question_view/question_view.css b/erpnext/knowledge_base/page/question_view/question_view.css index 0c2526cc9fe..4472da7d81d 100644 --- a/erpnext/knowledge_base/page/question_view/question_view.css +++ b/erpnext/knowledge_base/page/question_view/question_view.css @@ -24,9 +24,6 @@ } .qv-question-wrapper { - margin: 7px 0px 13px 0px; - padding-bottom: 7px; - border-bottom: 1px solid #CCC; } .qv-add-answer { @@ -43,7 +40,5 @@ } .qv-answer { - margin: 7px 0px 7px 0px; - padding-bottom: 7px; - border-bottom: 1px solid #CCC; + } \ No newline at end of file diff --git a/erpnext/knowledge_base/page/question_view/question_view.html b/erpnext/knowledge_base/page/question_view/question_view.html new file mode 100644 index 00000000000..9939332e32f --- /dev/null +++ b/erpnext/knowledge_base/page/question_view/question_view.html @@ -0,0 +1,13 @@ +
+ × +

Knowledge Base

+
+

← Back to Questions

+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/erpnext/knowledge_base/page/question_view/question_view.js b/erpnext/knowledge_base/page/question_view/question_view.js index 9d36b15b19d..fd401a4ea53 100644 --- a/erpnext/knowledge_base/page/question_view/question_view.js +++ b/erpnext/knowledge_base/page/question_view/question_view.js @@ -14,17 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pscript['onload_question-view'] = function() { -// - var w = page_body.pages['question-view']; - w.className = 'layout_wrapper'; - new PageHeader(w, 'Knowledge Base'); - w.link = $ln($a(w, 'div'), '< Back to all questions', function() { loadpage('questions'); }) - w.body = $a(w, 'div', 'qv-body'); - +pscript['onload_question-view'] = function(wrapper) { + wrapper.add_answer_area = $('.add-answer-area').get(0); } pscript['refresh_question-view'] = function() { + $('.add-answer-area').empty(); // href var qid = window.location.hash.split('/')[1]; if(qid) { @@ -39,16 +34,11 @@ pscript.question_view = function(qid, qtext) { KBQuestionView = function(w, qid, qtext) { var me = this; - - w.body.innerHTML = ''; - w.question_area = $a(w.body, 'div', 'social qv-question-wrapper'); - w.answer_area = $a(w.body, 'div', 'social qv-answer-wrapper'); - w.add_answer_link = $a(w.body, 'div', '', {margin:'3px 0px'}); - w.add_answer_area = $a(w.body, 'div', 'qv-add-answer'); - + this.make_question = function() { + $(w).find('.qv-question-wrapper').empty(); new EditableText({ - parent: w.question_area, + parent: $(w).find('.qv-question-wrapper').get(0), dt: 'Question', dn: qid, fieldname: 'question', @@ -62,8 +52,9 @@ KBQuestionView = function(w, qid, qtext) { // answer list this.make_answer_list = function() { + $(w).find('.qv-answer-wrapper').empty(); this.ans_list = new KBAnswerList({ - parent: w.answer_area, + parent: $(w).find('.qv-answer-wrapper').get(0), qid: qid }) } @@ -80,11 +71,12 @@ KBQuestionView = function(w, qid, qtext) { // add a link to open add answer this.make_answer_box_link = function() { - $a(w.add_answer_link, 'span', 'link_type', null, '+ Add your answer', - function() { - $dh(w.add_answer_link); - me.make_answer_box(); - }); + $('.add-answer-link').html('').find('button').click( + function() { + $(this).toggle(false); + me.make_answer_box(); + }); } // answer box @@ -142,7 +134,7 @@ KBAnswerList = function(args) { this.list = new wn.widgets.Listing({ parent: me.parent, as_dict: 1, - no_results_message: 'No answers yet, be the first one to answer!', + no_result_message: 'No answers yet, be the first one to answer!', render_row: function(body, data) { new KBAnswer(body, data, me) }, @@ -151,7 +143,8 @@ KBAnswerList = function(args) { +"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 " +"where question='%(qid)s' and t1.owner = t2.name " +"order by t1.points desc, t1.modified desc", {qid: me.qid}) - } + }, + title: 'Answers' }); this.list.run(); @@ -168,7 +161,7 @@ KBAnswerList = function(args) { // points yyy KBAnswer = function(body, data, ans_list) { body.className = 'qv-answer'; - new EditableText({ + var edtxt = new EditableText({ parent: body, dt: 'Answer', dn: data.name, @@ -179,6 +172,8 @@ KBAnswer = function(body, data, ans_list) { rich_text: 1 }); + $(edtxt.wrapper).addClass('well'); + var div = $a(body, 'div', '', {}) new KBItemToolbar({ parent: div, diff --git a/erpnext/knowledge_base/page/questions/questions.css b/erpnext/knowledge_base/page/questions/questions.css index b8a80c4fcde..aa97ffc5d0b 100644 --- a/erpnext/knowledge_base/page/questions/questions.css +++ b/erpnext/knowledge_base/page/questions/questions.css @@ -13,7 +13,6 @@ div.kb-search-wrapper textarea { } .kb-questions { - color: #000; } .kb-question-details { diff --git a/erpnext/knowledge_base/page/questions/questions.html b/erpnext/knowledge_base/page/questions/questions.html index e69de29bb2d..c76f4902bb1 100644 --- a/erpnext/knowledge_base/page/questions/questions.html +++ b/erpnext/knowledge_base/page/questions/questions.html @@ -0,0 +1,19 @@ +
+
+ × +

Knowledge Base

+
+
+ +
+ + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/erpnext/knowledge_base/page/questions/questions.js b/erpnext/knowledge_base/page/questions/questions.js index 30d4ba80d25..7261cd88f96 100644 --- a/erpnext/knowledge_base/page/questions/questions.js +++ b/erpnext/knowledge_base/page/questions/questions.js @@ -14,25 +14,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pscript.onload_questions = function() { - var w = page_body.pages['questions']; +pscript.onload_questions = function(wrapper) { + body = $(wrapper).find('.layout-main-section').get(0); - var tab = make_table(w, 1, 2, '100%', ['75%', '25%'], {}); - var body = $a($td(tab,0,0),'div','layout_wrapper'); - - new PageHeader(body, 'Knowledge Base'); - // kb var kb = new KnowledgeBase(body); // sidebar - $y($td(tab, 0, 1), {paddingTop:'53px'}); - this.sidebar = new wn.widgets.PageSidebar($td(tab, 0, 1), { + this.sidebar = new wn.widgets.PageSidebar($(wrapper).find('.layout-side-section').get(0), { sections: [ { title: 'Top Tags', render: function(body) { - new wn.widgets.TagCloud(body, 'Question', function(tag) { kb.set_tag_filter(tag) }); + new wn.widgets.TagCloud(body, 'Question', function(tag) + { kb.set_tag_filter(tag) }); } } ] @@ -50,11 +45,14 @@ function KnowledgeBase(w) { this.tag_filter_dict = {}; this.make_search_bar = function() { - this.search = $a($a(w,'div','kb-search-wrapper'), 'textarea'); + this.search = $(w).find('.kb-search-wrapper textarea').get(0); - var div = $a(w,'div','kb-btn-wrapper'); - $btn(div, 'Search', function() { me.run() }, {fontSize:'14px'}); - $btn(div, 'Ask', function() { me.ask() }, {fontSize:'14px'}); + $(w).find('.btn.search').click(function() { + me.run(); + }) + $(w).find('.btn.ask').click(function() { + me.ask(); + }) } // ask a new question diff --git a/erpnext/utilities/page/calendar/calendar.css b/erpnext/utilities/page/calendar/calendar.css index e69de29bb2d..bcf7cce4cb3 100644 --- a/erpnext/utilities/page/calendar/calendar.css +++ b/erpnext/utilities/page/calendar/calendar.css @@ -0,0 +1,178 @@ +/**** CALENDAR ****/ + +div.cal_body { + margin: 16px; + background-color: #DDD; + position: relative; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + padding: 16px; + -moz-box-shadow: 1px 1px 8px #555; + -webkit-box-shadow: 1px 1px 8px #555; + box-shadow: 1px 1px 8px #555; +} + +div.cal_body h4 { + text-align: center; +} + +div.cal_head { + margin: 16px; + margin-bottom: 0px; +} +div.cal_head div { + font-size: 18px; + color: #666; + padding-top: 8px; +} + +div.cal_toolbar { +} + +div.cal_toolbar .btn { + text-align: center; + margin: 0px; + margin-left: -1px; +} + +div.cal_view_body { +} + +div.cal_view_body_plain { + margin: 16px; +} + +div.cal_month_head { + margin: 8px 0px 8px 0px; + height: 30px; +} + +div.cal_month_head .btn { + float: right; +} + +span.cal_view_title { + display: inline-block; + font-size: 20px; +} + +div.cal_month_body { +} + +.cal_month_headtable { + /*table-layout:fixed;*/ + width: 100%; +} + +.cal_month_name { + width: 100%; + color: #888; + font-size: 14px; + font-weight: bold; + text-align: center; +} + +.cal_month_headtable tr td{ + font-size: 12px; + font-weight: bold; + text-align: center; + padding: 4px; +} + +table.cal_month_table { + border-collapse: collapse; + /*table-layout:fixed;*/ + width: 100%; +} + +table.cal_month_table td { + width: 14.29%; + height: 20%; + /*overflow:hidden;*/ + padding:0px; +} + +div.cal_month_date { + width:100%; + font-size: 10px; + /*background-color: #EEF;*/ +} + +div.cal_month_date_holiday { + /*background-color: #FFF;*/ +} + +div.cal_month_unit { + width:100%; + min-height: 100px; + overflow:hidden; + cursor:pointer; + /*background-color:#FFF;*/ +} + +div.cal_vu_disabled { + background-color:#FFF; + cursor:default; +} + +table.cal_day_table { + border-collapse: collapse; + width: 100%; +} + +table.cal_day_table td { +} + +div.cal_day_body { + width: 100%; + overflow-x: hidden; + border-top: 1px solid #AAA; +} + +div.cal_day_unit{ + width:100%; + cursor:pointer; +} + +table.cal_week_table { + border-collapse: collapse; + width: 100%; +} + +table.cal_week_table td { + width: 12.5%; +} + +div.cal_week_body { + width: 100%; + overflow-x: hidden; + border-top: 1px solid #888; +} + +div.cal_week_unit{ + width: 100%; + cursor:pointer; +} + +div.cal_event { + width: 100%; + height: 12px; + overflow: hidden; + font-size: 11px; + color: #00B; + margin-bottom: 2px; + text-decoration: underline; +} + +div.cal_event_Public { + color: GREEN; +} + +div.cal_event_Private { + color: BLUE; +} + +div.cal_event_hover { + text-decoration: underline; +} diff --git a/erpnext/utilities/page/calendar/calendar.html b/erpnext/utilities/page/calendar/calendar.html index e69de29bb2d..2a5150eeb3e 100644 --- a/erpnext/utilities/page/calendar/calendar.html +++ b/erpnext/utilities/page/calendar/calendar.html @@ -0,0 +1,26 @@ +
+ × +
+ + + + +
+
+ + + +
+
\ No newline at end of file diff --git a/erpnext/utilities/page/calendar/calendar.js b/erpnext/utilities/page/calendar/calendar.js index e69de29bb2d..6e59f21388f 100644 --- a/erpnext/utilities/page/calendar/calendar.js +++ b/erpnext/utilities/page/calendar/calendar.js @@ -0,0 +1,679 @@ +// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com) +// +// MIT License (MIT) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +pscript.onload_calendar = function(wrapper) { + if(!erpnext.calendar) { + erpnext.calendar = new Calendar(); + erpnext.calendar.init(wrapper); + rename_observers.push(erpnext.calendar); + } +} + +///// CALENDAR + +Calendar=function() { + this.views=[]; + this.events = {}; + this.has_event = {}; + this.events_by_name = {}; + this.weekdays = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); +} + +Calendar.prototype.init=function (parent) { + + this.wrapper = parent; + this.body = $('.cal_body').get(0); + + //this.make_head_buttons(); + //this.make_header(); + this.view_title = $('.cal_view_title').get(0); + + this.todays_date = new Date(); + this.selected_date = this.todays_date; + this.selected_hour = 8; + + // Create views + this.views['Month'] = new Calendar.MonthView(this); + this.views['Week'] = new Calendar.WeekView(this); + this.views['Day'] = new Calendar.DayView(this); + + // Month view as initial + this.cur_view = this.views['Day']; + this.views['Day'].show(); + +} + +Calendar.prototype.rename_notify = function(dt, old_name, new_name) { + // calendar + if(dt = 'Event' && this.has_event[old_name]) + this.has_event[old_name] = false; +} + +//------------------------------------------------------ + +Calendar.prototype.show_event = function(ev, cal_ev) { + var me = this; + if(!this.event_dialog) { + var d = new Dialog(400, 400, 'Calendar Event'); + d.make_body([ + ['HTML','Heading'] + ,['Text','Description'] + ,['Check', 'Public Event'] + ,['Check', 'Cancel Event'] + ,['HTML', 'Event Link'] + ,['Button', 'Save'] + ]) + + // show the event when the dialog opens + d.onshow = function() { + // heading + var c = me.selected_date; + var tmp = time_to_ampm(this.ev.event_hour); + tmp = tmp[0]+':'+tmp[1]+' '+tmp[2]; + + this.widgets['Heading'].innerHTML = + '
' + + erpnext.calendar.weekdays[c.getDay()] + ', ' + c.getDate() + ' ' + month_list_full[c.getMonth()] + ' ' + c.getFullYear() + + ' - '+tmp+'
'; + + // set + this.widgets['Description'].value = cstr(this.ev.description); + + this.widgets['Public Event'].checked = false; + this.widgets['Cancel Event'].checked = false; + + if(this.ev.event_type=='Public') + this.widgets['Public Event'].checked = true; + + this.widgets['Event 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'; + + } + + // event save + d.widgets['Save'].onclick = function() { + var d = me.event_dialog; + + // save values + d.ev.description = d.widgets['Description'].value; + if(d.widgets['Cancel Event'].checked) d.ev.event_type='Cancel'; + else if(d.widgets['Public Event'].checked) d.ev.event_type='Public'; + + me.event_dialog.hide(); + + // if new event + if(d.cal_ev) + var cal_ev = d.cal_ev; + else + var cal_ev = me.set_event(d.ev); + + cal_ev.save(); + if(me.cur_view)me.cur_view.refresh(); + } + this.event_dialog = d; + } + this.event_dialog.ev = ev; + this.event_dialog.cal_ev = cal_ev ? cal_ev : null; + this.event_dialog.show(); + +} + +//------------------------------------------------------ + +Calendar.prototype.add_event = function() { + + var ev = LocalDB.create('Event'); + ev = locals['Event'][ev]; + + ev.event_date = dateutil.obj_to_str(this.selected_date); + ev.event_hour = this.selected_hour+':00'; + ev.event_type = 'Private'; + + this.show_event(ev); +} +//------------------------------------------------------ + +Calendar.prototype.get_month_events = function(call_back) { + // ret fn + var me = this; + var f = function(r, rt) { + if(me.cur_view) me.cur_view.refresh(); + if(call_back)call_back(); + } + + //load + var y=this.selected_date.getFullYear(); var m = this.selected_date.getMonth(); + if(!this.events[y] || !this.events[y][m]) { + $c('webnotes.widgets.event.load_month_events', args = { + 'month': m + 1, + 'year' : y}, + f); + } +} +//------------------------------------------------------ + +Calendar.prototype.get_daily_event_list=function(day) { + var el = []; + var d = day.getDate(); var m = day.getMonth(); var y = day.getFullYear() + if(this.events[y] && this.events[y][m] && + this.events[y][m][d]) { + var l = this.events[y][m][d] + for(var i in l) { + for(var j in l[i]) el[el.length] = l[i][j]; + } + return el; + } + else return []; +} +//------------------------------------------------------ + +Calendar.prototype.set_event = function(ev) { + // don't duplicate + if(this.events_by_name[ev.name]) { + return; + } + + var dt = dateutil.str_to_obj(ev.event_date); + var m = dt.getMonth(); + var d = dt.getDate(); + var y = dt.getFullYear(); + + if(!this.events[y]) this.events[y] = []; + if(!this.events[y][m]) this.events[y][m] = []; + if(!this.events[y][m][d]) this.events[y][m][d] = []; + if(!this.events[y][m][d][cint(cint(ev.event_hour))]) + this.events[y][m][d][cint(ev.event_hour)] = []; + + var cal_ev = new Calendar.CalEvent(ev, this); + this.events[y][m][d][cint(ev.event_hour)].push(cal_ev); + this.events_by_name[ev.name] = cal_ev; + this.has_event[ev.name] = true; + + return cal_ev; +} +//------------------------------------------------------ + +Calendar.prototype.refresh = function(viewtype){//Sets the viewtype of the Calendar and Calls the View class based on the viewtype + if(viewtype) + this.viewtype = viewtype; + // switch view if reqd + if(this.cur_view.viewtype!=this.viewtype) { + this.cur_view.hide(); + this.cur_view = this.views[this.viewtype]; + this.cur_view.in_home = false; // for home page + this.cur_view.show(); + } + else{ + this.cur_view.refresh(this); + } +} + +//------------------------------------------------------ + +Calendar.CalEvent= function(doc, cal) { + this.body = document.createElement('div'); + var v = locals['Event'][doc.name].description; + if(v==null)v=''; + this.body.innerHTML = v; + + this.doc = doc; + var me = this; + + this.body.onclick = function() { + if(me.doc.name) { + cal.show_event(me.doc, me); + } + } +} + +Calendar.CalEvent.prototype.show = function(vu) { + + var t = this.doc.event_type; + this.my_class = 'cal_event cal_event_'+ t; + + if(this.body.parentNode) + this.body.parentNode.removeChild(this.body); + vu.body.appendChild(this.body); + + // refresh + var v = this.doc.description; + if(v==null)v=''; + this.body.innerHTML = v; + this.body.className = this.my_class; +} + +Calendar.CalEvent.prototype.save = function() { + var me = this; + save_doclist('Event', me.doc.name, 'Save', function(r) { + me.doc = locals['Event'][r.docname]; + erpnext.calendar.has_event[r.docname] = true; + } ); +} +// ---------- + +Calendar.View =function() { this.daystep = 0; this.monthstep = 0; } +Calendar.View.prototype.init=function(cal) { + this.cal = cal; + this.body = $a(cal.body, 'div', 'cal_view_body'); + this.body.style.display = 'none'; + this.create_table(); +} + + +Calendar.View.prototype.show=function() { + this.get_events(); this.refresh(); this.body.style.display = 'block'; +} + +Calendar.View.prototype.hide=function() { this.body.style.display = 'none';} + +Calendar.View.prototype.next = function() { + var s = this.cal.selected_date; + this.cal.selected_date = new Date(s.getFullYear(), s.getMonth() + this.monthstep, s.getDate() + this.daystep); + this.get_events(); this.refresh(); +} + +Calendar.View.prototype.prev = function() { + var s = this.cal.selected_date; + this.cal.selected_date = new Date(s.getFullYear(), s.getMonth() - this.monthstep, s.getDate() - this.daystep); + this.get_events(); this.refresh(); +} + +Calendar.View.prototype.get_events = function() { + this.cal.get_month_events(); +} +Calendar.View.prototype.add_unit = function(vu) { + this.viewunits[this.viewunits.length] = vu; +} +Calendar.View.prototype.refresh_units = function() { + // load the events + if(locals['Event']) { + for(var name in locals['Event']) { + this.cal.set_event(locals['Event'][name]); + } + } + + + for(var r in this.table.rows) { + for(var c in this.table.rows[r].cells) { + if(this.table.rows[r].cells[c].viewunit) { + this.table.rows[r].cells[c].viewunit.refresh(); + } + } + } +} + +// ................. Month View.......................... +Calendar.MonthView = function(cal) { this.init(cal); this.monthstep = 1; this.rows = 5; this.cells = 7; } +Calendar.MonthView.prototype=new Calendar.View(); +Calendar.MonthView.prototype.create_table = function() { + + // create head + this.head_wrapper = $a(this.body, 'div', 'cal_month_head'); + + // create headers + this.headtable = $a(this.head_wrapper, 'table', 'cal_month_headtable'); + var r = this.headtable.insertRow(0); + for(var j=0;j<7;j++) { + var cell = r.insertCell(j); + cell.innerHTML = erpnext.calendar.weekdays[j]; $w(cell, (100 / 7) + '%'); + } + + this.main = $a(this.body, 'div', 'cal_month_body'); + this.table = $a(this.main, 'table', 'cal_month_table'); + var me = this; + + // create body + for(var i=0;i<5;i++) { + var r = this.table.insertRow(i); + for(var j=0;j<7;j++) { + var cell = r.insertCell(j); + cell.viewunit = new Calendar.MonthViewUnit(cell); + } + } +} + +Calendar.MonthView.prototype.refresh = function() { + var c =this.cal.selected_date; + var me=this; + // fill other days + + var cur_row = 0; + + var cur_month = c.getMonth(); + var cur_year = c.getFullYear(); + + var d = new Date(cur_year, cur_month, 1); + var day = 1 - d.getDay(); + + + // set day headers + var d = new Date(cur_year, cur_month, day); + + this.cal.view_title.innerHTML = month_list_full[cur_month] + ' ' + cur_year; + + for(var i=0;i<6;i++) { + if((i<5) || cur_month==d.getMonth()) { // if this month + for(var j=0;j<7;j++) { + var cell = this.table.rows[cur_row].cells[j]; + + if((i<5) || cur_month==d.getMonth()) { // if this month + cell.viewunit.day = d; + cell.viewunit.hour = 8; + if(cur_month == d.getMonth()) { + cell.viewunit.is_disabled = false; + + if(same_day(this.cal.todays_date, d)) + cell.viewunit.is_today = true; + else + cell.viewunit.is_today = false; + + } else { + cell.viewunit.is_disabled = true; + } + } + // new date + day++; + d = new Date(cur_year, cur_month, day); + } + } + cur_row++; + if(cur_row == 5) {cur_row = 0;} // back to top + } + this.refresh_units(); + +} + // ................. Daily View.......................... +Calendar.DayView=function(cal){ this.init(cal); this.daystep = 1; } +Calendar.DayView.prototype=new Calendar.View(); +Calendar.DayView.prototype.create_table = function() { + + // create body + this.main = $a(this.body, 'div', 'cal_day_body'); + this.table = $a(this.main, 'table', 'cal_day_table'); + var me = this; + + for(var i=0;i<24;i++) { + var r = this.table.insertRow(i); + for(var j=0;j<2;j++) { + var cell = r.insertCell(j); + if(j==0) { + var tmp = time_to_ampm((i)+':00'); + cell.innerHTML = tmp[0]+':'+tmp[1]+' '+tmp[2]; + $w(cell, '10%'); + } else { + cell.viewunit = new Calendar.DayViewUnit(cell); + cell.viewunit.hour = i; + $w(cell, '90%'); + if((i>=7)&&(i<=20)) { + cell.viewunit.is_daytime = true; + } + } + } + } + } + +Calendar.DayView.prototype.refresh = function() { + var c =this.cal.selected_date; + + // fill other days + var me=this; + + this.cal.view_title.innerHTML = erpnext.calendar.weekdays[c.getDay()] + ', ' + + c.getDate() + ' ' + month_list_full[c.getMonth()] + ' ' + c.getFullYear(); + + // headers + var d = c; + + for(var i=0;i<24;i++) { + var cell = this.table.rows[i].cells[1]; + if(same_day(this.cal.todays_date, d)) cell.viewunit.is_today = true; + else cell.viewunit.is_today = false; + cell.viewunit.day = d; + } + this.refresh_units(); +} + +// ................. Weekly View.......................... +Calendar.WeekView=function(cal) { this.init(cal); this.daystep = 7; } +Calendar.WeekView.prototype=new Calendar.View(); +Calendar.WeekView.prototype.create_table = function() { + + // create head + this.head_wrapper = $a(this.body, 'div', 'cal_month_head'); + + // day headers + this.headtable = $a(this.head_wrapper, 'table', 'cal_month_headtable'); + var r = this.headtable.insertRow(0); + for(var j=0;j<8;j++) { + var cell = r.insertCell(j); + $w(cell, (100 / 8) + '%'); + } + + // hour header + + // create body + this.main = $a(this.body, 'div', 'cal_week_body'); + this.table = $a(this.main, 'table', 'cal_week_table'); + var me = this; + + for(var i=0;i<24;i++) { + var r = this.table.insertRow(i); + for(var j=0;j<8;j++) { + var cell = r.insertCell(j); + if(j==0) { + var tmp = time_to_ampm(i+':00'); + cell.innerHTML = tmp[0]+':'+tmp[1]+' '+tmp[2]; + + $w(cell, '10%'); + } else { + cell.viewunit = new Calendar.WeekViewUnit(cell); + cell.viewunit.hour = i; + if((i>=7)&&(i<=20)) { + cell.viewunit.is_daytime = true; + } + } + } + } +} + +Calendar.WeekView.prototype.refresh = function() { + var c =this.cal.selected_date; + // fill other days + var me=this; + + this.cal.view_title.innerHTML = month_list_full[c.getMonth()] + ' ' + c.getFullYear(); + + // headers + var d = new Date(c.getFullYear(), c.getMonth(), c.getDate() - c.getDay()); + + for (var k=1;k<8;k++) { + this.headtable.rows[0].cells[k].innerHTML = erpnext.calendar.weekdays[d.getDay()] + ' ' + d.getDate(); + + for(var i=0;i<24;i++) { + var cell = this.table.rows[i].cells[k]; + if(same_day(this.cal.todays_date, d)) + cell.viewunit.is_today = true; + else cell.viewunit.is_today = false; + + cell.viewunit.day = d; + //cell.viewunit.refresh(); + } + d=new Date(d.getFullYear(),d.getMonth(),d.getDate() + 1); + + } + + this.refresh_units(); +} + +//------------------------------------------------------. + +Calendar.ViewUnit = function() {} +Calendar.ViewUnit.prototype.init = function(parent) { + parent.style.border = "1px solid #CCC" ; + this.body = $a(parent, 'div', this.default_class); + this.parent = parent; + + var me = this; + this.body.onclick = function() { + erpnext.calendar.selected_date = me.day; + erpnext.calendar.selected_hour = me.hour; + + if(erpnext.calendar.cur_vu && erpnext.calendar.cur_vu!=me){ + erpnext.calendar.cur_vu.deselect(); + me.select(); + erpnext.calendar.cur_vu = me; + } + } + this.body.ondblclick = function() { + erpnext.calendar.add_event(); + } +} + +Calendar.ViewUnit.prototype.set_header=function(v) { + this.header.innerHTML = v; +} + +Calendar.ViewUnit.prototype.set_today = function() { + this.is_today = true; + this.set_display(); +} + +Calendar.ViewUnit.prototype.clear = function() { + if(this.header)this.header.innerHTML = ''; + + // clear body + while(this.body.childNodes.length) + this.body.removeChild(this.body.childNodes[0]); +} + +Calendar.ViewUnit.prototype.set_display = function() { + var cn = '#FFF'; + + // colors + var col_tod_sel = '#EEE'; + var col_tod = '#FFF'; + var col_sel = '#EEF'; + + if(this.is_today) { + if(this.selected) cn = col_tod_sel; + else cn = col_tod; + } else + if(this.selected) cn = col_sel; + + if(this.header) { + if(this.is_disabled) { + this.body.className = this.default_class + ' cal_vu_disabled'; + this.header.style.color = '#BBB'; + } else { + this.body.className = this.default_class; + this.header.style.color = '#000'; + } + + if(this.day&&this.day.getDay()==0) + this.header.style.backgroundColor = '#FEE'; + else + this.header.style.backgroundColor = ''; + } + this.parent.style.backgroundColor = cn; +} + +Calendar.ViewUnit.prototype.is_selected = function() { + return (same_day(this.day, erpnext.calendar.selected_date) + && this.hour==erpnext.calendar.selected_hour) +} + +Calendar.ViewUnit.prototype.get_event_list = function() { + var y = this.day.getFullYear(); + var m = this.day.getMonth(); + var d = this.day.getDate(); + if(erpnext.calendar.events[y] && erpnext.calendar.events[y][m] && + erpnext.calendar.events[y][m][d] && + erpnext.calendar.events[y][m][d][this.hour]) { + return erpnext.calendar.events[y][m][d][this.hour]; + } else + return []; +} + +Calendar.ViewUnit.prototype.refresh = function() { + this.clear(); + + if(this.is_selected()) { + if(erpnext.calendar.cur_vu)erpnext.calendar.cur_vu.deselect(); + this.selected = true; + erpnext.calendar.cur_vu = this; + } + this.set_display(); + this.el = this.get_event_list(); + if(this.onrefresh)this.onrefresh(); + + for(var i in this.el) { + this.el[i].show(this); + } + + var me = this; +} + +Calendar.ViewUnit.prototype.select=function() { this.selected = true; this.set_display(); } +Calendar.ViewUnit.prototype.deselect=function() { this.selected = false; this.set_display(); } +Calendar.ViewUnit.prototype.setevent=function() { } + +Calendar.MonthViewUnit=function(parent) { + this.header = $a(parent, 'div' , "cal_month_date"); + this.default_class = "cal_month_unit"; + + this.init(parent); + + this.onrefresh = function() { + this.header.innerHTML = this.day.getDate(); + } +} +Calendar.MonthViewUnit.prototype = new Calendar.ViewUnit(); +Calendar.MonthViewUnit.prototype.is_selected = function() { + return same_day(this.day, erpnext.calendar.selected_date) +} + +Calendar.MonthViewUnit.prototype.get_event_list = function() { + return erpnext.calendar.get_daily_event_list(this.day); +} + +Calendar.DayViewUnit= function(parent) { + this.default_class = "cal_day_unit"; this.init(parent); +} +Calendar.DayViewUnit.prototype = new Calendar.ViewUnit(); +Calendar.DayViewUnit.prototype.onrefresh = function() { + if(this.el.length<3) + this.body.style.height = '30px'; + else this.body.style.height = ''; +} + +Calendar.WeekViewUnit=function(parent) { + this.default_class = "cal_week_unit"; this.init(parent); +} +Calendar.WeekViewUnit.prototype = new Calendar.ViewUnit(); +Calendar.WeekViewUnit.prototype.onrefresh = function() { + if(this.el.length<3) this.body.style.height = '30px'; + else this.body.style.height = ''; +} diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css index 9f158526745..4ac49d621c1 100644 --- a/erpnext/utilities/page/todo/todo.css +++ b/erpnext/utilities/page/todo/todo.css @@ -1,5 +1,7 @@ .todoitem { - margin-bottom: 11px; + padding-bottom: 11px; + border-bottom: 1px solid #DEB85F; + margin-bottom: 5px; height: 14px; } diff --git a/erpnext/utilities/page/todo/todo.html b/erpnext/utilities/page/todo/todo.html index aa46d97a19a..34004552f18 100644 --- a/erpnext/utilities/page/todo/todo.html +++ b/erpnext/utilities/page/todo/todo.html @@ -1,4 +1,4 @@ -
+
×

To Do


diff --git a/js/all-app.js b/js/all-app.js index 655ac39e43a..048fe2b2d86 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -211,8 +211,7 @@ wn.versions.check();$(document).bind('ready',function(){var base=window.location * lib/js/legacy/globals.js */ wn.provide('wn.widgets.form');wn.provide('wn.widgets.report');wn.provide('wn.utils');wn.provide('wn.model');wn.provide('wn.profile');wn.provide('wn.session');wn.provide('_f');wn.provide('_p');wn.provide('_r');wn.provide('_c');wn.provide('_e');wn.provide('_startup_data') -wn.settings.no_history=1;var NEWLINE='\n';var login_file='';var version='v170';var profile=null;var session={};var is_testing=false;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var home_page=null;var hide_autosuggest=null;var page_body=null;var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var _c={};var widget_files={'_f.FrmContainer':'form.compressed.js','_c.CalendarPopup':'widgets/form/date_picker.js','_r.ReportContainer':'report.compressed.js','_p.PrintQuery':'widgets/print_query.js','Calendar':'widgets/calendar.js','Recommendation':'widgets/recommend.js','RatingWidget':'widgets/rating.js'} -var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;var cur_autosug=null; +wn.settings.no_history=1;var NEWLINE='\n';var login_file='';var version='v170';var profile=null;var session={};var is_testing=false;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var home_page=null;var hide_autosuggest=null;var page_body=null;var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;var cur_autosug=null; /* * lib/js/legacy/utils/datatype.js */ @@ -851,7 +850,8 @@ Listing.prototype.std_cell=function(cell,ri,ci,d){var has_headrow=this.colnames? */ wn.widgets.Listing=function(opts){this.opts=opts;this.page_length=20;this.btns={};this.start=0;var me=this;this.make=function(opts){this.wrapper=$a(this.opts.parent,'div');this.filters_area=$a(this.wrapper,'div','listing-filters');this.toolbar_area=$a(this.wrapper,'div','listing-toolbar');this.results_area=$a(this.wrapper,'div','listing-results');this.more_button_area=$a(this.wrapper,'div','listing-more');this.no_results_area=$a(this.wrapper,'div','help_box',{display:'none'},(this.opts.no_result_message?this.opts.no_result_message:'No results'));if(opts)this.opts=opts;this.page_length=this.opts.page_length?this.opts.page_length:this.page_length;this.make_toolbar();this.make_filters();this.make_more_button();} this.make_filters=function(){if(this.opts.filters){$ds(this.filters_area);this.filters=new wn.widgets.FieldGroup(this.filters_area,this.opts.fields);}} -this.make_toolbar=function(){if(!(this.opts.hide_refresh||this.opts.no_refresh)){this.ref_img=$a(this.toolbar_area,'span','link_type',{color:'#888'},'[refresh]');this.ref_img.onclick=function(){me.run();} +this.make_toolbar=function(){if(!(this.opts.hide_refresh||this.opts.no_refresh)){if(this.opts.title){$a(this.toolbar_area,'h3','',{display:'inline-block',marginRight:'15px'},this.opts.title);} +this.ref_img=$a(this.toolbar_area,'span','link_type',{color:'#888'},'[refresh]');this.ref_img.onclick=function(){me.run();} this.loading_img=$a(this.toolbar_area,'img','lib/images/ui/button-load.gif',{display:'none',marginLeft:'3px',marginBottom:'-2px'});} if(this.opts.new_doctype){this.new_btn=$btn(this.toolbar_area,'New '+get_doctype_label(this.opts.new_doctype),function(){newdoc(me.opts.new_doctype,me.opts.new_doc_onload,me.opts.new_doc_indialog,me.opts.new_doc_onsave);},{marginLeft:'7px'});}} this.make_more_button=function(){this.more_btn=$btn(this.more_button_area,'More...',function(){me.more_btn.set_working();me.run(function(){me.more_btn.done_working();},1);},'',0,1);$y(this.more_btn.loading_img,{marginBottom:'0px'});} @@ -1202,8 +1202,7 @@ function get_local(dt,dn){return locals[dt]?locals[dt][dn]:null;} LocalDB.sync=function(list){if(list._kl)list=expand_doclist(list);for(var i=0;i