Friday, June 24, 2011

Editing templates

  Following screenshot explains how i have modified the template editing page so a user can edit both the standard and mobile versions of the templates.

The problems that i had to address were,

1) How to keep track of mobile and standard template pages. (According to the templateEdit class we need to get template id from the bean to display the current template to edit.) 

This was bit tricky and in bean i store both mobile and standard template id. According to the user request we load the mobile or standard template in the tabbed panel.

2) How to synchronize between standard template and mobile template if user changes name or the link.

When user saves a page we will try to figure out if the mobile and standard have the same link and corresponding template name.(for mobile it is foo.Mobile if standard's name is foo). if there is any changes we will change the mobile templates link or/and name, then save it in roller.

3) How to display if only the standard template is only available template.
Simply check if there are multiple templates for a single link and if so use the above UI or else switch to what we have in past (single template page without tabs).


Creating a custom template.

 During the past weeks there were few important mile stones .The first major implementation i had to decide was on how to create a custom template and let the user to render it.I have discussed it in the mailing list and could come up with a method which seems to be convenient and manageable to a user without much trouble. [1]

 The above diagram shows how the custom template creation is going to be handled. When a user logs land on the template creation page he can give the template name (lets say it foo.). And then user clicks on add to add a template to roller.

This will make a roller to create two template pages of types mobile and standard.In that we will assign the default link both the templates as /foo so they are viewable at {baseUrl}/page/foo. So i have modified such that roller can have duplicate templates for a single link but with different types.

Since roller cannot have duplicate templates with single name we are changing the name of the mobile template to "foo.Mobile". But user will not be aware of this action and he will not see such a template in the templates table he sees on the templates page. ( In next post we will let you know how he will be able to edit change mobile version of the template in roller.)

[1]http://www.mail-archive.com/dev@roller.apache.org/msg02470.html

Friday, June 10, 2011

1st patch to test the functionality [setting a theme to render it a mobile theme]

I was able to wrap up my work in to a patch [1] and let the developers to test my progress.I hope i will get feedback on this.To test the work following are the instructions.
1.Apply the patch to the trunk
2.copy one of the Themes in themes directory of webapp (lets copy basic and then change the themes.xml as following)

<id>mobile</id>
 <name>Mobile</name>
 <author>Roller Weblogger</author>
  <type>mobile</type>

Please note in the patch i changed the type of fauxcoly to "mobile" so it will recognize as a mobile theme as well.
3. After building Roller run Dev test run and you can define a mobile theme at weblog creation time.


4.After that try to view the weblog from desktop as well as a mobile emulator (opera mobile emulator). so it will render your defined theme for mobile when you try to view through mobile emulator.



[1] https://issues.apache.org/jira/browse/ROL-1919

Wednesday, June 8, 2011

Tag to define template type in theme.xml

After discussing the proper meta data entry in the theme.xml i was able to finalize a proper tag in theme.xml.So we will be using <type> to indicate a particular theme's type.At the moment we are defining two types of values for <type>.

1. standard - Normal Desktop/laptop screen size supported themes. (Of course these themes support apple IPAD too.But in future we may have different type of theme for IPAD or tablet optimized too. ;) )

2.mobile - for themes that support mobile devices , (iphones , android phones etc.)

Following is an extract from the new theme.xml for a mobile theme.


<id>basic</id>
<name>Basic</name>
<author>Roller Weblogger</author>
<type>mobile</type>

Friday, June 3, 2011

Adding a meta data in Theme.xml to Identify a mobile optimized theme [Discussion]

It was a week with understanding how the Themes will be loading from the physical location and creating the weblog internal context.I wanted to add a metadata in Theme.xml to identify that a theme is mobile ready or not.

After discussions in the mailing list we are going have <type></type> in the Theme.xml file.So in mobile version of a theme it will be <type>mobile</type>.This is an interesting suggestion from the community since we will be able to define themes for different type of devices in future. So by defining the correct Template designer can make them available for selective rendering based on the device.

 We need to have a default value for <type> tag and following are the candidates proposed.

1.desktop - (we have ipads and laptops so misleading.)
2.default     (not self explaining the type )
3.html         (There are overlapping with mobile theme as well.)

While i was brainstorming for a good candidate i got ,"standard". You can find on going discussion on the above matter in the mailing list. [0]

[0]http://mail-archives.apache.org/mod_mbox/roller-dev/201105.mbox/%3CBANLkTinR+2S4Ppf9rmcTi2Ou+FM1o7myBg@mail.gmail.com%3E