From 9e59f6cf5630d2e5ba6b84c8c9868e6ff9e7f0e9 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 7 May 2007 13:56:29 +0000 Subject: [PATCH] Udpated Feedback dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6281 594d385d-05f5-0310-b6e9-bd551577e9d8 --- setup/class_setupStep_Feedback.inc | 182 ++++++++++++++++++++++++++++- setup/setup_feedback.tpl | 55 ++++----- 2 files changed, 205 insertions(+), 32 deletions(-) diff --git a/setup/class_setupStep_Feedback.inc b/setup/class_setupStep_Feedback.inc index af3a91a79..4a7b0c9b8 100644 --- a/setup/class_setupStep_Feedback.inc +++ b/setup/class_setupStep_Feedback.inc @@ -23,9 +23,36 @@ class Step_Feedback extends setup_step { var $languages = array(); - var $attributes = array(); var $header_image = "images/welcome.png"; + var $organization = ""; + var $eMail = ""; + var $name = ""; + var $subscribe = TRUE; + var $use_gosa_announce = TRUE; + + var $get_started = TRUE; + var $problems_encountered = ""; + + var $first_use = TRUE; + var $use_since = ""; + + var $distribution = ""; + var $web_server = ""; + var $php_version = ""; + + var $ldap_server = ""; + var $object_count = ""; + + var $want_to_see_next = ""; + + var $features_used = array(); + var $initialized = FALSE; + + var $attributes = array("organization","eMail","name","subscribe","use_gosa_announce","get_started","problems_encountered","features_used", + "first_use","use_since","distribution","web_server","php_version","ldap_server","object_count","want_to_see_next"); + + function Step_Feedback() { $this->is_enabled = TRUE; @@ -33,6 +60,52 @@ class Step_Feedback extends setup_step $this->update_strings(); } + function init() + { + $cv = $this->parent->captured_values; + + /* Initialize values */ + $this->use_since = date("Y"); + $this->organization = preg_replace("/^[^=]*+=(.*),.*$/","\\1",$cv['base']); + $this->distribution = PHP_OS."/".$_SERVER['SERVER_SOFTWARE']; + $this->web_server = $_SERVER['SERVER_SOFTWARE']; + + $this->php_version = PHP_VERSION; + + /* On first call check for rid/sid base */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $ldap->search("(objectClass=*)",array("dn")); + $this->object_count=$ldap->count(); + + $oc = $ldap->get_objectclasses(); + + + $this->features_used = array(); + $this->features_used['posix'] = array("USED" => isset($oc['posixAccount']) , + "NAME" => _("UNIX accounts/groups")); + $this->features_used['samba'] = array("USED" => isset($oc['sambaSamAccount']) || isset($oc['sambaAccount']) , + "NAME" => _("Samba management")); + $this->features_used['mail'] = array("USED" => $cv['mail'] != "none", + "NAME" => _("Mailsystem management")); + $this->features_used['fax'] = array("USED" => isset($oc['goFaxAccount']) , + "NAME" => _("FAX system administration")); + $this->features_used['asterisk'] = array("USED" => isset($oc['goFonAccount']), + "NAME" => _("Asterisk administration")); + $this->features_used['inventory'] = array("USED" => isset($oc['glpiAccount']) , + "NAME" => _("System invetory")); + $this->features_used['system'] = array("USED" => FALSE , + "NAME" => _("System-/Configmanagement")); + $this->features_used['addressbook'] = array("USED" => FALSE , + "NAME" => _("Addressbook")); + } + function update_strings() { $this->s_title = _("Feedback"); @@ -42,16 +115,121 @@ class Step_Feedback extends setup_step function execute() { + if(!$this->initialized){ + $this->initialized = TRUE; + $this->init(); + } + + $years = array(); + for($i = date("Y") ; $i >= 2001; $i--){ + $years[$i] = $i; + } + $this->is_completed=TRUE; $smarty = get_smarty(); + + foreach($this->attributes as $attr){ + $smarty->assign($attr, $this->$attr); + } + $smarty->assign("years",$years); + $smarty->assign("features_used",$this->features_used); $smarty->assign ("must", "*"); - $smarty->assign('auth_id', session_id()); return($smarty->fetch(get_template_path("setup_feedback.tpl",TRUE,dirname(__FILE__)))); } function save_object() { + if(isset($_POST['step_feedback'])){ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = get_post($attr); + } + } + + if(isset($_POST['subscribe'])){ + $this->subscribe = TRUE; + }else{ + $this->subscribe = FALSE; + } + + if(isset($_POST['use_gosa_announce'])){ + $this->use_gosa_announce = TRUE; + }else{ + $this->use_gosa_announce = FALSE; + } + + foreach($this->features_used as $key => $data){ + if(isset($_POST['feature_'.$key])){ + $this->features_used[$key]['USED'] = TRUE; + }else{ + $this->features_used[$key]['USED'] = FALSE; + } + } + if(isset($_POST['send_feedback'])){ + $str = $this->create_serialise_data_string(); + + $feedback_url = "http://dyn-111/hickert-test/feedback.php?data=".serialize($str); + $ret = fopen($feedback_url,"r"); + $ret_value = fgets($ret,256); + fclose($ret); + + if(!preg_match("/successfully/i",$ret_value)){ + print_red(_("Could not send feedback.")); + } + } + } + + } + + function create_serialise_data_string() + { + + $str = "#FEEDBACK ".date("H:i:s d:m:Y"); + if($this->subscribe){ + + $str.= "\n\nSubscribe"; + $str .= "\nOrganization: ".$this->organization; + $str .= "\nName: ".$this->name; + $str .= "\neMail: ".$this->eMail; + } + + if($this->use_gosa_announce){ + + $str.= "\n\nFeedback"; + + if($this->get_started) { + $str .= "\nGet started: TRUE"; + }else{ + $str .= "\nGet started: FALSE"; + } + $str .= "\nProblems : ".base64_encode($this->problems_encountered); + + if($this->first_use){ + $str .= "\nFirst use: TRUE"; + }else{ + $str .= "\nFirst use: FALSE"; + } + $str .= "\nUsing GOsa since: ".$this->use_since; + + $str .="\nDistribution: ".$this->distribution; + $str .="\nWeb Server: ".$this->web_server; + $str .="\nPHP_Version: ".$this->php_version; + $str .="\nLDAP Server: ".$this->ldap_server; + $str .="\nObject count: ".$this->object_count; + $str .="\nMissing features: ".base64_encode($this->want_to_see_next); + } + + $str .= "\n\nFeatures used"; + foreach($this->features_used as $name => $data){ + $str.="\n".$name.": "; + if($data['USED']){ + $str .= "TRUE"; + }else{ + $str .= "FALSE"; + } + } + return($str); } } diff --git a/setup/setup_feedback.tpl b/setup/setup_feedback.tpl index efaf46ad1..7d6ffaf2a 100644 --- a/setup/setup_feedback.tpl +++ b/setup/setup_feedback.tpl @@ -1,7 +1,7 @@

