/**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     global $data, $lang_str, $config;
     /* get list of credentials */
     if (false === ($this->credentials = $data->get_credentials($this->controler->user_id->get_uid(), null))) {
         return false;
     }
     $did = $uname = $realm = $password = null;
     $for_ser = $for_serweb = true;
     if ($this->action['action'] == 'edit') {
         foreach ($this->credentials as $k => $v) {
             if ($v->get_uname() == $this->edit_uname and $v->get_realm() == $this->edit_realm and (!$config->auth['use_did'] or $v->get_did() == $this->edit_did)) {
                 $uname = $v->get_uname();
                 $realm = $v->get_realm();
                 $did = $v->get_did();
                 $password = $v->get_password();
                 $for_ser = $v->is_for_ser();
                 $for_serweb = $v->is_for_serweb();
                 break;
             }
         }
     }
     $domains =& Domains::singleton();
     if (false === ($domain_names = $domains->get_id_name_pairs())) {
         return false;
     }
     $dom_options = array();
     foreach ($domain_names as $k => $v) {
         $dom_options[] = array("label" => $v, "value" => $k);
     }
     $this->f->add_element(array("type" => "text", "name" => "cr_uname", "size" => 16, "maxlength" => 64, "value" => $uname, "minlength" => 1, "length_e" => $lang_str['fe_not_filled_username'], "valid_regex" => $config->username_regex, "valid_e" => $lang_str['fe_uname_not_follow_conventions']));
     $this->f->add_element(array("type" => "select", "name" => "cr_domain", "options" => $dom_options, "value" => $did, "size" => 1));
     $this->f->add_element(array("type" => "text", "name" => "cr_passw", "size" => 16, "maxlength" => 28, "value" => $password));
     $this->f->add_element(array("type" => "checkbox", "name" => "cr_for_ser", "value" => "1", "checked" => $for_ser));
     $this->f->add_element(array("type" => "checkbox", "name" => "cr_for_serweb", "value" => "1", "checked" => $for_serweb));
     $this->f->add_element(array("type" => "hidden", "name" => "cr_e_un", "value" => $this->edit_uname));
     $this->f->add_element(array("type" => "hidden", "name" => "cr_e_re", "value" => $this->edit_realm));
     $this->f->add_element(array("type" => "hidden", "name" => "cr_e_did", "value" => $this->edit_did));
     if (!$config->clear_text_pw) {
         $this->js_before .= "\n\t\t\t\tif (f.cr_e_un.value != '' &&   //perform this check only when modifing credential, not when creating new one\n\t\t\t\t    f.cr_e_did.value != f.cr_domain[f.cr_domain.selectedIndex].value &&\n\t\t\t\t    f.cr_passw.value == ''){\n\t\t\t\t\t\n\t\t\t\t\talert('" . addslashes($lang_str['err_credential_changed_domain']) . "');\n\t\t\t\t\tf.cr_passw.focus();\n\t\t\t\t\treturn (false);\n\t\t\t\t}\n\t\t\t\n\t\t\t";
     }
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     $this->get_form_elements();
     $js_elements = array();
     foreach ($this->form_elements as $k => $v) {
         if (!isset($this->session['f_values'][$v['name']])) {
             if (isset($v['initial'])) {
                 $this->session['f_values'][$v['name']] = $v['initial'];
             } else {
                 $this->session['f_values'][$v['name']] = null;
             }
         }
         /* pre set the value */
         if ($v['type'] == "checkbox") {
             $v['checked'] = $this->session['f_values'][$v['name']];
             if (empty($v['value'])) {
                 $v['value'] = 1;
             }
             //if value is not set
         } else {
             $v['value'] = $this->session['f_values'][$v['name']];
         }
         $js_el = array();
         $js_el["name"] = $v['name'];
         $js_el["type"] = $v['type'];
         /* do specific actions for each type */
         switch ($v['type']) {
             case "text":
                 if (!isset($v['maxlength'])) {
                     $v['maxlength'] = 32;
                 }
                 if ($v['value']) {
                     $this->filter_applied = true;
                 }
                 break;
             case "checkbox":
                 /* add the hidden element in order to it not depend 
                    if checkbox is displayed by the template or not */
                 $this->f->add_element(array("name" => $v['name'] . "_hidden", "type" => "hidden", "value" => $v['checked'] ? 1 : 0));
                 $onclick = "if (this.checked) this.form." . $v['name'] . "_hidden" . ".value=1; else this.form." . $v['name'] . "_hidden" . ".value=0;";
                 if (!empty($v['3state'])) {
                     $js_el["three_state"] = true;
                     $v['disabled'] = empty($this->session['f_spec'][$v['name']]['enabled']);
                     /* add the chcekbox element enabling or disabling the first one */
                     $this->f->add_element(array("name" => $v['name'] . "_en", "type" => "checkbox", "value" => 1, "checked" => !$v['disabled'], "extrahtml" => "title='enable filtering by this flag' onclick='if (this.checked) this.form." . $v['name'] . ".disabled=false; else this.form." . $v['name'] . ".disabled=true;'"));
                     //					$onchange .= "if (this.checked) this.form.".$v['name'].".disable=false; else this.form.".$v['name'].".disable=true;";
                     if (!$v['disabled']) {
                         $this->filter_applied = true;
                     }
                 } else {
                     if ($v['checked']) {
                         $this->filter_applied = true;
                     }
                 }
                 if (empty($v['extrahtml'])) {
                     $v['extrahtml'] = "";
                 }
                 $v['extrahtml'] .= " onclick='" . $onclick . "'";
                 break;
         }
         $this->f->add_element($v);
         $this->form_elements[$k] = $v;
         if (isset($v['label'])) {
             $this->labels[$v['name']] = $v['label'];
         }
         $js_elements[] = $js_el;
     }
     $this->opt['form_clear']['extra_html'] = "onclick='filter_form_ctl.filter_clear(); return false;'";
     $this->f->add_extra_submit("f_clear", $this->opt['form_clear']);
     $onload_js = "\n\t\t\tfilter_form_ctl = new Filter_Form('" . $this->opt['form_name'] . "', " . my_JSON_encode($js_elements) . ");\n\t\t";
     $this->controler->set_onload_js($onload_js);
 }
 function create_html_form(&$errors)
 {
     global $available_languages;
     parent::create_html_form($errors);
     $options = array();
     foreach ($available_languages as $id => $tmplang) {
         /* skip entries with charset different from $this->opt['use_charset_only'] */
         if ($this->opt['use_charset_only'] and false === strpos($id, $this->opt['use_charset_only'])) {
             continue;
         }
         $options[] = array("label" => ucfirst(substr(strrchr($tmplang[0], '|'), 1)) . ($this->opt['use_charset_only'] ? "" : " (" . $id . ")"), "value" => $id);
     }
     uasort($options, create_function('&$a, $b', 'return (strcmp($a["label"], $b["label"]));'));
     $this->f->add_element(array("type" => "select", "name" => "ls_language", "options" => $options, "size" => 1, "value" => $_SESSION['lang']));
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     global $available_languages;
     parent::create_html_form($errors);
     $file_content = "";
     $kind = "";
     if ($this->action['action'] == "edit_text_file" or $this->action['action'] == "edit_layout_file") {
         $kind = $this->action['action'] == "edit_text_file" ? "text" : "layout";
         if ($this->opt['nr_backups']) {
             if (false === $this->get_versions($kind == "text", $errors)) {
                 return false;
             }
         }
         $ds =& Domain_settings::singleton($this->domain_id, $this->get_filename($kind == "text"), $this->opt['nr_backups']);
         if (is_null($this->file_ver)) {
             if (false === ($ver = $ds->get_last_version())) {
                 return false;
             }
             $this->file_ver = $ver;
         }
         if (false === ($file_content = $ds->get_file_content($this->file_ver))) {
             return false;
         }
         if (is_null($file_content) and $kind == "text") {
             $f = multidomain_get_lang_file($this->filename, "txt", $this->lang, "_default");
             if (!empty($f)) {
                 $fp = fopen($f, "r");
                 $file_content = fread($fp, 65536);
                 fclose($fp);
             }
         }
         /* strip first line containing die() preventing this script from displaying throught http */
         if (!empty($this->fileinfo['ini'])) {
             $first_eol = strpos($file_content, "\n");
             $first_line = substr($file_content, 0, $first_eol);
             if (false !== strpos($first_line, "<?php die(")) {
                 $file_content = substr($file_content, $first_eol);
             }
         }
     }
     $this->f->add_element(array("type" => "textarea", "name" => "dl_content", "rows" => 25, "cols" => 80, "value" => $file_content, "wrap" => "off"));
     $this->f->add_element(array("type" => "hidden", "name" => "dl_filename", "value" => $this->filename));
     $this->f->add_element(array("type" => "hidden", "name" => "dl_kind_of_file", "value" => $kind));
     $this->f->add_element(array("type" => "hidden", "name" => "dl_lang", "value" => $this->lang));
 }
 function create_html_form(&$errors)
 {
     global $lang_str;
     parent::create_html_form($errors);
     $this->f->add_element(array("type" => "text", "name" => "fp_uname", "size" => 20, "maxlength" => 64, "value" => "", "minlength" => 1, "length_e" => $lang_str['fe_not_filled_username'], "extrahtml" => "autocomplete='off' " . ($this->opt['fully_qualified_name'] ? " onBlur='login_completion(this)'" : "")));
 }
 function create_html_form(&$errors)
 {
     global $data, $config;
     parent::create_html_form($errors);
     $this->f->add_element(array("type" => "file", "name" => "vm_greeting", "size" => $this->opt['max_file_size'], "value" => ""));
     /* if should be used radio button */
     if ($this->opt['use_radio_button']) {
         /* get state of the button */
         if ($data->is_greeting_existent($this->user_id, $errors)) {
             $which_greeting_value = 'customized';
         } else {
             $which_greeting_value = 'standard';
         }
         /* add it to form */
         $this->f->add_element(array("type" => "radio", "name" => "which_greeting", "options" => array(array('label' => 'standard greeting', 'value' => 'standard'), array('label' => 'customized greeting', 'value' => 'customized')), "value" => $which_greeting_value));
         $this->f->add_element(array("type" => "hidden", "name" => "_hidden_customized_greeting_exists", "value" => $which_greeting_value == 'customized' ? '1' : '0'));
     }
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
 }
 /**
  *  create html form 
  *
  *  @return null            FALSE on failure
  */
 function create_html_form()
 {
     parent::create_html_form();
     $this->f->add_element(array("type" => "text", "name" => "hello_world_name", "value" => $this->session['name'], "js_trim_value" => true, "js_validate" => false, "maxlength" => 64));
 }
 function create_html_form(&$errors)
 {
     global $data, $lang_str;
     parent::create_html_form($errors);
     if (false === ($this->whitelist = $data->get_whitelist($this->user_id, NULL, $errors))) {
         return;
     }
     $uri_field = 'uri';
     /* if we are using phonenumbers, convert all sip addresses to phonenumber */
     if ($this->opt['username_in_target_only']) {
         $uri_field = 'username_uri';
         foreach ($this->whitelist as $key => $val) {
             $this->whitelist[$key]['username_uri'] = $this->reg->get_username($val['uri']);
         }
     }
     $opt = array();
     foreach ($this->whitelist as $val) {
         $opt[] = array('label' => $val[$uri_field], 'value' => $val[$uri_field]);
     }
     $this->f->add_element(array("type" => "select", "name" => "whitelist", "size" => 10, "options" => $opt, "multiple" => true));
     $element_edit_field = array("type" => "text", "name" => "editfield", "size" => 16);
     if ($this->opt['username_in_target_only']) {
         if ($this->opt['numerical_target_only']) {
             $element_edit_field["valid_regex"] = "^(" . $this->opt['phonenumber_check_regex'] . ")?\$";
             $element_edit_field["valid_e"] = $this->opt['phonenumber_check_e'];
         }
     } else {
         $element_edit_field["valid_regex"] = "^(" . $this->reg->sip_address . ")?\$";
         $element_edit_field["valid_e"] = $lang_str['fe_not_valid_sip'];
         $element_edit_field["extrahtml"] = "onBlur='sip_address_completion(this)'";
     }
     $this->f->add_element($element_edit_field);
     $this->f->add_element(array("type" => "hidden", "name" => "hidden_edit_field"));
     /* all options in whitelist must be selected in order to browser send them */
     $this->js_before = "select_all_options(f.whitelist);";
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     global $lang_str;
     /* get info about edited attribute */
     $attrs =& Attr_types::singleton();
     if (false === ($this->at = $attrs->get_attr_type($this->opt['attr_name']))) {
         $errors[] = "unknown attribute";
         return false;
     }
     /* store items of list */
     $this->type_spec = $this->at->get_type_spec();
     if (!$this->type_spec) {
         $this->type_spec = array();
     }
     if (!isset($this->type_spec['min'])) {
         $this->type_spec['min'] = null;
     }
     if (!isset($this->type_spec['max'])) {
         $this->type_spec['max'] = null;
     }
     if (!isset($this->type_spec['err'])) {
         $this->type_spec['err'] = null;
     }
     $this->f->add_element(array("type" => "text", "name" => "at_int_min", "value" => $this->type_spec['min'], "size" => 16, "maxlength" => 16, "valid_regex" => "^-?[0-9]*\$", "valid_e" => "'" . $lang_str['ff_at_int_min'] . "' " . $lang_str['fe_is_not_number']));
     $this->f->add_element(array("type" => "text", "name" => "at_int_max", "value" => $this->type_spec['max'], "size" => 16, "maxlength" => 16, "valid_regex" => "^-?[0-9]*\$", "valid_e" => "'" . $lang_str['ff_at_int_max'] . "' " . $lang_str['fe_is_not_number']));
     $this->f->add_element(array("type" => "text", "name" => "at_int_err", "value" => $this->type_spec['err'], "size" => 16, "maxlength" => 64));
 }
 function create_html_form(&$errors)
 {
     global $sess_acc_filter;
     parent::create_html_form($errors);
     if ($this->opt['use_filter']) {
         $opt = array(array('label' => $this->opt['filter_labels']['all'], 'value' => 'all'), array('label' => $this->opt['filter_labels']['incoming'], 'value' => 'incoming'), array('label' => $this->opt['filter_labels']['outgoing'], 'value' => 'outgoing'));
         $this->f->add_element(array("type" => "select", "name" => "filter", "size" => 1, "value" => $sess_acc_filter, "options" => $opt));
     }
 }
 function create_html_form(&$errors)
 {
     global $lang_str, $data;
     parent::create_html_form($errors);
     if ($this->action['action'] == 'edit' or $this->action['action'] == 'delete_ack') {
         if (false === ($this->contact = $data->get_phonebook_entry($this->user_id, $this->act_pb_id, $errors))) {
             return false;
         }
     }
     if ($this->action['action'] == 'delete_ack') {
         $this->f->add_element(array("type" => "hidden", "name" => "pb_delete_ack", "value" => $this->act_pb_id));
     } else {
         $this->f->add_element(array("type" => "text", "name" => "fname", "size" => 16, "maxlength" => 32, "value" => isset($this->contact['fname']) ? $this->contact['fname'] : ""));
         $this->f->add_element(array("type" => "text", "name" => "lname", "size" => 16, "maxlength" => 32, "value" => isset($this->contact['lname']) ? $this->contact['lname'] : ""));
         $element_sip_uri = array("type" => "text", "name" => "sip_uri", "size" => 16, "maxlength" => 128);
         $sip_uri_val = isset($this->contact['sip_uri']) ? $this->contact['sip_uri'] : "";
         if ($this->opt['username_in_target_only']) {
             /* parse username from request uri */
             $element_sip_uri["value"] = $this->reg->get_username($sip_uri_val);
             /* if user should enter only phonenumber as username part of uri, add validating regex */
             if ($this->opt['numerical_target_only']) {
                 $element_sip_uri["valid_regex"] = "^(" . $this->reg->phonenumber . ")?\$";
                 $element_sip_uri["valid_e"] = $lang_str['fe_not_valid_phonenumber'];
             }
         } else {
             $element_sip_uri["value"] = $sip_uri_val;
             $element_sip_uri["valid_regex"] = "^(" . $this->reg->sip_address . ")?\$";
             $element_sip_uri["valid_e"] = $lang_str['fe_not_valid_sip'];
             $element_sip_uri["extrahtml"] = "onBlur='sip_address_completion(this)'";
             $this->js_before = 'sip_address_completion(f.sip_uri);';
         }
         $this->f->add_element($element_sip_uri);
         $this->f->add_element(array("type" => "hidden", "name" => "id", "value" => $this->act_pb_id));
         if ($this->opt['blacklist']) {
             //perform regex check against entered URIs
             $js_tmp = "if (window.RegExp) {\n" . " \tvar blacklistreg = /" . str_replace('/', '\\/', $this->opt['blacklist']) . "/gi\n\n";
             /* if we are using phonenumbers, convert it to strict form */
             if ($this->opt['username_in_target_only'] and $this->opt['numerical_target_only']) {
                 $js_tmp .= "\t" . $this->reg->convert_phonenumber_to_strict_js("f.elements['sip_uri'].value", "blklist_tmp_uri") . ";\n";
             } else {
                 $js_tmp .= "\tblklist_tmp_uri = f.elements['sip_uri'].value;\n";
             }
             $js_tmp .= "\tif (blacklistreg.test(blklist_tmp_uri)) {\n" . "\t\talert('" . addslashes($this->opt['blacklist_e']) . "');\n" . "\t\tf.elements['sip_uri'].focus();\n" . "\t\treturn(false);\n" . "\t}\n}\n";
             $this->js_after .= $js_tmp;
         }
     }
 }
 /**
  *  create html form 
  *
  *  @param array $errors    array with error messages
  *  @return null            FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     global $lang_str, $data, $config, $sess;
     $f =& $config->data_sql->uri->flag_values;
     $domains =& Domains::singleton();
     if (false === ($this->domain_names = $domains->get_id_name_pairs())) {
         return false;
     }
     /* create a list of allowed domain names for the form */
     if (is_array($this->opt['allowed_domains'])) {
         $alowed_domain_names = array();
         foreach ($this->opt['allowed_domains'] as $v) {
             $alowed_domain_names[$v] = $this->domain_names[$v];
         }
     } else {
         $alowed_domain_names =& $this->domain_names;
     }
     $dom_options = array();
     foreach ($alowed_domain_names as $k => $v) {
         $dom_options[] = array("label" => $v, "value" => $k);
     }
     $reg =& Creg::singleton();
     if ($this->action['action'] == "edit" or $this->action['action'] == "update") {
         $opt = array();
         $opt['filter']['username'] = new Filter("username", $this->edit['un'], "=", false, false);
         $opt['filter']['did'] = new Filter("did", $this->edit['did'], "=", false, false);
         $opt['filter']['flags'] = new Filter("flags", $this->edit['flags'], "=", false, false);
         $opt['filter']['scheme'] = new Filter("scheme", $this->edit['scheme'], "=", false, false);
         if (false === ($uri = $data->get_uris($this->controler->user_id->get_uid(), $opt))) {
             return false;
         }
         if (!count($uri)) {
             $uri = new URI($this->controler->user_id->get_uid(), "", "", $f['DB_CANON']);
             $errors[] = $lang_str['tcssr_err_rs_prefix_to_edit_not_found'];
         } else {
             //get first (and only) element of array
             $uri = reset($uri);
         }
         $this->edit_uri =& $uri;
         $edit = true;
     } else {
         $uri = new URI($this->controler->user_id->get_uid(), "", "", &$config->data_sql->uri->flag_values['DB_CANON']);
         $this->edit_uri =& $uri;
         $edit = false;
     }
     $this->f->add_element(array("type" => "text", "name" => "uri_un", "value" => $this->edit_uri->username, "js_trim_value" => true, "size" => 16, "maxlength" => 64, "minlength" => 1, "valid_regex" => "^" . $reg->user . "\$", "valid_e" => $lang_str['fe_not_valid_username'], "length_e" => $lang_str['fe_not_filled_username'], "value" => $this->edit_uri->username, "extrahtml" => "onkeyup='alias_ctl.onAliasChange();' oncut='alias_ctl.onAliasChange();' onpaste='alias_ctl.onAliasChange();'"));
     $this->f->add_element(array("type" => "select", "name" => "uri_did", "options" => $dom_options, "value" => $this->edit_uri->did, "size" => 1, "extrahtml" => "onchange='alias_ctl.onAliasChange();' onkeyup='alias_ctl.onAliasChange();'"));
     $this->f->add_element(array("type" => "checkbox", "name" => "uri_is_canon", "checked" => (bool) ($this->edit_uri->flags & $f['DB_CANON']), "value" => 1));
     if ($this->action['action'] == "edit" or $this->action['action'] == "update") {
         $this->f->add_element(array("type" => "hidden", "name" => "uri_un_edit", "value" => $this->edit_uri->username));
         $this->f->add_element(array("type" => "hidden", "name" => "uri_did_edit", "value" => $this->edit_uri->did));
         $this->f->add_element(array("type" => "hidden", "name" => "uri_flags_edit", "value" => $this->edit_uri->flags));
     }
     $onload_js = "\n            var alias_ctl;\n            alias_ctl = new Aliases_ctl('alias_ctl');\n            alias_ctl.init('" . $this->opt['form_name'] . "', 'uri_un', 'uri_did');\n            alias_ctl.onAliasChangeUrl='" . $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&uri_usage=1") . "';\n            alias_ctl.aliasSuggestUrl='" . $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&uri_suggest=1") . "';\n            alias_ctl.aliasGenerateUrl='" . $sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&uri_generate=1") . "';\n            alias_ctl.lang_str.no_suggestions='" . js_escape($lang_str['no_suggestions']) . "'                \n        ";
     $this->controler->set_onload_js($onload_js);
 }
 function create_html_form(&$errors)
 {
     global $data, $lang_str, $sess_sd_act_row, $sess_sd_sort, $sess_sd_sort_dir;
     parent::create_html_form($errors);
     $opt = array('dial_did' => $this->opt['domain_for_requests'], 'sort' => $sess_sd_sort, 'sort_desc' => $sess_sd_sort_dir == 'asc' ? false : true);
     $data->set_act_row($sess_sd_act_row);
     $data->set_showed_rows(10);
     if (false === ($this->speed_dials = $data->get_speed_dials($this->controler->user_id->get_uid(), $opt))) {
         return false;
     }
     $this->pager['url'] = $_SERVER['PHP_SELF'] . "?kvrk=" . uniqid("") . "&act_row=";
     $this->pager['pos'] = $data->get_act_row();
     $this->pager['items'] = $data->get_num_rows();
     $this->pager['limit'] = $data->get_showed_rows();
     $this->pager['from'] = $data->get_res_from();
     $this->pager['to'] = $data->get_res_to();
     $i = 0;
     foreach ($this->speed_dials as $key => $val) {
         $index = sprintf("%02u", $i);
         /* add index into speed_dial array */
         $this->speed_dials[$key]['index'] = $index;
         $element_new_uri = array("type" => "text", "name" => "new_uri_" . $index, "size" => 16, "maxlength" => $this->opt['new_uri_max_chars'], "value" => $val['new_uri']);
         if ($this->opt['username_in_target_only']) {
             /* parse username from request uri */
             $element_new_uri["value"] = $this->reg->get_username($val['new_uri']);
             /* if user should enter only phonenumber as username part of uri, add validating regex */
             if ($this->opt['numerical_target_only']) {
                 $element_new_uri["valid_regex"] = "^(" . $this->reg->phonenumber . ")?\$";
                 $element_new_uri["valid_e"] = $lang_str['fe_not_valid_phonenumber'];
             }
         } else {
             $element_new_uri["value"] = $val['new_uri'];
             $element_new_uri["valid_regex"] = "^(" . $this->reg->sip_address . ")?\$";
             $element_new_uri["valid_e"] = $lang_str['fe_not_valid_sip'];
             $element_new_uri["extrahtml"] = "onBlur='sip_address_completion(this)'";
         }
         $this->f->add_element($element_new_uri);
         $this->f->add_element(array("type" => "text", "name" => "fname_" . $index, "size" => 16, "maxlength" => $this->opt['fname_max_chars'], "value" => $val['fname']));
         $this->f->add_element(array("type" => "text", "name" => "lname_" . $index, "size" => 16, "maxlength" => $this->opt['lname_max_chars'], "value" => $val['lname']));
         if ($this->opt['blacklist']) {
             //perform regex check against entered URIs
             $js_tmp = "if (window.RegExp) {\n" . " \tvar blacklistreg = /" . str_replace('/', '\\/', $this->opt['blacklist']) . "/gi\n\n";
             /* if we are using phonenumbers, convert it to strict form */
             if ($this->opt['username_in_target_only'] and $this->opt['numerical_target_only']) {
                 $js_tmp .= "\t" . $this->reg->convert_phonenumber_to_strict_js("f.elements['new_uri_" . $index . "'].value", "blklist_tmp_uri") . ";\n";
             } else {
                 $js_tmp .= "\tblklist_tmp_uri = f.elements['new_uri_" . $index . "'].value;\n";
             }
             $js_tmp .= "\tif (blacklistreg.test(blklist_tmp_uri)) {\n" . "\t\talert('" . addslashes($this->opt['blacklist_e']) . "');\n" . "\t\tf.elements['new_uri_" . $index . "'].focus();\n" . "\t\treturn(false);\n" . "\t}\n}\n";
             $this->js_blacklist[] = $js_tmp;
         }
         $i++;
     }
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     global $lang_str, $sess;
     parent::create_html_form($errors);
     /* get list of attributes */
     $this->attrs =& Attr_types::singleton();
     if (false === ($at = $this->attrs->get_attr_types())) {
         return false;
     }
     if (false === ($grp = $this->attrs->get_attr_groups())) {
         return false;
     }
     $this->attr_groups = $grp;
     $grp[] = array("label" => "< " . $lang_str['attr_grp_create_new'] . " >", "value" => "__new__");
     $grp_cnt = count($grp) - 1;
     /* default values for form elements */
     if ($this->edit_id and isset($at[$this->edit_id])) {
         $atr =& $at[$this->edit_id];
     } else {
         $atr = new Attr_type("", 2, "string", "", "", 0, 0, 0, 0, 0);
     }
     $this->f->add_element(array("type" => "text", "name" => "attr_name", "size" => 16, "maxlength" => 32, "value" => $atr->get_name(), "minlength" => 1, "length_e" => $lang_str['fe_not_filled_name_of_attribute']));
     $this->f->add_element(array("type" => "select", "name" => "attr_type", "size" => 1, "options" => Attr_types::get_all_types(), "value" => $atr->get_type()));
     $this->f->add_element(array("type" => "text", "name" => "attr_order", "size" => 16, "maxlength" => 5, "value" => $atr->get_order(), "valid_regex" => "^[0-9]+\$", "valid_e" => $lang_str['fe_order_is_not_number']));
     $this->f->add_element(array("type" => "text", "name" => "attr_label", "size" => 16, "maxlength" => 255, "value" => $atr->get_raw_description()));
     $this->f->add_element(array("type" => "select", "name" => "attr_access", "size" => 1, "options" => $atr->get_access_options(), "value" => $atr->get_access()));
     $this->f->add_element(array("type" => "select", "name" => "attr_group", "size" => 1, "options" => $grp, "value" => $atr->get_group(), "extrahtml" => "onchange='if (this.selectedIndex==" . $grp_cnt . "){this.form.attr_new_group.disabled=false; this.form.attr_new_group.focus();}else{this.form.attr_new_group.disabled=true;}'"));
     $this->f->add_element(array("type" => "text", "name" => "attr_new_group", "size" => 16, "value" => "", "disabled" => true));
     $this->f->add_element(array("type" => "checkbox", "name" => "for_ser", "value" => "1", "checked" => $atr->is_for_ser()));
     $this->f->add_element(array("type" => "checkbox", "name" => "for_serweb", "value" => "1", "checked" => $atr->is_for_serweb()));
     $this->f->add_element(array("type" => "checkbox", "name" => "pr_uri", "value" => "1", "checked" => $atr->is_for_URIs()));
     $this->f->add_element(array("type" => "checkbox", "name" => "pr_user", "value" => "1", "checked" => $atr->is_for_users()));
     $this->f->add_element(array("type" => "checkbox", "name" => "pr_domain", "value" => "1", "checked" => $atr->is_for_domains()));
     $this->f->add_element(array("type" => "checkbox", "name" => "pr_global", "value" => "1", "checked" => $atr->is_for_globals()));
     $this->f->add_element(array("type" => "checkbox", "name" => "multivalue", "value" => "1", "checked" => $atr->is_multivalue()));
     $this->f->add_element(array("type" => "checkbox", "name" => "registration", "value" => "1", "checked" => $atr->fill_on_register()));
     $this->f->add_element(array("type" => "checkbox", "name" => "required", "value" => "1", "checked" => $atr->is_required()));
     $this->f->add_element(array("type" => "hidden", "name" => "edit_id", "value" => $this->edit_id));
     if ($atr->apu_edit()) {
         $this->f->add_extra_submit('extended_settings', $this->opt['form_submit_extended']);
     }
     /* Instantiate page controler object */
     $onload_js = "\n            var at_ctl;\n            at_ctl = new Attr_types_ctl('at_ctl', " . my_JSON_encode($lang_str) . ", '" . js_escape($sess->url($_SERVER['PHP_SELF'] . "?kvrk=" . uniqID("") . "&rename_group=1")) . "');";
     $this->controler->set_onload_js($onload_js);
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     global $lang_str;
     /* get info about edited attribute */
     $attrs =& Attr_types::singleton();
     if (false === ($this->at = $attrs->get_attr_type($this->opt['attr_name']))) {
         $errors[] = "unknown attribute";
         return false;
     }
     /* store items of list */
     $this->item_list = $this->at->get_type_spec();
     if (!$this->item_list) {
         $this->item_list = array();
     }
     $label = $value = "";
     /* if editing, set default values of form elements */
     if ($this->action['action'] == 'edit') {
         $label = isset($this->item_list[$this->item_id]) ? $this->item_list[$this->item_id] : "";
         $value = $this->item_id;
     }
     $this->f->add_element(array("type" => "text", "name" => "at_item_label", "value" => $label, "size" => 16, "maxlength" => 255, "minlength" => 1, "length_e" => $lang_str['fe_not_filled_item_label']));
     $this->f->add_element(array("type" => "text", "name" => "at_item_value", "value" => $value, "size" => 16, "maxlength" => 255, "minlength" => 1, "length_e" => $lang_str['fe_not_filled_item_value']));
     $this->f->add_element(array("type" => "hidden", "name" => "at_item_id", "value" => $this->item_id));
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     global $data, $lang_str, $config;
     parent::create_html_form($errors);
     $an =& $config->attr_names;
     /* get list of customers */
     if (false === ($this->customers = $data->get_customers(array(), $errors))) {
         return false;
     }
     /* if domain id is set */
     if (!is_null($this->id)) {
         $domain_attrs =& Domain_Attrs::singleton($this->id);
         /* get domain attributes */
         if (false === ($this->domain_attrs = $domain_attrs->get_attributes())) {
             return false;
         }
     }
     $options = array();
     $options[] = array('label' => "--- " . $lang_str['none'] . " ---", 'value' => -1);
     foreach ($this->customers as $v) {
         $options[] = array('label' => $v['name'], 'value' => $v['cid']);
     }
     $selected_owner = null;
     /* set preselected customer */
     if (!is_null($this->opt['preselected_customer'])) {
         $selected_owner = $this->opt['preselected_customer'];
     }
     /* if domain id is set */
     if (!is_null($this->id)) {
         /* get owner of the domain */
         if (isset($this->domain_attrs[$an['dom_owner']])) {
             $this->owner['id'] = $this->domain_attrs[$an['dom_owner']];
             $this->owner['name'] = $this->customers[$this->owner['id']]['name'];
             $selected_owner = $this->owner['id'];
         }
         /* get list of the domain names */
         if (false === $this->get_domain_names($errors)) {
             return false;
         }
     }
     $reg =& CReg::singleton();
     $this->f->add_element(array("type" => "text", "name" => "do_new_name", "size" => 16, "maxlength" => 128, "value" => "", "valid_regex" => "^(" . $reg->host . ")?\$", "valid_e" => $lang_str['fe_not_valid_domainname']));
     $this->f->add_extra_submit("do_okey_add", $this->opt['form_add_submit']);
     $this->f->add_element(array("type" => "select", "name" => "do_customer", "size" => 1, "options" => $options, "value" => $selected_owner));
 }
 function create_html_form(&$errors)
 {
     global $config;
     parent::create_html_form($errors);
     $an =& $config->attr_names;
     $ua =& User_Attrs::singleton($this->user_id->get_uid());
     if (false === ($user_attrs = $ua->get_attributes())) {
         return false;
     }
     $this->privileges['is_admin'] = isset($user_attrs[$an['is_admin']]) ? $user_attrs[$an['is_admin']] : false;
     $this->privileges['hostmaster'] = isset($user_attrs[$an['is_hostmaster']]) ? $user_attrs[$an['is_hostmaster']] : false;
     $this->privileges['acl_control'] = isset($user_attrs[$an['acl_control']]) ? $user_attrs[$an['acl_control']] : array();
     /* add form elements */
     foreach ($config->grp_values as $row) {
         $this->f->add_element(array("type" => "checkbox", "name" => "pr_chk_" . $row, "checked" => in_array($row, $this->privileges['acl_control']) ? "1" : "0", "value" => "1"));
     }
     $this->f->add_element(array("type" => "checkbox", "name" => "pr_chk_hostmaster", "checked" => isset($this->privileges['hostmaster'][0]) and $this->privileges['hostmaster'][0] ? "1" : "0", "value" => "1"));
     $this->f->add_element(array("type" => "checkbox", "name" => "pr_chk_is_admin", "checked" => isset($this->privileges['is_admin'][0]) and $this->privileges['is_admin'][0] ? "1" : "0", "value" => "1", "extrahtml" => "onclick='disable_chk(this);'"));
     $js = "\n\t\t\t/* disable other checkboxes if is_admin checkbox is not checked */\n\t\t\n\t\t\tfunction disable_chk(is_admin){\n\t\t\t\tf=is_admin.form;\n\n\t\t\t\tdis = !is_admin.checked;\n\n\t\t\t\tif (f.pr_chk_hostmaster)        f.pr_chk_hostmaster.disabled = dis;\n\t\t";
     foreach ($config->grp_values as $row) {
         $js .= "\n\t\t\t\tif (f.pr_chk_" . $row . ") f.pr_chk_" . $row . ".disabled = dis;";
     }
     $js .= "\n\t\t\t}\n\n\t\t\t/* disable other checkboxes if is_admin checkbox is not checked */\n\t\t\tdisable_chk(document." . $this->opt['form_name'] . ".pr_chk_is_admin);\n\n\t\t";
     $this->controler->set_onload_js($js);
 }
 function create_html_form(&$errors)
 {
     global $data, $config;
     parent::create_html_form($errors);
     $attr_types =& Attr_types::singleton();
     //get list of attributes
     if (false === ($this->attr_types =& $attr_types->get_attr_types())) {
         return false;
     }
     switch ($this->opt['attrs_kind']) {
         case "uri":
             // get uri_attrs
             $this->uri_attrs =& Uri_Attrs::singleton($this->uri_scheme, $this->uri_uname, $this->uri_did);
             if (false === ($uri_attrs = $this->uri_attrs->get_attributes())) {
                 return false;
             }
         case "user":
             // get user_attrs
             $this->user_attrs =& User_Attrs::singleton($this->uid);
             if (false === ($user_attrs = $this->user_attrs->get_attributes())) {
                 return false;
             }
         case "domain":
             // get domain_attrs
             $this->domain_attrs =& Domain_Attrs::singleton($this->did);
             if (false === ($domain_attrs = $this->domain_attrs->get_attributes())) {
                 return false;
             }
         case "global":
             // get global_attrs
             $this->global_attrs =& Global_Attrs::singleton();
             if (false === ($global_attrs = $this->global_attrs->get_attributes())) {
                 return false;
             }
     }
     $this->attr_values = array();
     foreach ($this->attr_types as $k => $v) {
         if ($this->opt['attrs_kind'] == 'uri' and !$this->attr_types[$k]->is_for_URIs()) {
             continue;
         } elseif ($this->opt['attrs_kind'] == 'user' and !$this->attr_types[$k]->is_for_users()) {
             continue;
         } elseif ($this->opt['attrs_kind'] == 'domain' and !$this->attr_types[$k]->is_for_domains()) {
             continue;
         } elseif ($this->opt['attrs_kind'] == 'global' and !$this->attr_types[$k]->is_for_globals()) {
             continue;
         }
         switch ($this->opt['attrs_kind']) {
             case "uri":
                 if (isset($uri_attrs[$k])) {
                     $this->attr_values[$k] = $uri_attrs[$k];
                     break;
                 }
             case "user":
                 if (isset($user_attrs[$k])) {
                     $this->attr_values[$k] = $user_attrs[$k];
                     break;
                 }
             case "domain":
                 if (isset($domain_attrs[$k])) {
                     $this->attr_values[$k] = $domain_attrs[$k];
                     break;
                 }
             case "global":
                 if (isset($global_attrs[$k])) {
                     $this->attr_values[$k] = $global_attrs[$k];
                     break;
                 }
         }
         /*
          *	If the value of attribute is not found, set it as null
          */
         if (!isset($this->attr_values[$k])) {
             $this->attr_values[$k] = null;
         }
     }
     // if option 'atributes' is not given, that mean we will work with all attributes
     if (empty($this->opt['attributes'])) {
         foreach ($this->attr_values as $k => $v) {
             // work only with attributes which have access to read
             if ($this->access_to_read($k)) {
                 $this->opt['attributes'][] = $k;
             }
         }
     } else {
         foreach ($this->opt['attributes'] as $k => $v) {
             if (!array_key_exists($v, $this->attr_values)) {
                 log_errors(PEAR::RaiseError("Attribute named '" . $v . "' does not exists"), $errors);
                 unset($this->opt['attributes'][$k]);
             }
         }
     }
     //except unwanted arguments
     $this->opt['attributes'] = array_diff($this->opt['attributes'], $this->opt['exclude_attributes']);
     //save avaiable attrs before are filtered by group
     $this->all_avaiable_attrs = $this->opt['attributes'];
     if (!empty($this->opt['attrs_group'])) {
         foreach ($this->opt['attributes'] as $k => $v) {
             // work only with attributes from specified group
             if ($this->attr_types[$v]->get_group() != $this->opt['attrs_group']) {
                 unset($this->opt['attributes'][$k]);
             }
         }
     }
     //set options to attributes
     foreach ($this->opt['attributes'] as $att) {
         if (isset($this->opt['attrs_options'][$att]) and is_array($this->opt['attrs_options'][$att])) {
             foreach ($this->opt['attrs_options'][$att] as $k => $v) {
                 $this->attr_types[$att]->set_opt($k, $v);
             }
         }
     }
     // add elements to form object
     foreach ($this->opt['attributes'] as $att) {
         if (!$this->access_to_change($att)) {
             continue;
         }
         //if attribute cannot be changed, do not add it ot the form
         $opt = array();
         $opt['err_msg'] = isset($this->opt['error_messages'][$att]) ? $this->opt['error_messages'][$att] : null;
         $this->attr_types[$att]->form_element($this->f, $this->attr_values[$att], $opt);
         $this->js_on_subm .= $this->attr_types[$att]->validation_js_before();
         $this->js_on_subm_2 .= $this->attr_types[$att]->validation_js_after();
     }
     if (!empty($this->opt['validate_js_funct'])) {
         $this->js_on_subm_2 .= $this->opt['validate_js_funct'];
     }
 }
