mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-14 01:41:26 -06:00
use new API
This commit is contained in:
parent
0f0dc88d03
commit
fa5f889f5f
@ -18,8 +18,5 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import (
|
||||
document_page,
|
||||
wizard
|
||||
)
|
||||
from . import document_page
|
||||
from . import wizard
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
{
|
||||
'name': 'Document Page',
|
||||
'version': '1.0.1',
|
||||
'version': '8.0.1.0.1',
|
||||
'category': 'Knowledge Management',
|
||||
'description': """
|
||||
Pages
|
||||
@ -30,7 +30,10 @@ Web pages
|
||||
""",
|
||||
'author': ['OpenERP SA'],
|
||||
'website': 'http://www.openerp.com/',
|
||||
'depends': ['knowledge'],
|
||||
'license': 'AGPL-3',
|
||||
'depends': [
|
||||
'knowledge'
|
||||
],
|
||||
'data': [
|
||||
'wizard/document_page_create_menu_view.xml',
|
||||
'wizard/document_page_show_diff_view.xml',
|
||||
@ -38,8 +41,12 @@ Web pages
|
||||
'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': [],
|
||||
|
@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="wiki_wiki_main" model="wiki.wiki">
|
||||
<field name="name">The OpenERP wiki</field>
|
||||
<field name="tags">help, quick start, wiki, formatting</field>
|
||||
<field name="minor_edit">0</field>
|
||||
<field name="section">1</field>
|
||||
<field name="toc">0</field>
|
||||
<field name="summary">Initial Page</field>
|
||||
<field name="text_area">=The OpenERP wiki=
|
||||
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]
|
||||
|
||||
|
||||
</field>
|
||||
<field name="group_id" ref="wiki_groups_wikiformatting0"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
@ -1,116 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="wiki_groups_wikiformatting0" model="wiki.groups">
|
||||
<field name="name">Help - Using The Wiki</field>
|
||||
<field eval="1" name="section"/>
|
||||
</record>
|
||||
<record id="wiki_wiki_quickstart0" model="wiki.wiki">
|
||||
<field name="name">Basic Wiki Editing</field>
|
||||
<field name="tags">help, quick start, wiki, formatting</field>
|
||||
<field name="minor_edit">0</field>
|
||||
<field name="toc">1</field>
|
||||
<field name="section">1.1</field>
|
||||
<field name="summary">Initial Page</field>
|
||||
<field name="text_area">==Basic Wiki Editing==
|
||||
You can ''italicize text'' by putting 2
|
||||
apostrophes on each side.
|
||||
3 apostrophes will embolden '''the text'''.
|
||||
5 apostrophes will embolden and italicize
|
||||
'''''the text'''''.
|
||||
(4 apostrophes don't do anything
|
||||
special -- there's just ''''one left
|
||||
over''''.)
|
||||
|
||||
You can ''italicize text'' by putting 2
|
||||
apostrophes on each side.
|
||||
|
||||
3 apostrophes will embolden '''the text'''.
|
||||
|
||||
5 apostrophes will embolden and italicize
|
||||
'''''the text'''''.
|
||||
|
||||
(4 apostrophes don't do anything special -- there's just ''''one left over''''.)
|
||||
|
||||
==Links==
|
||||
===Internal===
|
||||
You give the link as same as the wiki Page Title
|
||||
|
||||
Go back to Main Page : [[The OpenERP wiki]]
|
||||
===External===
|
||||
You can give link to the other Web page over the Internet easily [http://google.com Visit Google]
|
||||
==Attachments==
|
||||
===Images===
|
||||
You can get the External links easily
|
||||
|
||||
img:http://images.google.co.in/intl/en_ALL/images/images_hp.gif
|
||||
|
||||
==Play with OpenERP Records==
|
||||
* edit:res.partner|False|Create New Partner
|
||||
* edit:res.partner|China Export|Edit China Export
|
||||
* edit:res.country|India|Edit Country - India
|
||||
|
||||
==Working with Attachments==
|
||||
* Download File : attach:document.doc
|
||||
|
||||
==Unnumbered List==
|
||||
* ''Unordered lists'' are easy to do:
|
||||
** Start every line with a star.
|
||||
*** More stars indicate a deeper level.
|
||||
*: Previous item continues.
|
||||
** A new line
|
||||
* in a list
|
||||
marks the end of the list.
|
||||
*Of course you can start again.
|
||||
|
||||
==Numbered List==
|
||||
# ''Numbered lists'' are:
|
||||
## Very organized
|
||||
## Easy to follow
|
||||
#: Previous item continues
|
||||
A new line marks the end of the list.
|
||||
# New numbering starts with 1
|
||||
|
||||
==Text Indents==
|
||||
: A colon (:) indents a line or paragraph.
|
||||
A newline starts a new paragraph.
|
||||
: We use 1 colon to indent once.
|
||||
:: We use 2 colons to indent twice.
|
||||
::: 3 colons to indent 3 times, and so on.
|
||||
|
||||
==Table==
|
||||
<nowiki>
|
||||
{| border="1" cellspacing="0" cellpadding="5" align="left"
|
||||
! Web site
|
||||
! Link
|
||||
! Contact Email
|
||||
|-
|
||||
| '''OpenERP''' - ''Belgium''
|
||||
| [http://openerp.com]
|
||||
| [mailto:sales AT tiny.be]
|
||||
|}
|
||||
</nowiki>
|
||||
|
||||
{| border="1" cellspacing="0" cellpadding="5" align="left"
|
||||
! Web site
|
||||
! Link
|
||||
! Contact Email
|
||||
|-
|
||||
| '''OpenERP''' - ''Belgium''
|
||||
| [http://openerp.com]
|
||||
| [mailto:sales AT tiny.be]
|
||||
|}
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
==Headings==
|
||||
=1st Level Heading=
|
||||
==2nd Level Heading==
|
||||
===3rd Level Heading===
|
||||
|
||||
</field>
|
||||
<field name="group_id" ref="wiki_groups_wikiformatting0"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
@ -18,126 +18,162 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
import difflib
|
||||
from openerp import models, fields, api, _
|
||||
|
||||
|
||||
class document_page(osv.osv):
|
||||
class document_page(models.Model):
|
||||
_name = "document.page"
|
||||
_description = "Document Page"
|
||||
_order = 'name'
|
||||
|
||||
def _get_page_index(self, cr, uid, page, link=True):
|
||||
name = fields.Char('Title', required=True)
|
||||
|
||||
type = fields.Selection(
|
||||
[('content', 'Content'), ('category', 'Category')],
|
||||
'Type',
|
||||
help="Page type",
|
||||
default="content"
|
||||
)
|
||||
|
||||
parent_id = fields.Many2one(
|
||||
'document.page',
|
||||
'Category',
|
||||
domain=[('type', '=', 'category')]
|
||||
)
|
||||
|
||||
child_ids = fields.One2many(
|
||||
'document.page',
|
||||
'parent_id',
|
||||
'Children'
|
||||
)
|
||||
|
||||
content = fields.Text(
|
||||
"Content"
|
||||
)
|
||||
|
||||
display_content = fields.Text(
|
||||
string='Displayed Content',
|
||||
compute='_get_display_content'
|
||||
)
|
||||
|
||||
history_ids = fields.One2many(
|
||||
'document.page.history',
|
||||
'page_id',
|
||||
'History'
|
||||
)
|
||||
|
||||
menu_id = fields.Many2one(
|
||||
'ir.ui.menu',
|
||||
"Menu",
|
||||
readonly=True
|
||||
)
|
||||
|
||||
create_date = fields.Datetime(
|
||||
"Created on",
|
||||
select=True,
|
||||
readonly=True
|
||||
)
|
||||
|
||||
create_uid = fields.Many2one(
|
||||
'res.users',
|
||||
'Author',
|
||||
select=True,
|
||||
readonly=True
|
||||
)
|
||||
|
||||
write_date = fields.Datetime(
|
||||
"Modification Date",
|
||||
select=True,
|
||||
readonly=True)
|
||||
|
||||
write_uid = fields.Many2one(
|
||||
'res.users',
|
||||
"Last Contributor",
|
||||
select=True,
|
||||
readonly=True
|
||||
)
|
||||
|
||||
def _get_page_index(self, page, link=True):
|
||||
index = []
|
||||
for subpage in page.child_ids:
|
||||
index += ["<li>" + self._get_page_index(cr, uid, subpage) +
|
||||
index += ["<li>" + self._get_page_index(subpage) +
|
||||
"</li>"]
|
||||
r = ''
|
||||
if link:
|
||||
r = '<a href="#id=%s">%s</a>' % (page.id, page.name)
|
||||
|
||||
if index:
|
||||
r += "<ul>" + "".join(index) + "</ul>"
|
||||
return r
|
||||
|
||||
def _get_display_content(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for page in self.browse(cr, uid, ids, context=context):
|
||||
def _get_display_content(self):
|
||||
for page in self:
|
||||
if page.type == "category":
|
||||
content = self._get_page_index(cr, uid, page, link=False)
|
||||
display_content = self._get_page_index(page, link=False)
|
||||
else:
|
||||
content = page.content
|
||||
res[page.id] = content
|
||||
return res
|
||||
display_content = page.content
|
||||
page.display_content = display_content
|
||||
|
||||
_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'),
|
||||
'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'),
|
||||
'menu_id': fields.many2one('ir.ui.menu', "Menu", readonly=True),
|
||||
@api.onchange("parent_id")
|
||||
def do_set_content(self):
|
||||
if self.parent_id and not self.content:
|
||||
if self.parent_id.type == "category":
|
||||
self.content = self.parent_id.content
|
||||
|
||||
'create_date': fields.datetime("Created on", select=True,
|
||||
readonly=True),
|
||||
'create_uid': fields.many2one('res.users', 'Author', select=True,
|
||||
readonly=True),
|
||||
'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 create_history(self, page_id, content):
|
||||
history = self.env['document.page.history']
|
||||
return history.create({
|
||||
"content": content,
|
||||
"page_id": page_id
|
||||
})
|
||||
|
||||
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')
|
||||
if vals.get('content'):
|
||||
res = {
|
||||
'content': vals.get('content', ''),
|
||||
'page_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
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
result = super(document_page, self).write(cr, uid, ids, vals, context)
|
||||
self.create_history(cr, uid, ids, vals, context)
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
result = super(document_page, self).write(vals)
|
||||
content = vals.get('content')
|
||||
if content:
|
||||
for page in self:
|
||||
self.create_history(page.id, content)
|
||||
return result
|
||||
|
||||
@api.model
|
||||
@api.returns('self', lambda value: value.id)
|
||||
def create(self, vals):
|
||||
page_id = super(document_page, self).create(vals)
|
||||
content = vals.get('content')
|
||||
if content:
|
||||
self.create_history(page_id.id, content)
|
||||
return page_id
|
||||
|
||||
class document_page_history(osv.osv):
|
||||
|
||||
class document_page_history(models.Model):
|
||||
_name = "document.page.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"),
|
||||
}
|
||||
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")
|
||||
|
||||
def getDiff(self, cr, uid, v1, v2, context=None):
|
||||
history_pool = self.pool.get('document.page.history')
|
||||
text1 = history_pool.read(cr, uid, [v1], ['content'])[0]['content']
|
||||
text2 = history_pool.read(cr, uid, [v2], ['content'])[0]['content']
|
||||
def getDiff(self, v1, v2):
|
||||
text1 = self.browse(v1).content
|
||||
text2 = self.browse(v2).content
|
||||
line1 = line2 = ''
|
||||
if text1:
|
||||
line1 = text1.splitlines(1)
|
||||
if text2:
|
||||
line2 = text2.splitlines(1)
|
||||
if (not line1 and not line2) or (line1 == line2):
|
||||
raise osv.except_osv(_('Warning!'),
|
||||
_('There are no changes in revisions.'))
|
||||
diff = difflib.HtmlDiff()
|
||||
return diff.make_table(line1, line2, "Revision-%s" % (v1),
|
||||
"Revision-%s" % (v2), context=True)
|
||||
return _('There are no changes in revisions.')
|
||||
else:
|
||||
diff = difflib.HtmlDiff()
|
||||
return diff.make_table(
|
||||
line1, line2,
|
||||
"Revision-{}".format(v1),
|
||||
"Revision-{}".format(v2),
|
||||
context=True
|
||||
)
|
||||
|
@ -2,7 +2,8 @@
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="base.user_demo" model="res.users">
|
||||
<field eval="[(4, ref('base.group_sale_salesman')),(4, ref('base.group_document_user'))]" name="groups_id"/>
|
||||
<field eval="[(4, ref('base.group_document_user'))]"
|
||||
name="groups_id"/>
|
||||
</record>
|
||||
<record id="demo_category1" model="document.page">
|
||||
<field name="name">OpenERP Features</field>
|
||||
|
@ -1,8 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem name="Knowledge" id="knowledge.menu_document"/>
|
||||
<menuitem name="Pages" id="menu_wiki" parent="knowledge.menu_document" sequence="20" />
|
||||
<menuitem name="Knowledge"
|
||||
id="knowledge.menu_document" />
|
||||
|
||||
<menuitem name="Pages"
|
||||
id="menu_wiki"
|
||||
parent="knowledge.menu_document"
|
||||
sequence="20" />
|
||||
|
||||
<!-- wiki tree view -->
|
||||
<record id="view_wiki_tree_children" model="ir.ui.view">
|
||||
@ -18,6 +23,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- wiki list view -->
|
||||
<record id="view_wiki_tree" model="ir.ui.view">
|
||||
<field name="name">document.page.list</field>
|
||||
@ -32,6 +38,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- wiki Form view -->
|
||||
<record id="view_wiki_form" model="ir.ui.view">
|
||||
<field name="name">document.page.form</field>
|
||||
@ -42,42 +49,66 @@
|
||||
<h1><field name="name" placeholder="Name"/></h1>
|
||||
<group class="oe_edit_only">
|
||||
<group>
|
||||
<field name="parent_id" on_change="onchange_parent_id(parent_id,content)" string="Category" context="{'default_type':'category'}"/>
|
||||
<field name="parent_id"
|
||||
string="Category"
|
||||
context="{'default_type':'category'}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="write_uid" groups="base.group_no_one"/>
|
||||
<field name="write_date" groups="base.group_no_one"/>
|
||||
<field name="menu_id" groups="base.group_no_one"/>
|
||||
<field name="write_uid"
|
||||
groups="base.group_no_one"/>
|
||||
<field name="write_date"
|
||||
groups="base.group_no_one"/>
|
||||
<field name="menu_id"
|
||||
groups="base.group_no_one"/>
|
||||
</group>
|
||||
</group>
|
||||
<div class="oe_edit_only" attrs="{'invisible':[('type','=','content')]}">
|
||||
|
||||
<div class="oe_edit_only"
|
||||
attrs="{'invisible':[('type','=','content')]}">
|
||||
<label for="content" string="Template"/>
|
||||
that will be used as a content template for all new page of this category.
|
||||
</div>
|
||||
<field name="content" placeholder="e.g. Once upon a time..." class="oe_edit_only" widget="html"/>
|
||||
<field name="content"
|
||||
placeholder="e.g. Once upon a time..."
|
||||
class="oe_edit_only"
|
||||
widget="html" />
|
||||
<div class="oe_document_page">
|
||||
<field name="display_content" widget="html" class="oe_view_only" options='{"safe": True}'/>
|
||||
<field name="display_content"
|
||||
widget="html"
|
||||
class="oe_view_only"
|
||||
options='{"safe": True}' />
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- page Search view -->
|
||||
<record id="view_wiki_filter" model="ir.ui.view">
|
||||
<field name="name">document.page.search</field>
|
||||
<field name="model">document.page</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Document Page">
|
||||
<field name="name" string="Content" filter_domain="['|', ('name','ilike',self), ('content','ilike',self)]"/>
|
||||
<field name="name"
|
||||
string="Content"
|
||||
filter_domain="['|', ('name','ilike',self), ('content','ilike',self)]"/>
|
||||
<field name="write_uid"/>
|
||||
<field name="parent_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Document Type" domain="[]" context="{'group_by':'parent_id'}"/>
|
||||
<filter string="Author" domain="[]" context="{'group_by':'create_uid'}"/>
|
||||
<filter string="Last Contributor" domain="[]" context="{'group_by':'write_uid'}"/>
|
||||
<filter string="Document Type"
|
||||
domain="[]"
|
||||
context="{'group_by':'parent_id'}" />
|
||||
<filter string="Author"
|
||||
domain="[]"
|
||||
context="{'group_by':'create_uid'}" />
|
||||
<filter string="Last Contributor"
|
||||
domain="[]"
|
||||
context="{'group_by':'write_uid'}" />
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- page action -->
|
||||
<record id="action_page" model="ir.actions.act_window">
|
||||
<field name="name">Pages</field>
|
||||
@ -94,7 +125,13 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
<menuitem id="menu_page" parent="menu_wiki" name="Pages" action="action_page" sequence="10"/>
|
||||
|
||||
<menuitem id="menu_page"
|
||||
parent="menu_wiki"
|
||||
name="Pages"
|
||||
action="action_page"
|
||||
sequence="10" />
|
||||
|
||||
<record id="action_category" model="ir.actions.act_window">
|
||||
<field name="name">Category</field>
|
||||
<field name="res_model">document.page</field>
|
||||
@ -105,7 +142,11 @@
|
||||
<field name="view_id" ref="view_wiki_tree"/>
|
||||
<field name="search_view_id" ref="view_wiki_filter"/>
|
||||
</record>
|
||||
<menuitem id="menu_category" parent="menu_wiki" name="Categories" action="action_category" sequence="20"/>
|
||||
<menuitem id="menu_category"
|
||||
parent="menu_wiki"
|
||||
name="Categories"
|
||||
action="action_category"
|
||||
sequence="20"/>
|
||||
|
||||
<!-- History Tree view -->
|
||||
<record model="ir.ui.view" id="view_wiki_history_tree">
|
||||
@ -134,6 +175,7 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- History Action -->
|
||||
<record model="ir.actions.act_window" id="action_history">
|
||||
<field name="name">Page history</field>
|
||||
@ -141,7 +183,14 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem id="menu_page_history" parent="menu_wiki" name="Pages history" action="action_history" sequence="30" groups="base.group_no_one"/>
|
||||
|
||||
<menuitem id="menu_page_history"
|
||||
parent="menu_wiki"
|
||||
name="Pages history"
|
||||
action="action_history"
|
||||
sequence="30"
|
||||
groups="base.group_no_one" />
|
||||
|
||||
<act_window
|
||||
id="action_related_page_history"
|
||||
context="{'search_default_page_id': [active_id], 'default_page_id': active_id}"
|
||||
@ -149,7 +198,8 @@
|
||||
name="Page History"
|
||||
res_model="document.page.history"
|
||||
src_model="document.page"/>
|
||||
<act_window
|
||||
|
||||
<act_window
|
||||
id="action_related_page_create_menu"
|
||||
name="Create Menu"
|
||||
res_model="document.page.create.menu"
|
||||
|
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
<record id="base.group_document_user" model="res.groups">
|
||||
<field name="name">User</field>
|
||||
<field name="category_id" ref="base.module_category_knowledge_management"/>
|
||||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
@ -30,13 +30,16 @@
|
||||
|
||||
Wiki text can easily be edited
|
||||
'
|
||||
|
||||
-
|
||||
I check the page history for the current page by clicking on "Page History".After that find difference between history.
|
||||
-
|
||||
!python {model: wizard.document.page.history.show_diff}: |
|
||||
hist_obj = model.pool.get('document.page.history')
|
||||
ids = hist_obj.search(cr, uid, [('page_id', '=', ref("test_page0"))])
|
||||
model.get_diff(cr, uid, {'active_ids': ids[:] })
|
||||
!python {model: wizard.document.page.history.show_diff, id: False}: |
|
||||
hist_obj = self.env['document.page.history']
|
||||
ids = hist_obj.search([('page_id', '=', ref("test_page0"))])
|
||||
self.with_context(active_ids=[i.id for i in ids]).get_diff()
|
||||
|
||||
|
||||
-
|
||||
I click the "create menu" link and i fill the form.
|
||||
-
|
||||
@ -46,9 +49,7 @@
|
||||
-
|
||||
I create a Menu by clicking on "create menu"
|
||||
-
|
||||
!python {model: document.page.create.menu}: |
|
||||
ids = [ref("test_create_menu0")]
|
||||
context['active_id'] = ref('test_page0')
|
||||
self.document_page_menu_create(cr, uid, ids, context)
|
||||
|
||||
!python {model: document.page.create.menu, id: False}: |
|
||||
menu = self.search([('id', '=', ref("test_create_menu0"))])
|
||||
menu.with_context(active_id=[ref('test_page0')]).document_page_menu_create()
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
import widgets
|
||||
import controllers
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
@ -1,3 +0,0 @@
|
||||
import wiki
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
@ -1,65 +0,0 @@
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2007-TODAY Tiny ERP Pvt Ltd. All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Developed by Tiny (http://openerp.com) and Axelor (http://axelor.com).
|
||||
#
|
||||
# The OpenERP web client is distributed under the "OpenERP Public License".
|
||||
# It's based on Mozilla Public License Version (MPL) 1.1 with following
|
||||
# restrictions:
|
||||
#
|
||||
# - All names, links and logos of Tiny, OpenERP and Axelor must be
|
||||
# kept as in original distribution without any changes in all software
|
||||
# screens, especially in start-up page and the software header, even if
|
||||
# the application source code has been changed or updated or code has been
|
||||
# added.
|
||||
#
|
||||
# - All distributions of the software must keep source code with OEPL.
|
||||
#
|
||||
# - All integrations to any other software must keep source code with OEPL.
|
||||
#
|
||||
# If you need commercial licence to remove this kind of restriction please
|
||||
# contact us.
|
||||
#
|
||||
# You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
#
|
||||
###############################################################################
|
||||
import base64
|
||||
|
||||
import cherrypy
|
||||
|
||||
import openobject
|
||||
from openobject.tools import expose
|
||||
|
||||
from openerp.controllers import SecuredController
|
||||
|
||||
|
||||
class WikiView(SecuredController):
|
||||
_cp_path = "/wiki/wiki"
|
||||
|
||||
def get_attachment(self, **kwargs):
|
||||
attachments = openobject.rpc.RPCProxy('ir.attachment')
|
||||
file_name = kwargs.get('file').replace("'", '').strip()
|
||||
id = kwargs.get('id').strip()
|
||||
|
||||
ids = attachments.search([('datas_fname', '=', file_name),
|
||||
('res_model', '=', 'wiki.wiki'),
|
||||
('res_id', '=', id)])
|
||||
|
||||
res = attachments.read(ids, ['datas'])[0].get('datas')
|
||||
return res, file_name
|
||||
|
||||
@expose(content_type='application/octet')
|
||||
def getImage(self, *kw, **kws):
|
||||
res, _ = self.get_attachment(**kws)
|
||||
return base64.decodestring(res)
|
||||
|
||||
@expose(content_type='application/octet')
|
||||
def getfile(self, *kw, **kws):
|
||||
res, file_name = self.get_attachment(**kws)
|
||||
cherrypy.response.headers['Content-Disposition'] = 'filename="%s"' % (file_name,)
|
||||
return base64.decodestring(res)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
@ -1,22 +0,0 @@
|
||||
# Bulgarian translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-02-11 01:13+0000\n"
|
||||
"Last-Translator: Dimitar Markov <Unknown>\n"
|
||||
"Language-Team: Bulgarian <bg@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-02-12 06:06+0000\n"
|
||||
"X-Generator: Launchpad (build 12351)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Съдържание"
|
@ -1,22 +0,0 @@
|
||||
# Catalan translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-03-12 20:33+0000\n"
|
||||
"Last-Translator: mgaja (GrupoIsep.com) <Unknown>\n"
|
||||
"Language-Team: Catalan <ca@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-03-13 06:16+0000\n"
|
||||
"X-Generator: Launchpad (build 12559)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Índex"
|
@ -1,22 +0,0 @@
|
||||
# Danish translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-04-29 12:05+0000\n"
|
||||
"Last-Translator: Hans Henrik Gabelgaard <Unknown>\n"
|
||||
"Language-Team: Danish <da@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-04-30 06:08+0000\n"
|
||||
"X-Generator: Launchpad (build 12758)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Indholdsfortegnelse"
|
@ -1,22 +0,0 @@
|
||||
# German translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-02-11 11:54+0000\n"
|
||||
"Last-Translator: Ferdinand @ Camptocamp <Unknown>\n"
|
||||
"Language-Team: German <de@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-02-12 06:06+0000\n"
|
||||
"X-Generator: Launchpad (build 12351)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Inhaltsverzeichnis"
|
@ -1,20 +0,0 @@
|
||||
# German (Germany) translations for PROJECT.
|
||||
# Copyright (C) 2009 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
|
||||
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: de_DE <LL@li.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
@ -1,24 +0,0 @@
|
||||
# German (Germany) translations for PROJECT.
|
||||
# Copyright (C) 2009 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
|
||||
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: de_DE <LL@li.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr ""
|
||||
|
@ -1,23 +0,0 @@
|
||||
# Translations template for PROJECT.
|
||||
# Copyright (C) 2010 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2012-02-08 03:00-0600\n"
|
||||
"Last-Translator: Carlos Vásquez - CLEARCORP <carlos.vasquez@clearcorp.co.cr>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr ""
|
||||
|
@ -1,20 +0,0 @@
|
||||
# Spanish (Spain) translations for PROJECT.
|
||||
# Copyright (C) 2009 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
|
||||
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: es_ES <LL@li.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
@ -1,24 +0,0 @@
|
||||
# Spanish (Spain) translations for PROJECT.
|
||||
# Copyright (C) 2009 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
|
||||
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: es_ES <LL@li.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr ""
|
||||
|
@ -1,22 +0,0 @@
|
||||
# Spanish (Paraguay) translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-03-21 16:31+0000\n"
|
||||
"Last-Translator: fadel <Unknown>\n"
|
||||
"Language-Team: Spanish (Paraguay) <es_PY@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-03-22 06:23+0000\n"
|
||||
"X-Generator: Launchpad (build 12559)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Tabla de Contenido"
|
@ -1,22 +0,0 @@
|
||||
# French translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-02-11 20:16+0000\n"
|
||||
"Last-Translator: lolivier <olivier.lenoir@free.fr>\n"
|
||||
"Language-Team: French <fr@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-02-12 06:06+0000\n"
|
||||
"X-Generator: Launchpad (build 12351)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Table des matières"
|
@ -1,20 +0,0 @@
|
||||
# French (France) translations for PROJECT.
|
||||
# Copyright (C) 2009 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
|
||||
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: fr_FR <LL@li.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
@ -1,24 +0,0 @@
|
||||
# French (France) translations for PROJECT.
|
||||
# Copyright (C) 2009 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
|
||||
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: fr_FR <LL@li.org>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr ""
|
||||
|
@ -1,22 +0,0 @@
|
||||
# Galician translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-03-02 23:19+0000\n"
|
||||
"Last-Translator: Santi (Pexego) <santiago@pexego.es>\n"
|
||||
"Language-Team: Galician <gl@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-03-03 06:01+0000\n"
|
||||
"X-Generator: Launchpad (build 12351)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Índice"
|
@ -1,19 +0,0 @@
|
||||
# Translations template for PROJECT.
|
||||
# Copyright (C) 2010 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
@ -1,23 +0,0 @@
|
||||
# Translations template for PROJECT.
|
||||
# Copyright (C) 2010 ORGANIZATION
|
||||
# This file is distributed under the same license as the PROJECT project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel None\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr ""
|
||||
|
@ -1,22 +0,0 @@
|
||||
# Russian translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-03-16 00:17+0000\n"
|
||||
"Last-Translator: Stanislav Hanzhin <Unknown>\n"
|
||||
"Language-Team: Russian <ru@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-03-17 06:12+0000\n"
|
||||
"X-Generator: Launchpad (build 12559)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Содержание"
|
@ -1,22 +0,0 @@
|
||||
# Slovak translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-02-21 13:05+0000\n"
|
||||
"Last-Translator: Radoslav Sloboda <rado.sloboda@gmail.com>\n"
|
||||
"Language-Team: Slovak <sk@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-02-22 14:27+0000\n"
|
||||
"X-Generator: Launchpad (build 12351)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "Obsah"
|
@ -1,22 +0,0 @@
|
||||
# Turkish translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
|
||||
"PO-Revision-Date: 2011-02-08 21:20+0000\n"
|
||||
"Last-Translator: Ahmet Altınışık <Unknown>\n"
|
||||
"Language-Team: Turkish <tr@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-02-09 06:02+0000\n"
|
||||
"X-Generator: Launchpad (build 12177)\n"
|
||||
|
||||
#: widgets/wikimarkup/__init__.py:1981
|
||||
msgid "Table of Contents"
|
||||
msgstr "İçindekiler"
|
@ -1,32 +0,0 @@
|
||||
.wikiwidget #toc {
|
||||
border:1px solid #aaaaaa;
|
||||
background-color:#f9f9f9;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: black;
|
||||
background: none;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
padding-top: .5em;
|
||||
padding-bottom: .17em;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
h1 { font-size: 188%; }
|
||||
h2 { font-size: 150%; }
|
||||
h3, h4, h5, h6 {
|
||||
border-bottom: none;
|
||||
}
|
||||
h3 { font-size: 132%; }
|
||||
h4 { font-size: 116%; }
|
||||
h5 { font-size: 100%; }
|
||||
h6 { font-size: 80%; }
|
||||
|
||||
pre {
|
||||
background-color:#F9F9F9;
|
||||
border:1px dashed #2F6FAB;
|
||||
color:black;
|
||||
line-height:1.1em;
|
||||
padding:1em;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
from wiki import WikiWidget
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
@ -1,3 +0,0 @@
|
||||
import feedparser
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
File diff suppressed because it is too large
Load Diff
@ -1,23 +0,0 @@
|
||||
% if editable and not inline:
|
||||
<textarea rows="10" id="${name}" name="${name}" class="${css_class}"
|
||||
${py.attrs(attrs, kind=kind)} style="width: 99%;">${value}</textarea>
|
||||
<script type="text/javascript">
|
||||
if (!window.browser.isWebKit) {
|
||||
new openerp.ui.TextArea('${name}');
|
||||
}
|
||||
</script>
|
||||
% endif
|
||||
|
||||
% if editable and inline:
|
||||
<input type="text" id="${name}" name="${name}" class="${css_class}"
|
||||
${py.attrs(attrs, kind=kind, value=value)}/>
|
||||
% endif
|
||||
|
||||
% if editable and error:
|
||||
<span class="fielderror">${error}</span>
|
||||
% endif
|
||||
|
||||
% if not editable and value:
|
||||
<div kind="${kind}" id="${name}" class="${css_class}">${data|n}</div>
|
||||
% endif
|
||||
|
@ -1,224 +0,0 @@
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2007-TODAY Tiny ERP Pvt Ltd. All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Developed by Tiny (http://openerp.com) and Axelor (http://axelor.com).
|
||||
#
|
||||
# The OpenERP web client is distributed under the "OpenERP Public License".
|
||||
# It's based on Mozilla Public License Version (MPL) 1.1 with following
|
||||
# restrictions:
|
||||
#
|
||||
# - All names, links and logos of Tiny, OpenERP and Axelor must be
|
||||
# kept as in original distribution without any changes in all software
|
||||
# screens, especially in start-up page and the software header, even if
|
||||
# the application source code has been changed or updated or code has been
|
||||
# added.
|
||||
#
|
||||
# - All distributions of the software must keep source code with OEPL.
|
||||
#
|
||||
# - All integrations to any other software must keep source code with OEPL.
|
||||
#
|
||||
# If you need commercial licence to remove this kind of restriction please
|
||||
# contact us.
|
||||
#
|
||||
# You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
import re
|
||||
|
||||
import cherrypy
|
||||
import wikimarkup
|
||||
|
||||
from openobject import rpc
|
||||
from openobject.widgets import CSSLink
|
||||
|
||||
|
||||
from openerp.widgets import register_widget
|
||||
from openerp.widgets.form import Text
|
||||
|
||||
|
||||
_image = re.compile(r'img:(.*)\.(.*)', re.UNICODE)
|
||||
_rss = re.compile(r'rss:(.*)\.(.*)', re.UNICODE)
|
||||
_attach = re.compile(r'attach:(.*)\.(.*)', re.UNICODE)
|
||||
_internalLinks = re.compile(r'\[\[.*\]\]', re.UNICODE)
|
||||
_edit = re.compile(r'edit:(.*)\|(.*)', re.UNICODE)
|
||||
_view = re.compile(r'view:(.*)\|(.*)', re.UNICODE)
|
||||
|
||||
class WikiParser(wikimarkup.Parser):
|
||||
|
||||
def parse(self, text, id):
|
||||
text = text.replace(' ', 'n-b-s-p')
|
||||
text = text.replace('&', 'n-a-m-p')
|
||||
text = text.replace('&','&')
|
||||
text = text.replace('n-b-s-p', ' ')
|
||||
text = text.replace('n-a-m-p', '&')
|
||||
text = text.replace('<code>', '<pre>')
|
||||
text = text.replace('</code>', '</pre>')
|
||||
|
||||
text = wikimarkup.to_unicode(text)
|
||||
text = self.strip(text)
|
||||
|
||||
text = super(WikiParser, self).parse(text)
|
||||
text = self.addImage(text, id)
|
||||
text = self.attachDoc(text, id)
|
||||
text = self.recordLink(text)
|
||||
text = self.viewRecordLink(text)
|
||||
text = self.addInternalLinks(text)
|
||||
#TODO : already implemented but we will implement it later after releasing the 5.0
|
||||
#text = self.addRss(text, id)
|
||||
return text
|
||||
|
||||
def viewRecordLink(self, text):
|
||||
def record(path):
|
||||
record = path.group().replace('view:','').split("|")
|
||||
model = record[0]
|
||||
text = record[1].replace('\r','').strip()
|
||||
label = "View Record"
|
||||
if len(record) > 2:
|
||||
label = record[2]
|
||||
proxy = rpc.RPCProxy(model)
|
||||
ids = proxy.name_search(text, [], 'ilike', {})
|
||||
if len(ids):
|
||||
id = ids[0][0]
|
||||
else:
|
||||
try:
|
||||
id = int(text)
|
||||
except:
|
||||
id = 0
|
||||
return "[[/openerp/form/view?model=%s&id=%d | %s]]" % (model, id, label)
|
||||
|
||||
bits = _view.sub(record, text)
|
||||
return bits
|
||||
|
||||
def addRss(self, text, id):
|
||||
def addrss(path):
|
||||
rssurl = path.group().replace('rss:','')
|
||||
import rss.feedparser as feedparser
|
||||
data = feedparser.parse(rssurl)
|
||||
values = "<h2>%s</h2><br/>" % (data.feed.title)
|
||||
values += "%s<br/>" % (data.channel.description)
|
||||
for entry in data['entries']:
|
||||
values += "<h3><a href='%s'> %s </a></h3><br/>" % (entry.link, entry.title)
|
||||
values += "%s <br/>" % (entry.summary)
|
||||
|
||||
return values
|
||||
|
||||
bits = _rss.sub(addrss, text)
|
||||
return bits
|
||||
|
||||
def attachDoc(self, text, id):
|
||||
def document(path):
|
||||
file = path.group().replace('attach:','')
|
||||
if file.startswith('http') or file.startswith('ftp'):
|
||||
return "<a href='%s'>Download File</a>" % (file)
|
||||
else:
|
||||
proxy = rpc.RPCProxy('ir.attachment')
|
||||
ids = proxy.search([('datas_fname','=',file.strip()), ('res_model','=','wiki.wiki'), ('res_id','=',id)])
|
||||
if len(ids) > 0:
|
||||
return "<a href='/widget_wiki/wiki/getfile?file=%s&id=%d'>%s</a>" % (file, id, file)
|
||||
else:
|
||||
return """<a onclick="openobject.tools.openWindow(openobject.http.getURL('/openerp/attachment', {model: 'wiki.wiki', id: %d}),
|
||||
{name : 'Wiki Attachments'})">Attach : %s </a>""" % (id, file)
|
||||
bits = _attach.sub(document, text)
|
||||
return bits
|
||||
|
||||
def addImage(self, text, id):
|
||||
def image(path):
|
||||
file = path.group().replace('img:','')
|
||||
if file.startswith('http') or file.startswith('ftp'):
|
||||
return "<img src='%s'/>" % (file)
|
||||
else:
|
||||
proxy = rpc.RPCProxy('ir.attachment')
|
||||
ids = proxy.search([('datas_fname','=',file.strip()), ('res_model','=','wiki.wiki'), ('res_id','=',id)])
|
||||
if len(ids) > 0:
|
||||
return "<img src='/widget_wiki/wiki/getImage?file=%s&id=%d'/>" % (file, id)
|
||||
else:
|
||||
return """<a onclick="openobject.tools.openWindow(openobject.http.getURL('/openerp/attachment', {model: 'wiki.wiki', id: %d}),
|
||||
{name : 'Wiki Attachments'})">Attach : %s </a>""" % (id, file)
|
||||
#"[[/attachment/?model=wiki.wiki&id=%d | Attach:%s]]" % (id, file)
|
||||
bits = _image.sub(image, text)
|
||||
return bits
|
||||
|
||||
def recordLink(self, text):
|
||||
def record(path):
|
||||
record = path.group().replace('edit:','').split("|")
|
||||
model = record[0]
|
||||
text = record[1].replace('\r','').strip()
|
||||
label = "Edit Record"
|
||||
if len(record) > 2:
|
||||
label = record[2]
|
||||
proxy = rpc.RPCProxy(model)
|
||||
ids = proxy.name_search(text, [], '=', {})
|
||||
if len(ids):
|
||||
id = ids[0][0]
|
||||
else:
|
||||
try:
|
||||
id = int(text)
|
||||
except:
|
||||
id = 0
|
||||
return "[[/openerp/form/edit?model=%s&id=%d | %s]]" % (model, id, label)
|
||||
|
||||
bits = _edit.sub(record, text)
|
||||
return bits
|
||||
|
||||
def addInternalLinks(self, text):
|
||||
proxy = rpc.RPCProxy('wiki.wiki')
|
||||
|
||||
def link(path):
|
||||
link = path.group().replace('[','').replace('[','').replace(']','').replace(']','').split("|")
|
||||
name_to_search = link[0].strip()
|
||||
mids = proxy.search([('name','ilike', name_to_search)])
|
||||
link_str = ""
|
||||
if mids:
|
||||
if len(link) == 2:
|
||||
link_str = "<a href='/openerp/form/view?model=wiki.wiki&id=%s'>%s</a>" % (mids[0], link[1])
|
||||
elif len(link) == 1:
|
||||
link_str = "<a href='/openerp/form/view?model=wiki.wiki&id=%s'>%s</a>" % (mids[0], link[0])
|
||||
else:
|
||||
if len(link) == 2:
|
||||
link_str = "<a href='%s'>%s</a>" % (link[0], link[1])
|
||||
elif len(link) == 1:
|
||||
link_str = "<a href='/openerp/form/edit?model=wiki.wiki&id=False'>%s</a>" % (link[0])
|
||||
|
||||
return link_str
|
||||
|
||||
bits = _internalLinks.sub(link, text)
|
||||
return bits
|
||||
|
||||
def wiki2html(text, showToc, id):
|
||||
p = WikiParser(show_toc=showToc)
|
||||
return p.parse(text, id)
|
||||
|
||||
class WikiWidget(Text):
|
||||
template = "/wiki/widgets/templates/wiki.mako"
|
||||
|
||||
params = ["data"]
|
||||
|
||||
css = [CSSLink("wiki", "css/wiki.css")]
|
||||
|
||||
data = None
|
||||
|
||||
def set_value(self, value):
|
||||
super(WikiWidget, self).set_value(value)
|
||||
|
||||
if value:
|
||||
toc = True
|
||||
id = False
|
||||
if hasattr(cherrypy.request, 'terp_record'):
|
||||
params = cherrypy.request.terp_params
|
||||
if params._terp_model == 'wiki.wiki':
|
||||
proxy = rpc.RPCProxy('wiki.wiki')
|
||||
toc = proxy.read([params.id], ['toc'])[0]['toc']
|
||||
id = params.id
|
||||
|
||||
text = value+'\n\n'
|
||||
html = wiki2html(text, toc, id)
|
||||
|
||||
self.data = html
|
||||
|
||||
register_widget(WikiWidget, ["text_wiki"])
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
File diff suppressed because it is too large
Load Diff
@ -18,8 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import document_page_create_menu
|
||||
import document_page_show_diff
|
||||
from . import document_page_create_menu
|
||||
from . import document_page_show_diff
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
@ -18,50 +18,43 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.osv import fields, osv
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class document_page_create_menu(osv.osv_memory):
|
||||
class document_page_create_menu(models.TransientModel):
|
||||
""" Create Menu """
|
||||
_name = "document.page.create.menu"
|
||||
_description = "Wizard Create Menu"
|
||||
|
||||
_columns = {
|
||||
'menu_name': fields.char('Menu Name', size=256, required=True),
|
||||
'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu',
|
||||
required=True),
|
||||
}
|
||||
menu_name = fields.Char(
|
||||
'Menu Name',
|
||||
required=True
|
||||
)
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(document_page_create_menu, self).default_get(cr, uid,
|
||||
fields,
|
||||
context=
|
||||
context)
|
||||
page_id = context.get('active_id')
|
||||
obj_page = self.pool.get('document.page')
|
||||
page = obj_page.browse(cr, uid, page_id, context=context)
|
||||
menu_parent_id = fields.Many2one(
|
||||
'ir.ui.menu',
|
||||
'Parent Menu',
|
||||
required=True
|
||||
)
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields_list):
|
||||
res = super(document_page_create_menu, self).default_get(fields_list)
|
||||
page_id = self.env.context.get('active_id')
|
||||
obj_page = self.env['document.page']
|
||||
page = obj_page.browse(page_id)
|
||||
res['menu_name'] = page.name
|
||||
return res
|
||||
|
||||
def document_page_menu_create(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
obj_page = self.pool.get('document.page')
|
||||
obj_menu = self.pool.get('ir.ui.menu')
|
||||
obj_action = self.pool.get('ir.actions.act_window')
|
||||
page_id = context.get('active_id', False)
|
||||
page = obj_page.browse(cr, uid, page_id, context=context)
|
||||
@api.multi
|
||||
def document_page_menu_create(self):
|
||||
obj_page = self.env['document.page']
|
||||
obj_menu = self.env['ir.ui.menu']
|
||||
obj_action = self.env['ir.actions.act_window']
|
||||
page_id = self.env.context.get('active_id', False)
|
||||
page = obj_page.browse(page_id)
|
||||
|
||||
datas = self.browse(cr, uid, ids, context=context)
|
||||
data = False
|
||||
if datas:
|
||||
data = datas[0]
|
||||
if not data:
|
||||
return {}
|
||||
data = self[0]
|
||||
value = {
|
||||
'name': 'Document Page',
|
||||
'view_type': 'form',
|
||||
@ -74,16 +67,18 @@ class document_page_create_menu(osv.osv_memory):
|
||||
value['domain'] = "[('parent_id','=',%d)]" % (page.id)
|
||||
value['res_id'] = page.id
|
||||
|
||||
action_id = obj_action.create(cr, SUPERUSER_ID, value)
|
||||
# only the super user is allowed to create menu due to security rules
|
||||
# on ir.values
|
||||
menu_id = obj_menu.create(cr, SUPERUSER_ID, {
|
||||
# see.: http://goo.gl/Y99S7V
|
||||
action_id = obj_action.sudo().create(value)
|
||||
|
||||
menu_id = obj_menu.sudo().create({
|
||||
'name': data.menu_name,
|
||||
'parent_id': data.menu_parent_id.id,
|
||||
'icon': 'STOCK_DIALOG_QUESTION',
|
||||
'action': 'ir.actions.act_window,' + str(action_id),
|
||||
}, context)
|
||||
obj_page.write(cr, uid, [page_id], {'menu_id': menu_id})
|
||||
'action': 'ir.actions.act_window,' + str(action_id.id),
|
||||
})
|
||||
page.write({'menu_id': menu_id.id})
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'reload',
|
||||
|
@ -12,15 +12,23 @@
|
||||
<field name="menu_parent_id" />
|
||||
</group>
|
||||
<footer>
|
||||
<button name="document_page_menu_create" string="Create Menu" type="object" class="oe_highlight"/>
|
||||
<button name="document_page_menu_create"
|
||||
string="Create Menu"
|
||||
type="object"
|
||||
class="oe_highlight" />
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
<button string="Cancel"
|
||||
class="oe_link"
|
||||
special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Create Menu Action -->
|
||||
<record id="action_wiki_create_menu" model="ir.actions.act_window">
|
||||
<record id="action_wiki_create_menu"
|
||||
model="ir.actions.act_window">
|
||||
<field name="name">Create Menu</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.page.create.menu</field>
|
||||
|
@ -18,46 +18,44 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp import models, fields, _
|
||||
from openerp import exceptions
|
||||
|
||||
|
||||
class showdiff(osv.osv_memory):
|
||||
""" Disp[ay Difference for History """
|
||||
class showdiff(models.TransientModel):
|
||||
""" Display Difference for History """
|
||||
|
||||
_name = 'wizard.document.page.history.show_diff'
|
||||
|
||||
def get_diff(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
history = self.pool.get('document.page.history')
|
||||
ids = context.get('active_ids', [])
|
||||
def get_diff(self):
|
||||
history = self.env["document.page.history"]
|
||||
ids = self.env.context.get('active_ids', [])
|
||||
|
||||
diff = ""
|
||||
if len(ids) == 2:
|
||||
if ids[0] > ids[1]:
|
||||
diff = history.getDiff(cr, uid, ids[1], ids[0])
|
||||
diff = history.getDiff(ids[1], ids[0])
|
||||
else:
|
||||
diff = history.getDiff(cr, uid, ids[0], ids[1])
|
||||
|
||||
diff = history.getDiff(ids[0], ids[1])
|
||||
elif len(ids) == 1:
|
||||
old = history.browse(cr, uid, ids[0])
|
||||
nids = history.search(cr, uid, [('page_id', '=', old.page_id.id)])
|
||||
nids.sort()
|
||||
diff = history.getDiff(cr, uid, ids[0], nids[-1])
|
||||
old = history.browse(ids[0])
|
||||
nids = history.search(
|
||||
[('page_id', '=', old.page_id.id)],
|
||||
order='id DESC',
|
||||
limit=1
|
||||
)
|
||||
diff = history.getDiff(ids[0], nids.id)
|
||||
else:
|
||||
raise osv.except_osv(_('Warning!'), _('You need to select minimum \
|
||||
one or maximum two history \
|
||||
revisions!'))
|
||||
raise exceptions.Warning(
|
||||
_("You need to select minimum one or maximum "
|
||||
"two history revisions!")
|
||||
)
|
||||
return diff
|
||||
|
||||
_columns = {
|
||||
'diff': fields.text('Diff', readonly=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'diff': get_diff
|
||||
}
|
||||
diff = fields.Text(
|
||||
'Diff',
|
||||
readonly=True,
|
||||
default=get_diff
|
||||
)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
@ -8,13 +8,19 @@
|
||||
<field name="model">wizard.document.page.history.show_diff</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Difference" version="7.0">
|
||||
<field name="diff" widget="html" options='{"safe": True}'/>
|
||||
<field name="diff"
|
||||
widget="html"
|
||||
options='{"safe": True}' />
|
||||
<footer>
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
<button string="Close"
|
||||
class="oe_link"
|
||||
special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Create Index Action -->
|
||||
<record id="action_view_wiki_show_diff" model="ir.actions.act_window">
|
||||
<field name="name">Difference</field>
|
||||
@ -24,8 +30,10 @@
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Create Index Action Window -->
|
||||
<act_window
|
||||
<act_window
|
||||
id="action_view_wiki_show_diff_values"
|
||||
key2="client_action_multi"
|
||||
name="Difference"
|
||||
|
@ -1,104 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRl (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 Affero General Public license for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public license
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class wiki_make_index(osv.osv_memory):
|
||||
""" Create Index For Selected Page """
|
||||
|
||||
_name = "wiki.make.index"
|
||||
_description = "Create Index"
|
||||
|
||||
def wiki_do_index(self, cr, uid, ids, context=None):
|
||||
|
||||
""" Makes Index according to page hierarchy
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: list of wiki index’s IDs
|
||||
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
data = context and context.get('active_ids', []) or []
|
||||
|
||||
if not data:
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
for index_obj in self.browse(cr, uid, ids, context=context):
|
||||
wiki_pool = self.pool.get('wiki.wiki')
|
||||
cr.execute("Select id, section from wiki_wiki where id IN %s \
|
||||
order by section ", (tuple(data),))
|
||||
lst0 = cr.fetchall()
|
||||
if not lst0[0][1]:
|
||||
raise osv.except_osv(_('Warning!'), _('There is no section in\
|
||||
this Page.'))
|
||||
|
||||
lst = []
|
||||
s_ids = {}
|
||||
|
||||
for l in lst0:
|
||||
s_ids[l[1]] = l[0]
|
||||
lst.append(l[1])
|
||||
|
||||
lst.sort()
|
||||
val = None
|
||||
|
||||
def toint(x):
|
||||
try:
|
||||
return int(x)
|
||||
except:
|
||||
return 1
|
||||
|
||||
lst = map(lambda x: map(toint, x.split('.')), lst)
|
||||
|
||||
result = []
|
||||
current = ['0']
|
||||
current2 = []
|
||||
|
||||
for l in lst:
|
||||
for pos in range(len(l)):
|
||||
if pos >= len(current):
|
||||
current.append('1')
|
||||
continue
|
||||
if (pos == len(l) - 1) or (pos >= len(current2)) or \
|
||||
(toint(l[pos]) > toint(current2[pos])):
|
||||
current[pos] = str(toint(current[pos]) + 1)
|
||||
current = current[:pos + 1]
|
||||
if pos == len(l) - 1:
|
||||
break
|
||||
key = ('.'.join([str(x) for x in l]))
|
||||
id = s_ids[key]
|
||||
val = ('.'.join([str(x) for x in current[:]]), id)
|
||||
|
||||
if val:
|
||||
result.append(val)
|
||||
current2 = l
|
||||
|
||||
for rs in result:
|
||||
wiki_pool.write(cr, uid, [rs[1]], {'section': rs[0]})
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
wiki_make_index()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Create Index Form view -->
|
||||
|
||||
<record id="view_wiki_make_index" model="ir.ui.view">
|
||||
<field name="name">Create Index</field>
|
||||
<field name="model">wiki.make.index</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Menu" version="7.0">
|
||||
<separator string="Menu Information"/>
|
||||
<label string="Want to create a Index on Selected Pages ? "/>
|
||||
<footer>
|
||||
<button name="wiki_do_index" string="Create Index" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Create Index Action -->
|
||||
|
||||
<record id="action_view_wiki_make_index" model="ir.actions.act_window">
|
||||
<field name="name">Create Index</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">wiki.make.index</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- Create Index Action Window -->
|
||||
|
||||
<act_window id="action_view_wiki_make_index_values"
|
||||
key2="client_action_multi" name="Create Index"
|
||||
res_model="wiki.make.index" src_model="wiki.wiki"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
@ -1,71 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
|
||||
|
||||
class wiki_wiki_page_open(osv.osv_memory):
|
||||
""" wizard Open Page """
|
||||
|
||||
_name = "wiki.wiki.page.open"
|
||||
_description = "wiz open page"
|
||||
|
||||
def open_wiki_page(self, cr, uid, ids, context=None):
|
||||
|
||||
""" Opens Wiki Page of Group
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of open wiki page’s IDs
|
||||
@return: dictionay of open wiki window on give group id
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
group_ids = context.get('active_ids', [])
|
||||
for group in self.pool.get('wiki.groups').browse(cr, uid, group_ids,
|
||||
context=context):
|
||||
value = {
|
||||
'domain': "[('group_id','=',%d)]" % (group.id),
|
||||
'name': 'Wiki Page',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'wiki.wiki',
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
if group.method == 'page':
|
||||
value['res_id'] = group.home.id
|
||||
elif group.method == 'list':
|
||||
value['view_type'] = 'form'
|
||||
value['view_mode'] = 'tree,form'
|
||||
elif group.method == 'tree':
|
||||
view_id = self.pool.get('ir.ui.view').\
|
||||
search(cr, uid, [('name', '=',
|
||||
'wiki.wiki.tree.children')])
|
||||
value['view_id'] = view_id
|
||||
value['domain'] = [('group_id', '=', group.id), ('parent_id', '=',
|
||||
False)]
|
||||
value['view_type'] = 'tree'
|
||||
|
||||
return value
|
||||
|
||||
wiki_wiki_page_open()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Open Page Form view -->
|
||||
|
||||
<record id="view_wiki_wiki_page_open" model="ir.ui.view">
|
||||
<field name="name">Open Page</field>
|
||||
<field name="model">wiki.wiki.page.open</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Page" version="7.0">
|
||||
<label string="Want to open a wiki page? "/>
|
||||
<footer>
|
||||
<button name="open_wiki_page" string="Open Wiki Page" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Open Page Action -->
|
||||
|
||||
<record id="action_view_wiki_wiki_page_open" model="ir.actions.act_window">
|
||||
<field name="name">Open Page</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">wiki.wiki.page.open</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue
Block a user