diff --git a/patches/patch_list.py b/patches/patch_list.py index ea61a04dc3..e02d8e0c83 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -252,4 +252,5 @@ patch_list = [ "patches.may_2013.p03_update_support_ticket", "patches.may_2013.p04_reorder_level", "patches.may_2013.p05_update_cancelled_gl_entries", + "patches.may_2013.p06_make_notes", ] \ No newline at end of file diff --git a/public/js/kb_common.js b/public/js/kb_common.js deleted file mode 100644 index 6dca3f8dbb..0000000000 --- a/public/js/kb_common.js +++ /dev/null @@ -1,158 +0,0 @@ -// 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 . - -// question toolbar -// contains - voting widget / tag list and user info / timestamp -// By XXXXXX on YYYYY - -KBItemToolbar = function(args, kb) { - $.extend(this, args); - var me = this; - this.make = function() { - this.wrapper = $a(this.parent, 'div', '', {}); - this.line1 = $a(this.wrapper, 'div', '', {color: '#888', fontSize:'11px', margin:'7px 0px'}); - this.make_timestamp(); - this.make_answers(); - if(this.with_tags) - this.make_tags(); - this.setup_del(); - } - - this.make_timestamp = function() { - this.line1.innerHTML = repl('By %(name)s | %(when)s', { - name: wn.user_info(this.det.owner).fullname, - when: wn.datetime.comment_when(this.det.modified) - }); - - // allow system manager to delete questions / answers - if(has_common(user_roles, ['Administrator', 'System Manager'])) { - this.line1.innerHTML += ' | delete'; - } - } - - this.make_answers = function() { - if(this.doctype=='Question') { - if(this.det.answers==0) { - this.line1.innerHTML += ' | no answers'; - } else if(this.det.answers==1) { - this.line1.innerHTML += ' | 1 answer'; - } else { - this.line1.innerHTML += ' | '+this.det.answers+' answers'; - } - } - } - - this.make_tags = function() { - 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) - } - - this.setup_del = function() { - $(this.line1).find('.del-link').click(function() { - this.innerHTML = 'deleting...'; - this.disabled = 1; - $c_page('utilities', 'questions', 'delete', { - dt: me.doctype, dn: me.det.name}, function(r,rt) { - // reload the list - kb.list.run() - }); - }); - } - - this.make(); -} - - -// displays an editable text, -// needs parent, text, disp_class, inp_class -// dt, dn - -EditableText = function(args) { - $.extend(this, args); - var me = this; - - me.$w = $(repl('
\ -
\ - [edit]\ - \ -

