Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 5237

Show
Ignore:
Timestamp:
08/11/08 15:34:49 (5 months ago)
Author:
r0bby
Message:

groovyforms: checking in what I have so far; it's not quite working but it compiles

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/groovyforms/groovyModule.iml

    r5180 r5237  
    4949          <containerElement type="library" level="module"> 
    5050            <attribute name="method" value="1" /> 
    51             <attribute name="URI" value="/WEB-INF/lib/httpunit.jar" /> 
     51            <attribute name="URI" value="/WEB-INF/lib" /> 
    5252            <url>jar://$MODULE_DIR$/lib/httpunit.jar!/</url> 
    5353          </containerElement> 
     
    121121  <component name="NewModuleRootManager" inherit-compiler-output="false"> 
    122122    <output url="file://$MODULE_DIR$/../../openmrs/out/production/groovyModule" /> 
     123    <output-test url="file://$MODULE_DIR$/../../openmrs/out/test/groovyModule" /> 
    123124    <exclude-output /> 
    124     <output-test url="file://$MODULE_DIR$/../../openmrs/out/test/groovyModule" /> 
    125125    <content url="file://$MODULE_DIR$"> 
    126126      <sourceFolder url="file://$MODULE_DIR$/metadata" isTestSource="false" /> 
     
    267267      </library> 
    268268    </orderEntry> 
    269     <orderEntryProperties /> 
    270269  </component> 
    271270  <component name="POM File Configuration" pomFile="" /> 
     271  <component name="PluginUploader.PluginUploadConfigurable"> 
     272    <option name="ARCHIVE_PATH" /> 
     273    <option name="PLUGIN_ID" /> 
     274  </component> 
    272275  <component name="copyright"> 
    273276    <Base> 
  • openmrs-modules/groovyforms/metadata/config.xml

    r5225 r5237  
    115115            DWRGroovyFormsService.getFormName(String id); 
    116116            DWRGroovyFormsService.getFormVersion(String id); 
    117             DWRGroovyFormsService.getFormDescription(String id); 
    118             DWGGroovyFormsService.loadForms();  
    119  
     117            DWRGroovyFormsService.getFormDescription(String id);             
    120118                        ]]> 
    121119        </signatures> 
  • openmrs-modules/groovyforms/src/org/openmrs/module/groovyforms/GroovyFormsActivator.java

    r5224 r5237  
    7979        try { 
    8080            List<GroovyForm> forms = GroovyFormsUtil. 
    81                     unMarshalGroovyForms(new File(GroovyFormsUtil.getGROOVY_FORMS_HOME().getCanonicalPath()+"/groovyforms.xml")); 
    82             log.debug(forms.size()); 
     81                    unMarshalGroovyForms(new File(GroovyFormsUtil.getGROOVY_FORMS_HOME().getCanonicalPath()+"/groovyforms.xml"));             
    8382            GroovyFormsContainer.setGroovyForms(forms); 
    8483        } catch(Exception e) { 
  • openmrs-modules/groovyforms/web/module/manageGroovyForms.jsp

    r5180 r5237  
    1  
    21<%-- 
    32  The contents of this file are subject to the OpenMRS Public License 
     
    2928<script type="text/javascript"> 
    3029    $(document).ready(function() { 
    31         $("#formNae").bind("blur",function() { 
    32             var value = $("#formVersion").val(); 
     30        $("#formName").bind("blur",function() { 
    3331            var id = $("formId").html(); 
    34             updateFormName(id,value); 
     32            updateFormName(id); 
     33        }); 
     34 
     35        $("#formVersion").blur( function() { 
     36            var id = $("formId").html(); 
     37            updateFormVersion(id); 
     38            alert("fooooo"); 
     39 
    3540        }); 
    3641    }); 
     
    4146 
    4247    function backupForm(formId) { 
    43         DWRGroovyFormsService.backupForm(formId, function() { 
    44             // do nothing 
    45         }); 
     48        DWRGroovyFormsService.backupForm(formId); 
    4649 
    4750    } 
    4851 
    4952    function backupAllForms() { 
    50         DWRGroovyFormsService.backupAllForms(function() { 
    51             // do nothing 
    52         }); 
     53        DWRGroovyFormsService.backupAllForms(); 
    5354 
    5455    } 
    55  
    56     function updateFormName(id,user) { 
     56    function updateFormDesc(id) { 
     57        var desc = $("#desc").val(); 
     58        var user = '${user}'; 
     59        DWRGroovyFormsService.setFormDescription(id,desc); 
     60        DWRGroovyFormsService.setLastChanged(id, function(res) { 
     61            $("dateChanged").html(res); 
     62        }); 
     63        DWRGroovyFormsService.setChangedBy(id, user, function() { 
     64            $("#changedBy").html(user); 
     65        }); 
     66    } 
     67    function updateFormName(id) { 
    5768        var name = $("#formName").val(); 
    5869        var user = '${user}'; 
    5970        DWRGroovyFormsService.setFormName(id,name); 
    60         DWRGroovyFormsService.getFormName(id,function(res) { 
    61            alert(res);  
     71        DWRGroovyFormsService.setLastChanged(id, function(res) { 
     72            $("dateChanged").html(res); 
     73        }); 
     74        DWRGroovyFormsService.setChangedBy(id, user, function() { 
     75            $("#changedBy").html(user);             
    6276        }); 
    6377    } 
    6478 
     79    function updateFormVersion(id) { 
     80        var name = $("#formName").val(); 
     81        var user = '${user}'; 
     82        DWRGroovyFormsService.setFormVersion(function(res) { 
     83            alert(res); 
     84        }); 
     85          DWRGroovyFormsService.setLastChanged(id, function(res) { 
     86            $("dateChanged").html(res); 
     87        }); 
     88        DWRGroovyFormsService.setChangedBy(id, user, function() { 
     89            $("#changedBy").html(user); 
     90        }); 
    6591 
     92        function updateFormModel(id) { 
     93            var model = $("#formModel"); 
     94            var user = ${user}; 
     95            DWRGroovyFormsService 
     96        } 
     97    } 
    6698 
     99       function validateSyntax(name,version,clazz) { 
     100        $("#view").val(""); 
     101        $("#controller").val(""); 
     102        $("stepTwo").fadeOut("fast"); 
     103        $("#out").val(""); 
     104        $("#out").fadeOut("fast"); 
     105        DWRGroovyFormsService.validateSyntax(name,version,clazz,function(res) { 
     106            if(res == null) { 
     107                checkProps(name,version,clazz); 
     108            } else { 
     109                $("#out").html(res); 
     110            } 
     111        }); 
     112    } 
    67113</script> 
    68114<p/> 
     
    81127        <th><spring:message code="groovyforms.ui.heading.version"/></th> 
    82128        <th><spring:message code="groovyforms.ui.heading.published"/></th> 
    83     </tr>     
     129    </tr> 
     130 
    84131    <c:forEach var="form" items="${groovyForms}" varStatus="status"> 
    85132        <tr> 
    86133            <td><span id="formId">${form.id}</span></td> 
    87             <td><input type="text" id="formName" value="${form.name}"/></td> 
    88             <td >${form.description}</td> 
    89             <td>${form.dateCreated}</td> 
    90             <td><span id="dateChanged">${form.dateChanged}</span></td> 
    91             <td>${form.createdBy}</td> 
    92             <td><span id="changedBy">${form.changedBy}</span></td> 
    93             <td>${form.version}</td> 
     134            <td> 
     135                <input type="text" id="formName" value="${form.name}"/> 
     136            </td> 
     137            <td> 
     138                <input type="text" id="desc" value="${form.description}"/> 
     139            </td> 
     140            <td> 
     141                ${form.dateCreated}</td> 
     142            <td> 
     143                <span id="dateChanged">${form.dateChanged}</span></td> 
     144            <td> 
     145                ${form.createdBy}</td> 
     146            <td> 
     147                <span id="changedBy">${form.changedBy}</span> 
     148            </td> 
     149            <td> 
     150                <input type="text"  id="formVersion" value="${form.version}"/> 
     151            </td> 
    94152            <td> 
    95153                <c:choose> 
    96                     <c:when test="${form.published }"> 
    97                         <input type="checkbox" id="published" name="published" checked="checked" 
    98                                value="${form.id}" onClick="setPublished('${form.id}')"/> 
    99                     </c:when> 
     154                            <c:when test="${form.published }"> 
     155                                <input type="checkbox" id="published" name="published" checked="checked" 
     156                                       value="${form.id}" onClick="setPublished('${form.id}')"/> 
     157                            </c:when> 
    100158 
    101                     <c:otherwise> 
    102                         <input type="checkbox" id="published" name="checkbox" value="${form.id}" 
    103                                onClick="setPublished('${form.id}')"/> 
    104                     </c:otherwise> 
    105                 </c:choose> 
     159                            <c:otherwise> 
     160                                <input type="checkbox" id="published" name="checkbox" value="${form.id}" 
     161                                       onClick="setPublished('${form.id}')"/> 
     162                            </c:otherwise> 
     163                        </c:choose> 
    106164            </td> 
    107             <td><input type="submit" id="${form.id}" 
    108                        onClick="edit('${form.id}')" value="<spring:message code="groovyforms.ui.edit-form-button"/>"/> </td> 
    109             <td><input type="submit" id="${form.id}" onClick="backupForm('${form.id}');" value="<spring:message code="groovyforms.ui.backup-form-button"/>"/> </td> 
     165            <td> 
     166                <input type="submit" 
     167                       onClick="edit('${form.id}');" value="<spring:message code="groovyforms.ui.edit-form-button"/>"/> 
     168            </td> 
     169            <td> 
     170                <input type="submit"  onClick="backupForm('${form.id}');" value="<spring:message code="groovyforms.ui.backup-form-button"/>"/> 
     171            </td> 
    110172        </tr> 
    111173    </c:forEach> 
     
    113175<a href="createGroovyForms.form"> 
    114176    <spring:message code="groovyforms.create-new-groovyform"/></a> 
    115 <br /><a href="#" onClick="backupAllForms()"/> 
     177<br /><a href="#" onClick="backupAllForms();"/> 
    116178<spring:message code="groovyforms.link.backupforms"/></a> 
    117179<br /> 
     180<div id="mvc" style="display:none"> 
     181 
     182 
     183</div> 
    118184 
    119185<%@ include file="/WEB-INF/template/footer.jsp" %> 
  • openmrs-modules/groovyforms/web/src/org/openmrs/module/groovyforms/web/dwr/DWRGroovyFormsService.groovy

    r5180 r5237  
    3636    /** 
    3737     * Method to allow for backup of all the forms via the management page 
    38      * @throws java.io.IOException if an i/o error occurs 
    3938     */ 
    40     void backupAllForms() throws IOException
     39    void backupAllForms()
    4140        GroovyFormsUtil.writeGlobalXMLToFile GroovyFormsContainer.getForms() 
    4241    } 
    43    
     42 
    4443    boolean hasProperties(String fName, String version, String clazz) { 
    4544        GroovyFormsClassUtil.hasProperties(getFormId(fName, version), clazz) 
     
    9291            } 
    9392            GroovyFormsContainer.getForm(formId).published = isPublished 
    94  
    9593        } 
    9694    } 
    9795 
    98     String setFormName(String id, String value) { 
     96    void setFormName(String id, String value) { 
    9997        if (GroovyFormsContainer.getForm(id)) { 
    10098            GroovyFormsContainer.getForm(id).name = value 
     
    118116    void setChangedBy(String id, String value) { 
    119117        if (GroovyFormsContainer.getForm(id)) { 
     118            log.info "Setting changedBy for form id $id to $value" 
    120119            GroovyFormsContainer.getForm(id).changedBy = value 
    121120        } 
     
    123122 
    124123    String getChangedBy(String id) { 
    125         if(GroovyFormsContainer.getForm(id)) { 
    126             GroovyFormsContainer.getForm(id).changedBy 
     124        if (GroovyFormsContainer.getForm(id)) { 
     125            return GroovyFormsContainer.getForm(id).changedBy 
    127126        } 
    128127    } 
     128 
    129129    Date setLastChanged(String id) { 
    130130        if (GroovyFormsContainer.getForm(id)) { 
    131131            def d = new Date() 
     132            log.info "Setting dateChanged to $d" 
    132133            GroovyFormsContainer.getForm(id).dateChanged = d 
    133            
     134            return
    134135        } 
    135136    } 
     
    138139        if (GroovyFormsContainer.getForm(id)) { 
    139140            def version = GroovyFormsContainer.getForm(id).version 
    140  
     141            return version 
    141142        } 
    142143    } 
     
    144145    String getFormName(String id) { 
    145146        if (GroovyFormsContainer.getForm(id)) { 
    146             def name = GroovyFormsContainer.getForm(id).name 
     147            def name = GroovyFormsContainer.getForm(id).name 
    147148            log.info "Returning $name for form id $id" 
     149            return name 
    148150 
    149151        } 
     
    153155        if (GroovyFormsContainer.getForm(id)) { 
    154156            def desc = GroovyFormsContainer.getForm(id).description 
     157            return desc 
    155158        } 
    156159    } 
     160 
     161    String  getFormModel(String id) { 
     162        GroovyFormsUtil.getViewFile(id).text 
     163    } 
     164 
     165    String getFormController(String id) { 
     166        GroovyFormsUtil.getControllerClazzFile(id).text 
     167    } 
     168 
     169    String getFormView(String id) { 
     170        GroovyFormsUtil.getModelClazzFile(id).text 
     171    } 
     172 
     173    void saveFormView(String id, String view) { 
     174        GroovyFormsGenerationUtil.saveView id, view 
     175    } 
     176 
     177    void saveFormController(String id, String clazz) { 
     178        GroovyFormsGenerationUtil.saveControllerClass id, clazz 
     179    } 
     180 
     181    void saveFormModel(String id, String clazz) { 
     182        GroovyFormsGenerationUtil.saveDomainClass id, clazz 
     183    } 
    157184}