← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17123: Fixed bug #1381399: No org units caused failure to load the rest of the page.

 

------------------------------------------------------------
revno: 17123
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-15 14:19:54 +0200
message:
  Fixed bug #1381399: No org units caused failure to load the rest of the page.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.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-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm	2014-07-29 12:54:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm	2014-10-15 12:19:54 +0000
@@ -1,17 +1,17 @@
 <script type="text/javascript">
-	jQuery(document).ready(function(){	
-		tableSorter( 'listTable' );	
+  jQuery( document ).ready( function() {
+    tableSorter( 'listTable' );
 
-    dhis2.contextmenu.makeContextMenu({
+    dhis2.contextmenu.makeContextMenu( {
       menuId: 'contextMenu',
       menuItemActiveClass: 'contextMenuItemActive'
     });
-	});
+  });
 
-	var none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'" )';
-	var yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'" )';
-	var no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'" )';
-	var confirm_to_delete_org_unit = '$encoder.jsEscape( $i18n.getString( "confirm_to_delete_org_unit" ) , "'" )';
+  var none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'" )';
+  var yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'" )';
+  var no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'" )';
+  var confirm_to_delete_org_unit = '$encoder.jsEscape( $i18n.getString( "confirm_to_delete_org_unit" ) , "'" )';
 </script>
 
 <h3>$i18n.getString( "org_unit_management" ) #openHelp( "orgunit" )</h3>
@@ -20,75 +20,76 @@
   <ul id="contextMenuItems" class="contextMenuItems">
     <li><a data-target-fn="showUpdateOrganisationUnitForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
     <li data-enabled="canUpdate"><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i>&nbsp;&nbsp;$i18n.getString( "translation_translate" )</a></li>
-	<li data-enabled="canDelete"><a data-target-fn="removeOrganisationUnit"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
+    <li data-enabled="canDelete"><a data-target-fn="removeOrganisationUnit"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
     <li><a data-target-fn="showOrganisationUnitDetails"><i class="fa fa-info-circle"></i>&nbsp;&nbsp;$i18n.getString( "show_details" )</a></li>
   </ul>
 </div>
 
 <table class="mainPageTable">
-	<tr>
-		<td style="vertical-align:top">
-			<table width="100%">
-				<tr>
-					<td>#filterDiv( "organisationUnit" )</td>
-					<td colspan="3" style="text-align:right">
-						<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrganisationUnitForm.action'"/>
-					</td>
-				</tr>
-			</table>
-			<table class="listTable" id="listTable">
-				<col/>
+  <tr>
+    <td style="vertical-align:top">
+      <table width="100%">
+        <tr>
+          <td>#filterDiv( "organisationUnit" )</td>
+          <td colspan="3" style="text-align:right">
+            <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrganisationUnitForm.action'"/>
+          </td>
+        </tr>
+      </table>
+      <table class="listTable" id="listTable">
+        <col/>
         <thead>
-				<tr>
-					<th>$i18n.getString( "name" )</th>
-				</tr>
+        <tr>
+          <th>$i18n.getString( "name" )</th>
+        </tr>
         </thead>
-				<tbody id="list">
-				#foreach( $organisationUnit in $organisationUnits )
-				<tr id="tr${organisationUnit.id}" data-id="$!organisationUnit.id" data-uid="$!organisationUnit.uid" data-type="OrganisationUnit" data-name="$encoder.htmlEncode( $!organisationUnit.displayName )"
-				    data-can-manage="$security.canManage( $organisationUnit )"
-				    data-can-update="$security.canUpdate( $organisationUnit )"
-				    data-can-delete="#if($organisationUnit.children.size() == 0 && $auth.hasAccess( "dhis-web-maintenance-organisationunit", "removeOrganisationUnit" ))true#{else}false#end">
-				    <td>$encoder.htmlEncode( $!organisationUnit.displayName )</td>
-				</tr>
-				#end
-                </tbody>
-				#if ( $organisationUnits.size() == 0 )
-				<tr>
-					<td colspan="4">$i18n.getString( "this_org_unit_has_no_children" )</td>
-				</tr>
-				#end
-			</table>
-			<p></p>
-			#parse( "/dhis-web-commons/paging/paging.vm" )
-
-		</td>
-		<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( "short_name" ):</label><br/><span id="shortNameField"></span></p>
-				<p><label>$i18n.getString( "description" ):</label><br/><span id="descriptionField"></span></p>
-				<p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
-				<p><label>$i18n.getString( "opening_date" ):</label><br/><span id="openingDateField"></span></p>
-				<p><label>$i18n.getString( "closed_date" ):</label><br/><span id="closedDateField"></span></p>
-				<p><label>$i18n.getString( "registers_date" ):</label><br/><span id="activeField"></span></p>
-				<p><label>$i18n.getString( "comment" ):</label><br/><span id="commentField"></span></p>
-                <p><label>$i18n.getString( "url" ):</label><br/><span id="urlField"></span></p>
-                <p><label>$i18n.getString( "last_updated" ):</label><br/><span id="lastUpdatedField"></span></p>
-				<p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
-			</div>
-
-            <div id="warningArea">
-                <div id="hideDetailsArea">
-                    <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_warning' )"/></a>
-                </div>
-                <p><span id="warningField"></span></p>
-            </div>
-
-		</td>
-	</tr>
+        #if( $organisationUnits.size() > 0 )
+        <tbody id="list">
+            #foreach( $organisationUnit in $organisationUnits )
+            <tr id="tr${organisationUnit.id}" data-id="$!organisationUnit.id" data-uid="$!organisationUnit.uid"
+                data-type="OrganisationUnit" data-name="$encoder.htmlEncode( $!organisationUnit.displayName )"
+                data-can-manage="$security.canManage( $organisationUnit )"
+                data-can-update="$security.canUpdate( $organisationUnit )"
+                data-can-delete="#if($organisationUnit.children.size() == 0 && $auth.hasAccess( "dhis-web-maintenance-organisationunit", "removeOrganisationUnit" ))true#{else}false#end">
+              <td>$encoder.htmlEncode( $!organisationUnit.displayName )</td>
+            </tr>
+            #end
+        #else ## Mock table contents and display no-children message in single row
+        <tbody>
+        <tr>
+          <td colspan="4">$i18n.getString( "this_org_unit_has_no_children" )</td>
+        </tr>
+        </tbody>
+        #end
+      </table>
+      <p></p>
+        #parse( "/dhis-web-commons/paging/paging.vm" )
+    </td>
+    <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( "short_name" ):</label><br/><span id="shortNameField"></span></p>
+        <p><label>$i18n.getString( "description" ):</label><br/><span id="descriptionField"></span></p>
+        <p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
+        <p><label>$i18n.getString( "opening_date" ):</label><br/><span id="openingDateField"></span></p>
+        <p><label>$i18n.getString( "closed_date" ):</label><br/><span id="closedDateField"></span></p>
+        <p><label>$i18n.getString( "registers_date" ):</label><br/><span id="activeField"></span></p>
+        <p><label>$i18n.getString( "comment" ):</label><br/><span id="commentField"></span></p>
+        <p><label>$i18n.getString( "url" ):</label><br/><span id="urlField"></span></p>
+        <p><label>$i18n.getString( "last_updated" ):</label><br/><span id="lastUpdatedField"></span></p>
+        <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
+      </div>
+
+      <div id="warningArea">
+        <div id="hideDetailsArea">
+          <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+        </div>
+        <p><span id="warningField"></span></p>
+      </div>
+
+    </td>
+  </tr>
 </table>