From: hickert Date: Thu, 22 Dec 2005 13:16:08 +0000 (+0000) Subject: Glpi template, etc X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9dcda561b23bb194b7d5c2356c46e824971d64f4;p=gosa.git Glpi template, etc git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2382 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_config.inc b/include/class_config.inc index fdfeb3d7b..84f9b1764 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -367,7 +367,7 @@ class config { 'SERVER' => $attrs['cn'][0], 'LOGIN' => $attrs['goGlpiAdmin'][0], 'PASSWORD' => $attrs['goGlpiPassword'][0], - 'DB' => $attrs['goGpliDatabase'][0]); + 'DB' => $attrs['goGlpiDatabase'][0]); } /* Get logdb server */ $ldap->cd ($this->current['BASE']); diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc index 0d532c871..5632cb462 100644 --- a/plugins/admin/systems/class_glpiAccount.inc +++ b/plugins/admin/systems/class_glpiAccount.inc @@ -12,25 +12,88 @@ class glpiAccount extends plugin var $attributes= array(); var $objectclasses= array("whatever"); + var $initialy_was_account = false; + + var $data; + var $handle = NULL; + /* Contructor Sets default values and checks if we already hae an existing glpi account */ function glpiAccount ($config, $dn= NULL) { plugin::plugin ($config, $dn); - print $this->is_account; - print $this->initialy_was_account; + + if(!isset($this->config->data['SERVERS']['GLPI'])){ + return; + } + + $this->data = $this->config->data['SERVERS']['GLPI']; + + if(!is_callable("mysql_connect")){ + return; + } + + $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']); + + if(!$this->handle->is_connected){ + return; + } + + if($this->handle->is_account($this->dn)){ + $this->is_account = true; + }else{ + $this->is_account = false; + } + + $this->initialy_was_account = $this->is_account; } function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); /* Fill templating stuff */ $smarty= get_smarty(); $display= ""; + /* Assign smarty defaults */ + foreach(array("SystemTypes","Manufacturers","OSs","TechnicalResponsibles","InstalledDevices","Attachments") as $attr){ + $smarty->assign($attr,array()); + $smarty->assign($attr."ACL"," disabled "); + } + + foreach(array("SystemType","Manufacturer","OS","TechnicalResponsible") as $attr){ + $smarty->assign($attr,""); + $smarty->assign($attr."ACL"," disabled "); + } + + /* Perform some checks + * arround the database + */ + if(!isset($this->config->data['SERVERS']['GLPI'])){ + print_red(_("There is no valid configuration for glpi database available.")); + return($smarty->fetch(get_template_path('glpi.tpl', TRUE))); + } + $this->data = $this->config->data['SERVERS']['GLPI']; + + if(!is_callable("mysql_connect")){ + print_red(_("The php mysql extension is missing. Can't perform any queries.")); + return($smarty->fetch(get_template_path('glpi.tpl', TRUE))); + } + + $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']); + + if(!$this->handle->is_connected){ + print_red(_("Can't copnnect to specified database.")); + return($smarty->fetch(get_template_path('glpi.tpl', TRUE))); + } + + /* If we reach this this + * the database connection seams to ok + */ + /* Do we need to flip is_account state? */ if (isset($_POST['modify_state'])){ $this->is_account= !$this->is_account; @@ -46,6 +109,26 @@ class glpiAccount extends plugin return ($display); } + + foreach(array("SystemType","Manufacturer","OS","TechnicalResponsible","InstalledDevices","Attachments") as $attr){ + $smarty->assign($attr,""); + $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); + } + + + $smarty->assign("SystemTypes",$this->handle->getSystemTypes()); + $smarty->assign("SystemType","os"); + + $smarty->assign("OSs",$this->handle->getOSTypes()); + $smarty->assign("OS","is"); + + $smarty->assign("Manufacturers",$this->handle->getEnterprisesTypes()); + $smarty->assign("Manufacturer","still"); + + $smarty->assign("TechnicalResponsibles",array("os","is","still","missing")); + $smarty->assign("TechnicalResponsible","missing"); + + $display.= $smarty->fetch(get_template_path('glpi.tpl', TRUE)); return($display); } diff --git a/plugins/admin/systems/glpi.tpl b/plugins/admin/systems/glpi.tpl index b16551d03..120ca6e65 100644 --- a/plugins/admin/systems/glpi.tpl +++ b/plugins/admin/systems/glpi.tpl @@ -1 +1,98 @@ -dasfasd + + + + + +
+ + +

{t}Generic{/t}

+ + + + + + + + + + + + + + + + + +
{t}System type{/t} + + +
{t}Operating system{/t} + + +
{t}Manufacturer{/t} + + +
{t}Technicalresposible{/t} + + +
+

 

+

{t}Installed devices{/t}

+ + + + +
+ + +
+

 

+ + + +
+ +

{t}Contacts{/t}

+ + + + + + + + + +
+ {t}Contact person{/t} + + contact person sdasd {t}mailto{/t} +
+ {t}Comments{/t} + + +
+

 

+

{t}Attachments{/t}

+ + + + +
+ + +
+ +