2010-03-02 10:56:55 +00:00
|
|
|
|
# -*- 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/>.
|
|
|
|
|
#
|
|
|
|
|
##############################################################################
|
|
|
|
|
|
2010-12-29 09:16:47 +00:00
|
|
|
|
from osv import osv
|
2010-03-02 04:55:33 +00:00
|
|
|
|
|
|
|
|
|
class wiki_wiki_page_open(osv.osv_memory):
|
2010-03-16 14:01:43 +00:00
|
|
|
|
""" wizard Open Page """
|
2010-03-17 08:36:08 +00:00
|
|
|
|
|
2010-03-02 04:55:33 +00:00
|
|
|
|
_name = "wiki.wiki.page.open"
|
|
|
|
|
_description = "wiz open page"
|
2010-03-16 14:01:43 +00:00
|
|
|
|
|
2010-11-22 10:37:53 +00:00
|
|
|
|
def open_wiki_page(self, cr, uid, ids, context=None):
|
2010-03-17 08:36:08 +00:00
|
|
|
|
|
2010-03-15 13:40:23 +00:00
|
|
|
|
""" 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
|
2010-03-17 09:27:12 +00:00
|
|
|
|
@return: dictionay of open wiki window on give group id
|
2010-03-15 13:40:23 +00:00
|
|
|
|
"""
|
2010-11-23 07:05:05 +00:00
|
|
|
|
if context is None:
|
2010-11-22 10:37:53 +00:00
|
|
|
|
context = {}
|
2010-04-12 10:06:18 +00:00
|
|
|
|
group_ids = context.get('active_ids', [])
|
2010-11-22 10:37:53 +00:00
|
|
|
|
for group in self.pool.get('wiki.groups').browse(cr, uid, group_ids, context=context):
|
2010-03-02 04:55:33 +00:00
|
|
|
|
value = {
|
2010-04-12 12:41:47 +00:00
|
|
|
|
'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',
|
2010-08-13 12:20:05 +00:00
|
|
|
|
}
|
2010-03-02 04:55:33 +00:00
|
|
|
|
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':
|
2010-10-25 08:44:46 +00:00
|
|
|
|
view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'wiki.wiki.tree.children')])
|
2010-03-02 04:55:33 +00:00
|
|
|
|
value['view_id'] = view_id
|
2010-03-17 09:27:12 +00:00
|
|
|
|
value['domain'] = [('group_id', '=', group.id), ('parent_id', '=', False)]
|
2010-03-02 04:55:33 +00:00
|
|
|
|
value['view_type'] = 'tree'
|
|
|
|
|
|
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
wiki_wiki_page_open()
|
2010-03-02 10:56:55 +00:00
|
|
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|