Code

Updated opsiLicenses search filter
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 15:32:15 +0000 (15:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 15:32:15 +0000 (15:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16538 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsiLicenses/class_filterOpsiLicense.inc
gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc
gosa-plugins/opsi/admin/opsiLicenses/opsiLicense-filter.tpl [deleted file]
gosa-plugins/opsi/admin/opsiLicenses/opsiLicense-filter.xml
gosa-plugins/opsi/admin/opsiLicenses/opsiLicense-list.tpl

index 10d0e19588d7a5eacac7645da3e993cc11ebae2d..13c5bfde1b1772e0ba038deae129ce93d876fdb0 100644 (file)
@@ -12,10 +12,17 @@ class filterOpsiLicense {
     $flag= ($scope == "sub")?GL_SUBSEARCH:0;
     $result= filterOpsiLicense::get_list($base, $filter, $attributes, $category, $objectStorage, $flag);
 
+    // Prepare filter and split it into attribute and value to search for
+    $filter=preg_replace("/\*/","",$filter);
+    $attr = $value = "";
+    if(!empty($filter) && preg_match("/=/", $filter)){
+      list($attr,$value) = preg_split("/=/", $filter);
+    }
+
     // Simple filtering 
-    if(!empty($filter)){
+    if(!empty($attr)){
       foreach($result as $key => $entry){
-        if(!preg_match($filter, $entry['cn'][0])){
+        if(!preg_match("/".$value."/i", $entry[$attr][0])){
           unset($result[$key]);
         }
       }
index 4e969cce6bf22db1aab00ed842517f289063f76d..6c67c5253ed52e28a2e6a4efdb5cad2887248923 100644 (file)
@@ -40,13 +40,13 @@ class opsiLicenses extends management
    
     $this->storagePoints = array("");
  
-    // Build filter
-    if (session::global_is_set(get_class($this)."_filter")){
-      $filter= session::global_get(get_class($this)."_filter");
-    } else {
+#    // Build filter
#   if (session::global_is_set(get_class($this)."_filter")){
+  #    $filter= session::global_get(get_class($this)."_filter");
+   # } else {
       $filter = new filter(get_template_path("opsiLicense-filter.xml", true));
       $filter->setObjectStorage($this->storagePoints);
-    }
+    #}
     $this->setFilter($filter);
 
     // Build headpage
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/opsiLicense-filter.tpl b/gosa-plugins/opsi/admin/opsiLicenses/opsiLicense-filter.tpl
deleted file mode 100644 (file)
index 3d47da6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<div class="contentboxh">
- <p class="contentboxh">
-  <img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}
- </p>
-</div>
-
-<div class="contentboxb">
-
- <table summary='{t}Filter options{/t}' style="width:100%;border-top:1px solid #B0B0B0;">
-  <tr>
-   <td>
-    <label for="NAME">
-     <img src="images/lists/search.png" align=middle>&nbsp;Name
-    </label>
-   </td>
-   <td>
-    {$NAME}
-   </td>
-  </tr>
- </table>
-
- <table summary='{t}Filter options{/t}'  width="100%"  style="background:#EEEEEE;border-top:1px solid #B0B0B0;">
-  <tr>
-   <td width="100%" align="right">
-    {$APPLY}
-   </td>
-  </tr>
- </table>
-</div>
index 7abcde7e664bfb39733c04fd73e0a6a3204f25eb..8fccaeccaee870ec16247ff971323bedbca08d64 100644 (file)
@@ -3,38 +3,43 @@
 <filterdef>
   <definition>
     <category>opsi</category>
-    <template>opsiLicense-filter.tpl</template>
     <initial>true</initial>
+    <default>default</default>
+    <scope>one</scope>
+    <attribute>dn</attribute>
+    <attribute>objectClass</attribute>
+    <attribute>cn</attribute>
+    <attribute>description</attribute>
+    <attribute>productId</attribute>
   </definition>
 
   <search>
+    <tag>default</tag>
+    <label>Default filter</label>
     <query>
       <backend>OpsiLicense</backend>
-      <filter>$NAME</filter>
-      <attribute>dn</attribute>
-      <attribute>objectClass</attribute>
-      <attribute>cn</attribute>
-      <attribute>description</attribute>
+      <filter>cn=$</filter>
     </query>
     <scope>auto</scope>
+    <autocomplete>
+      <attribute>cn</attribute>
+      <frequency>0.5</frequency>
+      <characters>3</characters>
+    </autocomplete>
   </search>
 
-  <element>
-    <type>textfield</type>
-    <tag>NAME</tag>
-    <size>20</size>
-    <maxlength>60</maxlength>
-    <default></default>
-    <unset></unset>
-    <set>/$/i</set>
-    <alphabet>false</alphabet>
-    <autocomplete>
+  <search>
+    <tag>byProduct</tag>
+    <label>By product</label>
+    <query>
       <backend>OpsiLicense</backend>
-      <filter>/$NAME/i</filter>
+      <filter>productId=$</filter>
+    </query>
+    <scope>auto</scope>
+    <autocomplete>
       <attribute>cn</attribute>
       <frequency>0.5</frequency>
       <characters>3</characters>
     </autocomplete>
-  </element>
-
+  </search>
 </filterdef>
index bc45133df654473f73dd344c257a34e938fd9ed7..3327d4f105af65e9999dc945945ec49cf728c402 100644 (file)
@@ -1,28 +1,27 @@
 <input type='image' src='images/empty.png' name='no_action_posted' value='do_nothing' alt='' style='width:2px;height:2px;'>
 
-<table summary="" style="width:100%;height:100%; vertical-align:top; text-align:left;" cellpadding=2>
-  <tr>
-    <td style="vertical-align:top; width:100%;">
-      <div class="contentboxh">
-        <p class="contentboxh">&nbsp;{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
-      </div>
-      
-      <div class="contentboxb">
-       <div style='background:white;padding:3px;'>
-        <table><tr>
-          <td>{$ROOT}&nbsp;</td><td>{$BACK}&nbsp;</td><td>{$HOME}&nbsp;</td><td>{$RELOAD}&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td><img src='images/rocket.png' alt='' class='center'></td><td> {$ACTIONS}</td>
-        </tr></table>
-       </div>
-      </div>
-      
-      <div style='height:4px;'>
-      </div>
-      {$LIST}
-    </td>
-    <td style='vertical-align:top;min-width:250px'>
-      {$FILTER}
-    </td>
-  </tr>
-</table>
+<div id="mainlist">
+
+  <div class="mainlist-header">
+   <p>{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
+   <div class="mainlist-nav">
+    <table>
+     <tr>
+      <td>{$ROOT}</td>
+      <td>{$BACK}</td>
+      <td>{$HOME}</td>
+      <td>{$RELOAD}</td>
+      <td class="left-border">{$ACTIONS}</td>
+      <td class="left-border">{$FILTER}</td>
+     </tr>
+    </table>
+   </div>
+  </div>
+
+  {$LIST}
+</div>
+
+<div class="clear"></div>
 
 <input type="hidden" name="ignore">
+