Sahana XForm

Let me give you a quick introduction on what this “Sahana XForm” is all about and what is trying to achieve through this. The main idea behind this effort is to come up with a working prototype to transform the forms on Web-based applications in to a print friendly form that heavily involves data capturing. Sahana is one such application that heavily involves in such activities and it’s main targeted for the overall management of diverse activities in a post disaster situation.

A disaster means it involves recording and dissemination of information among various parties for the immediate fulfillment of victims requirements. Although there are very sophisticated methods and equipments in most cases still the preferred and the used method is the use of paper based forms. In here I should especially mentioned about Chamindra because it was he who came up with this idea and encouraged me on this.

In this approach it provides a way to extracts the XHTML from elements in an active Web form and transform them to a print friendly format (printed and to be used as off-line paper forms) leaving behind the images and unwanted elements on the page. In order for the functionality to work the XHTML mark for the form should be organized in the following manner.

<h2>Personal Details</h2>
<div class="xform-container">
<form name="form" >
  <fieldset><legend> Identity </legend>
     <label for="nic"> Identity Card Number </label>
              <input type="text" name="nic" id="nic"/>
     <label for="passport"> Passport Number </label>
              <input type="text" name="passport" id="passport"/>

  <fieldset><legend> Basic Details </legend>
     <label for="family_name"> Family Name </label>
              <input type="text" name="family_name" id="family_name" value=""/>
     <label for="local_name"> Local Name </label>
              <input type="text" name="local_name" id="local_name" value=""/>
     <label for="dob"> Date of Birth </label>
              <input type="text" name="dob" value="" id="dob"/>
     <label for="opt_gender"> Gender </label>
              <select name="opt_gender">
                <option value="male"> Male </option>
                <option value="female"> Female </option>

  <fieldset><legend> Contact Information </legend>
     <label for="address"> Address </label>
              <textarea name="address" id="address"></textarea>
     <label for="zip"> Postal Code </label>
              <input type="text" name="zip" id="zip"/>
     <label for="home_phone"> Home Phone </label>
              <input type="text" name="home_phone" id="home_phone"/>
     <label for="mobile_phone"> Mobile Phone </label>
              <input type="text" name="mobile_phone" id="mobile_phone"/>

