dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27241
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13527: don't allow deletion of default dataElementCatOption
------------------------------------------------------------
revno: 13527
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-02 11:14:51 +0100
message:
don't allow deletion of default dataElementCatOption
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.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-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionListAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionListAction.java 2014-01-02 10:14:51 +0000
@@ -28,18 +28,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-
-import java.util.ArrayList;
-import java.util.List;
-
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.paging.ActionPagingSupport;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
/**
* @author Chau Thu Tran
- *
* @version GetDataElementCategoryOptionListAction.java 8:47:42 AM Feb 22, 2013 $
*/
public class GetDataElementCategoryOptionListAction
@@ -67,6 +66,13 @@
return dataElementCategoryOptions;
}
+ private DataElementCategoryOption defaultCategoryOption;
+
+ public DataElementCategoryOption getDefaultCategoryOption()
+ {
+ return defaultCategoryOption;
+ }
+
private String key;
public String getKey()
@@ -85,6 +91,8 @@
public String execute()
{
+ defaultCategoryOption = dataElementCategoryService.getDataElementCategoryOptionByName( DataElementCategoryOption.DEFAULT_NAME );
+
if ( isNotBlank( key ) ) // Filter on key only if set
{
this.paging = createPaging( dataElementCategoryService.getDataElementCategoryOptionCountByName( key ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm 2013-12-04 12:58:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm 2014-01-02 10:14:51 +0000
@@ -59,14 +59,14 @@
</thead>
<tbody id="list">
#foreach( $dataElementCategoryOption in $dataElementCategoryOptions )
- #if( $dataElementCategoryOption.id != $defaultCategory.id )
+ #if( $dataElementCategoryOption.id != $defaultCategoryOption.id )
<tr id="tr${dataElementCategoryOption.id}" data-id="$!dataElementCategoryOption.id" data-uid="$!dataElementCategoryOption.uid" data-type="DataElementCategoryOption" data-name="$encoder.htmlEncode( $!dataElementCategoryOption.displayName )"
data-can-manage="$security.canManage( $dataElementCategoryOption )"
data-can-update="$security.canUpdate( $dataElementCategoryOption )"
data-can-delete="$security.canDelete( $dataElementCategoryOption )">
<td>$encoder.htmlEncode( $!dataElementCategoryOption.displayName )</td>
</tr>
- #end
+ #end
#end
</tbody>
@@ -75,15 +75,15 @@
#parse( "/dhis-web-commons/paging/paging.vm" )
</td>
- <td id="detailsData">
+ <td id="detailsData">
<div id="detailsArea">
<div id="hideDetailsArea">
- <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
- </div>
- <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
- <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
- <p><label>$i18n.getString( "concept" ):</label><br/><span id="conceptField"></span></p>
- </div>
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
+ <p><label>$i18n.getString( "concept" ):</label><br/><span id="conceptField"></span></p>
+ </div>
<div id="warningArea">
<div id="hideDetailsArea">