Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
08/18/08 12:05:28 (5 months ago)
Author:
machosry
Message:

address hierarchy: done with newPatientForm and patientDashboard yet to fix the drop down in patient.form

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/addresshierarchy/web/src/org/openmrs/module/addresshierarchy/web/controller/LayoutPortletControlle.java

    r5288 r5302  
    1515 
    1616import java.util.HashMap; 
     17import java.util.List; 
    1718import java.util.Map; 
     19import java.util.Vector; 
    1820 
    1921import javax.servlet.http.HttpServletRequest; 
     
    2224import org.apache.commons.logging.LogFactory; 
    2325import org.openmrs.api.context.Context; 
    24 import org.openmrs.module.addresshierarchy.layout.web.LayoutSupport; 
    25 import org.openmrs.module.addresshierarchy.layout.web.LayoutTemplate; 
     26import org.openmrs.layout.web.LayoutSupport; 
     27import org.openmrs.layout.web.LayoutTemplate; 
    2628import org.openmrs.web.controller.PortletController; 
     29import org.openmrs.web.controller.layout.LayoutPortletController; 
    2730 
    2831public abstract class LayoutPortletControlle extends PortletController { 
    29          
    30         private static Log log = LogFactory.getLog(LayoutPortletControlle.class); 
     32 
     33        private static Log log = LogFactory.getLog(LayoutPortletController.class); 
    3134 
    3235        protected void populateModel(HttpServletRequest request, Map<String, Object> model) { 
    3336                // TODO: this only cached the first name or address template that comes through. I need to cache one of each.  
    3437                String templateName = (String)model.get("layoutTemplateName"); 
     38                 
    3539                String thisLayoutName = getDefaultDivId() + "." + templateName; 
    3640                if (!thisLayoutName.equals(model.get("cachedLayoutName"))) { 
    3741                        LayoutSupport layoutSupport = getLayoutSupportInstance(); 
    38                         LayoutTemplate layoutTemplate = layoutSupport.getDefaultLayoutTemplate(); 
     42                        LayoutTemplate layoutTemplate = layoutSupport.getLayoutTemplateByCodeName("us"); 
    3943                         
    4044                        if ( layoutTemplate == null ) { 
    4145                                log.debug("Could not get default LayoutTemplate from " + layoutSupport.getClass()); 
     46                                System.out.println("not working"); 
    4247                        } 
    4348                         
     
    8085                        model.put("layoutTemplateName", templateName); 
    8186                        model.put("cachedLayoutName", thisLayoutName); 
    82                         Object chumma = model.get("layoutTemplate"); 
    83                         System.out.println("here is the fucking model"+model); 
     87                         
     88                        List<List<Map<String,String>>> x = layoutTemplate.getLines(); 
     89                        for(int i=0;i<x.size();i++){ 
     90                                System.out.println(x.get(i)); 
     91                                List<Map<String,String>> y = x.get(i); 
     92                                for(int j=0;j<y.size();j++){ 
     93                                        System.out.println(y.get(i)); 
     94                                } 
     95                        } 
     96                         
     97                        String somethng = "{isToken=IS_NOT_ADDR_TOKEN, displayText=}, {isToken=IS_ADDR_TOKEN, displaySize=50, displayText=Location.address1, codeName=address1}"; 
     98                        Map<String,String> y = new HashMap<String,String>(); 
     99                        List<Map<String,String>> z =new Vector<Map<String,String>>(); 
     100                        y.put("isToken", "IS_NOTADDR_TOKEN"); 
     101                        y.put("displayText", ""); 
     102                        z.add(0, y); 
     103                        Map<String,String> yz = new HashMap<String,String>(); 
     104                        yz.put("isToken", "IS_ADDR_TOKEN"); 
     105                        yz.put("displaySize", "50"); 
     106                        yz.put("displayText", "addresshierarchy.location.address1"); 
     107                        yz.put("codeName", "address1"); 
     108                        z.add(1, yz); 
     109                        List<List<Map<String,String>>> xz = new Vector<List<Map<String,String>>>(); 
     110                        xz.add(z); 
     111                        yz.put("isToken", "IS_ADDR_TOKEN"); 
     112                        yz.put("displaySize", "50"); 
     113                        yz.put("displayText", "addresshierarchy.location.sublocation1"); 
     114                        yz.put("codeName", "sublocation"); 
     115                        z.add(1, yz); 
     116                        //List<List<Map<String,String>>> xz = new Vector<List<Map<String,String>>>(); 
     117                        xz.add(z); 
     118                        model.put("addressHierarchyTemplate", xz); 
     119                         
    84120                } 
    85121        } 
     
    94130         
    95131        protected abstract LayoutSupport getLayoutSupportInstance(); 
    96          
    97 
     132        }