summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 04f1439)
raw | patch | inline | side by side (parent: 04f1439)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 26 Oct 2005 07:16:44 +0000 (07:16 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 26 Oct 2005 07:16:44 +0000 (07:16 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1690 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc
index 1b4c5a39633a788f0332102f7eb8e8cfa0cacb11..d036a0128ce6c644369155dd813828d23b4c36cf 100644 (file)
* Perform a Check. If everything is fine, use the new PPD.
*/
if(isset($_POST['SavePPDSelection'])){
- if(count($this->dialog->check())>0){
- foreach($this->dialog->check() as $msg){
- print_red($msg);
- }
+ if(!isset($_POST['PPDselection'])){
+ print_red(_("Please select a valid PPD."));
}else{
- $this->selectedPPD = $this->dialog->save();
- $this->ppdConfig = false;
+ $this->selectedPPD['link'] = $_POST['PPDselection'];
+ $this->ppdConfig = false;
unset($this->dialog);
$this->dialog=NULL;
}
}
-
+
/* if a dialog is open, print the dialog instead of this class
*/
if($this->dialog!=NULL){
function save_object()
{
if(isset($_POST['PPDDisSubmitted'])){
- foreach($this->ppdConfig as $cat => $obj){
- foreach($obj as $attr => $attributes){
- if(isset($_POST[base64_encode($attributes['_name'])])){
- $this->ppdConfig[$cat][$attr]['_default'] = $_POST[base64_encode($attributes['_name'])];
+ if(is_array($this->ppdConfig)){
+ foreach($this->ppdConfig as $cat => $obj){
+ foreach($obj as $attr => $attributes){
+ if(isset($_POST[base64_encode($attributes['_name'])])){
+ $this->ppdConfig[$cat][$attr]['_default'] = $_POST[base64_encode($attributes['_name'])];
+ }
}
}
}
diff --git a/plugins/admin/systems/class_printerPPDSelectionDialog.inc b/plugins/admin/systems/class_printerPPDSelectionDialog.inc
index 78935b9d1b9f0a344b55333f3e08b8ccb46d0393..39f38da545491afbec35434b55cb3e1abc6b0f82 100644 (file)
}
}
+ if(!isset($_SESSION['printerPPDSelectionDialog'])){
+ $_SESSION['printerPPDSelectionDialog']['regex'] = "*";
+ }
+
/* Order the manufacturers index */
ksort($this->header);
}
$display= "";
$s_action = "none";
- /* Links used to open/select an entry */
- $LINK_openDir = "<a href='?plug=".$_GET['plug']."&open=%s'>%s</a>";
- $LINK_useThis = "<a href='?plug=".$_GET['plug']."&use=%s'>%s</a>";
+ $regex = $_SESSION['printerPPDSelectionDialog']['regex'];
- /* Open manufacturer */
- if(isset($_GET['open'])){
- $this->currentPos=base64_decode($_GET['open']);
+ if(isset($_GET['search'])){
+ $regex = $_GET['search']."*";
}
-
- /* Select ppd */
- if(isset($_GET['use'])){
- $this->currentSel=base64_decode($_GET['use']);
+
+ if(isset($_POST['regex'])){
+ $regex= $_POST['regex'];
}
+
+ $regex = str_replace("**","*",$regex);
+ $_SESSION['printerPPDSelectionDialog']['regex'] = $regex;
+
/* if manufacturer is selected and a ppd file
* Set this selected file to our return value.
$this->selectedPPD = $this->list[$this->currentPos][$this->currentSel];
}
- /* "Back" resets our selection
- */
- foreach($_POST as $post => $val){
- if(preg_match("/dep_back/",$post)){
- $s_action = "back";
- $this->currentPos = "";
- $this->currentSel = -1;
- }
- }
-
- /* The listhead is shown on top of the list.
- * It represents a menu that contains basic option for this dialog/list
- */
- $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
- " <input type='image' align='middle' src='images/list_back.png' title='"._("Reset list")."' alt='"._("Up")."' name='dep_back'> ".
- " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- " <input type='image' align='middle' src='images/list_new_user.png' title='"._("Upload PPD")."' alt='"._("Upload PPD")."' name='upload'> ".
- "</div>";
-
- /* Create new list*/
- $div = new divlist("PPD");
- $div -> SetSummary(_("List with all available ppd files."));
- $div -> SetEntriesPerPage(18);
-
- /* If nothing is selected open manufacturers list */
- if($this->currentPos==""){
- $div -> SetHeader (array(
- array("string"=>_("Name")),
- array("string"=>_("Entries"),"attach"=>"style='border-right:none;width:100px;'")));
- $options = "";
-
- /* Append elements */
- foreach($this->header as $header => $nums){
- $field1 = array("string" => sprintf($LINK_openDir,base64_encode($header),$header),"attach"=>"style='border-right:none;height:26px;'");
- $field2 = array("string" => $nums,"attach"=>"style='border-right:none;height:26px;'");
- $div->AddEntry(array($field1,$field2));
- }
-
- /* Display all ppds for the given manufacturer */
- }else{
- $div -> SetHeader (array(
- array("string"=>_("Name")." - ".$this->currentPos ,"attach"=>"style='border-right:none;'")));
-
- /* Append elements */
- foreach($this->list[$this->currentPos] as $pos => $ppd){
- if($pos == $this->currentSel){
- $field1 = array("string" => sprintf($LINK_useThis,base64_encode($pos),$ppd['name'])." - "._("selected"),"attach"=>"style='border-right:none;background:#99CCBB;height:25px;'");
- }else{
- $field1 = array("string" => sprintf($LINK_useThis,base64_encode($pos),$ppd['name']),"attach"=>"style='border-right:none;height:25px;'");
+ /** Added **/
+ $list = array();
+ foreach($this->list as $cat => $ppds){
+ foreach($ppds as $ppd){
+ if(preg_match("/^".str_replace("*",".*",$regex)."/i",$ppd['ppd'])){
+ $list[$ppd['link']] = $ppd['ppd'];
}
- $div->AddEntry(array($field1));
}
}
-
- /* print out template */
- $smarty->assign("listhead",$listhead);
- $smarty->assign("list",$div->DrawList());
+
+ $smarty->assign("objects", $list);
+ $smarty->assign("objectKeys", array_flip($list));
+ $smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+ $smarty->assign("tree_image", get_template_path('images/tree.png'));
+ $smarty->assign("alphabet", generate_alphabet());
+ $smarty->assign("apply", apply_filter());
+ $smarty->assign("regex", $regex);
+
$display.= $smarty->fetch(get_template_path('printerPPDSelectionDialog.tpl', TRUE,dirname(__FILE__)));
return($display);
}
+ function save_object()
+ {
+ }
+
function check(){
- $message=array();
- if(empty($this->selectedPPD)){
- $message[] = _("Please select a PPD or press cancel");
- }
- return $message;
}
/* Save to LDAP */
diff --git a/plugins/admin/systems/printerPPDSelectionDialog.tpl b/plugins/admin/systems/printerPPDSelectionDialog.tpl
index 6a4f3934a90eedd932c748b7318eb86f82629571..7dfcc61d9ead0578e6fbff1e3744ed716c4b69a2 100644 (file)
-<table summary="" style="width:50%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
- <td style="vertical-align:top;width:50%;">
- <div class="contentboxh">
- <p class="contentboxh">
- <LABEL for="userlist">{t}List of PPDs{/t}</LABEL>
- </p>
- </div>
- <div class="contentboxb">
- {$listhead}
- </div>
- <div class="contentboxb">
- {$list}
-</div>
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+ <tr>
+ <td style="vertical-align:top;">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px">
+ <b>{t}Select objects to add{/t}</b>
+ </p>
+ </div>
+ <div class="contentboxb">
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <select style="width:500px; height:450px; margin-top:4px;" name="PPDselection" size="15">
+ {html_options values=$objectKeys options=$objects}
+ </select>
+ <input type=hidden name="edit_helper">
+ </p>
+ </div>
</td>
- </tr>
+ <td style="vertical-align:top;">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px">
+ <img src="{$launchimage}" align="right" alt="[F]">
+ <b>{t}Filters{/t}</b>
+ </p>
+ </div>
+ <div class="contentboxb">
+ <table summary="" style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+ {$alphabet}
+ </table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <tr>
+ <td width="50%">
+ <img alt="" src="{$tree_image}" align=middle>
+ {t}Display objects of department{/t}
+ </td>
+ </tr>
+ </table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <tr>
+ <td width="50%">
+ <img alt="" src="{$search_image}" align=middle>
+ {t}Display objects matching{/t}
+ </td>
+ <td>
+ <input type='text' name='regex' maxlength='20' value='{$regex}'
+ title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit();">
+ </td>
+ </tr>
+ </table>
+ {$apply}
+ </div>
+ </td>
+ </tr>
</table>
-<input type="submit" name="SavePPDSelection" value="{t}Save{/t}">
-<input type="submit" name="ClosePPDSelection" value="{t}Close{/t}">
+
+<p class="plugbottom">
+<input type="submit" name="SavePPDSelection" value="{t}use{/t}">
+
+<input type="submit" name="ClosePPDSelection" value="{t}close{/t}">
+</p>
+<!--
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->