From: cajus Date: Sat, 8 Mar 2008 10:48:06 +0000 (+0000) Subject: Added messages for settings buttons/text. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6c1811b712207bfae16ed19faecc341b92bd9005;p=gosa.git Added messages for settings buttons/text. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9454 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index f27171e8d..81f387e13 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2652,6 +2652,23 @@ function add_objectClass($classes, &$attrs) } +function show_ldap_error($message, $addon= "") +{ + if (!preg_match("/Success/i", $message)){ + if ($addon == ""){ + msg_dialog::display(_("LDAP error:"), $message, ERROR_DIALOG); + } else { + if(!preg_match("/No such object/i",$message)){ + msg_dialog::display(_("LDAP error"), sprintf(_("Plugin '%s':%s"),"".$addon."", "

$message"),ERROR_DIALOG); + } + } + return TRUE; + } else { + return FALSE; + } +} + + /* Removes a given objectClass from the attrs entry */ function remove_objectClass($classes, &$attrs) { diff --git a/gosa-core/include/utils/class_msgPool.inc b/gosa-core/include/utils/class_msgPool.inc index ea90b3984..39cbe7a8c 100644 --- a/gosa-core/include/utils/class_msgPool.inc +++ b/gosa-core/include/utils/class_msgPool.inc @@ -293,5 +293,59 @@ class msgPool } } + public static function noValidExtension($name) + { + return sprintf(_("This account has no valid %s extensions!", $name)); + } + + public static function featuresEnabled($name, $depends= "") + { + if ($depends == ""){ + return sprintf(_("This account has %s settings enabled. You can disable them by clicking below."), $name); + } else { + if (is_array($depends)){ + return sprintf(_("This account has %s settings enabled. To disable them, you'll need to remove the %s settings first!"), $depends); + } else { + $deps= ""; + foreach ($depends as $dep){ + $deps.= "$dep / "; + } + $deps= preg_replace("/ \/ $/", "", $deps); + return sprintf(_("This account has %s settings enabled. To disable them, you'll need to remove the %s settings first!"), $deps); + } + } + } + + + public static function featuresDisabled($name, $depends= "") + { + if ($depends == ""){ + return sprintf(_("This account has %s settings disabled. You can enable them by clicking below."), $name); + } else { + if (is_array($depends)){ + return sprintf(_("This account has %s settings disabled. To enable them, you'll need to add the %s settings first!"), $depends); + } else { + $deps= ""; + foreach ($depends as $dep){ + $deps.= "$dep / "; + } + $deps= preg_replace("/ \/ $/", "", $deps); + return sprintf(_("This account has %s features settings. To disable them, you'll need to add the %s settings first!"), $deps); + } + } + } + + + public static function addFeaturesButton($name) + { + return sprintf(_("Add %s settings"), $name); + } + + + public static function removeFeaturesButton($name) + { + return sprintf(_("Remove %s settings"), $name); + } + } diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index afdb5dfaa..c7dd82b70 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -307,7 +307,7 @@ class user extends plugin /* Do we represent a valid gosaAccount? */ if (!$this->is_account){ $str = "\"\" ". - _("This account has no valid GOsa extensions.").""; + msgPool::noValidExtension("GOsa").""; return($str); } diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc index 26ba41e8b..ef07f0db1 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -272,7 +272,7 @@ class posixAccount extends plugin /* Do we represent a valid posixAccount? */ if (!$this->is_account && $this->parent === NULL ){ $display= "\"\" ". - _("This account has no unix extensions.").""; + msgPool::noValidExtension(_("POSIX")).""; $display.= back_to_main(); return ($display); } @@ -292,15 +292,12 @@ class posixAccount extends plugin in the moment, because I need to rely on unique uidNumbers. There'll be a better solution later on. */ - $display= $this->show_disable_header(_("Remove posix account"), - _("This account has unix features enabled. To disable them, you'll need to remove the samba / environment account first."), TRUE); + $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("POSIX")), msgPool::featuresEnabled(_("POSIX"), array(_("Samba"), _("Environment"))), TRUE); } else { - $display= $this->show_disable_header(_("Remove posix account"), - _("This account has posix features enabled. You can disable them by clicking below.")); + $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("POSIX")), msgPool::featuresEnabled(_("POSIX"))); } } else { - $display= $this->show_enable_header(_("Create posix account"), - _("This account has posix features disabled. You can enable them by clicking below.")); + $display= $this->show_enable_header(msgPool::addFeaturesButton(_("POSIX")), msgPool::featuresDisabled(_("POSIX"))); return($display); } } diff --git a/gosa-core/plugins/personal/posix/main.inc b/gosa-core/plugins/personal/posix/main.inc index 4aedfd346..abe69ad36 100644 --- a/gosa-core/plugins/personal/posix/main.inc +++ b/gosa-core/plugins/personal/posix/main.inc @@ -128,7 +128,7 @@ if (!$remove_lock){ /* Page header*/ $display= print_header(get_template_path('images/posix.png'), - _("Unix settings"), $info).$display; + _("POSIX settings"), $info).$display; }