summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 137f4c7)
raw | patch | inline | side by side (parent: 137f4c7)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 23 Oct 2008 07:24:48 +0000 (07:24 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 23 Oct 2008 07:24:48 +0000 (07:24 +0000) |
-Disable options which are not writeable, hide ppd selections and gray-out save button.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12758 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12758 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc | patch | blob | history | |
gosa-plugins/goto/admin/systems/ppd/printerPPDDialog.tpl | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc b/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc
index b9ffea9037e098a1a4a05431c66be9d6f057f33a..db3d54a25f1cd347b013f1777b92c3067caa5e36 100644 (file)
/* Object Info */
var $cn = "" ; // Used to tag the ppds modified by the printer object,
+ var $ui;
/* If there is already a ppd file for the same type of printer,
* remember the path to ppd file and display a dialog which allows
plugin::plugin ($config, $dn);
$this->depselect = $this->config->current['BASE'];
+ $this->ui = get_userinfo();
+
/* Get PPD path and remove double //, and add trailing / */
$config = session::get('config');
if($config->get_cfg_value("ppdPath") != ""){
$smarty->assign("ppdString", _("Can't get ppd informations."));
$smarty->assign("showOptions", "");
$smarty->assign("path_valid", TRUE);
+ $smarty->assign("acl",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"));
+
+ $acl = $this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD");
- if(empty($this->ppdPath)){
+ if(empty($this->pathToPPD)){
/* Print out template */
$smarty->assign("path_valid", FALSE);
/* If one of our required paths is not available, stop here and display some info */
foreach($paths as $path){
-
+
/* Check if path is write/readable*/
$is_r = @is_readable($path);
if(((!is_dir($path))||(empty($path)) || (!$is_r)) && (!@mkdir($path))){
- msg_dialog::display(_("Configuration error"), sprintf(_("Cannot open PPD path '%s' for reading and writing!"), $path), ERROR_DIALOG);
+ msg_dialog::display(_("Configuration error"),
+ sprintf(_("Cannot open PPD path '%s' for reading and writing!"), $path), ERROR_DIALOG);
/* Print out template */
$display.= $smarty->fetch(get_template_path('printerPPDDialog.tpl', TRUE,dirname(__FILE__)));
// PPD selection / upload / dialog handling
/* Is there a new PPD file uploaded ? */
- if((isset($_FILES['NewPPDFile']))&&(isset($_POST['SubmitNewPPDFile']))){
- $file = ($_FILES['NewPPDFile']);
- if($file['size'] != 0 ){
- if($name = $this->AddPPD($file['tmp_name'])){
- $this->SelectPPD($name);
+ if(preg_match("/w/",$acl)){
+ if((isset($_FILES['NewPPDFile']))&&(isset($_POST['SubmitNewPPDFile']))){
+ $file = ($_FILES['NewPPDFile']);
+ if($file['size'] != 0 ){
+ if($name = $this->AddPPD($file['tmp_name'])){
+ $this->SelectPPD($name);
+ }
+ }else{
+ msg_dialog::display(_("PPD error"), msgPool::incorrectUpload(_("file is empty")), ERROR_DIALOG);
}
- }else{
- msg_dialog::display(_("PPD error"), msgPool::incorrectUpload(_("file is empty")), ERROR_DIALOG);
}
}
}
/* Open a dialog that allow us to select different PPDs */
- if(isset($_POST['SelectPPD'])){
- $this->dialog= new printerPPDSelectionDialog($this->config,$this->dn,$this->ppdList,$this->ppdListHeader,$this->selectedPPD);
+ if(preg_match("/w/",$acl)){
+ if(isset($_POST['SelectPPD'])){
+ $this->dialog= new printerPPDSelectionDialog($this->config,$this->dn,$this->ppdList,$this->ppdListHeader,$this->selectedPPD);
+ }
}
/* The selection dialog fpr PPDs is canceled */
return;
}
- 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(preg_match("/w/",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"))){
+ 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'])];
+ }
}
}
}
}
}
+ $acl ="";
+ if(!preg_match("/w/",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"))){
+ $acl = "disabled";
+ }
+
/* preparing Html output
* Supported types are PickOne/Boolean
*/
/* If type is PickOne, create a select box */
if(($type == "PickOne")||(($type=="Boolean")&&(count($values)>1))){
- $str .= "<select name='".base64_encode($name)."'>\n";
+ $str .= "<select name='".base64_encode($name)."' $acl >\n";
foreach($values as $optionKey => $value){
$selected = "";
if($optionKey == $default){
}elseif($type == "Boolean"){
/* If type is Boolean & no values are given */
- $str .= "<select name='".base64_encode($name)."'>\n";
+ $str .= "<select name='".base64_encode($name)."' $acl>\n";
if($default == "False"){
$str .= "<option value='True' >"._("True")."</option>\n";
$str .= "<option value='False' selected>"._("False")."</option>\n";
diff --git a/gosa-plugins/goto/admin/systems/ppd/printerPPDDialog.tpl b/gosa-plugins/goto/admin/systems/ppd/printerPPDDialog.tpl
index 8cafc3b26323dc540a825f1da90a2d6b2b0c028d..e1845673d05cb2f6f60883b91c4d2238d34712aa 100644 (file)
<tr>
<td width="50%" style="vertical-align:top">
{t}Model{/t}: <i>{$ppdString}</i>
+ {render acl=$acl}
<input type="submit" name="SelectPPD" value="{t}Select{/t}">
+ {/render}
</td>
<td style="border-left: 1px solid rgb(160, 160, 160);padding-left:10px;">
{t}New driver{/t}
+ {render acl=$acl}
<input type="file" value="" name="NewPPDFile">
+ {/render}
+ {render acl=$acl}
<input type="submit" name="SubmitNewPPDFile" value="{t}Upload{/t}">
+ {/render}
</td>
</tr>
</table>
<p class="plugbottom">
<input type="hidden" name="PPDDisSubmitted" value="1">
{if $path_valid}
+ {render acl=$acl}
<input type="submit" name="SavePPD" value="{msgPool type=applyButton}">
+ {/render}
{/if}
<input type="submit" name="ClosePPD" value="{msgPool type=cancelButton}">
</p>