diff --git a/addons/document_page/__openerp__.py b/addons/document_page/__openerp__.py index f08315bf61e..34138f3c719 100644 --- a/addons/document_page/__openerp__.py +++ b/addons/document_page/__openerp__.py @@ -30,19 +30,25 @@ Web pages """, 'author': ['OpenERP SA'], 'website': 'http://www.openerp.com/', - 'depends': ['knowledge'], + 'depends': ['mail', 'knowledge'], 'data': [ - 'wizard/document_page_create_menu_view.xml', + # 'wizard/document_page_create_menu_view.xml', 'wizard/document_page_show_diff_view.xml', 'document_page_view.xml', - 'security/document_page_security.xml', + 'document_page_data.xml', + # 'security/document_page_security.xml', 'security/ir.model.access.csv', ], - 'demo': ['document_page_demo.xml'], - 'test': ['test/document_page_test00.yml'], + 'demo': [ + 'document_page_demo.xml' + ], + 'test': [ + # 'test/document_page_test00.yml' + ], 'installable': True, 'auto_install': False, - 'images': [], - 'css' : ['static/src/css/document_page.css'], + 'css': [ + 'static/src/css/document_page.css' + ], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_page/document_page.py b/addons/document_page/document_page.py index 7f885018001..0290de6750c 100644 --- a/addons/document_page/document_page.py +++ b/addons/document_page/document_page.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-Today OpenERP SA (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,45 +22,56 @@ from openerp.osv import fields, osv from openerp.tools.translate import _ import difflib -from openerp import tools -class document_page(osv.osv): - _name = "document.page" - _description = "Document Page" + +class BlogCategory(osv.Model): + _name = 'blog.category' + _description = 'Blog Category' + _inherit = ['mail.thread'] _order = 'name' - def _get_page_index(self, cr, uid, page, link=True): - index = [] - for subpage in page.child_ids: - index += ["
  • "+ self._get_page_index(cr, uid, subpage) +"
  • "] - r = '' - if link: - r = '%s'%(page.id,page.name) - if index: - r += "" - return r + _columns = { + 'name': fields.char('Name', required=True), + 'description': fields.text('Description'), + 'template': fields.text('Template'), + 'blog_ids': fields.one2many( + 'blog.post', 'category_id', + 'Blogs', + ), + } - def _get_display_content(self, cr, uid, ids, name, args, context=None): - res = {} - for page in self.browse(cr, uid, ids, context=context): - if page.type == "category": - content = self._get_page_index(cr, uid, page, link=False) - else: - content = page.content - res[page.id] = content - return res + +class BlogTag(osv.Model): + _name = 'blog.tag' + _description = 'Blog Tag' + _order = 'name' + + _columns = { + 'name': fields.char('Name', required=True), + } + + +class BlogPost(osv.Model): + _name = "blog.post" + _description = "Blog Post" + _inherit = ['mail.thread'] + _order = 'name' _columns = { 'name': fields.char('Title', required=True), - 'type':fields.selection([('content','Content'), ('category','Category')], 'Type', help="Page type"), - - 'parent_id': fields.many2one('document.page', 'Category', domain=[('type','=','category')]), - 'child_ids': fields.one2many('document.page', 'parent_id', 'Children'), + 'category_id': fields.many2one( + 'blog.category', 'Category', + ondelete='set null', + ), + 'tag_ids': fields.many2many( + 'blog.tag', 'blog_tag_rel', + 'blog_id', 'tag_id', + 'Tags', + ), 'content': fields.text("Content"), - 'display_content': fields.function(_get_display_content, string='Displayed Content', type='text'), - 'history_ids': fields.one2many('document.page.history', 'page_id', 'History'), + 'history_ids': fields.one2many('blog.post.history', 'post_id', 'History'), 'menu_id': fields.many2one('ir.ui.menu', "Menu", readonly=True), 'create_date': fields.datetime("Created on", select=True, readonly=True), @@ -68,52 +79,43 @@ class document_page(osv.osv): 'write_date': fields.datetime("Modification Date", select=True, readonly=True), 'write_uid': fields.many2one('res.users', "Last Contributor", select=True, readonly=True), } - _defaults = { - 'type':'content', - } - - def onchange_parent_id(self, cr, uid, ids, parent_id, content, context=None): - res = {} - if parent_id and not content: - parent = self.browse(cr, uid, parent_id, context=context) - if parent.type == "category": - res['value'] = { - 'content': parent.content, - } - return res def create_history(self, cr, uid, ids, vals, context=None): for i in ids: - history = self.pool.get('document.page.history') + history = self.pool.get('blog.post.history') if vals.get('content'): res = { 'content': vals.get('content', ''), - 'page_id': i, + 'post_id': i, } history.create(cr, uid, res) def create(self, cr, uid, vals, context=None): - page_id = super(document_page, self).create(cr, uid, vals, context) - self.create_history(cr, uid, [page_id], vals, context) - return page_id + if context is None: + context = {} + create_context = dict(context, mail_create_nolog=True) + post_id = super(BlogPost, self).create(cr, uid, vals, context=create_context) + self.create_history(cr, uid, [post_id], vals, context) + return post_id def write(self, cr, uid, ids, vals, context=None): - result = super(document_page, self).write(cr, uid, ids, vals, context) + result = super(BlogPost, self).write(cr, uid, ids, vals, context) self.create_history(cr, uid, ids, vals, context) return result -class document_page_history(osv.osv): - _name = "document.page.history" + +class BlogPostHistory(osv.Model): + _name = "blog.post.history" _description = "Document Page History" _order = 'id DESC' _rec_name = "create_date" _columns = { - 'page_id': fields.many2one('document.page', 'Page'), - 'summary': fields.char('Summary', size=256, select=True), - 'content': fields.text("Content"), - 'create_date': fields.datetime("Date"), - 'create_uid': fields.many2one('res.users', "Modified By"), + 'post_id': fields.many2one('blog.post', 'Blog Post'), + 'summary': fields.char('Summary', size=256, select=True), + 'content': fields.text("Content"), + 'create_date': fields.datetime("Date"), + 'create_uid': fields.many2one('res.users', "Modified By"), } def getDiff(self, cr, uid, v1, v2, context=None): diff --git a/addons/document_page/document_page_data.xml b/addons/document_page/document_page_data.xml index 1cef65694d8..85e8aaed530 100644 --- a/addons/document_page/document_page_data.xml +++ b/addons/document_page/document_page_data.xml @@ -1,41 +1,29 @@ - - - The OpenERP wiki - help, quick start, wiki, formatting - 0 - 1 - Initial Page - ==The OpenERP wiki== - -[[File:http://www.openerp.com/sites/all/themes/openerp/logo.png OpenERP]] + + -The OpenERP wiki allows you to manage your enterprise's contents using wiki -restructured texts. This module provides a collaborative way to manage internal -FAQs, quality manuals, technical references, etc. - -==Keypoints== -* Same formating style than MediaWiki, -* Any number of wiki group for different purposes, -* Detailed history on all pages, -* Integrated with the document management system. - -==Why you should use the OpenERP integrated wiki than a separate wiki system ?== -* Allows links to any document of the system, -* Uses the access controls of OpenERP for uniq access rights management, -* Use it to describe projects, tasks, products, -* Integrated with customer portal to provide restricted external accesses, -* Linked to users processes for quality manuals. - -==To get more information== -* [[Basic Wiki Editing]] -* [[Wiki Documentation]] -* [http://openerp.com The OpenERP website] - - - - + + + New Post + blog.post + + New Post + + Post Published + blog.post + + Post Published + + + + New Post + blog.category + + + category_id + + diff --git a/addons/document_page/document_page_demo.xml b/addons/document_page/document_page_demo.xml index f779ea8313f..f636f5631d0 100644 --- a/addons/document_page/document_page_demo.xml +++ b/addons/document_page/document_page_demo.xml @@ -1,13 +1,13 @@ - - - - - - OpenERP Features - category - + + + + + + News + Presentation of new OpenERP features + Summary of the feature Long explanation @@ -15,13 +15,22 @@ Long explanation Conclusion Additional ressources - - + - - OpenERP 6.1. Functional Demo - + + + functional + + + pos + + + + + OpenERP 7.0 Functional Demo + + @@ -48,9 +57,9 @@ company, with your clients and implement it now for your business.
    - + Personalise Dashboards - + @@ -89,9 +98,10 @@ you change your mind there is a reset button to return to the default view.
    - + Touchscreen Point of Sale - + + diff --git a/addons/document_page/document_page_view.xml b/addons/document_page/document_page_view.xml index 9d02b47d265..5cbc947e172 100644 --- a/addons/document_page/document_page_view.xml +++ b/addons/document_page/document_page_view.xml @@ -1,116 +1,128 @@ - - + + - - - document.page.tree - document.page - child_ids - 100 + + + blog.category.list + blog.category - + - - - - - document.page.list - document.page + + blog.category.form + blog.category - +
    + + + + + + + +
    + + +
    +
    +
    +
    + + + + blog.post.list + blog.post + + - + - - - document.page.form - document.page + + + blog.post.form + blog.post -
    - -

    - - - + + +

    + + + + + + + + + + - - - - - -
    -
    -
    - -
    - +
    + +
    + +
    + +
    - - - document.page.search - document.page + + + blog.post.search + blog.post - + - + - - - + + + - - Pages - document.page - [('type','=','content')] - {'default_type': 'content'} + + Blog Posts + blog.post form tree,form - - + + -

    - Click to create a new web page. -

    +

    + Click to create a new blog post. +

    - - + + + Category - document.page - [('type','=','category')] - {'default_type': 'category'} + blog.category form tree,form - - - + - - document.page.history.tree - document.page.history + + blog.post.history.tree + blog.post.history @@ -120,11 +132,11 @@ - - document.page.history.form - document.page.history + + blog.post.history.form + blog.post.history -
    +