Code

Some changes for oxchangeaccount
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 18 May 2006 12:02:59 +0000 (12:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 18 May 2006 12:02:59 +0000 (12:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3429 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/connectivity/class_oxchangeAccount.inc
plugins/personal/connectivity/oxchange.tpl

index 40119ac487f4284e5bb51987f3b9a0913145e0dd..6104d2574cda31fa7190842f65b4d056536d2da7 100644 (file)
@@ -601,7 +601,8 @@ class oxchangeAccount extends plugin
        //plugin::execute();
 
 
-    /* Show tab dialog headers */
+       $display="";
+    /* Show tab dialog headers  * /
     $display="";
     if ($this->parent != NULL){
       if ($this->is_account){
@@ -620,7 +621,7 @@ class oxchangeAccount extends plugin
         }
       }
     }
-
+*/
     /* Show main page */
     $smarty= get_smarty();
 
@@ -653,6 +654,20 @@ class oxchangeAccount extends plugin
       $smarty->assign("tabbed", 0);
        }
 
+       /* Trying to open a Postgresql Database Server */
+       if (function_exists("pg_connect")){
+               if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){
+                       $pgcon =  @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
+                       if (! $pgcon){
+                               $smarty->assign("pg", false);
+                       }
+               }else{
+                       $smarty->assign("pg", false);
+               }
+       }else{
+               $smarty->assign("pg", false);
+       }
+
     $display.= $smarty->fetch (get_template_path('oxchange.tpl', TRUE, dirname(__FILE__)));
     return ($display);
   }
@@ -695,8 +710,11 @@ class oxchangeAccount extends plugin
 
     /* Trying to open a Postgresql Database Server */
     if (function_exists("pg_connect")){
-      if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){
-        $pgcon = pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
+      if(isset($this->oxconf["PGUSER"]) and 
+                isset($this->oxconf["PGHOST"]) and 
+            isset($this->oxconf["PGDBNAME"]) and 
+         isset($this->oxconf["PGPASSWD"])){
+        $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
         if (! $pgcon){
           print_red(_("Couldn't connect to postgresql database!"));
           return;
@@ -793,7 +811,7 @@ class oxchangeAccount extends plugin
       /* Trying to open a Postgresql Database Server */
       if (function_exists("pg_connect")){
         if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){
-          $pgcon = pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
+          $pgcon =  @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
           if (! $pgcon){
             print_red(_("Couldn't connect to postgresql database!"));
             return;
index 75a04af19c503cf4da35a27da4f5bace85db07f4..653f0e33c672befd043a8900ed1e05ef32cc776d 100644 (file)
@@ -1,7 +1,15 @@
-{ if !$pg }
-<h2>{t}Open-Xchange Account{/t} - {t}disabled, no Postgresql support detected{/t}</h2>
+{if !$pg}
+<h2>{t}Open-Xchange Account{/t} - {t}disabled, no Postgresql support detected. Or the specified database can't be reached{/t}</h2>
 {else}
-<h2>{if $tabbed eq 1}<input type="checkbox" name="oxchange" value="B" {$oxchangeState} {$oxchangeAccountACL} onCLick="changeState('OXAppointmentDays');changeState('OXTaskDays');changeState('OXTimeZone');" >{/if}{t}Open-Xchange account{/t}</h2>
+
+<input type="checkbox" name="oxchange" value="B" 
+       {$oxchangeState} {$oxchangeAccountACL} 
+       onCLick="       changeState('OXAppointmentDays');
+                               changeState('OXTaskDays');
+                               changeState('OXTimeZone');" >
+<h2>{t}Open-Xchange account{/t}</h2>
+
+
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
 
  <!-- Headline container -->