diff --git a/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/plugins/admin/systems/class_selectUserToPrinterDialog.inc
index 945d6f6b084c2153bba25746942fe592da37eb55..3469979c2761a6df6805de93636ca4543593f552 100644 (file)
class selectUserToPrinterDialog extends plugin
{
class selectUserToPrinterDialog extends plugin
{
- /* CLI vars */
- var $cli_summary = "Manage server basic objects";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
/* attribute list for save action */
var $ignore_account = TRUE;
var $attributes = array();
var $objectclasses = array("whatever");
var $regex = "*";
/* attribute list for save action */
var $ignore_account = TRUE;
var $attributes = array();
var $objectclasses = array("whatever");
var $regex = "*";
+ var $subtree = FALSE;
var $depselect = "/";
var $deplist = "/";
var $searchObjects = "";
var $searchAttrs = "";
var $searchAppend = "";
var $depselect = "/";
var $deplist = "/";
var $searchObjects = "";
var $searchAttrs = "";
var $searchAppend = "";
+ var $baseAddition = "";
var $type = "";
function selectUserToPrinterDialog ($config, $dn= NULL,$type=false )
var $type = "";
function selectUserToPrinterDialog ($config, $dn= NULL,$type=false )
switch($type){
case "AddUser" :
switch($type){
case "AddUser" :
- $this->searchObjects = "(objectClass=person)(objectClass=inetOrgPerson)";
+ $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))";
$this->searchAttrs = array("cn","uid");
$this->searchAppend = "uid";
$this->searchAttrs = array("cn","uid");
$this->searchAppend = "uid";
+ $this->baseAddition = get_people_ou();
;break;
case "AddGroup" :
$this->searchObjects = "(objectClass=posixGroup)";
$this->searchAttrs = array("cn","description");
$this->searchAppend = "cn";
;break;
case "AddGroup" :
$this->searchObjects = "(objectClass=posixGroup)";
$this->searchAttrs = array("cn","description");
$this->searchAppend = "cn";
+ $this->baseAddition = get_groups_ou();
;break;
case "AddAdminUser" :
;break;
case "AddAdminUser" :
- $this->searchObjects = "(objectClass=person)(objectClass=inetOrgPerson)";
+ $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))";
$this->searchAttrs = array("cn","uid");
$this->searchAppend = "uid";
$this->searchAttrs = array("cn","uid");
$this->searchAppend = "uid";
+ $this->baseAddition = get_people_ou();
;break;
case "AddAdminGroup" :
$this->searchObjects = "(objectClass=posixGroup)";
$this->searchAttrs = array("cn","description");
$this->searchAppend = "cn";
;break;
case "AddAdminGroup" :
$this->searchObjects = "(objectClass=posixGroup)";
$this->searchAttrs = array("cn","description");
$this->searchAppend = "cn";
+ $this->baseAddition = get_groups_ou();
;break;
}
$this->type = $type;
;break;
}
$this->type = $type;
function execute()
{
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Fill templating stuff */
$smarty= get_smarty();
$display= "";
/* Fill templating stuff */
$smarty= get_smarty();
$display= "";
$this->regex=$_POST['regexPrinter'];
$this->depselect = $_POST['depselectPrinter'];
}
$this->regex=$_POST['regexPrinter'];
$this->depselect = $_POST['depselectPrinter'];
}
+ $this->subtree= isset($_POST['SubSearch']);
if((isset($_GET['search']))&&(!empty($_GET['search']))){
$this->regex=$_GET['search']."*";
$this->regex=preg_replace("/\*\*/","*",$this->regex);
}
if((isset($_GET['search']))&&(!empty($_GET['search']))){
$this->regex=$_GET['search']."*";
$this->regex=preg_replace("/\*\*/","*",$this->regex);
}
- $this->deplist=array_flip($this->config->departments);
-
+ $tmp_printers= $this->getPrinter();
+ natcasesort($tmp_printers);
$smarty->assign("regexPrinter" , $this->regex);
$smarty->assign("regexPrinter" , $this->regex);
- $smarty->assign("deplistPrinter" , $this->deplist);
+ $smarty->assign("deplistPrinter" , $this->config->idepartments);//deplist);
$smarty->assign("depselectPrinter" , $this->depselect);
$smarty->assign("depselectPrinter" , $this->depselect);
- $smarty->assign("gotoPrinters" , $this->getPrinter());
- $smarty->assign("gotoPrinterKeys" , array_flip($this->getPrinter()));
+ $smarty->assign("gotoPrinters" , $tmp_printers);
+ $smarty->assign("gotoPrinterKeys" , array_flip($tmp_printers));
$smarty->assign("apply" , apply_filter());
$smarty->assign("alphabet" , generate_alphabet());
$smarty->assign("search_image" , get_template_path('images/search.png'));
$smarty->assign("tree_image" , get_template_path('images/tree.png'));
$smarty->assign("infoimage" , get_template_path('images/info.png'));
$smarty->assign("apply" , apply_filter());
$smarty->assign("alphabet" , generate_alphabet());
$smarty->assign("search_image" , get_template_path('images/search.png'));
$smarty->assign("tree_image" , get_template_path('images/tree.png'));
$smarty->assign("infoimage" , get_template_path('images/info.png'));
- $smarty->assign("launchimage" , get_template_path('images/launch.png'));
+ $smarty->assign("launchimage" , get_template_path('images/small_filter.png'));
$smarty->assign("deplist" , $this->config->idepartments);
$smarty->assign("deplist" , $this->config->idepartments);
+ $smarty->assign("subtree", $this->subtree?"checked":"");
$display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__)));
return($display);
}
function check(){
$display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__)));
return($display);
}
function check(){
- $message=array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
if(empty($_POST['gotoPrinter'])){
$message[] = _("Please select a printer or press cancel.");
}
if(empty($_POST['gotoPrinter'])){
$message[] = _("Please select a printer or press cancel.");
}
$a_return=array();
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->depselect);
$a_return=array();
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->depselect);
- $ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))",$this->searchAttrs);
+ if ($this->subtree){
+ $ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))", $this->searchAttrs);
+ } else {
+ $ldap->ls("(&".$this->searchObjects."(cn=".$this->regex."))", $this->baseAddition.$this->depselect, $this->searchAttrs);
+ }
while($printer = $ldap->fetch()){
if(($detailed ==true)){
if(isset($printer[$this->searchAppend])){
while($printer = $ldap->fetch()){
if(($detailed ==true)){
if(isset($printer[$this->searchAppend])){
}
}
}
}
-
-
-
-
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>