implement
* show diff for the 2 wiki history line * make section enabled based on the wiki group bzr revid: mga@tinyerp.com-20081124101428-z89vuq3p4822m2bd
This commit is contained in:
parent
e73f4dfd6d
commit
655205d823
|
@ -42,11 +42,11 @@ class WikiGroup(osv.osv):
|
|||
'page_ids':fields.one2many('wiki.wiki', 'group_id', 'Pages'),
|
||||
'notes':fields.text("Description", select=True),
|
||||
'create_date':fields.datetime("Created Date", select=True),
|
||||
'template': fields.text('Wiki Template')
|
||||
'template': fields.text('Wiki Template'),
|
||||
'section': fields.boolean("Make Section?")
|
||||
}
|
||||
WikiGroup()
|
||||
|
||||
|
||||
class Wiki(osv.osv):
|
||||
_name="wiki.wiki"
|
||||
_description="Wiki Page"
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form srting="Wiki Groups">
|
||||
<group colspan="4" col="6">
|
||||
<group colspan="4" col="4">
|
||||
<field name="name" select="1"/>
|
||||
<field name="parent_id" select="2"/>
|
||||
<field name="create_date" readonly="2"/>
|
||||
<field name="section"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Notes">
|
||||
|
@ -94,8 +95,7 @@
|
|||
<group col="6" colspan="4">
|
||||
<field name="name" select="1"/>
|
||||
<field name="group_id" select="1" on_change="onchange_group_id(group_id, text_area)"/>
|
||||
<field name="section" select="2"/>
|
||||
|
||||
<field name="section" select="2" invisible="not context.get('section',False)"/>
|
||||
<field name="write_date" readonly="1" select="2"/>
|
||||
<field name="write_uid" readonly="1" select="2"/>
|
||||
<field name="tags" select="2" groups="base.group_extended"/>
|
||||
|
|
|
@ -46,7 +46,7 @@ def wiki_menu_create(self, cr, uid, data, context):
|
|||
'name': group.name,
|
||||
'view_type':'form',
|
||||
'view_mode':"tree,form",
|
||||
'context': "{'group_id':%d}" % (group.id,),
|
||||
'context': "{'group_id':%d, 'section':%d}" % (group.id, group.section),
|
||||
'domain': "[('group_id','child_of',[%d])]" % (group.id,),
|
||||
'res_model': 'wiki.wiki'
|
||||
})
|
||||
|
|
|
@ -22,29 +22,32 @@
|
|||
|
||||
from osv import fields,osv
|
||||
|
||||
|
||||
|
||||
class showdiff(osv.osv_memory):
|
||||
_name = 'wizard.wiki.history.show_diff'
|
||||
|
||||
def _get_diff(self, cr, uid, ctx):
|
||||
print 'XXXXXXXXXXXXXXXXXX : ', ctx
|
||||
history = self.pool.get('wiki.wiki.history')
|
||||
res = {}
|
||||
# if lan(ids) == 2:
|
||||
# diff = history.getDiff(cr, uid, ids[0]. ids[1])
|
||||
# res = {
|
||||
# ids[0] : diff,
|
||||
# ids[1] : diff,
|
||||
# }
|
||||
return res
|
||||
ids = ctx.get('active_ids')
|
||||
diff = ""
|
||||
if len(ids) == 2:
|
||||
if ids[0] > ids[1]:
|
||||
diff = history.getDiff(cr, uid, ids[1], ids[0])
|
||||
else:
|
||||
diff = history.getDiff(cr, uid, ids[0], ids[1])
|
||||
|
||||
elif len(ids) == 1:
|
||||
old = history.browse(cr, uid, ids[0])
|
||||
nids = history.search(cr, uid, [('wiki_id','=',old.wiki_id.id)])
|
||||
nids.sort()
|
||||
if ids[0] != nids[-1]:
|
||||
diff = history.getDiff(cr, uid, ids[0], nids[-1])
|
||||
|
||||
return diff
|
||||
|
||||
_columns = {
|
||||
'diff': fields.function(_get_diff, method=True, type='char', string='Diff'),
|
||||
'diff': fields.text('Diff'),
|
||||
}
|
||||
_defaults = {
|
||||
'diff': _get_diff
|
||||
}
|
||||
showdiff()
|
||||
|
||||
|
||||
showdiff()
|
Loading…
Reference in New Issue