Formatted as markdown
\ - \ - Cancel\ -
', args)).appendTo(me.parent); - - this.set_display = function(txt) { - var display_wrapper = me.$w.find('.ed-text-display'); - display_wrapper.html(wn.markdown(txt)); - display_wrapper.find("a").attr("target", "blank"); - me.text = txt; - } - - this.set_display(me.text); - - if(me.height) me.$w.find('.ed-text-input').css('height', me.height); - if(me.width) me.$w.find('.ed-text-input').css('width', me.width); - - // edit - me.$w.find('.ed-text-edit').click(function() { - me.$w.find('.ed-text-input').val(me.text); - me.show_as_input(); - }) - - // save button - save the new text - me.$w.find('.ed-text-save').click( - function() { - var v = me.$w.find('.ed-text-input').val(); - // check if text is written - if(!v) { - msgprint('Please write something!'); - return; - } - var btn = this; - $(btn).set_working(); - $c_page('utilities', 'question_view', 'update_item', { - dt: me.dt, dn: me.dn, fn: me.fieldname, text: v - }, - function(r) { - $(btn).done_working(); - if(r.exc) {msgprint(r.exc); return; } - me.set_display(v); - me.show_as_text(); - }); - } - ) - - - // cancel button - me.$w.find('.ed-text-cancel').click(function() { - me.show_as_text(); - }) - - this.show_as_text = function() { - me.$w.find('.ed-text-display, .ed-text-edit').toggle(true); - me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(false); - } - - this.show_as_input = function() { - me.$w.find('.ed-text-display, .ed-text-edit').toggle(false); - me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(true); - } - -} diff --git a/utilities/doctype/answer/__init__.py b/utilities/doctype/answer/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/utilities/doctype/answer/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/utilities/doctype/answer/answer.py b/utilities/doctype/answer/answer.py deleted file mode 100644 index 7f48feb2eb..0000000000 --- a/utilities/doctype/answer/answer.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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 . - -from __future__ import unicode_literals -import webnotes - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/utilities/doctype/answer/answer.txt b/utilities/doctype/answer/answer.txt deleted file mode 100644 index 58f0ba351b..0000000000 --- a/utilities/doctype/answer/answer.txt +++ /dev/null @@ -1,80 +0,0 @@ -[ - { - "creation": "2012-03-27 14:36:01", - "docstatus": 0, - "modified": "2012-03-27 14:36:01", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "allow_attach": 0, - "allow_trash": 1, - "autoname": "_ANS.#######", - "doctype": "DocType", - "in_create": 1, - "module": "Utilities", - "name": "__common__", - "read_only": 1, - "section_style": "Simple", - "show_in_menu": 0, - "version": 3 - }, - { - "doctype": "DocField", - "name": "__common__", - "parent": "Answer", - "parentfield": "fields", - "parenttype": "DocType", - "permlevel": 0 - }, - { - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "name": "__common__", - "parent": "Answer", - "parentfield": "permissions", - "parenttype": "DocType", - "permlevel": 0, - "read": 1, - "report": 1, - "role": "All", - "write": 1 - }, - { - "doctype": "DocType", - "name": "Answer" - }, - { - "doctype": "DocPerm" - }, - { - "doctype": "DocField", - "fieldname": "question", - "fieldtype": "Link", - "label": "Question", - "options": "Question" - }, - { - "doctype": "DocField", - "fieldname": "answer", - "fieldtype": "Text", - "label": "Answer", - "oldfieldname": "question", - "oldfieldtype": "Text" - }, - { - "doctype": "DocField", - "fieldname": "points", - "fieldtype": "Int", - "label": "Points" - }, - { - "doctype": "DocField", - "fieldname": "_users_voted", - "fieldtype": "Text", - "hidden": 1, - "label": "Users Voted", - "print_hide": 1 - } -] \ No newline at end of file diff --git a/utilities/doctype/answer/locale/_messages_doc.json b/utilities/doctype/answer/locale/_messages_doc.json deleted file mode 100644 index 252553e4c0..0000000000 --- a/utilities/doctype/answer/locale/_messages_doc.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "Question", - "Utilities", - "Answer", - "Points", - "Users Voted" -] \ No newline at end of file diff --git a/utilities/doctype/answer/locale/ar-doc.json b/utilities/doctype/answer/locale/ar-doc.json deleted file mode 100644 index 495091654a..0000000000 --- a/utilities/doctype/answer/locale/ar-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "\u0625\u062c\u0627\u0628\u0629", - "Points": "\u0646\u0642\u0627\u0637", - "Question": "\u0633\u0624\u0627\u0644", - "Users Voted": "\u0635\u0648\u062a \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646", - "Utilities": "\u062e\u062f\u0645\u0627\u062a" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/de-doc.json b/utilities/doctype/answer/locale/de-doc.json deleted file mode 100644 index 13b891110d..0000000000 --- a/utilities/doctype/answer/locale/de-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "Beantworten", - "Points": "Punkte", - "Question": "Frage", - "Users Voted": "Nutzer", - "Utilities": "Dienstprogramme" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/es-doc.json b/utilities/doctype/answer/locale/es-doc.json deleted file mode 100644 index ac4cb59d45..0000000000 --- a/utilities/doctype/answer/locale/es-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "Responder", - "Points": "Puntos", - "Question": "Cuesti\u00f3n", - "Users Voted": "Los usuarios Votado", - "Utilities": "Utilidades" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/fr-doc.json b/utilities/doctype/answer/locale/fr-doc.json deleted file mode 100644 index e3c0b30e7d..0000000000 --- a/utilities/doctype/answer/locale/fr-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "R\u00e9pondre", - "Points": "Points", - "Question": "Question", - "Users Voted": "Des internautes Yahoo!", - "Utilities": "Utilitaires" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/hi-doc.json b/utilities/doctype/answer/locale/hi-doc.json deleted file mode 100644 index 1c44b8694b..0000000000 --- a/utilities/doctype/answer/locale/hi-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "\u091c\u0935\u093e\u092c", - "Points": "\u00bb", - "Question": "\u0938\u0935\u093e\u0932", - "Users Voted": "\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e \u0935\u094b\u091f \u0926\u093f\u092f\u093e", - "Utilities": "\u0909\u092a\u092f\u094b\u0917\u093f\u0924\u093e\u090f\u0901" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/hr-doc.json b/utilities/doctype/answer/locale/hr-doc.json deleted file mode 100644 index b712783b42..0000000000 --- a/utilities/doctype/answer/locale/hr-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "Odgovoriti", - "Points": "Bodovi", - "Question": "Pitanje", - "Users Voted": "Korisnici Glasao", - "Utilities": "Komunalne usluge" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/nl-doc.json b/utilities/doctype/answer/locale/nl-doc.json deleted file mode 100644 index dc7d232513..0000000000 --- a/utilities/doctype/answer/locale/nl-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "Beantwoorden", - "Points": "Punten", - "Question": "Vraag", - "Users Voted": "Gebruikers Verkozen", - "Utilities": "Utilities" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/pt-BR-doc.json b/utilities/doctype/answer/locale/pt-BR-doc.json deleted file mode 100644 index b8b74d7a3b..0000000000 --- a/utilities/doctype/answer/locale/pt-BR-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "Resposta", - "Points": "Pontos", - "Question": "Pergunta", - "Users Voted": "Votos de usu\u00e1rios", - "Utilities": "Utilit\u00e1rios" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/pt-doc.json b/utilities/doctype/answer/locale/pt-doc.json deleted file mode 100644 index 987cbf2081..0000000000 --- a/utilities/doctype/answer/locale/pt-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "Responder", - "Points": "Pontos", - "Question": "Pergunta", - "Users Voted": "Votado usu\u00e1rios", - "Utilities": "Utilit\u00e1rios" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/sr-doc.json b/utilities/doctype/answer/locale/sr-doc.json deleted file mode 100644 index 711187fec9..0000000000 --- a/utilities/doctype/answer/locale/sr-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "\u041e\u0434\u0433\u043e\u0432\u043e\u0440", - "Points": "\u0422\u0430\u0447\u043a\u0435", - "Question": "\u041f\u0438\u0442\u0430\u045a\u0435", - "Users Voted": "\u041a\u043e\u0440\u0438\u0441\u043d\u0438\u0446\u0438 \u0413\u043b\u0430\u0441\u0430\u043e", - "Utilities": "\u041a\u043e\u043c\u0443\u043d\u0430\u043b\u043d\u0435 \u0443\u0441\u043b\u0443\u0433\u0435" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/ta-doc.json b/utilities/doctype/answer/locale/ta-doc.json deleted file mode 100644 index 2fa783a740..0000000000 --- a/utilities/doctype/answer/locale/ta-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "\u0baa\u0ba4\u0bbf\u0bb2\u0bcd", - "Points": "\u0baa\u0bc1\u0bb3\u0bcd\u0bb3\u0bbf\u0b95\u0bb3\u0bcd", - "Question": "\u0bb5\u0bbf\u0ba9\u0bbe", - "Users Voted": "\u0baa\u0baf\u0ba9\u0bb0\u0bcd \u0ba4\u0bb3\u0bae\u0bcd", - "Utilities": "\u0baa\u0baf\u0ba9\u0bcd\u0baa\u0bbe\u0b9f\u0bc1\u0b95\u0bb3\u0bcd" -} \ No newline at end of file diff --git a/utilities/doctype/answer/locale/th-doc.json b/utilities/doctype/answer/locale/th-doc.json deleted file mode 100644 index eb8c6234cf..0000000000 --- a/utilities/doctype/answer/locale/th-doc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Answer": "\u0e15\u0e2d\u0e1a", - "Points": "\u0e08\u0e38\u0e14", - "Question": "\u0e04\u0e33\u0e16\u0e32\u0e21", - "Users Voted": "\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\u0e42\u0e2b\u0e27\u0e15", - "Utilities": "\u0e22\u0e39\u0e17\u0e34\u0e25\u0e34\u0e15\u0e35\u0e49" -} \ No newline at end of file diff --git a/utilities/doctype/note/note.py b/utilities/doctype/note/note.py index 3a1799443b..beca2416e0 100644 --- a/utilities/doctype/note/note.py +++ b/utilities/doctype/note/note.py @@ -8,12 +8,13 @@ class DocType: self.doc, self.doclist = d, dl def onload(self): - if webnotes.session.user != self.doc.owner: + if not self.doc.public and webnotes.session.user != self.doc.owner: if webnotes.session.user not in [d.user for d in self.doclist if d.doctype=="Note User"]: webnotes.msgprint("You are not authorized to read this record.", raise_exception=True) def validate(self): - if webnotes.session.user != self.doc.owner: - if webnotes.session.user not in webnotes.conn.sql_list("""select user from `tabNote User` - where parent=%s and permission='Edit'""", self.doc.name): - webnotes.msgprint("You are not authorized to edit this record.", raise_exception=True) + if not self.doc.fields.get("__islocal"): + if webnotes.session.user != self.doc.owner: + if webnotes.session.user not in webnotes.conn.sql_list("""select user from `tabNote User` + where parent=%s and permission='Edit'""", self.doc.name): + webnotes.msgprint("You are not authorized to edit this record.", raise_exception=True) diff --git a/utilities/doctype/note/note.txt b/utilities/doctype/note/note.txt index 2deb02746e..88c5f1000c 100644 --- a/utilities/doctype/note/note.txt +++ b/utilities/doctype/note/note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 13:41:00", "docstatus": 0, - "modified": "2013-05-24 15:47:11", + "modified": "2013-05-24 16:24:02", "modified_by": "Administrator", "owner": "Administrator" }, @@ -62,6 +62,13 @@ "fieldtype": "Section Break", "label": "Share" }, + { + "description": "Everyone can read", + "doctype": "DocField", + "fieldname": "public", + "fieldtype": "Check", + "label": "Public" + }, { "doctype": "DocField", "fieldname": "share_with", diff --git a/utilities/doctype/question/__init__.py b/utilities/doctype/question/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/utilities/doctype/question/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/utilities/doctype/question/locale/_messages_doc.json b/utilities/doctype/question/locale/_messages_doc.json deleted file mode 100644 index 4d4aa115b5..0000000000 --- a/utilities/doctype/question/locale/_messages_doc.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "User Tags", - "Question", - "Utilities", - "Answer", - "Points", - "File List", - "Users Voted" -] \ No newline at end of file diff --git a/utilities/doctype/question/locale/ar-doc.json b/utilities/doctype/question/locale/ar-doc.json deleted file mode 100644 index bafb808500..0000000000 --- a/utilities/doctype/question/locale/ar-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "\u0625\u062c\u0627\u0628\u0629", - "File List": "\u0645\u0644\u0641 \u0642\u0627\u0626\u0645\u0629", - "Points": "\u0646\u0642\u0627\u0637", - "Question": "\u0633\u0624\u0627\u0644", - "User Tags": "\u0627\u0644\u0643\u0644\u0645\u0627\u062a \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645", - "Users Voted": "\u0635\u0648\u062a \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646", - "Utilities": "\u062e\u062f\u0645\u0627\u062a" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/de-doc.json b/utilities/doctype/question/locale/de-doc.json deleted file mode 100644 index cf7569c904..0000000000 --- a/utilities/doctype/question/locale/de-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "Beantworten", - "File List": "Dateiliste", - "Points": "Punkte", - "Question": "Frage", - "User Tags": "Nutzertags", - "Users Voted": "Nutzer", - "Utilities": "Dienstprogramme" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/es-doc.json b/utilities/doctype/question/locale/es-doc.json deleted file mode 100644 index 683fc0cf5c..0000000000 --- a/utilities/doctype/question/locale/es-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "Responder", - "File List": "Lista de archivos", - "Points": "Puntos", - "Question": "Cuesti\u00f3n", - "User Tags": "Nube de etiquetas", - "Users Voted": "Los usuarios Votado", - "Utilities": "Utilidades" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/fr-doc.json b/utilities/doctype/question/locale/fr-doc.json deleted file mode 100644 index 872280110b..0000000000 --- a/utilities/doctype/question/locale/fr-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "R\u00e9pondre", - "File List": "Liste des fichiers", - "Points": "Points", - "Question": "Question", - "User Tags": "Nuage de Tags", - "Users Voted": "Des internautes Yahoo!", - "Utilities": "Utilitaires" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/hi-doc.json b/utilities/doctype/question/locale/hi-doc.json deleted file mode 100644 index c7b9ebc676..0000000000 --- a/utilities/doctype/question/locale/hi-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "\u091c\u0935\u093e\u092c", - "File List": "\u092b\u093c\u093e\u0907\u0932 \u0938\u0942\u091a\u0940", - "Points": "\u00bb", - "Question": "\u0938\u0935\u093e\u0932", - "User Tags": "\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e \u0915\u0947 \u091f\u0948\u0917", - "Users Voted": "\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e \u0935\u094b\u091f \u0926\u093f\u092f\u093e", - "Utilities": "\u0909\u092a\u092f\u094b\u0917\u093f\u0924\u093e\u090f\u0901" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/hr-doc.json b/utilities/doctype/question/locale/hr-doc.json deleted file mode 100644 index 94127c2c8d..0000000000 --- a/utilities/doctype/question/locale/hr-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "Odgovoriti", - "File List": "Popis datoteka", - "Points": "Bodovi", - "Question": "Pitanje", - "User Tags": "Upute Tags", - "Users Voted": "Korisnici Glasao", - "Utilities": "Komunalne usluge" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/nl-doc.json b/utilities/doctype/question/locale/nl-doc.json deleted file mode 100644 index b9f30e2ad9..0000000000 --- a/utilities/doctype/question/locale/nl-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "Beantwoorden", - "File List": "File List", - "Points": "Punten", - "Question": "Vraag", - "User Tags": "Gebruiker-tags", - "Users Voted": "Gebruikers Verkozen", - "Utilities": "Utilities" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/pt-BR-doc.json b/utilities/doctype/question/locale/pt-BR-doc.json deleted file mode 100644 index 36a2804f8c..0000000000 --- a/utilities/doctype/question/locale/pt-BR-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "Resposta", - "File List": "Lista de Arquivos", - "Points": "Pontos", - "Question": "Pergunta", - "User Tags": "Etiquetas de Usu\u00e1rios", - "Users Voted": "Votos de usu\u00e1rios", - "Utilities": "Utilit\u00e1rios" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/pt-doc.json b/utilities/doctype/question/locale/pt-doc.json deleted file mode 100644 index 415ce2b92e..0000000000 --- a/utilities/doctype/question/locale/pt-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "Responder", - "File List": "Lista de Arquivos", - "Points": "Pontos", - "Question": "Pergunta", - "User Tags": "Etiquetas de usu\u00e1rios", - "Users Voted": "Votado usu\u00e1rios", - "Utilities": "Utilit\u00e1rios" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/sr-doc.json b/utilities/doctype/question/locale/sr-doc.json deleted file mode 100644 index 07f56ced7e..0000000000 --- a/utilities/doctype/question/locale/sr-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "\u041e\u0434\u0433\u043e\u0432\u043e\u0440", - "File List": "\u0424\u0438\u043b\u0435 \u041b\u0438\u0441\u0442", - "Points": "\u0422\u0430\u0447\u043a\u0435", - "Question": "\u041f\u0438\u0442\u0430\u045a\u0435", - "User Tags": "\u041a\u043e\u0440\u0438\u0441\u043d\u0438\u043a \u0422\u0430\u0433\u0441:", - "Users Voted": "\u041a\u043e\u0440\u0438\u0441\u043d\u0438\u0446\u0438 \u0413\u043b\u0430\u0441\u0430\u043e", - "Utilities": "\u041a\u043e\u043c\u0443\u043d\u0430\u043b\u043d\u0435 \u0443\u0441\u043b\u0443\u0433\u0435" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/ta-doc.json b/utilities/doctype/question/locale/ta-doc.json deleted file mode 100644 index 8efcefcbf0..0000000000 --- a/utilities/doctype/question/locale/ta-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "\u0baa\u0ba4\u0bbf\u0bb2\u0bcd", - "File List": "\u0b95\u0bc7\u0bbe\u0baa\u0bcd\u0baa\u0bc1 \u0baa\u0b9f\u0bcd\u0b9f\u0bbf\u0baf\u0bb2\u0bcd", - "Points": "\u0baa\u0bc1\u0bb3\u0bcd\u0bb3\u0bbf\u0b95\u0bb3\u0bcd", - "Question": "\u0bb5\u0bbf\u0ba9\u0bbe", - "User Tags": "\u0baa\u0baf\u0ba9\u0bb0\u0bcd \u0b95\u0bc1\u0bb1\u0bbf\u0b9a\u0bcd\u0b9a\u0bc6\u0bbe\u0bb1\u0bcd\u0b95\u0bb3\u0bcd", - "Users Voted": "\u0baa\u0baf\u0ba9\u0bb0\u0bcd \u0ba4\u0bb3\u0bae\u0bcd", - "Utilities": "\u0baa\u0baf\u0ba9\u0bcd\u0baa\u0bbe\u0b9f\u0bc1\u0b95\u0bb3\u0bcd" -} \ No newline at end of file diff --git a/utilities/doctype/question/locale/th-doc.json b/utilities/doctype/question/locale/th-doc.json deleted file mode 100644 index cafd7360d3..0000000000 --- a/utilities/doctype/question/locale/th-doc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Answer": "\u0e15\u0e2d\u0e1a", - "File List": "\u0e23\u0e32\u0e22\u0e0a\u0e37\u0e48\u0e2d\u0e44\u0e1f\u0e25\u0e4c", - "Points": "\u0e08\u0e38\u0e14", - "Question": "\u0e04\u0e33\u0e16\u0e32\u0e21", - "User Tags": "\u0e41\u0e17\u0e47\u0e01\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49", - "Users Voted": "\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\u0e42\u0e2b\u0e27\u0e15", - "Utilities": "\u0e22\u0e39\u0e17\u0e34\u0e25\u0e34\u0e15\u0e35\u0e49" -} \ No newline at end of file diff --git a/utilities/doctype/question/question.py b/utilities/doctype/question/question.py deleted file mode 100644 index 6a6fd5ba3c..0000000000 --- a/utilities/doctype/question/question.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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 . - -from __future__ import unicode_literals -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl - - def on_trash(self): - import webnotes - webnotes.conn.sql("delete from tabAnswer where question=%s", self.doc.name) - \ No newline at end of file diff --git a/utilities/doctype/question/question.txt b/utilities/doctype/question/question.txt deleted file mode 100644 index fbd7b75341..0000000000 --- a/utilities/doctype/question/question.txt +++ /dev/null @@ -1,84 +0,0 @@ -[ - { - "creation": "2013-01-02 17:08:46", - "docstatus": 0, - "modified": "2013-01-01 18:58:55", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "allow_attach": 0, - "autoname": "QUES.#######", - "doctype": "DocType", - "in_create": 1, - "module": "Utilities", - "name": "__common__", - "read_only": 1 - }, - { - "doctype": "DocField", - "name": "__common__", - "parent": "Question", - "parentfield": "fields", - "parenttype": "DocType", - "permlevel": 0 - }, - { - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "name": "__common__", - "parent": "Question", - "parentfield": "permissions", - "parenttype": "DocType", - "permlevel": 0, - "read": 1, - "report": 1, - "role": "All", - "submit": 0, - "write": 1 - }, - { - "doctype": "DocType", - "name": "Question" - }, - { - "doctype": "DocField", - "fieldname": "question", - "fieldtype": "Text", - "label": "Question", - "oldfieldname": "question", - "oldfieldtype": "Text" - }, - { - "doctype": "DocField", - "fieldname": "points", - "fieldtype": "Int", - "hidden": 1, - "label": "Points" - }, - { - "doctype": "DocField", - "fieldname": "answer", - "fieldtype": "Text Editor", - "label": "Answer", - "oldfieldname": "answer", - "oldfieldtype": "Text Editor" - }, - { - "doctype": "DocField", - "fieldname": "_user_tags", - "fieldtype": "Data", - "hidden": 1, - "label": "User Tags" - }, - { - "doctype": "DocField", - "fieldname": "_users_voted", - "fieldtype": "Text", - "label": "Users Voted" - }, - { - "doctype": "DocPerm" - } -] \ No newline at end of file diff --git a/utilities/page/question_view/__init__.py b/utilities/page/question_view/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/utilities/page/question_view/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/utilities/page/question_view/question_view.css b/utilities/page/question_view/question_view.css deleted file mode 100644 index 4472da7d81..0000000000 --- a/utilities/page/question_view/question_view.css +++ /dev/null @@ -1,44 +0,0 @@ -.qv-body { - padding: 13px; -} - - -.qv-input { - font-size: 14px; - height: 2.5em; - width: 100%; -} - -.qv-text { - font-size: 20px; - font-weight: bold; -} - -.qv-ans-input { - height: 5em; -} - -.qv-ans-text { - color: #444; - line-height: 1.7em; -} - -.qv-question-wrapper { -} - -.qv-add-answer { - width: 50%; - margin: 7px 0px; - padding: 7px; - background-color: #E2E2EE; - display: none; -} - -.qv-add-answer textarea { - height: 17em; - font-size: 12px; -} - -.qv-answer { - -} \ No newline at end of file diff --git a/utilities/page/question_view/question_view.html b/utilities/page/question_view/question_view.html deleted file mode 100644 index 0f22abf1ea..0000000000 --- a/utilities/page/question_view/question_view.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/utilities/page/question_view/question_view.js b/utilities/page/question_view/question_view.js deleted file mode 100644 index 86723505d8..0000000000 --- a/utilities/page/question_view/question_view.js +++ /dev/null @@ -1,193 +0,0 @@ -// 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 . - -pscript['onload_question-view'] = function(wrapper) { - wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe')); - wrapper.appframe.title('Question'); - wrapper.appframe.add_home_breadcrumb(); - wrapper.appframe.add_module_icon("Knowledge Base"); - wrapper.appframe.add_breadcrumb("icon-file"); - - wrapper.add_answer_area = $('.add-answer-area').get(0); -} - -pscript['refresh_question-view'] = function(wrapper) { - // href - var qid = window.location.hash.split('/')[1]; - if(qid) { - pscript.question_view(qid); - } -} - -pscript.question_view = function(qid, qtext) { - var w = wn.pages['question-view']; - new KBQuestionView(w, qid, qtext); -} - -KBQuestionView = function(w, qid, qtext) { - var me = this; - - this.make_question = function() { - $(w).find('.qv-question-wrapper').empty(); - $(w.add_answer_area).empty(); - new EditableText({ - parent: $(w).find('.qv-question-wrapper').get(0), - dt: 'Question', - dn: qid, - fieldname: 'question', - text: qtext, - inp_class: 'qv-input', - disp_class: 'qv-text' - }); - - // show tags - } - - // answer list - this.make_answer_list = function() { - $(w).find('.qv-answer-wrapper').empty(); - this.ans_list = new KBAnswerList({ - parent: $(w).find('.qv-answer-wrapper').get(0), - qid: qid - }) - } - - // check if users has answered - // (if no) then add a box to add a new answer - this.make_add_answer = function() { - $c_page('utilities', 'question_view', 'has_answered', qid, function(r, rt) { - if(r.message=='No') { - me.make_answer_box_link(); - } - }); - } - - // add a link to open add answer - this.make_answer_box_link = function() { - wn.pages['question-view'].appframe.add_button('Add your answer', function() { - $(this).toggle(false); - me.make_answer_box(); - }, 'icon-plus'); - } - - // answer box - // text area + add button - this.make_answer_box = function() { - $ds(w.add_answer_area); - $(w.add_answer_area, '

Add your Answer

\ -
In markdown format
'); - this.input = $a(w.add_answer_area, 'textarea'); - $(this.input).css({width: "90%", height: "200px"}); - //wn.tinymce.add_simple(this.input); - - this.btn = $btn($a(w.add_answer_area, 'div'), 'Post', function() { - var v = $(me.input).val(); - if(!v) { msgprint('Write something!'); return; } - me.btn.set_working(); - $c_page('utilities', 'question_view', 'add_answer', - JSON.stringify({qid: qid, "answer":v}), - function(r, rt) { - me.btn.done_working(); - me.ans_list.list.run(); - $dh(w.add_answer_area); - } - ); - }); - } - - this.setup = function() { - if(qtext) { - this.make(); - } - else { - $c_page('utilities', 'question_view', 'get_question', qid, function(r, rt) { - qtext = r.message; - me.make(); - }); - } - } - - this.make = function() { - set_title(qtext); - this.make_question(); - this.make_answer_list(); - this.make_add_answer(); - } - - this.setup(); -} - - -// kb answer list -KBAnswerList = function(args) { - var me = this; - $.extend(this, args); - - this.make_list = function() { - wn.pages['question-view'].appframe.clear_buttons(); - this.list = new wn.ui.Listing({ - parent: me.parent, - appframe: wn.pages['question-view'].appframe, - as_dict: 1, - no_result_message: 'No answers yet, be the first one to answer!', - render_row: function(body, data) { - new KBAnswer(body, data, me) - }, - get_query: function() { - return repl("SELECT t1.name, t1.owner, t1.answer, t1._users_voted, t2.first_name, " - +"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 " - +"where question='%(qid)s' and t1.owner = t2.name " - +"order by t1.modified desc", {qid: me.qid}) - } - }); - - this.list.run(); - - } - - this.make_list(); - -} - -// kb answer -// answer -// by xxx | on xxx -KBAnswer = function(body, data, ans_list) { - body.className = 'qv-answer'; - var edtxt = new EditableText({ - parent: body, - dt: 'Answer', - dn: data.name, - fieldname: 'answer', - text: data.answer, - inp_class: 'qv-ans-input', - disp_class: 'qv-ans-text', - height: '300px', - width: '90%' - }); - - $(edtxt.wrapper).addClass('well'); - - var div = $a(body, 'div', '', {}) - new KBItemToolbar({ - parent: div, - det: data, - with_tags: 0, - doctype: 'Answer' - }, ans_list) -} - -wn.require('app/js/kb_common.js'); \ No newline at end of file diff --git a/utilities/page/question_view/question_view.py b/utilities/page/question_view/question_view.py deleted file mode 100644 index 175a8ede1b..0000000000 --- a/utilities/page/question_view/question_view.py +++ /dev/null @@ -1,47 +0,0 @@ -# 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 . - -from __future__ import unicode_literals -import webnotes -from webnotes.utils import load_json, cstr, now - -@webnotes.whitelist() -def update_item(arg): - args = load_json(arg) - - webnotes.conn.sql("update `tab%s` set `%s`=%s, modified=%s where name=%s" \ - % (args['dt'], args['fn'], '%s', '%s', '%s'), (args['text'], now(), args['dn'])) - -@webnotes.whitelist() -def has_answered(arg): - return webnotes.conn.sql("select name from tabAnswer where owner=%s and question=%s", (webnotes.user.name, arg)) and 'Yes' or 'No' - -@webnotes.whitelist() -def get_question(arg): - return cstr(webnotes.conn.sql("select question from tabQuestion where name=%s", arg)[0][0]) - -@webnotes.whitelist() -def add_answer(arg): - arg = load_json(arg) - - from webnotes.model.doc import Document - a = Document('Answer') - a.answer = arg['answer'] - a.question = arg['qid'] - a.points = 1 - a.save(1) - - webnotes.conn.set_value('Question', arg['qid'], 'modified', now()) \ No newline at end of file diff --git a/utilities/page/question_view/question_view.txt b/utilities/page/question_view/question_view.txt deleted file mode 100644 index 87fd053732..0000000000 --- a/utilities/page/question_view/question_view.txt +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "creation": "2013-04-09 11:45:31", - "docstatus": 0, - "modified": "2013-04-09 11:47:24", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "doctype": "Page", - "module": "Utilities", - "name": "__common__", - "page_name": "Question View", - "standard": "Yes" - }, - { - "doctype": "Page Role", - "name": "__common__", - "parent": "question-view", - "parentfield": "roles", - "parenttype": "Page", - "role": "All" - }, - { - "doctype": "Page", - "name": "question-view" - }, - { - "doctype": "Page Role" - } -] \ No newline at end of file diff --git a/utilities/page/questions/__init__.py b/utilities/page/questions/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/utilities/page/questions/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/utilities/page/questions/questions.css b/utilities/page/questions/questions.css deleted file mode 100644 index 779da5505e..0000000000 --- a/utilities/page/questions/questions.css +++ /dev/null @@ -1,31 +0,0 @@ -div.kb-search-wrapper textarea { - height: 2.2em; - width: 80%; - font-size: 14px; - padding: 3px; - margin-bottom: 7px; -} - -.kb-question-wrapper { - padding-bottom: 3px; - margin-bottom: 3px; -} - -.kb-questions { -} - -.un-answered { - color: #f33; -} - -.kb-question-details { - margin: 11px 0px 11px 29px; -} - -.kb-tag-filter-area { - padding: 7px; - background-color: #F2F2E8; - color: #222; - margin: 7px 0px; - display: none; -} \ No newline at end of file diff --git a/utilities/page/questions/questions.html b/utilities/page/questions/questions.html deleted file mode 100644 index 43078471b3..0000000000 --- a/utilities/page/questions/questions.html +++ /dev/null @@ -1,19 +0,0 @@ -
-
-
-
- -
- - -
-
-
-
-
-

A wiki or Q&A for your organization

-
-
-
\ No newline at end of file diff --git a/utilities/page/questions/questions.js b/utilities/page/questions/questions.js deleted file mode 100644 index e7e99b5323..0000000000 --- a/utilities/page/questions/questions.js +++ /dev/null @@ -1,221 +0,0 @@ -// 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 . - -pscript.onload_questions = function(wrapper) { - body = $(wrapper).find('.layout-main-section').get(0); - - wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe')); - wrapper.appframe.add_home_breadcrumb(); - wrapper.appframe.add_breadcrumb(wn.modules["Knowledge Base"].icon); - wrapper.appframe.title('Knowledge Base'); - - // kb - var kb = new KnowledgeBase(body); - - wn.model.with_doctype("Question", function() { - this.sidebar_stats = new wn.views.SidebarStats({ - doctype: "Question", - stats: ["_user_tags"], - parent: $(wrapper).find('.questions-tags'), - set_filter: function(fieldname, label) { - kb.set_filter(fieldname, label); - //me.set_filter(fieldname, label); - } - }); - }) -} - -// knowledge base object -// has a box for search or ask a question -// and list of top rated search results -// -function KnowledgeBase(w) { - var me = this; - this.sort_by = 'modified'; - this.tag_filter_dict = {}; - - this.make_search_bar = function() { - this.search = $(w).find('.kb-search-wrapper textarea').get(0); - - $(w).find('.btn.search').click(function() { - me.run(); - }) - $(w).find('.btn.ask').click(function() { - me.ask(); - }) - } - - // ask a new question - this.ask = function() { - if(this.search.value==$(this.search).attr('default_text')) { - msgprint('Please enter some text'); return; - } - this.add_question([]); - } - - // suggest a few users who can answer - this.suggest = function() { - this.dialog = new wn.ui.Dialog({ - title: 'Suggest a users', - width: 400, - fields: [ - {fieldtype:'HTML', options:'Optional: Suggest a few users who can help you answer this question
'}, - {fieldtype:'Link', fieldname:'profile1', label:'1st User',options:'Profile'}, - {fieldtype:'Link', fieldname:'profile2', label:'2nd User',options:'Profile'}, - {fieldtype:'Link', fieldname:'profile3', label:'3rd User',options:'Profile'}, - {fieldtype:'Button', fieldname:'ask', label:'Add the Question'} - ] - }); - this.dialog.fields_dict.ask.input.onclick = function() { - me.dialog.hide(); - me.add_question(values(me.dialog.get_values())); - } - this.dialog.show(); - } - - // add a new question to the database - this.add_question = function(suggest_list) { - $c_page('utilities', 'questions', 'add_question', { - question: this.search.value, - suggest: suggest_list - }, function(r,rt) { - $(me.search).val('').blur(); - me.run(); - }) - } - - // where tags that filter will be displayed - this.make_tag_filter_area = function() { - this.tag_filters = $a(w, 'div', 'kb-tag-filter-area'); - $a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'}, 'Showing for:'); - this.tag_area = $a(this.tag_filters, 'span'); - } - - // make a list of questions - this.make_list = function() { - this.make_tag_filter_area(); - this.list_area = $a(w, 'div', '', {marginRight:'13px'}) - this.no_result = $a(w, 'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask') - - this.list = new wn.ui.Listing({ - parent: this.list_area, - no_results_message: 'No questions found. Ask a new question!', - appframe: wn.pages.questions.appframe, - as_dict: 1, - method: 'utilities.page.questions.questions.get_questions', - get_args: function() { - var args = {}; - if(me.search.value) { - args.search_text = me.search.value; - } - if(me.tag_filter_dict) { - args.tag_filters = keys(me.tag_filter_dict); - } - return args - }, - render_row: function(parent, data, listing) { - new KBQuestion(parent, data, me); - } - }); - - this.list.run(); - - } - - this.set_filter = function(fieldname, label) { - this.set_tag_filter({label:label}); - } - // add a tag filter to the search in the - // main page - this.set_tag_filter = function(tag) { - - // check if exists - if(in_list(keys(me.tag_filter_dict), tag.label)) return; - - // create a tag in filters - var filter_tag = new SingleTag({ - parent: me.tag_area, - label: tag.label, - dt: 'Question', - color: tag.color - }); - - // remove tag from filters - filter_tag.remove = function(tag_remove) { - $(tag_remove.body).fadeOut(); - delete me.tag_filter_dict[tag_remove.label]; - - // hide everything? - if(!keys(me.tag_filter_dict).length) { - $(me.tag_filters).slideUp(); // hide - } - - // run - me.run(); - } - - // add to dict - me.tag_filter_dict[tag.label] = filter_tag; - $ds(me.tag_filters); - - // run - me.run(); - } - this.run = function() { - this.list.run(); - } - - this.make_search_bar(); - this.make_list(); - -} - -// single kb question -// "question -// points | tag list" - -KBQuestion = function(parent, det, kb) { - - this.make = function() { - this.wrapper = $a(parent, 'div', 'kb-question-wrapper'); - this.q_area = $a($a(this.wrapper, 'div'), 'h3', - 'kb-questions link_type', {display:'inline', textDecoration:'none'}, det.question); - if(det.answers==0) { - $(this.q_area).addClass('un-answered') - } - - this.q_area.onclick = function() { - var q = this; - window.location.href = '#!question-view/' + q.id; - //loadpage('question-view', function() { pscript.question_view(q.id, q.txt) }) - } - - this.q_area.id = det.name; this.q_area.txt = det.question; - - new KBItemToolbar({ - parent: this.wrapper, - det: det, - with_tags: 1, - doctype: 'Question' - }, kb) - - } - - - this.make() -} - -wn.require('app/js/kb_common.js'); diff --git a/utilities/page/questions/questions.py b/utilities/page/questions/questions.py deleted file mode 100644 index 442fb0139a..0000000000 --- a/utilities/page/questions/questions.py +++ /dev/null @@ -1,74 +0,0 @@ -# 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 . - -from __future__ import unicode_literals -import webnotes - -from webnotes.utils import load_json -import json - -@webnotes.whitelist() -def get_questions(): - """get list of questions""" - import json - conds = '' - - if 'search_text' in webnotes.form_dict: - conds = ' and t1.question like "%'+ webnotes.form_dict['search_text'] + '%"' - - if 'tag_filters' in webnotes.form_dict: - tag_filters = json.loads(webnotes.form_dict['tag_filters']) - for t in tag_filters: - conds += ' and t1._user_tags like "%'+ t +'%"' - - return webnotes.conn.sql("""select t1.name, t1.owner, t1.question, t1.modified, t1._user_tags, - (select count(*) from tabAnswer where - tabAnswer.question = t1.name) as answers - from tabQuestion t1, tabProfile t2 - where t1.docstatus!=2 - and t1.owner = t2.name - %(conds)s - order by t1.modified desc""" % {"conds":conds}, as_dict=1) - -# add a new question -@webnotes.whitelist() -def add_question(arg): - args = load_json(arg) - - from webnotes.model.doc import Document - d = Document('Question') - d.question = args['question'] - d.points = 1 - d.save(1) - - if args['suggest']: - from core.page.messages import messages - for s in args['suggest']: - if s: - messages.post(json.dumps({ - 'contact': s, - 'txt': 'Please help me and answer the question "%s" in the Knowledge Base' % d.question, - 'notify': 1 - })) - -@webnotes.whitelist() -def delete(arg): - """ - delete a question or answer (called from kb toolbar) - """ - args = load_json(arg) - from webnotes.model import delete_doc - delete_doc(args['dt'], args['dn']) diff --git a/utilities/page/questions/questions.txt b/utilities/page/questions/questions.txt deleted file mode 100644 index e327ebfd18..0000000000 --- a/utilities/page/questions/questions.txt +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "creation": "2013-04-09 11:50:08", - "docstatus": 0, - "modified": "2013-04-09 11:52:08", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "doctype": "Page", - "module": "Utilities", - "name": "__common__", - "page_name": "Questions", - "standard": "Yes" - }, - { - "doctype": "Page Role", - "name": "__common__", - "parent": "questions", - "parentfield": "roles", - "parenttype": "Page", - "role": "All" - }, - { - "doctype": "Page", - "name": "questions" - }, - { - "doctype": "Page Role" - } -] \ No newline at end of file