Exemple #20
0
 function create_html_form(&$errors)
 {
     global $lang_str;
     parent::create_html_form($errors);
     $cookie_uname = "";
     if (isset($_COOKIE['serwebuser'])) {
         $cookie_uname = $_COOKIE['serwebuser'];
     }
     $this->f->add_element(array("type" => "text", "name" => "uname", "size" => 20, "maxlength" => 50, "value" => $cookie_uname, "minlength" => 1, "length_e" => $lang_str['fe_not_filled_username'], "extrahtml" => "autocomplete='off' " . ($this->opt['fully_qualified_name_on_login'] ? " onBlur='login_completion(this)'" : "")));
     $this->f->add_element(array("type" => "text", "name" => "passw", "value" => "", "size" => 20, "maxlength" => 25, "pass" => 1));
     $this->f->add_element(array("type" => "checkbox", "name" => "remember_uname", "value" => "1", "checked" => $cookie_uname ? 1 : 0));
 }
 function create_html_form(&$errors)
 {
     global $lang_str, $data;
     parent::create_html_form($errors);
     $this->f->add_element(array("type" => "text", "name" => "pu_passwd", "value" => "", "size" => 16, "maxlength" => 25, "pass" => 1));
     $this->f->add_element(array("type" => "text", "name" => "pu_passwd_r", "value" => "", "size" => 16, "maxlength" => 25, "pass" => 1));
 }
 /**
  *  create html form 
  *
  *  @param array $errors    array with error messages
  *  @return null            FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     $f_options = $this->f->array_to_opt($this->opt['timeouts']);
     $this->f->add_element(array("type" => "select", "name" => "refresh_timeout", "value" => $this->session['timeout'], "size" => 1, "options" => $f_options, "extra_html" => "onchange='this.form.submit();'"));
     $this->f->add_element(array("type" => "hidden", "name" => "refresh_updated", "value" => 1));
     if (is_numeric($this->session['timeout']) and (int) $this->session['timeout'] > 0) {
         $onload_js = "\n                setTimeout('location.reload(true);', " . 1000 * (int) $this->session['timeout'] . ");\n            ";
         $this->controler->set_onload_js($onload_js);
     }
 }
 function create_html_form(&$errors)
 {
     global $lang_str;
     parent::create_html_form($errors);
     $this->f->add_element(array("type" => "text", "name" => "ul_sip_address", "size" => 16, "maxlength" => 128, "minlength" => 1, "length_e" => $lang_str['fe_not_filled_sip'], "valid_regex" => "^" . $this->controler->reg->sip_address . "\$", "valid_e" => $lang_str['fe_not_valid_sip'], "extrahtml" => "onBlur='sip_address_completion(this)'"));
     $options = array(array("label" => $lang_str['contact_expire_hour'], "value" => 3600), array("label" => $lang_str['contact_expire_day'], "value" => 86400), array("label" => $lang_str['contact_will_not_expire'], "value" => UL_FOREVER));
     $this->f->add_element(array("type" => "select", "name" => "ul_expires", "options" => $options, "size" => 1, "value" => 3600));
 }
Exemple #24
0
 function create_html_form(&$errors)
 {
     global $config;
     parent::create_html_form($errors);
     $an =& $config->attr_names;
     $ua =& User_Attrs::singleton($this->user_id->get_uid());
     if (false === ($this->acl = $ua->get_attribute($an['acl']))) {
         return false;
     }
     if (is_null($this->acl)) {
         $this->acl = array();
     }
     if ($this->opt['allow_edit']) {
         /* get admin ACL control privileges */
         $user_attrs =& User_Attrs::singleton($_SESSION['auth']->get_uid());
         if (false === ($this->acl_control = $user_attrs->get_attribute($an['acl_control']))) {
             return false;
         }
         if (is_null($this->acl_control)) {
             $this->acl_control = array();
         }
         /* add form elements */
         foreach ($this->acl_control as $row) {
             $this->f->add_element(array("type" => "checkbox", "name" => "acl_chk_" . $row, "checked" => in_array($row, $this->acl) ? "1" : "0", "value" => "1"));
         }
     }
 }
 function create_html_form(&$errors)
 {
     global $lang_str, $data, $config;
     parent::create_html_form($errors);
     if (is_null($this->opt['register_in_domain']) and false === $this->add_domain_to_form()) {
         return false;
     }
     if (false === $this->add_attrs_to_form()) {
         return false;
     }
     if ($this->opt['terms_file']) {
         /* read txt files */
         $t = read_lang_txt_file($this->opt['terms_file'], "txt", $_SESSION['lang'], array(array("domain", $config->domain)));
         if ($t !== false) {
             $terms = $t['body'];
         }
         $this->f->add_element(array("type" => "textarea", "name" => "terms", "value" => $terms, "rows" => 8, "cols" => 38, "wrap" => "soft"));
         $this->f->add_element(array("type" => "checkbox", "name" => "accept", "value" => 1));
         $this->js_after .= "\n\t\t\t\t\t\tif (!f.accept.checked){\n\t\t\t\t\t\t\talert('" . addslashes($lang_str['fe_not_accepted_terms']) . "');\n\t\t\t\t\t\t\tf.accept.focus();\n\t\t\t\t\t\t\treturn (false);\n\t\t\t\t\t\t}";
     }
     $did = null;
     if (!is_null($this->opt['register_in_domain'])) {
         $did = $this->opt['register_in_domain'];
     } elseif (isset($_POST['domain'])) {
         $did = $_POST['domain'];
     }
     if (false === ($this->uname_assign_mode = $this->get_uname_assign_mode($did))) {
         return false;
     }
     $this->f->add_element(array("type" => "text", "name" => "uname", "size" => 23, "maxlength" => 50, "value" => "", "minlength" => $this->uname_assign_mode == "email" ? 0 : 1, "length_e" => $lang_str['fe_not_filled_username'], "valid_regex" => $this->uname_assign_mode == "email" ? ".*" : $config->username_regex, "valid_e" => $lang_str['fe_uname_not_follow_conventions'], "extrahtml" => "autocomplete='off'"));
     if ($this->opt['choose_passw']) {
         $this->f->add_element(array("type" => "text", "name" => "passwd", "value" => "", "size" => 23, "maxlength" => 25, "pass" => 1, "minlength" => 1, "length_e" => $lang_str['fe_not_filled_password']));
         $this->f->add_element(array("type" => "text", "name" => "passwd_r", "value" => "", "size" => 23, "maxlength" => 25, "pass" => 1));
         $this->js_after .= "\n\t\t\t\t\t\tif (f.passwd.value!=f.passwd_r.value){\n\t\t\t\t\t\t\talert('" . addslashes($lang_str['fe_passwords_not_match']) . "');\n\t\t\t\t\t\t\tf.passwd.focus();\n\t\t\t\t\t\t\treturn (false);\n\t\t\t\t\t\t}";
     }
 }
 /**
  *	create html form 
  *
  *	@param array $errors	array with error messages
  *	@return null			FALSE on failure
  */
 function create_html_form(&$errors)
 {
     global $lang_str, $data;
     parent::create_html_form($errors);
     if ($this->action['action'] == 'edit') {
         $opt = array('single' => $this->act_id);
         if (false === ($customer = $data->get_customers($opt, $errors))) {
             return false;
         }
         $this->customer = reset($customer);
         //return first value of array
     }
     $reg = Creg::singleton();
     $this->f->add_element(array("type" => "text", "name" => "cu_name", "size" => 16, "maxlength" => 128, "value" => isset($this->customer['name']) ? $this->customer['name'] : "", "minlength" => 1, "length_e" => $lang_str['fe_not_customer_name']));
     $this->f->add_element(array("type" => "text", "name" => "cu_address", "size" => 16, "maxlength" => 255, "value" => isset($this->customer['address']) ? $this->customer['address'] : ""));
     $this->f->add_element(array("type" => "text", "name" => "cu_phone", "size" => 16, "maxlength" => 64, "value" => isset($this->customer['phone']) ? $this->customer['phone'] : ""));
     $this->f->add_element(array("type" => "text", "name" => "cu_email", "size" => 16, "maxlength" => 255, "value" => isset($this->customer['email']) ? $this->customer['email'] : "", "valid_regex" => "(" . $reg->email . ")|(^\$)", "valid_e" => $lang_str['fe_not_valid_email']));
     $this->f->add_element(array("type" => "hidden", "name" => "cu_id", "value" => $this->act_id));
 }
 /**
  *  create html form 
  *
  *  @param array $errors    array with error messages
  *  @return null            FALSE on failure
  */
 function create_html_form(&$errors)
 {
     global $lang_str;
     parent::create_html_form($errors);
     $reg =& CReg::singleton();
     $this->f->add_element(array("type" => "text", "name" => "domainname", "size" => 16, "maxlength" => 128, "value" => "", "valid_regex" => "^(" . $reg->hostname . ")?\$", "valid_e" => $lang_str['fe_not_valid_domainname']));
 }
 /**
  *  create html form 
  *
  *  @param array $errors    array with error messages
  *  @return null            FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     $ex_opts = array(array("value" => "update", "label" => "Update current attribute type"), array("value" => "skip", "label" => "Replace current attribute type"));
     $js = ' if (this.checked){
                 this.form.at_exists[0].disabled=true;
                 this.form.at_exists[1].disabled=true;
             }
             else{
                 this.form.at_exists[0].disabled=false;
                 this.form.at_exists[1].disabled=false;
             } ';
     $this->f->add_element(array("type" => "file", "name" => "at_file", "value" => ""));
     $this->f->add_element(array("type" => "checkbox", "name" => "at_purge", "value" => "1", "extra_html" => "onclick='" . $js . "'"));
     $this->f->add_element(array("type" => "radio", "name" => "at_exists", "value" => "skip", "options" => $ex_opts));
 }
 function create_html_form(&$errors)
 {
     global $lang_str;
     parent::create_html_form($errors);
     $max_len_msg = addslashes($lang_str['max_length_of_im']);
     $max_len = $this->opt['im_length'];
     if (isset($_POST['im_instant_message'])) {
         $num_chars = $max_len - strlen($_POST['im_instant_message']);
         // element is disabled, set its value manualy in order to form->load_defaults work correctly
         $_POST['im_num_chars'] = $num_chars;
         $_REQUEST['im_num_chars'] = $num_chars;
     } else {
         $num_chars = $max_len;
     }
     $this->f->add_element(array("type" => "text", "name" => "im_sip_address", "value" => isset($_GET['im_sip_addr']) ? $_GET['im_sip_addr'] : "", "size" => 16, "maxlength" => 128, "valid_regex" => "^" . $this->controler->reg->sip_address . "\$", "valid_e" => $lang_str['fe_not_valid_sip'], "extrahtml" => "onBlur='sip_address_completion(this)'"));
     $this->f->add_element(array("type" => "textarea", "name" => "im_instant_message", "rows" => 6, "cols" => 40, "wrap" => "soft", "extrahtml" => "onBlur='im_countit(this.form, " . $max_len . ", \"" . $max_len_msg . "\");' " . "onChange='im_countit(this.form, " . $max_len . ", \"" . $max_len_msg . "\");' " . "onClick='im_countit(this.form, " . $max_len . ", \"" . $max_len_msg . "\");' " . "onFocus='im_countit(this.form, " . $max_len . ", \"" . $max_len_msg . "\");' " . "onKeyUp='im_countit(this.form, " . $max_len . ", \"" . $max_len_msg . "\");'"));
     $this->f->add_element(array("type" => "text", "name" => "im_num_chars", "value" => $num_chars, "size" => 5, "maxlength" => 5, "extrahtml" => "disabled class='swFormElementInvisible'"));
 }
 /**
  *  create html form 
  *
  *  @param array $errors    array with error messages
  *  @return null            FALSE on failure
  */
 function create_html_form(&$errors)
 {
     parent::create_html_form($errors);
     global $lang_str;
     $this->form_elements = $this->base_apu->get_filter_form();
     /* if option 'filter_items' is set, 
        limit list of form elements to only items specified by this option */
     if ($this->opt['filter_items']) {
         foreach ($this->form_elements as $k => $v) {
             if (!in_array($this->form_elements[$k]['name'], $this->opt['filter_items'])) {
                 unset($this->form_elements[$k]);
             }
         }
     }
     /* if option 'exclude_filter_items' is set,
        remove items specified by this option from the list of form elements */
     if ($this->opt['exclude_filter_items']) {
         foreach ($this->form_elements as $k => $v) {
             if (in_array($this->form_elements[$k]['name'], $this->opt['exclude_filter_items'])) {
                 unset($this->form_elements[$k]);
             }
         }
     }
     if ($this->session['f_field']) {
         $this->filter_applied = true;
     }
     $f_options = array(array("value" => "", "label" => "- None -"));
     foreach ($this->form_elements as $k => $v) {
         $f_options[] = array("value" => $v['name'], "label" => isset($v['label']) ? $v['label'] : $v['name']);
     }
     $op_options = array(array("value" => "=", "label" => "="), array("value" => "!=", "label" => "!="), array("value" => ">", "label" => ">"), array("value" => ">=", "label" => ">="), array("value" => "<", "label" => "<"), array("value" => "<=", "label" => "<="), array("value" => "like", "label" => "LIKE"), array("value" => "is_null", "label" => "IS NULL"));
     $this->f->add_element(array("type" => "select", "name" => "filter_field", "value" => $this->session['f_field'], "size" => 1, "options" => $f_options, "extra_html" => "onchange='if (this.selectedIndex==0) {this.form.filter_op.disabled=true;this.form.filter_val.disabled=true; if (typeof(this.form.filter_reset) != \"undefined\") this.form.filter_reset.disabled=true;} else {this.form.filter_op.disabled=false;this.form.filter_val.disabled=false; if (typeof(this.form.filter_reset) != \"undefined\") this.form.filter_reset.disabled=false;}'"));
     $this->f->add_element(array("type" => "select", "name" => "filter_op", "value" => $this->session['f_op'], "size" => 1, "options" => $op_options, "disabled" => !(bool) $this->session['f_field']));
     $this->f->add_element(array("type" => "text", "name" => "filter_val", "value" => $this->session['f_val'], "disabled" => !(bool) $this->session['f_field']));
     $this->f->add_element(array("type" => "button", "name" => "filter_reset", "button_type" => "submit", "content" => $lang_str['b_reset'], "extra_html" => "onclick='this.form.filter_field.selectedIndex=0; this.form.filter_field.onchange();'", "disabled" => !(bool) $this->session['f_field']));
     $this->f->add_element(array("type" => "hidden", "name" => "filter_updated", "value" => 1));
 }