summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b73a59e)
raw | patch | inline | side by side (parent: b73a59e)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Jun 2009 13:32:57 +0000 (13:32 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Jun 2009 13:32:57 +0000 (13:32 +0000) |
- Show a message if a printer has been created on a
different server, to warn the user.
- Do not simply overwrite ppd URI when editting a printer,
that has been created on a different server.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13703 594d385d-05f5-0310-b6e9-bd551577e9d8
different server, to warn the user.
- Do not simply overwrite ppd URI when editting a printer,
that has been created on a different server.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13703 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc | patch | blob | history |
diff --git a/trunk/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/trunk/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
index b907bd98303229ab6c1b91b7f472282ad7dd669c..dabefb6f70f1d10ce2aa26c94a2c28a4d0e560ee 100644 (file)
var $labeledURI = "";
var $gotoPrinterPPD = "";
var $initial_PPD = "";
+ var $initial_PPD_URL = "";
var $orig_dn = "";
var $orig_cn = "";
var $orig_base = "";
}
}
+ $this->initial_PPD_URL = $this->gotoPrinterPPD;
/* Extract selected ppd */
if(isset($this->gotoPrinterPPD)){
$this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD);
if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
$this->dialog = $this->PPDdialogToSave;
}else{
+ $this->initial_PPD_URL = "";
$this->dialog = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
$this->dialog->cn= $this->cn;
}
return $display;
}
+ /* Get servername */
+ $server = $_SERVER['SERVER_NAME'];
+ if(tests::is_ip($server)){
+ $server_name = gethostbyaddr($server);
+ }else{
+ $server_name = gethostbyaddr(gethostbyname($server));
+ }
+ $orig_server_name = "";
+ if ($this->initial_PPD_URL != "") {
+ $ppd_server = preg_replace("/^http.*:../i","",$this->initial_PPD_URL);
+ $ppd_server = preg_replace("/\/.*/i","",$ppd_server);
+ if(tests::is_ip($ppd_server)){
+ $orig_server_name = gethostbyaddr($ppd_server);
+ }else{
+ $orig_server_name = gethostbyaddr(gethostbyname($ppd_server));
+ }
+ }
+
/* Parse selected ppd file */
$config = session::get('config');
if ($config->get_cfg_value("ppdPath") != ""){
$ppdManager= new ppdManager($path);
if(!empty($this->gotoPrinterPPD)){
- if((!file_exists($path.$this->gotoPrinterPPD))){
- $smarty->assign("driverInfo", "<b>".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$path.$this->gotoPrinterPPD)."</b>");
+ if($orig_server_name != "" && $server_name != $orig_server_name) {
+ $smarty->assign("driverInfo", "<b>".sprintf(_("Printer got configured on remote server '%s', Editing Driver will overwrite settings."),$orig_server_name)."</b>");
}else{
- $ppdDesc = $ppdManager->loadDescription($path.$this->gotoPrinterPPD);
- $smarty->assign("driverInfo", $ppdDesc['name']);
+ if((!file_exists($path.$this->gotoPrinterPPD))){
+ $smarty->assign("driverInfo", "<b>".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$path.$this->gotoPrinterPPD)."</b>");
+ }else{
+ $ppdDesc = $ppdManager->loadDescription($path.$this->gotoPrinterPPD);
+ $smarty->assign("driverInfo", $ppdDesc['name']);
+ }
}
}else{
$smarty->assign("driverInfo", _("Not defined"));
/* If no ppd is selected, remove this attribute */
if(!empty($this->gotoPrinterPPD)) {
- $this->gotoPrinterPPD = $method.str_replace("//","/",$server_name."/ppd/".$this->gotoPrinterPPD);
+ if (($this->gotoPrinterPPD != $this->initial_PPD) || ($this->initial_PPD_URL == "")) {
+ /* PPD has changed, update it */
+ if (!preg_match('/^http[s]+:\/\/.*/', $this->gotoPrinterPPD)) {
+ /* ppd is not an url */
+ $this->gotoPrinterPPD = $method.str_replace("//","/",$server_name."/ppd/".$this->gotoPrinterPPD);
+ }
+ } else {
+ /* Restore original PPD URL */
+ $this->gotoPrinterPPD = $this->initial_PPD_URL;
+ }
}else{
$this->gotoPrinterPPD = array();
}