dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21101
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9903: Improve custom registration form function.
------------------------------------------------------------
revno: 9903
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-26 14:29:59 +0700
message:
Improve custom registration form function.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java 2013-02-04 03:48:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewPatientRegistrationFormAction.java 2013-02-26 07:29:59 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.patient.PatientRegistrationFormService;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.setting.SystemSettingManager;
import com.opensymphony.xwork2.Action;
@@ -83,6 +84,13 @@
this.patientRegistrationFormService = patientRegistrationFormService;
}
+ private SystemSettingManager systemSettingManager;
+
+ public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+ {
+ this.systemSettingManager = systemSettingManager;
+ }
+
// -------------------------------------------------------------------------
// Getters & Setters
// -------------------------------------------------------------------------
@@ -134,6 +142,13 @@
return program;
}
+ private List<String> flags;
+
+ public List<String> getFlags()
+ {
+ return flags;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -172,6 +187,12 @@
}
}
+ // ---------------------------------------------------------------------
+ // Get images
+ // ---------------------------------------------------------------------
+
+ flags = systemSettingManager.getFlags();
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2013-02-19 06:54:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2013-02-26 07:29:59 +0000
@@ -551,6 +551,9 @@
<property name="patientRegistrationFormService">
<ref bean="org.hisp.dhis.patient.PatientRegistrationFormService" />
</property>
+ <property name="systemSettingManager">
+ <ref bean="org.hisp.dhis.setting.SystemSettingManager" />
+ </property>
</bean>
<!-- Patient Attribute Group -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-26 04:24:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-26 07:29:59 +0000
@@ -354,4 +354,6 @@
assign_program_to_userroles = Assign program to userroles
property_is_inserted = The property is inserted
please_insert_all_required_fields = Please insert all required fields
-required_fields_valivation = Required fields validation
\ No newline at end of file
+required_fields_valivation = Required fields validation
+insert_properties = Insert properties
+insert_images = Insert images
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2013-02-20 09:08:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2013-02-26 07:29:59 +0000
@@ -574,6 +574,11 @@
/dhis-web-commons/ajax/jsonResponseSuccess.vm
</result>
</action>
+
+ <action name="delRegistrationEntryFormAction"
+ class="org.hisp.dhis.patient.action.dataentryform.DelRegistrationFormAction">
+ <result name="success" type="redirect">patientRegistrationForm.action</result>
+ </action>
<action name="showPatientRegistrationForm"
class="org.hisp.dhis.patient.action.dataentryform.ShowPatientRegistrationFormAction">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-02-26 04:24:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-02-26 07:29:59 +0000
@@ -1,6 +1,30 @@
+$( document ).ready( function()
+{
+ $(":button").button();
+ $(":submit").button();
+ $("#saveButton").button("option", "icons", { primary: "ui-icon-disk" });
+ $("#cancelButton").button("option", "icons", { primary: "ui-icon-cancel" });
+ $("#deleteButton").button("option", "icons", { primary: "ui-icon-trash" });
+ $("#insertButton").button("option", "icons", { primary: "ui-icon-plusthick" });
+ $("#propertiesButton").button("option", "icons", { primary: "ui-icon-newwin" });
+ $("#insertImagesButton").button("option", "icons", { primary: "ui-icon-newwin" });
+
+ $("#imageDialog").bind("dialogopen", function(event, ui) {
+ $("#insertImagesButton").button("disable");
+ })
+ $("#imageDialog").bind("dialogclose", function(event, ui) {
+ $("#insertImagesButton").button("enable");
+ })
+
+ $("#insertImagesButton").click(function() {
+ $("#imageDialog").dialog();
+ });
+});
+
function openPropertiesSelector()
-{
+{
+ $("#propertiesButton").addClass("ui-state-active2");
$('#selectionDialog' ).dialog(
{
title:i18n_properties,
@@ -9,12 +33,23 @@
modal:false,
overlay:{background:'#000000', opacity:0.1},
width:500,
- height:460
+ height:460,
+ close: function(ev, ui) {
+ $("#propertiesButton").removeClass("ui-state-active2");
+ }
});
}
function fixAttrOnClick()
{
+ $("#insertButton").click(function() {
+ insertElement( 'fixedAttr' );
+ });
+
+ $("#fixAttrButton").addClass("ui-state-active2");
+ $("#identifierTypeButton").removeClass("ui-state-active2");
+ $("#attributesButton").removeClass("ui-state-active2");
+ $("#programAttrButton").removeClass("ui-state-active2");
hideById('attributeTab');
hideById('identifierTypeTab');
hideById('programAttrTab');
@@ -23,6 +58,14 @@
function identifierTypeOnClick()
{
+ $("#insertButton").click(function() {
+ insertElement( 'iden' )
+ });
+
+ $("#fixAttrButton").removeClass("ui-state-active2");
+ $("#identifierTypeButton").addClass("ui-state-active2");
+ $("#attributesButton").removeClass("ui-state-active2");
+ $("#programAttrButton").removeClass("ui-state-active2");
hideById('attributeTab');
hideById('fixedAttrTab');
hideById('programAttrTab');
@@ -31,6 +74,14 @@
function attributesOnClick()
{
+ $("#insertButton").click(function() {
+ insertElement( 'attr' );
+ });
+
+ $("#fixAttrButton").removeClass("ui-state-active2");
+ $("#identifierTypeButton").removeClass("ui-state-active2");
+ $("#attributesButton").addClass("ui-state-active2");
+ $("#programAttrButton").removeClass("ui-state-active2");
hideById('identifierTypeTab');
hideById('fixedAttrTab');
hideById('programAttrTab');
@@ -39,6 +90,14 @@
function programAttrOnClick()
{
+ $("#insertButton").click(function() {
+ insertElement( 'prg' );
+ });
+
+ $("#fixAttrButton").removeClass("ui-state-active2");
+ $("#identifierTypeButton").removeClass("ui-state-active2");
+ $("#attributesButton").removeClass("ui-state-active2");
+ $("#programAttrButton").addClass("ui-state-active2");
hideById('attributeTab');
hideById('identifierTypeTab');
hideById('fixedAttrTab');
@@ -175,23 +234,32 @@
{
var id = '';
var value = '';
+
if( type == 'fixedAttr' ){
var element = jQuery('#fixedAttrSelector option:selected');
+ if( element.length == 0 ) return;
+
id = 'fixedattributeid="' + element.attr('value') + '"';
value = element.text();
}
else if( type == 'iden' ){
var element = jQuery('#identifiersSelector option:selected');
+ if( element.length == 0 ) return;
+
id = 'identifierid="' + element.attr('value') + '"';
value = element.text();
}
else if( type == 'attr' ){
var element = jQuery('#attributesSelector option:selected');
+ if( element.length == 0 ) return;
+
id = 'attributeid="' + element.attr('value') + '"';
value = element.text();
}
else if( type == 'prg' ){
var element = jQuery('#programAttrSelector option:selected');
+ if( element.length == 0 ) return;
+
id = 'programid="' + element.attr('value') + '"';
value = element.text();
}
@@ -208,3 +276,19 @@
}
}
+
+function deleteRegistrationForm( id, name )
+{
+ var result = window.confirm( i18n_confirm_delete + '\n\n' + name );
+ if ( result )
+ {
+ window.location.href = 'delRegistrationEntryFormAction.action?id=' + id;
+ }
+}
+
+function insertImage() {
+ var image = $("#imageDialog :selected").val();
+ var html = "<img src=\"" + image + "\" title=\"" + $("#imageDialog :selected").text() + "\">";
+ var oEditor = $("#designTextarea").ckeditorGet();
+ oEditor.insertHtml( html );
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-02-26 04:24:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-02-26 07:29:59 +0000
@@ -1,3 +1,13 @@
+<link href="../dhis-web-commons/javascripts/jQuery/ui/css/redmond/jquery-ui-1.9.1.custom.css" media="screen" rel="stylesheet" type="text/css">
+<link href="../dhis-web-commons/css/light_blue/light_blue.css" media="screen" rel="stylesheet" type="text/css">
+<link href="../dhis-web-commons/css/widgets.css" media="screen" rel="stylesheet" type="text/css">
+<link href="../dhis-web-commons/css/print.css" media="print" rel="stylesheet" type="text/css">
+<link href="../favicon.ico" rel="shortcut icon">
+<link rel="stylesheet" type="text/css" href="http://localhost:8080/dhis/dhis-web-commons/ckeditor/skins/kama/editor.css?t=B8DJ5M3"/>
+
+
+
+
<script type="text/javascript">
jQuery(document).ready( function()
@@ -37,7 +47,7 @@
padding: 2px;
}
-#fixedAttrSelector, #identifiersSelector, #attributesSelector, {
+#fixedAttrSelector, #identifiersSelector, #attributesSelector, #programSelector {
padding: 2px;
}
</style>
@@ -61,9 +71,6 @@
</td>
<td>
<input type="text" id="name" value="$!registrationForm.dataEntryForm.name" name="name" class="{validate:{required:true,rangelength:[4,150],alphanumericwithbasicpuncspaces:true,firstletteralphabet:false}}" style="width:30em;">
- </td>
- <td align="right">
- <input type="button" value="$i18n.getString( 'properties' )" onclick="openPropertiesSelector()"/><br>
</td>
</tr>
<tr>
@@ -91,10 +98,14 @@
<table width="100%">
<tr>
<td>
- <input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:120px"/>
- <input type="button" name="cancel" value="$i18n.getString( 'cancel' )" style="width:120px" onclick="window.location='patientRegistrationForm.action'">
- #if( $!registationForm.dataEntryForm )
- <input type="button" name="delete" value="$i18n.getString( 'delete' )" style="width:120px" onclick="deleteDataEntryForm( $registrationForm.id )" />
+ <button type="submit" id="saveButton"/>$i18n.getString( 'save' )</button>
+ <button type="button" id="cancelButton" onclick="window.location='patientRegistrationForm.action'">$i18n.getString( 'cancel' )</button>
+ <span style="color:#606060">|</span>
+ <button type="button" id="propertiesButton" onclick="openPropertiesSelector()"/>$i18n.getString( 'insert_properties' )</button>
+ <button type="button" id="insertImagesButton">$i18n.getString( 'insert_images' )</button>
+ #if($!registrationForm.dataEntryForm)
+ <span style="color:#606060">|</span>
+ <button type="button" id="deleteButton" onclick="deleteRegistrationForm( $registrationForm.id, '$registrationForm.dataEntryForm.name' )" />$i18n.getString( 'delete' )</button>
#end
</td>
</tr>
@@ -106,8 +117,8 @@
<table id="fixedAttrTab">
<tr>
<td>
- <input type='text' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'fixedAttrSelector' )">
- <input type='button' value="$i18n.getString('clear')" style="width:80px;">
+ <input type='text' id='fixedAttrFilter' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'fixedAttrSelector' )">
+ <input type='button' value="$i18n.getString('clear')" style="width:80px;" onclick="setFieldValue('fixedAttrFilter','');">
</td>
</tr>
<tr>
@@ -130,8 +141,8 @@
<table id="identifierTypeTab" class='hidden'>
<tr>
<td>
- <input type='text' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'identifiersSelector' )">
- <input type='button' value="$i18n.getString('clear')" style="width:80px;">
+ <input type='text' id='identifierTypeFilter' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'identifiersSelector' )">
+ <input type='button' value="$i18n.getString('clear')" style="width:80px;" onclick="setFieldValue('identifierTypeFilter','');">
</td>
</tr>
<tr>
@@ -148,8 +159,8 @@
<table id="attributeTab" class='hidden'>
<tr>
<td>
- <input type='text' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'attributesSelector' )">
- <input type='button' value="$i18n.getString('clear')" style="width:80px;">
+ <input type='text' id='attributeFilter' placeholder="$i18n.getString('filter')" style="width:365px;" onkeyup="filterList( this.value, 'attributesSelector' )">
+ <input type='button' value="$i18n.getString('clear')" style="width:80px;" onclick="setFieldValue('attributeFilter','');">
</td>
</tr>
<tr>
@@ -193,6 +204,8 @@
#if($!program)
<button type="button" id="programAttrButton" onclick="programAttrOnClick()">$i18n.getString( "program" )</button>
#end
+ <span style="color:#606060">|</span>
+ <button type="button" id="insertButton" onclick="insertElement( 'fixedAttr' )" >$i18n.getString( "insert" )</button>
</td>
</tr>
</table>
@@ -201,6 +214,19 @@
</div>
+<div id="imageDialog" title="$i18n.getString( 'insert_images' )" class='hidden'>
+ <div style="margin:4px">
+ <div>
+ <select id="imageSelector" multiple="multiple" style="height: 200px; width:100%;" ondblclick='insertImage();'>
+ #foreach( $flag in $flags )
+ <option value="../dhis-web-commons/flags/${flag}.png">$i18n.getString( ${flag} )</option>
+ #end
+ </select>
+ </div>
+ <div style="margin-top:6px"><button type="button" id="insertImageButton">$i18n.getString( "insert" )</button></div>
+ </div>
+</div>
+
<div id="validateDiv"></div>
<script>
@@ -213,4 +239,5 @@
var i18n_gender = '$encoder.jsEscape( $i18n.getString( "gender" ) , "'" )';;
var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'" )';
var i18n_properties = '$encoder.jsEscape( $i18n.getString( "properties" ) , "'" )';
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient_registration_form" ) , "'" )';
</script>