[icinga-checkins] icinga.org: icinga-web/master: Added icons, added IN operator

git at icinga.org git at icinga.org
Thu Aug 30 15:43:04 CEST 2012


Module: icinga-web
Branch: master
Commit: ac84268b4f28d01ad314e377a9ab1c4422af9cef
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=ac84268b4f28d01ad314e377a9ab1c4422af9cef

Author: Jannis Moßhammer <jannis.mosshammer at netways.de>
Date:   Thu Aug 30 00:54:39 2012 +0200

Added icons, added IN operator

---

 .../Api/models/Views/ApiDQLViewModel.class.php     |    7 ++++---
 .../lib/database/AppKitSQLConstants.class.php      |    8 +++++++-
 .../DQLCronkTemplateWorker.class.php               |    6 ++++--
 pub/styles/icinga-icons.css                        |    2 ++
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/app/modules/Api/models/Views/ApiDQLViewModel.class.php b/app/modules/Api/models/Views/ApiDQLViewModel.class.php
index ceb3031..89c1bdc 100644
--- a/app/modules/Api/models/Views/ApiDQLViewModel.class.php
+++ b/app/modules/Api/models/Views/ApiDQLViewModel.class.php
@@ -127,13 +127,14 @@ class API_Views_ApiDQLViewModel extends IcingaBaseModel {
     }
 
     public function addWhere($field,$operator,$value) {
-         $value = $this->connection->quote($value);
+         if($operator != "IN")
+             $value = $this->connection->quote($value);
 
          $field = $this->enableFilter($field);
          $field = $this->getAliasedTableFromDQL($field);
-         $this->currentQuery->addWhere("$field $operator $value");
+         $this->currentQuery->andWhere("$field $operator $value");
 
-         AppKitLogger::verbose("Query after addWhere extension %s ", $this->currentQuery->getSqlQuery());
+         AppKitLogger::verbose("Query after addWhere (%s %s %s) %s ",$field, $operator, $value, $this->currentQuery->getSqlQuery());
          
     }
 
diff --git a/app/modules/AppKit/lib/database/AppKitSQLConstants.class.php b/app/modules/AppKit/lib/database/AppKitSQLConstants.class.php
index 271f28f..a28c2ec 100644
--- a/app/modules/AppKit/lib/database/AppKitSQLConstants.class.php
+++ b/app/modules/AppKit/lib/database/AppKitSQLConstants.class.php
@@ -36,6 +36,9 @@ class AppKitSQLConstants {
     const SQL_OP_LESSOREQUAL    = 80;
     const SQL_OP_GREATEROREQUAL = 81;
 
+    const SQL_OP_IN             = 90;
+    const SQL_OP_NOT_IN         = 91;
+    
     private static $SQL_OPERATORS = array(
                                         self::SQL_OP_CONTAIN        => 'LIKE',
                                         self::SQL_OP_NOTCONTAIN     => 'NOT LIKE',
@@ -47,7 +50,10 @@ class AppKitSQLConstants {
                                         self::SQL_OP_LESSOREQUAL    => '<=',
 
                                         self::SQL_OP_GREATERTHAN    => '>',
-                                        self::SQL_OP_GREATEROREQUAL => '>='
+                                        self::SQL_OP_GREATEROREQUAL => '>=',
+
+                                        self::SQL_OP_IN   => 'IN',
+                                        self::SQL_OP_NOT_IN => 'NOT IN'
                                     );
 
     private static $ICINGA_OPERATORS = array(
diff --git a/app/modules/AppKit/lib/database/models/.gitignore b/app/modules/AppKit/lib/database/models/.gitignore
old mode 100755
new mode 100644
diff --git a/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php b/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php
index e74bd09..b3888ec 100644
--- a/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php
+++ b/app/modules/Cronks/lib/template/TemplateWorker/DQLCronkTemplateWorker.class.php
@@ -212,8 +212,10 @@ class DQLCronkTemplateWorker extends CronkGridTemplateWorker {
         } else {
             $field = $this->aliasToColumn($field);
         }
-        
-        $val = str_replace("'","'",$val);
+        if($op == AppKitSQLConstants::SQL_OP_IN || $op == AppKitSQLConstants::SQL_OP_NOT_IN) {
+            $val = "(".$val.")";
+        } else 
+            $val = str_replace("'","'",$val);
         $this->parser->addWhere($field, $operator,$val);
         
     }
diff --git a/pub/styles/icinga-icons.css b/pub/styles/icinga-icons.css
index 33138af..71e3339 100644
--- a/pub/styles/icinga-icons.css
+++ b/pub/styles/icinga-icons.css
@@ -195,5 +195,7 @@
 .icinga-icon-image-arrow { background-image: url(../images/icons/image--arrow.png) !important; background-repeat: no-repeat; }
 
 .icinga-icon-throbber {background-image: url(../images/ajax/circle-ball.gif) !important;background-repeat: no-repeat;}
+.icinga-icon-chart { background-image: url(../images/icons/chart.png) !important; background-repeat: no-repeat; }
+.icinga-icon-chart-arrow { background-image: url(../images/icons/chart--arrow.png) !important; background-repeat: no-repeat; }
 
 /* EOF */





More information about the icinga-checkins mailing list