openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #05024
lp:~openerp-dev/openobject-addons/addons-training-structured_content_shaper-ysa into lp:~openobject-training/openobject-addons/training
Yogesh(Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/addons-training-structured_content_shaper-ysa into lp:~openobject-training/openobject-addons/training.
Requested reviews:
OpenObject Training (openobject-training)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/addons-training-structured_content_shaper-ysa/+merge/56294
structured_content_shaper :- Convert into v6.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/addons-training-structured_content_shaper-ysa/+merge/56294
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/addons-training-structured_content_shaper-ysa.
=== modified file 'structured_content_shaper/__init__.py'
--- structured_content_shaper/__init__.py 2011-03-16 10:25:04 +0000
+++ structured_content_shaper/__init__.py 2011-04-05 06:24:32 +0000
@@ -3,3 +3,5 @@
# GNU Affero General Public License version 3 (see the file LICENSE).
import object
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== renamed file 'structured_content_shaper/__terp__.py' => 'structured_content_shaper/__openerp__.py'
--- structured_content_shaper/__terp__.py 2011-03-16 10:25:04 +0000
+++ structured_content_shaper/__openerp__.py 2011-04-05 06:24:32 +0000
@@ -20,6 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
+
{
'name': 'structured_content_shaper',
'version': '0.1',
@@ -46,3 +47,5 @@
'active': False,
'installable': True,
}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'structured_content_shaper/object/__init__.py'
--- structured_content_shaper/object/__init__.py 2011-01-17 22:53:53 +0000
+++ structured_content_shaper/object/__init__.py 2011-04-05 06:24:32 +0000
@@ -3,3 +3,5 @@
# GNU Affero General Public License version 3 (see the file LICENSE).
import structured_content
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'structured_content_shaper/object/structured_content.py'
--- structured_content_shaper/object/structured_content.py 2011-02-22 08:53:34 +0000
+++ structured_content_shaper/object/structured_content.py 2011-04-05 06:24:32 +0000
@@ -61,14 +61,16 @@
_defaults = {
'basetype': lambda *a: 'text',
}
+
structured_content_type()
class structured_content_page_type(osv.osv):
_name = 'structured.content.page.type'
_columns = {
- 'code': fields.char('Code', size=32, select=1),
- 'name': fields.char('Name', size=64, select=1),
+ 'code': fields.char('Code', size=32),
+ 'name': fields.char('Name', size=64),
}
+
structured_content_page_type()
class structured_content_page(osv.osv):
@@ -87,6 +89,8 @@
}
def onchange_type_id(self, cr, uid, ids, type_id, name, context=None):
+ if context is None:
+ context = {}
ocv = {'value': {}}
if name:
return ocv
@@ -106,42 +110,46 @@
_order = 'sequence'
def _computed_name(self, cr, uid, ids, fn, args, context=None):
+ if context is None:
+ context = {}
ira_pool = self.pool.get('ir.attachment')
res = dict.fromkeys(ids, '')
for block in self.browse(cr, uid, ids, context=context):
basetype = block.basetype
- r = ''
+ result = ''
if basetype == 'shorttext':
- r = block.shorttext
+ result = block.shorttext
elif basetype == 'text':
- r = block.text
+ result = block.text
elif basetype == 'url':
- r = block.shorttext
+ result = block.shorttext
if block.text:
- r += ' (%s)' % (block.text)
+ result += ' (%s)' % (block.text)
elif basetype == 'binary':
pass # TODO: for binary who to represent that ?
elif basetype == 'dms':
if block.content_attach_id:
ir_record = ira_pool.browse(cr, uid, block.content_attach_id.id, context=context)
- r = ir_record.name
+ result = ir_record.name
elif basetype == 'list':
pass # TODO: generate list name_get()
vals = []
- for k in block.list_ids:
- v = k.generate_preview()
- if v:
- vals.append(v.get(k.id, ''))
- r = '\n'.join(vals)
+ for key in block.list_ids:
+ val = key.generate_preview()
+ if val:
+ vals.append(val.get(key.id, ''))
+ result = '\n'.join(vals)
elif basetype == 'accordion':
pass # TODO: generate accordion name_get()
elif basetype == 'hr':
- r = u'-' * 64
- res[block.id] = r
+ result = u'-' * 64
+ res[block.id] = result
return res
def _get_types(self, cr, uid, context=None):
+ if context is None:
+ context = {}
res = []
type_pool = self.pool.get('structured.content.type')
type_ids = type_pool.search(cr, 1, [], context=context)
@@ -150,6 +158,8 @@
return res
def _get_basetype(self, cr, uid, ids, fn, args, context=None):
+ if context is None:
+ context = {}
res = dict.fromkeys(ids, 'shorttext')
type_pool = self.pool.get('structured.content.type')
type_ids = type_pool.search(cr, uid, [], context=context)
@@ -179,7 +189,8 @@
}
def onchange_type(self, cr, uid, ids, type_val, context=None):
- # TODO
+ if context is None:
+ context = {}
ocv = {'value': {'basetype': False}}
if not type_val:
return ocv
@@ -208,31 +219,33 @@
self.i = 0
def next(self, data):
- r = None
+ result = None
if self.type == 'none':
- r = data
+ result = data
elif self.type == 'dash':
- r = u'- %s' % (data)
+ result = u'- %s' % (data)
elif self.type == 'h1':
- r = u'%s' % (data.upper())
+ result = u'%s' % (data.upper())
elif self.type == 'h2':
- r = u'%s' % (data.capitalize())
+ result = u'%s' % (data.capitalize())
elif self.type == 'decimal':
- r = u'%d. %s' % (self.i + 1, data)
+ result = u'%d. %s' % (self.i + 1, data)
elif self.type == 'disc':
- r = u'⢠%s' % (data)
+ result = u'⢠%s' % (data)
elif self.type == 'upper_alpha':
- r = u'%s. %s' % (string.uppercase[self.i % 26], data)
+ result = u'%s. %s' % (string.uppercase[self.i % 26], data)
elif self.type == 'lower_alpha':
- r = u'%s. %s' % (string.lowercase[self.i % 26], data)
+ result = u'%s. %s' % (string.lowercase[self.i % 26], data)
self.i += 1
- return r
+ return result
def reset(self):
self.i = 0
return cgen(level, type)
def generate_preview(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
res = dict.fromkeys(ids, '')
level_pool = self.pool.get('structured.content.block.list.level')
level_pool_ids = level_pool.search(cr, uid, [], context=context)
@@ -286,6 +299,7 @@
r = u'\n'.join([u' '*4*l[1]+l[0] for l in lst ])
res[blocklist.id] = r
return res
+
structured_content_block_list()
class structured_content_block_list_level(osv.osv):
@@ -300,6 +314,7 @@
_defaults = {
'sequence': lambda *a: 0,
}
+
structured_content_block_list_level()
class structured_content_block_list_elem(osv.osv):
@@ -352,6 +367,7 @@
'block_id': fields.many2one('structured.content.block', 'Block', required=True, ondelete='cascade'),
'elem_ids': fields.one2many('structured.content.block.accordion.elem', 'accordion_id', 'Elements'),
}
+
structured_content_block_accordion()
class structured_content_block_accordion_elem(osv.osv):
@@ -385,4 +401,7 @@
'description': fields.text('Description'),
'link_alt': fields.char('Link Name', size=255),
}
+
structured_content_block_accordion_elem()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'structured_content_shaper/security/groups.xml'
--- structured_content_shaper/security/groups.xml 2011-02-01 13:54:11 +0000
+++ structured_content_shaper/security/groups.xml 2011-04-05 06:24:32 +0000
@@ -11,5 +11,6 @@
<field name="name">Content Shaper / Manager</field>
<field name="comment"></field>
</record>
+
</data>
</openerp>
=== modified file 'structured_content_shaper/view/structured_content_action.xml'
--- structured_content_shaper/view/structured_content_action.xml 2011-02-01 13:54:11 +0000
+++ structured_content_shaper/view/structured_content_action.xml 2011-04-05 06:24:32 +0000
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
-<data>
-
- <record model="ir.actions.act_window" id="action_structured_content_page_type_default">
- <field name="name">Content Page Type</field>
- <field name="res_model">structured.content.page.type</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
-
- <menuitem id="menu_structured_content_page_type"
- parent="base.menu_base_config"
+ <data>
+
+ <record model="ir.actions.act_window" id="action_structured_content_page_type_default">
+ <field name="name">Content Page Type</field>
+ <field name="res_model">structured.content.page.type</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem id="menu_structured_content_page_type"
+ parent="base.menu_base_config" sequence="500"
action="action_structured_content_page_type_default"/>
-</data>
+ </data>
</openerp>
=== modified file 'structured_content_shaper/view/structured_content_view.xml'
--- structured_content_shaper/view/structured_content_view.xml 2011-02-01 13:54:11 +0000
+++ structured_content_shaper/view/structured_content_view.xml 2011-04-05 06:24:32 +0000
@@ -15,6 +15,18 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_type_search">
+ <field name="name">strcutured.content.type.search</field>
+ <field name="model">structured.content.type</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content Type">
+ <field name="code"/>
+ <field name="name"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_type_form">
<field name="name">structured.content.type.form</field>
<field name="model">structured.content.type</field>
@@ -52,6 +64,18 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_page_type_search">
+ <field name="name">structured.content.page.type.search</field>
+ <field name="model">structured.content.page.type</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content Page Type">
+ <field name="name"/>
+ <field name="code"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_page_tree">
<field name="name">structured.content.page.tree</field>
<field name="model">structured.content.page</field>
@@ -66,6 +90,18 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_page_search">
+ <field name="name">structured.content.page.search</field>
+ <field name="model">structured.content.page</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content Page">
+ <field name="name"/>
+ <field name="type_id"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_page_form">
<field name="name">structured.content.page.form</field>
<field name="model">structured.content.page</field>
@@ -93,6 +129,18 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_block_search">
+ <field name="name">structured.content.block.search</field>
+ <field name="model">structured.content.block</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content Blocks">
+ <field name="computed_name"/>
+ <field name="sequence"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_block_form">
<field name="name">structured.content.block.form</field>
<field name="model">structured.content.block</field>
@@ -120,7 +168,7 @@
</group>
<group colspan="4" col="4" attrs="{'invisible': [('basetype','!=','dms')]}" expand="1">
<field name="content_attach_id"/>
- </group>
+ </group>
<group colspan="4" col="4" attrs="{'invisible': [('basetype','!=','list')]}" expand="1">
<separator string="Lists" colspan="4"/>
<field name="list_ids" nolabel="1" colspan="4" mode="form,tree"/>
@@ -145,6 +193,17 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_block_list_search">
+ <field name="name">structured.content.block.list.search</field>
+ <field name="model">structured.content.block.list</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content List">
+ <field name="name"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_block_list_form">
<field name="name">structured.content.block.list.form</field>
<field name="model">structured.content.block.list</field>
@@ -170,6 +229,19 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_block_list_level_search">
+ <field name="name">structured.content.block.list.level.search</field>
+ <field name="model">structured.content.block.list.level</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content List Levels">
+ <field name="name"/>
+ <field name="code"/>
+ <field name="default_type"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_block_list_level_form">
<field name="name">structured.content.block.list.level.form</field>
<field name="model">structured.content.block.list.level</field>
@@ -198,6 +270,18 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_block_list_elem_search">
+ <field name="name">structured.content.block.list.elem.search</field>
+ <field name="model">structured.content.block.list.elem</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content List Elements">
+ <field name="type"/>
+ <field name="level"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_block_list_elem_form">
<field name="name">structured.content.block.list.elem.form</field>
<field name="model">structured.content.block.list.elem</field>
@@ -227,6 +311,17 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_block_accordion_search">
+ <field name="name">structured.content.block.accordion.search</field>
+ <field name="model">structured.content.block.accordion</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content Accordions">
+ <field name="id"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_block_accordion_form">
<field name="name">structured.content.block.accordion.form</field>
<field name="model">structured.content.block.accordion</field>
@@ -253,6 +348,18 @@
</field>
</record>
+ <record model="ir.ui.view" id="view_structured_content_block_accordion_elem_search">
+ <field name="name">structured.content.block.accordion.elem.search</field>
+ <field name="model">structured.content.block.accordion.elem</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Content Accordion Elements">
+ <field name="title"/>
+ <field name="reference"/>
+ </search>
+ </field>
+ </record>
+
<record model="ir.ui.view" id="view_structured_content_block_accordion_elem_form">
<field name="name">structured.content.block.accordion.elem.form</field>
<field name="model">structured.content.block.accordion.elem</field>
Follow ups