-  {t}Subscribe to the gosa-announce mailinglist{/t} +  {t}Subscribe to the gosa-announce mailinglist{/t}

{t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to subscribe you to the gosa-announce mailing list. You've to confirm this by mail.{/t} @@ -12,7 +12,7 @@ {t}Organization{/t} - + @@ -20,7 +20,7 @@ {t}Name{/t} - + @@ -28,7 +28,7 @@ {t}eMail{/t}{$must} - + @@ -36,8 +36,8 @@

 

-  {t}Send feedback to the GOsa project team{/t} -

+  {t}Send feedback to the GOsa project team{/t} + {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to submit your form anonymously.{/t}
{t}Generic{/t} @@ -46,9 +46,9 @@ {t}Did the setup procedure help you to get started?{/t} @@ -56,7 +56,7 @@ {t}If not, what problems did you encounter{/t}: @@ -64,20 +64,17 @@ {t}Is this the first time you use GOsa?{/t} @@ -86,7 +83,7 @@ {t}What operation system / distribution do you use?{/t} @@ -94,7 +91,7 @@ {t}What web server do you use?{/t} @@ -102,7 +99,7 @@ {t}What PHP version do you use?{/t}
- {t}Yes{/t} + {t}Yes{/t}
- {t}No{/t} + {t}No{/t}
- +
- {t}Yes{/t} + {t}Yes{/t}
- {t}No{/t} + {t}No{/t}
{t}I use it since{/t} - - + {html_options options=$years}
- +
- +
- +
@@ -112,13 +109,13 @@ {t}What kind of LDAP server(s) do you use?{/t} - + {t}How many objects are in your LDAP?{/t} - + @@ -129,21 +126,19 @@ {t}What features of GOsa do you use?{/t} - [ ] POSIX (UNIX accounts/groups) - [ ] Samba management - [ ] Mailsystem management - [ ] FAX system administration - [ ] Asterisk administration - [ ] System invetory - [ ] System-/Configmanagement - [ ] Addressbook + {foreach from=$features_used item=data key=key} + + {$data.NAME}
+ {/foreach} {t}What features do you want to see in next versions of GOsa?{/t} - +
+ + -- 2.30.2