svn commit: r675914 - in /lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya: content/admin/groups/overview.xsp content/admin/groups/profile.xsp xslt/admin/groups/overview.xsl xslt/admin/groups/profile.xsl

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Fri Jul 11 03:43:35 2008
New Revision: 675914

URL: http://svn.apache.org/viewvc?rev=675914&view=rev
Log:
Show rule textarea and attribute list only for non-empty attribute sets.

Modified:
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/overview.xsl
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/profile.xsl

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp?rev=675914&r1=675913&r2=675914&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/overview.xsp Fri Jul 11 03:43:35 2008
@@ -69,17 +69,18 @@
             }
         }
         
-        AttributeRule rule = group.getRule();
-        String ruleString = null;
-        if (rule != null) {
-            ruleString = rule.getRule();
-        }
     </xsp:logic>
     <group>
       <id><xsp:expr>group.getId()</xsp:expr></id>
       <name><xsp:expr>group.getName()</xsp:expr></name>
       <description><xsp:expr>group.getDescription()</xsp:expr></description>
-      <rule><xsp:expr>ruleString</xsp:expr></rule>
+      <xsp:logic>
+        AttributeRule rule = group.getRule();
+        String ruleString = null;
+        if (rule != null) {
+          <rule><xsp:expr>rule.getRule()</xsp:expr></rule>
+        }
+      </xsp:logic>
       <users>
         <xsp:logic>
             for (Iterator i = users.iterator(); i.hasNext();) {

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp?rev=675914&r1=675913&r2=675914&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/content/admin/groups/profile.xsp Fri Jul 11 03:43:35 2008
@@ -61,16 +61,20 @@
       <description><jpath:value-of select="description"/></description>
       <rule><jpath:value-of select="rule"/></rule>
     </group>
-    <attributeNames>
-      <xsp:logic>
-        AttributeSet attrSet = (AttributeSet) <jpath:value-of select="attributes"/>;
-        String[] names = (String[]) attrSet.getAttributeNames(); 
-        for (int i = 0; i &lt; names.length; i++) {
-            Attribute attr = attrSet.getAttribute(names[i]);
-            <attributeName><xsp:expr>attr.getAlias()</xsp:expr></attributeName>
-        }
-      </xsp:logic>
-    </attributeNames>
+    <xsp:logic>
+      AttributeSet attrSet = (AttributeSet) <jpath:value-of select="attributes"/>;
+      String[] names = (String[]) attrSet.getAttributeNames();
+      if (names.length &gt; 0) { 
+        <attributeNames>
+          <xsp:logic>
+          for (int i = 0; i &lt; names.length; i++) {
+              Attribute attr = attrSet.getAttribute(names[i]);
+              <attributeName><xsp:expr>attr.getAlias()</xsp:expr></attributeName>
+          }
+          </xsp:logic>
+        </attributeNames>
+      }
+    </xsp:logic>
   </page>
   
 </xsp:page>

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/overview.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/overview.xsl?rev=675914&r1=675913&r2=675914&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/overview.xsl (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/overview.xsl Fri Jul 11 03:43:35 2008
@@ -71,10 +71,7 @@
               <td valign="top" class="lenya-entry-caption"><i18n:text>Description</i18n:text>:</td>
               <td><xsl:value-of select="description"/></td>
             </tr>
-            <tr>
-              <td valign="top" class="lenya-entry-caption"><i18n:text>Rule</i18n:text>:</td>
-              <td><xsl:value-of select="rule"/></td>
-            </tr>
+            <xsl:apply-templates select="rule"/>
             <tr>
               <td/>
               <td>
@@ -116,6 +113,14 @@
   </xsl:template>
   
   
+  <xsl:template match="rule">
+    <tr>
+      <td valign="top" class="lenya-entry-caption"><i18n:text>Rule</i18n:text>:</td>
+      <td><xsl:value-of select="."/></td>
+    </tr>
+  </xsl:template>
+  
+  
   <xsl:template match="users">
 		<tr>
 			<td class="lenya-entry-caption" valign="top"><i18n:text>Users</i18n:text>:</td>

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/profile.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/profile.xsl?rev=675914&r1=675913&r2=675914&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/profile.xsl (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/lenya/xslt/admin/groups/profile.xsl Fri Jul 11 03:43:35 2008
@@ -41,6 +41,7 @@
       <page:body>
         <xsl:apply-templates select="messages"/>
         <xsl:apply-templates select="group"/>
+        <xsl:apply-templates select="attributeNames"/>
       </page:body>
     </page:page>
   </xsl:template>
@@ -99,12 +100,14 @@
                 <textarea class="lenya-form-element" name="description"><xsl:value-of select="description"/>&#160;</textarea>
               </td>
             </tr>
-            <tr>
-              <td class="lenya-entry-caption" valign="top"><i18n:text>Rule</i18n:text></td>
-              <td>
-                <textarea class="lenya-form-element" name="rule" rows="5"><xsl:value-of select="rule"/> </textarea>
-              </td>
-            </tr>
+            <xsl:if test="../attributeNames">
+              <tr>
+                <td class="lenya-entry-caption" valign="top"><i18n:text>Rule</i18n:text></td>
+                <td>
+                  <textarea class="lenya-form-element" name="rule" rows="5"><xsl:value-of select="rule"/> </textarea>
+                </td>
+              </tr>
+            </xsl:if>
             <tr>
               <td/>
               <td>
@@ -114,29 +117,6 @@
               </td>
             </tr>
           </table>
-          <hr/>
-          
-          <strong><i18n:text>Example rule</i18n:text>:</strong><br/>
-          <code style="white-space: nowrap;">
-            swissEduPersonHomeOrganization == "unizh" &amp;&amp; surname == "Meier"
-          </code>
-          <br/><br/>
-          <strong><i18n:text>Available attributes</i18n:text></strong>:
-          <table class="lenya-table" style="margin-top: 1em;">
-            <tr>
-              <th style="border-right: none"><i18n:text>Name</i18n:text></th>
-              <th style="border-left: none"><i18n:text>Description</i18n:text></th>
-            </tr>
-            <xsl:for-each select="../attributeNames/attributeName">
-              <xsl:sort select="."/>
-              <tr>
-                <td style="border-right: none"><xsl:value-of select="."/></td>
-                <td style="border-left: none">
-                  <i18n:text>accesscontrol.attribute.<xsl:value-of select="."/></i18n:text>
-                </td>
-              </tr>
-            </xsl:for-each>
-          </table>
           
         </form>
       </div>
@@ -149,6 +129,31 @@
   </xsl:template>
   
   
+  <xsl:template match="attributeNames">
+    <strong><i18n:text>Example rule</i18n:text>:</strong><br/>
+    <code style="white-space: nowrap;">
+      swissEduPersonHomeOrganization == "unizh" &amp;&amp; surname == "Meier"
+    </code>
+    <br/><br/>
+    <strong><i18n:text>Available attributes</i18n:text></strong>:
+    <table class="lenya-table" style="margin-top: 1em;">
+      <tr>
+        <th style="border-right: none"><i18n:text>Name</i18n:text></th>
+        <th style="border-left: none"><i18n:text>Description</i18n:text></th>
+      </tr>
+      <xsl:for-each select="../attributeNames/attributeName">
+        <xsl:sort select="."/>
+        <tr>
+          <td style="border-right: none"><xsl:value-of select="."/></td>
+          <td style="border-left: none">
+            <i18n:text>accesscontrol.attribute.<xsl:value-of select="."/></i18n:text>
+          </td>
+        </tr>
+      </xsl:for-each>
+    </table>
+  </xsl:template>
+  
+  
   <xsl:template match="message">
     <xsl:if test="text()">
       <tr>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.