Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 4885

Show
Ignore:
Timestamp:
07/09/08 18:49:48 (4 months ago)
Author:
machosry
Message:

addresshierarchy: fixed few bugs and added few enhancements.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/addresshierarchy/metadata/messages.properties

    r4834 r4885  
    11@MODULE_ID@.title=Address Hierarchy Support Module 
    22@MODULE_ID@.tree=Address Hiererchy Tree 
    3 @MODULE_ID@.manage=Manage Hierarchy 
    4 @MODULE_ID@.create=Create Hierarchy 
    5 @MODULE_ID@.edit=Edit Hierarchy 
    6 @MODULE_ID@.delete=Delete Hierarchy 
    7 @MODULE_ID@.createform.title=Create Location 
    8 @MODULE_ID@.manageform.title=Manage Location 
    9 @MODULE_ID@.location.country=Country 
    10 @MODULE_ID@.location.state=State 
    11 @MODULE_ID@.location.sublocation1=Sub Location 1 
    12 @MODULE_ID@.location.sublocation2=Sub Location 2 
    13 @MODULE_ID@.location.sublocation3=Sub Location 3 
    14 @MODULE_ID@.location.sublocation4=Sub Location 4 
    15 @MODULE_ID@.location.sublocation5=Sub Location 5 
    16 @MODULE_ID@.location.sublocation6=Sub Location 6 
    17 @MODULE_ID@.location.postalcode=Postal Code 
    18 @MODULE_ID@.location.longitude=Longitude 
    19 @MODULE_ID@.location.latitude=Latitude 
  • openmrs-modules/addresshierarchy/metadata/moduleApplicationContext.xml

    r4834 r4885  
    99        <property name="mappings"> 
    1010            <props> 
    11                    <prop key="module/@MODULE_ID@/addresshierarchy.form">addresshierarchyForm</prop> 
    12                    <prop key="module/@MODULE_ID@/addresshierarchymanage.form">addresshierarchymanageForm</prop> 
    1311                    
    1412                </props> 
     
    4644    <!-- Controllers --> 
    4745         
    48     <bean id="addresshierarchyForm" class="org.openmrs.module.addresshierarchy.web.controller.AddressHierarchyFormController"> 
    49                 <property name="commandName"><value>addresshierarchy</value></property> 
    50                 <property name="commandClass"><value>org.openmrs.module.addresshierarchy.web.controller.AddressHierarchyFormController</value></property> 
    51                 <property name="formView"><value>/module/@MODULE_ID@/addresshierarchyForm</value></property> 
    52                 <property name="successView"><value>addresshierarchy.form</value></property> 
    53         </bean> 
    54         <bean id="addresshierarchymanageForm" class="org.openmrs.module.addresshierarchy.web.controller.AddressHierarchyManageFormController"> 
    55                 <property name="commandName"><value>addresshierarchyManage</value></property> 
    56                 <property name="commandClass"><value>org.openmrs.module.addresshierarchy.web.controller.AddressHierarchyManageFormController</value></property> 
    57                 <property name="formView"><value>/module/@MODULE_ID@/addresshierarchymanageForm</value></property> 
    58                 <property name="successView"><value>addresshierarchymanage.form</value></property> 
    59         </bean> 
    60             
     46      
    6147         
    6248    <!-- /Controllers --> 
  • openmrs-modules/addresshierarchy/src/org/openmrs/module/addresshierarchy/extension/html/AdminList.java

    r4834 r4885  
    5050                Map<String, String> map = new HashMap<String, String>(); 
    5151                 
    52                 map.put("module/addresshierarchy/addresshierarchy.form", "addresshierarchy.create"); 
    53                 map.put("module/addresshierarchy/addresshierarchymanage.form", "addresshierarchy.manage"); 
    5452                map.put("module/addresshierarchy/addresshierarchyTree.htm", "addresshierarchy.tree"); 
    5553                 
  • openmrs-modules/addresshierarchy/web/module/addresshierarchyTree.jsp

    r4883 r4885  
    66<openmrs:htmlInclude file="/dwr/interface/AddressHierarchy.js"/> 
    77<openmrs:htmlInclude file="/moduleResources/addresshierarchy/jquery.js" /> 
    8  
     8<style> 
     9.dojoTree { 
     10        -x-system-font:caption; 
     11        font-family:-moz-use-system-font; 
     12        font-size:14px; 
     13        font-size-adjust:-moz-use-system-font; 
     14        font-stretch:-moz-use-system-font; 
     15        font-style:-moz-use-system-font; 
     16        font-variant:-moz-use-system-font; 
     17        font-weight:normal; 
     18        line-height:-moz-use-system-font; 
     19        overflow:auto; 
     20
     21</style> 
    922 
    1023<script  type="text/javascript"> 
     
    2235 var TreeBuilder = { 
    2336   buildTreeNodes:function (dataObjs, treeParentNode){ 
     37     var arr=new Array("Start","Country","State","Sub Location1","Sub Location2","Sub Location3","Sub Location4","Sub Location5","Sub Location6","Postal Code","Longitude","Latitude"); 
     38      
    2439     for(var i=0; i<dataObjs.length;i++){ 
    25        var node = dojo.widget.createWidget("TreeNode",{ 
    26          title:dataObjs[i].title , locationId:dataObjs[i].locationId , typeId:dataObjs[i].typeId , parentId:dataObjs[i].parentId  
    27        }); 
     40        var typ = dataObjs[i].typeId; 
     41        var dumm = parseInt(typ); 
     42        var titl = dataObjs[i].title+"( "+arr[dumm]+" )";        
     43        var node = dojo.widget.createWidget("TreeNode",{ 
     44                 title:titl ,locationName:dataObjs[i].title, locationId:dataObjs[i].locationId , typeId:dataObjs[i].typeId , parentId:dataObjs[i].parentId  
     45        }); 
    2846       treeParentNode.addChild(node); 
    2947       treeParentNode.registerChild(node,i); 
     
    7189     else{ 
    7290     var rad = this.controller; 
    73      AddressHierarchy.createLocation(titl,typeid,parent.locationId,function(data){ 
    74         var res = rad.createChild(parent, 0, { title: data[0], locationId : data[1],typeId : data[2], parentId : data[3] }); 
     91     AddressHierarchy.createLocation(titl,parseInt(dummy)-1,parent.locationId,function(data){ 
     92        var arr=new Array("Start","Country","State","Sub Location1","Sub Location2","Sub Location3","Sub Location4","Sub Location5","Sub Location6","Postal Code","Longitude","Latitude"); 
     93                var dumm = parseInt(data[2]); 
     94        var titl = data[0]+"( "+arr[dumm]+" )"; 
     95        var res = rad.createChild(parent, 0, { title: titl,locationName:data[0], locationId : data[1],typeId : data[2], parentId : data[3] }); 
    7596     }) 
    7697      
     
    92113     } 
    93114     else{ 
    94      var name = node.title; 
     115     var name = node.locationName; 
    95116     var parid = node.parentId; 
    96117     this.controller = dojo.widget.manager.getWidgetById(controllerId); 
     
    116137     } 
    117138     else{ 
    118      var oldname = node.title; 
     139     var oldname = node.locationName; 
    119140     var parid = node.parentId; 
    120141     this.controller = dojo.widget.manager.getWidgetById(controllerId); 
    121142     var rad = this.controller; 
    122143     var newname = prompt("Enter the location name",oldname); 
     144      
     145     if(newname!=null){ 
    123146     AddressHierarchy.editLocation(parid,oldname,newname, function(){ 
    124         node.edit({title:newname}); 
    125      }) 
     147        var arr=new Array("Start","Country","State","Sub Location1","Sub Location2","Sub Location3","Sub Location4","Sub Location5","Sub Location6","Postal Code","Longitude","Latitude"); 
     148                var dumm = parseInt(node.typeId); 
     149        var titl = newname+"( "+arr[dumm]+" )"; 
     150        node.edit({title:titl , locationName:newname}); 
     151     })} 
    126152     } 
    127153   }