summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c190ab7)
raw | patch | inline | side by side (parent: c190ab7)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 Apr 2010 15:00:04 +0000 (15:00 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 Apr 2010 15:00:04 +0000 (15:00 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17564 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/ppd/class_printerPPDSelectionDialog.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/systems/ppd/class_printerPPDSelectionDialog.inc b/gosa-plugins/goto/admin/systems/ppd/class_printerPPDSelectionDialog.inc
index fc4c50e151bbd4fcf0b7b1b366df84f346098cbd..f0b5821172a770fcace01b791fa12d1d81ea47b9 100644 (file)
class printerPPDSelectionDialog extends plugin
{
- /* attribute list for save action */
- var $ignore_account = FALSE;
- var $attributes = array();
- var $objectclasses = array("whatever");
-
- var $list =array();
- var $header =array();
- var $current_del_id = "";
- var $Vendor = "";
- var $selectedPPD = "";
-
- function printerPPDSelectionDialog (&$config, $dn= NULL,$list=false,$headers=false,$ppd=false)
- {
- plugin::plugin ($config, $dn);
- $this->list = $list;
- $this->header = $headers;
- $this->depselect = $this->config->current['BASE'];
-
- // Prepare lists
- $this->ppdList = new sortableListing();
- $this->ppdList->setDeleteable(false);
- $this->ppdList->setEditable(true);
- $this->ppdList->setWidth("100%");
- $this->ppdList->setColspecs(array('*','20px'));
- $this->ppdList->setHeight("200px");
- $this->ppdList->setHeader(array(_("PPD")));
- $this->ppdList->setDefaultSortColumn(0);
- }
+ /* attribute list for save action */
+ var $ignore_account = FALSE;
+ var $attributes = array();
+ var $objectclasses = array("whatever");
+
+ var $list =array();
+ var $header =array();
+ var $current_del_id = "";
+ var $Vendor = "";
+ var $selectedPPD = "";
+
+ function printerPPDSelectionDialog (&$config, $dn= NULL,$list=false,$headers=false,$ppd=false)
+ {
+ plugin::plugin ($config, $dn);
+ $this->list = $list;
+ $this->header = $headers;
+ $this->depselect = $this->config->current['BASE'];
+
+ // Prepare lists
+ $this->ppdList = new sortableListing();
+ $this->ppdList->setDeleteable(false);
+ $this->ppdList->setEditable(true);
+ $this->ppdList->setWidth("100%");
+ $this->ppdList->setColspecs(array('*','20px'));
+ $this->ppdList->setHeight("200px");
+ $this->ppdList->setHeader(array(_("PPD")));
+ $this->ppdList->setDefaultSortColumn(0);
+ }
function isSelected(){
return(!empty($this->selectedPPD));
}
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- /* Fill templating stuff */
- $smarty= get_smarty();
- $display= "";
-
- /* Delete requested, check if everything is ok and display confirmation dialog */
- if(isset($_GET['act']) && $_GET['act'] == "del"){
-
- /* Get id and check if id is valid */
- $id_to_del = base64_decode($_GET['id']);
- $found = "";
- foreach($this->list[$this->Vendor] as $key => $data){
- if($data['link'] == $id_to_del){
- $found = $key;
- break;
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+ $display= "";
+
+ /* Delete requested, check if everything is ok and display confirmation dialog */
+ if(isset($_GET['act']) && $_GET['act'] == "del"){
+
+ /* Get id and check if id is valid */
+ $id_to_del = base64_decode($_GET['id']);
+ $found = "";
+ foreach($this->list[$this->Vendor] as $key => $data){
+ if($data['link'] == $id_to_del){
+ $found = $key;
+ break;
+ }
+ }
+ if(!empty($found)){
+ $this->current_del_id = $id_to_del;
+
+ $smarty->assign("warning", sprintf(msgPool::deleteInfo($found)));
+ return($smarty->fetch(get_template_path('remove_ppd.tpl', TRUE)));
+
+ }else{
+ msg_dialog::display(_("PPD error"), msgPool::fileDoesNotExist($id_to_del), ERROR_DIALOG);
+ }
}
- }
- if(!empty($found)){
- $this->current_del_id = $id_to_del;
- $smarty->assign("warning", sprintf(msgPool::deleteInfo($found)));
- return($smarty->fetch(get_template_path('remove_ppd.tpl', TRUE)));
+ /* Deletion confirmed */
+ if(isset($_POST['delete_ppd_confirm']) && !empty($this->current_del_id)){
+
+ /* check if file is removeable */
+ $is_ok = false;
+ if(is_writeable($this->current_del_id)){
+ $is_ok = @unlink($this->current_del_id);
+
+ /* Update ppd list */
+ if($is_ok){
+ foreach($this->list as $vendor => $ppds){
+ foreach($ppds as $ppd => $data){
+ if($data['link'] == $this->current_del_id){
+ unset($this->list[$vendor][$ppd]);
+ }
+ }
+ }
+ }
+ }
+
+ if(!$is_ok){
+ msg_dialog::display(_("PPD error"), msgPool::cannotDeleteFile($this->current_del_id), ERROR_DIALOG);
+ }
+ }
- }else{
- msg_dialog::display(_("PPD error"), msgPool::fileDoesNotExist($id_to_del), ERROR_DIALOG);
- }
- }
- /* Deletion confirmed */
- if(isset($_POST['delete_ppd_confirm']) && !empty($this->current_del_id)){
-
- /* check if file is removeable */
- $is_ok = false;
- if(is_writeable($this->current_del_id)){
- $is_ok = @unlink($this->current_del_id);
-
- /* Update ppd list */
- if($is_ok){
- foreach($this->list as $vendor => $ppds){
- foreach($ppds as $ppd => $data){
- if($data['link'] == $this->current_del_id){
- unset($this->list[$vendor][$ppd]);
- }
+ // Build up ppd
+ $list = array();
+ foreach($this->list as $cat => $ppds){
+ foreach($ppds as $ppd){
+ $name = $ppd['ppd']['name'];
+ $list[$ppd['link']] = $ppd;
}
- }
}
- }
- if(!$is_ok){
- msg_dialog::display(_("PPD error"), msgPool::cannotDeleteFile($this->current_del_id), ERROR_DIALOG);
- }
- }
+ $data = $lData = array();
+ if(empty($this->Vendor)){
+ foreach($this->header as $key => $entry){
+ $data[$key] = array('TYPE' => 'VENDOR' , 'ID' => $key);
+ $lData[$key] = array('data'=>array($key));
+ }
+
+ }else{
+ $data[] = array('TYPE' => 'VENDOR' , 'ID' => '..');
+ $lData[] = array('data'=>array(".. ["._("back")."]"));
- // Build up ppd
- $list = array();
- foreach($this->list as $cat => $ppds){
- foreach($ppds as $ppd){
- $name = $ppd['ppd']['name'];
- $list[$ppd['link']] = $ppd;
+ foreach($list as $key => $ppd){
+ $name = $ppd['ppd']['name'];
+ if(preg_match("/^".$this->Vendor."/", $name)){
+ $data[$key] = array('TYPE' => 'PPD' , 'ID' => $key);
+ $lData[$key] = array('data'=>array($name));
+ }
+ }
}
- }
+ $this->ppdList->setAcl('rwcdm');
+ $this->ppdList->setListData($data,$lData);
+ $this->ppdList->update();
- $data = $lData = array();
- if(empty($this->Vendor)){
- foreach($this->header as $key => $entry){
- $data[$key] = array('TYPE' => 'VENDOR' , 'ID' => $key);
- $lData[$key] = array('data'=>array($key));
- }
-
- }else{
- $data[] = array('TYPE' => 'VENDOR' , 'ID' => '..');
- $lData[] = array('data'=>array(".. ["._("back")."]"));
-
- foreach($list as $key => $ppd){
- $name = $ppd['ppd']['name'];
- if(preg_match("/^".$this->Vendor."/", $name)){
- $data[$key] = array('TYPE' => 'PPD' , 'ID' => $key);
- $lData[$key] = array('data'=>array($name));
- }
- }
+ $smarty->assign("List", $this->ppdList->render());
+
+ $display.= $smarty->fetch(get_template_path('printerPPDSelectionDialog.tpl', TRUE,dirname(__FILE__)));
+ return($display);
}
-
- $this->ppdList->setAcl('rwcdm');
- $this->ppdList->setListData($data,$lData);
- $this->ppdList->update();
-
- $smarty->assign("List", $this->ppdList->render());
-
- $display.= $smarty->fetch(get_template_path('printerPPDSelectionDialog.tpl', TRUE,dirname(__FILE__)));
- return($display);
- }
-
- function save_object()
- {
- $this->ppdList->save_object();
- $action = $this->ppdList->getAction();
- if($action['action'] == "edit"){
- $data = $this->ppdList->getData($action['targets'][0]);
- if($data['TYPE'] == "VENDOR"){
- $this->Vendor = $data['ID'];
- }
- if($data['TYPE'] == "PPD"){
- $this->selectedPPD = $data['ID'];
- }
- }
- }
+ function save_object()
+ {
+ $this->ppdList->save_object();
+ $action = $this->ppdList->getAction();
+ if($action['action'] == "edit"){
+ $data = $this->ppdList->getData($action['targets'][0]);
+ if($data['TYPE'] == "VENDOR"){
+ $this->Vendor = $data['ID'];
+ }
+ if($data['TYPE'] == "PPD"){
+ $this->selectedPPD = $data['ID'];
+ }
+ }
+
+ }
- function check(){
- }
+ function check(){
+ }
- /* Save to LDAP */
- function save()
- {
- return $this->selectedPPD;
- }
+ /* Save to LDAP */
+ function save()
+ {
+ return $this->selectedPPD;
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>