merging from the wiki development branch

bzr revid: mga@tinyerp.com-20081127085419-rx3k7pjnffw1ytka
This commit is contained in:
Mantavya Gajjar
2008-11-27 14:24:19 +05:30
8 changed files with 195 additions and 5 deletions
+1
View File
@@ -14,6 +14,7 @@
"demo_xml" : [],
"update_xml" : [
"wiki_view.xml",
#"wiki_data.xml",
"wizard/wizard_view.xml",
"security/ir.model.access.csv"
],
+5 -2
View File
@@ -59,7 +59,7 @@ class Wiki(osv.osv):
'create_date':fields.datetime("Created on", select=True),
'write_date':fields.datetime("Last modified", select=True),
'tags':fields.char('Tags', size=1024),
'history_id':fields.one2many('wiki.wiki.history','history_wiki_id','History Lines'),
'history_id':fields.one2many('wiki.wiki.history','wiki_id','History Lines'),
'minor_edit':fields.boolean('Minor edit', select=True),
'summary':fields.char('Summary',size=256, select=True),
'section': fields.char('Section', size=32, help="Use page section code like 1.2.1"),
@@ -85,7 +85,10 @@ class Wiki(osv.osv):
'section': section
}
}
def copy(self, cr, uid, id, default=None, context=None):
return super(Wiki, self).copy(cr, uid, id, {'wiki_id':False}, context)
def write(self, cr, uid, ids, vals, context=None):
result = super(Wiki,self).write(cr, uid, ids, vals, context)
history = self.pool.get('wiki.wiki.history')
+112
View File
@@ -0,0 +1,112 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="wiki_groups_help0" model="wiki.groups">
<field eval="&quot;&quot;&quot;Help&quot;&quot;&quot;" name="name"/>
<field eval="1" name="section"/>
</record>
</data>
<data>
<record id="wiki_groups_wikiformatting0" model="wiki.groups">
<field eval="&quot;&quot;&quot;Wiki Formatting&quot;&quot;&quot;" name="name"/>
<field name="parent_id" ref="wiki_groups_help0"/>
<field eval="1" name="section"/>
</record>
</data>
<data>
<record id="wiki_wiki_quickstart0" model="wiki.wiki">
<field eval="&quot;&quot;&quot;Quick Start&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;help, quick start, wiki, formatting&quot;&quot;&quot;" name="tags"/>
<field eval="0" name="minor_edit"/>
<field eval="&quot;&quot;&quot;1&quot;&quot;&quot;" name="section"/>
<field eval="&quot;&quot;&quot;quick start help for the wiki formating&quot;&quot;&quot;" name="summary"/>
<field name="text_area">
<![CDATA[
==Basic Fromatting==
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
<br/>
See also : [[Complete Help]]
===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 <br/>
img:http://images.google.co.in/intl/en_ALL/images/images_hp.gif
==Headings==
=1st Level Heading=
==2nd Level Heading==
===3rd Level Heading===
==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
|-
| '''Open ERP''' - ''Belgium''
| [http://openerp.com]
| [[ mailto:fp@tinyerp.com ]]
|}
</nowiki>
{| border="1" cellspacing="0" cellpadding="5" align="left"
! Web site
! Link
! Contact Email
|-
| '''Open ERP''' - ''Belgium''
| [http://openerp.com]
| [[ mailto:fp@tinyerp.com ]]
|}
<br/><br/>]]></field>
<field name="group_id" ref="wiki_groups_wikiformatting0"/>
</record>
</data>
</openerp>
+2 -1
View File
@@ -4,7 +4,7 @@
<menuitem name="Document Management" icon="terp-stock" id="menu_document2"/>
<menuitem name="Wiki Configuration" id="menu_document_configuration" parent="menu_document2"/>
<menuitem parent="menu_document2" name="Wiki" id="menu_document"/>
<wizard
id="wizard_group_menu_create"
string="Create Menu"
@@ -113,6 +113,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_wiki_tree"/>
<field name="context">{'section':'1'}</field>
</record>
<menuitem
parent="menu_document"
+2 -1
View File
@@ -1,2 +1,3 @@
import create_menu
import show_diff
import show_diff
import make_index
+65
View File
@@ -0,0 +1,65 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
import osv
import pooler
section_form = '''<?xml version="1.0"?>
<form string="Create Menu">
<separator string="Menu Information" colspan="4"/>
<label string="Want to create a Index on Selected Pages ? "/>
</form>'''
def wiki_do_index(self, cr, uid, data, context):
ids = data['ids']
pool = pooler.get_pool(cr.dbname)
wiki_pool = pool.get('wiki.wiki')
iid = ','.join([str(x) for x in ids])
sSQL = "Select id, section from wiki_wiki where id in (%s) order by section " % (iid)
cr.execute(sSQL)
wiki = cr.fetchall()
i = 1
for wk in wiki:
wiki_pool.write(cr, uid, [wk[0]], {'section':i})
i+=1
return {}
class make_index(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':section_form, 'fields':{}, 'state':[('end','Cancel'),('yes','Create Index')]}
},
'yes': {
'actions': [wiki_do_index],
'result': {
'type':'state',
'state':'end'
}
}
}
make_index('wiki.make.index')
+2 -1
View File
@@ -41,7 +41,8 @@ class showdiff(osv.osv_memory):
nids.sort()
if ids[0] != nids[-1]:
diff = history.getDiff(cr, uid, ids[0], nids[-1])
else:
raise osv.except_osv('Warning', "You need to select minimum 1 or maximum 2 history revision!")
return diff
_columns = {
+6
View File
@@ -21,5 +21,11 @@
target="new"
view_mode="form"
/>
<wizard
id="wizard_make_index"
string="Create Index"
name="wiki.make.index"
model="wiki.wiki"/>
</data>
</openerp>