Next using JavaScript scripting language and CSS implement the functionality as follows.

  • First identify Web forms from rest of the page(s) (It is very important that you enclose all form related elements inside a XHTML div element having a class attribute which holds a name. eg: <div class=”xform-container” > rest comes here… </div> ).
  • On success extract the XHTML form elements.
  • Then regenerate the XHTML markup on the same page. This should maintain the correct sequence of the original form(Label name and its corresponding input ).
  • Use the CSS to maintain the layouts and dimensions to match the layout for each section, which was there on the original form (Label name and the place to fill the data)
  • Next since we need to print this generated from to a paper we should arrange the components to fit into the page size(A4, Letter. Legal, etc…).
  • To invoke the functionality link the JavaScript file that hold the logic to the head section of the Web page and call the initialization function on any convenient location on the page (eg: <a href=”#” onclick=”init_xform();” title=”Generate XForm” > XForm</a>).

In the current implementation it is capable of transforming the page as shown in figure 1 into a form as shown in figure 2. Since the functionality itself can be extended for various directions I would like to invite all those who are interested in this work to come join us to extend this approach and the functionality to be readily used(eliminate the application level dependencies and to extend it to generate customized label layouts, etc… ) with any web based system just by linking the JavaScript library and generate the print friendly form. The code library is released under LGPL license along with Sahana.

Disaster Victim Registry - Web from

Figure 1: Disaster Victim Registry - Web from

Disaster Victim Registry - XForn

Figure2: Disaster Victim Registry - XForm

Your comments and suggestions are highly appreciated in developing this into a readily usable library for any web application.

One mission Accomplished, what next?

The past four and half years was the most enjoyable and the productive years of my life. In this time I had all the freedom to explore into many areas of the society as a university student. This period left me many memorable things and also gave me the chance to decide what I’ll do in the future. Most of the occasions people welcome us so warmly and corporate well in most activities where normal citizen would had to put an extra effort do the same activity. In a way I’m so lucky that I was so fortunate to continue my higher education in the field I’m interested in and earn a degree from a state owned university. During this endeavor I got opportunities to share what I have learn for the benefit of the society both local(SLAF) and international(Sahana) activities.

Now the time has come for me to think and work in a more responsible manner because most of what I’ll do will have a bigger impact to my future. As a start I have to find a sufficient income to support my own expenses rather continue to put that burden on my parents. I was successful in getting over that, within a month time, completing the degree I found an exciting and challenging place to work. Its has been almost two months has passed since I join the company. It was very challenging where I got the opportunity to work directly with a client and carried out development of a software system. My target was to built a web based system that helps the parties (customers, salesmen, owner, manufacturers, suppliers, etc.. ) to carry out their tasks in a user friendly and with minimum effort. It was a very challenging task for me because I had to learn many things. Luckily for me the client (Stuart) I was contacting has worked as a software developer, so this helped me a lot in all means of activities. My deadline for the completing of the projects is only two weeks ahead. Looking at the progress so far I have achieved I believe that target is achievable. 🙂

During the latter part of October I did a presentation at a local conference for a research carried out for the Sahana project. The presentation was grate success. Fifteen papers were presented at the conference covering various fields such as Software Engineering, Electrical Engineering, Telecommunication Engineering. Sahana is a project that focuses on building a versatile tool for post disaster/emergency management activities in the world with the collaborative effort of dedicated volunteers from all around the world.

Sahana GSoC 2009 WrapUp

Google Summer of Code 2009 logo Almost most of the excitement related to this year’s GSoC has come to the end with lot of success. This time I got the chance to be part of this wonderful community representing Sahana Project as a mentor.

Looking into the history of GSoC Sahana Project has won a grate position, I’m telling this because Sahana Project got selected as a mentoring organization for the fourth consecutive year (2006, 2007, 2008 and 2009). As previous this time also Sahana Project won ten positions. These ten positions got allocated to students proposals from Sri Lanka, India and Pakistan (out of 44 proposals), out of them eight students were successfully in building new features to the project.

I mentored Akshit Sharma form India who developed the Dynamic Theme Manager module that enables the user to alter the existing theme to his/her preference without needing to have any knowledge about CSS, just through the use of a color pallet to select the respective colors and a new logo.

Although with my academic work I didn’t had much trouble finding time to guide him to understanding the system’s functionality throughout the summer since he is just a time zone away. It was a grate experience for me. To my understanding he enjoyed working with Sahana community and hope to have his contributions in the future as well. Lastly I would like to congratulate all the eight students for being successful in delivering new modules to leverage the functionality of Sahana.

I just got a email notification from FedEx stating that Google has handed over a T-Shirt to them to deliver it to me. 🙂 Thank you Google.

Looking at the history of GSoC the University of Moratuwa has reached a significant milestone by being the top ranking university that produced the highest number of student participants in the GSoC 2009, 2008 and alltime

Sahana @ Unlocking Young Minds ~ 2009

Last Thursday was a very busy day for me specially because it was the starting day of our exhibition. I was responsible for designing the brochure and getting the content finalized and few other designs which needed to handed over to Sanjaya to get them printed on previous day (Wednesday).

The FOSS lovers of my batch got together and decided to do something valuable of what we know during the exhibition by having a section called “Open Source Software” to educate the public about the importance and the benefits they can gain for their daily life. Glimpse into what Sri Lankans have given to the world community. We planned to have the section as follows:

  • Free Operating Systems and their usage
  • FOSS tool for our daily work
  • Sahana Project

In the Free OS section we demonstrated Minix, Free BSD, Sun Solaris, Fedora and Ubuntu by Kalana and Yoshan. In most cases majority of them were surprised about the functionality and the capabilities inherited in them because they had only experienced and exposed to the Windows XP. In the next section people got the chance to get to know and experienced the FOSS alternatives for Office Productivity(OpenOffice Suite ), Image and Video Manipulation(GIMP, Inkscape, Blender, etc..), Internet (Mozilla Firefox, Thunderbird, Pidgin, etc..), Entertainment(VLC, Amarock, Mplayer, etc..), Education, Emulation Engines(Wine), etc.. to name a few, it was conducted by Uthpala.

I took myself the opportunity of explaining and demonstrating the Sahana, which came as a result of Asian Tsunami devastation that took quarter a million of human life away. With the help of the documents received from Chamindra I prepared a poster highlighting its special milestones and its functionality.

Sahana Poster :1

Sahana Poster : Part 1

Sahana Poster :2

Sahana Poster : Part 2

To make the session more interesting I took the OLPC running Sahana on it, and Sahana running from an USB to show them and make them feel how the system can be used in real life situations. I’m happy to say that out of the people I spoke to most showed their interest towards joining the community, especially by students. I’m happy to say that I got an invitation from a school at Rathnapura to do a demonstration of the Sahana project at their exhibition which will be held on 22nd of June, I’m looking forward to it.

During the three days I got the chance to get to know various people and majority of them haven’t even knew that such a project exist and it had done so much of service to the world. So I’m very happy that I got a chance to convey the importance and the services it had given to the world community. I got the chance to talk with Mr. Wasantha Deshapriya the Director, Re-engineering Government Programme Information & Communication Technology Agency(ICTA). He appreciate the effort rendered by the Sahana community to make it a globally acclaimed project.

I had to run to Motorola (Pvt) Ltd Sri Lanka. to collect some of their equipments(various kinds of Bar-code Scanners, Wearable Computers and several other hand-held devices – happy to say that most of them are designed and developed here at Motorola Sir Lanka) during Wednesday. I must especially thank Mr. Ruwan Jayanetthi(who teaches us Embedded Systems) and Mr. Damith Jayawickrama at Motorola (Pvt) Ltd for the support given to me despite their busy schedule.

Memorable moments







Sahana used in world largest Humanitarian Rescue Mission

During the last couple of months group form LSF and Ministry of Resettlement and Disaster Relief Services got together to deploy Sahana to facilitate the operations of world largest humanitarian rescue mission carrying out by the Sri Lankan Security Forces and the government of Sri Lanka to rescue the innocent civilians from the brutal and barbarian LTTE carders who keep them as a human shield with the fight against the Sri Lankan Security forces.


I’m so fortunate to help in this humanitarian rescue mission by being part of the development team which was lead by Ravith.

« Older entries