Changeset 10240
- Timestamp:
- 09/05/10 03:17:11 (3 years ago)
- Files:
-
- contributed_modules/modules/endpointman/.htaccess (deleted)
- contributed_modules/modules/endpointman/config.php (modified) (1 diff)
- contributed_modules/modules/endpointman/includes/advanced.inc (modified) (2 diffs)
- contributed_modules/modules/endpointman/includes/ajax_select.php (modified) (2 diffs)
- contributed_modules/modules/endpointman/includes/devices_manager.inc (modified) (9 diffs)
- contributed_modules/modules/endpointman/includes/export.php (modified) (1 diff)
- contributed_modules/modules/endpointman/includes/functions.inc (modified) (16 diffs)
- contributed_modules/modules/endpointman/includes/template_manager.inc (modified) (1 diff)
- contributed_modules/modules/endpointman/install.php (modified) (6 diffs)
- contributed_modules/modules/endpointman/module.xml (modified) (1 diff)
- contributed_modules/modules/endpointman/templates/devices_manager.html (modified) (9 diffs)
- contributed_modules/modules/endpointman/templates/global_header.html (modified) (2 diffs)
- contributed_modules/modules/endpointman/templates/template_editor.html (modified) (3 diffs)
- contributed_modules/modules/endpointman/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
contributed_modules/modules/endpointman/config.php
r10233 r10240 13 13 } 14 14 15 if(file_exists('/tftpboot')) { 16 if(!is_writeable('/tftpboot')) { 17 die(_('/tftpboot is not writable')); 18 } 19 } else { 20 die(_("Please create /tftpboot, even if you won't use it")); 21 } 22 23 if(phpversion < '5.0.0') { 24 die(_('PHP Version MUST be greater than 5!')); 15 if(phpversion < '5.1.0') { 16 die(_('PHP Version MUST be greater than 5.1.0!')); 25 17 } 26 18 contributed_modules/modules/endpointman/includes/advanced.inc
r10233 r10240 23 23 switch($_REQUEST['subpage']) { 24 24 case "iedl": 25 $amp_serial = base64_encode(serialize($amp_conf));26 $amp_serial = base64_encode(serialize($amp_conf));27 $temp_amp['amp_serial'] = $amp_serial;28 $temp_amp = base64_encode(serialize($temp_amp));29 30 25 $tpl->assign("exporter_address", "config.php?type=tool&display=epm_config&quietmode=1&handler=file&file=export.html.php&module=endpointman&rand=".rand()); 31 26 //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) … … 73 68 $description = ''; 74 69 } 75 $sql = "INSERT INTO endpointman_mac_list (mac, model , ext, description) VALUES ('".$mac."','".$model_id."','".$ext."','".$description."')";70 $sql = "INSERT INTO endpointman_mac_list (mac, model) VALUES ('".$mac."','".$model_id."')"; 76 71 $endpoint->db->query($sql); 72 73 $sql = 'SELECT last_insert_id()'; 74 $ext_id =& $endpoint->db->getOne($sql); 75 76 $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$ext_id."', '".$ext."', '1','".$description."')"; 77 $endpoint->db->query($sql); 78 77 79 $message .= "Inserted Mac Address ".$mac."<br/>"; 78 80 } else { contributed_modules/modules/endpointman/includes/ajax_select.php
r10218 r10240 24 24 } elseif ($_REQUEST['atype'] == "model_clone") { 25 25 $sql = "SELECT endpointman_model_list.id, endpointman_model_list.model as model FROM endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND product_id = '". $_GET['id']."'"; 26 } elseif ($_REQUEST['atype'] == "lines") { 27 $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '". $_GET['id']."'"; 26 28 } 27 29 … … 38 40 } 39 41 40 $result = $db->getAll($sql,array(), DB_FETCHMODE_ASSOC); 42 if($_REQUEST['atype'] == "lines") { 43 $count = $db->getOne($sql); 44 for($z=0;$z<$count;$z++) { 45 $result[$z]['id'] = $z + 1; 46 $result[$z]['model'] = $z + 1; 47 } 48 } else { 49 $result = $db->getAll($sql,array(), DB_FETCHMODE_ASSOC); 50 } 51 41 52 42 53 foreach($result as $row) { contributed_modules/modules/endpointman/includes/devices_manager.inc
r10233 r10240 68 68 } 69 69 70 $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, ` ext`, `description`, `custom_cfg_data`, `custom_cfg_template`) VALUES ('".$mac."', '".$_REQUEST['model_list']."', '".$_REQUEST['ext_list']."', '".$name."', '".$custom_cfg_data."', '".$_REQUEST['template_list']."')";70 $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `global_custom_cfg_data`, `template_id`) VALUES ('".$mac."', '".$_REQUEST['model_list']."', '".$custom_cfg_data."', '".$_REQUEST['template_list']."')"; 71 71 $endpoint->db->query($sql); 72 72 73 $sql = 'SELECT id FROM endpointman_mac_list WHERE ext ='. $_REQUEST['ext_list'];73 $sql = 'SELECT last_insert_id()'; 74 74 $ext_id =& $endpoint->db->getOne($sql); 75 76 if(!isset($_REQUEST['line_list'])) { 77 $_REQUEST['line_list'] = 1; 78 } 79 80 $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$ext_id."', '".$_REQUEST['ext_list']."', '".$_REQUEST['line_list']."', '".$name."')"; 81 $endpoint->db->query($sql); 75 82 76 83 $mac_id = $endpoint->get_phone_info($ext_id); … … 104 111 $name=$endpoint->db->getOne($sql); 105 112 106 $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = '".$_REQUEST['template_list']."', model = '".$_REQUEST['model_list']."', ext = ".$_REQUEST['ext_list'].", description = '".$name."' WHERE id = ". $_REQUEST['edit_id']; 113 $sql = "UPDATE endpointman_mac_list SET template_id = '".$_REQUEST['template_list']."', model = '".$_REQUEST['model_list']."' WHERE id = ". $_REQUEST['edit_id']; 114 $endpoint->db->query($sql); 115 116 $sql = "UPDATE endpointman_line_list SET ext = ".$_REQUEST['ext_list'].", description = '".$name."' WHERE mac_id = ". $_REQUEST['edit_id']; 107 117 $endpoint->db->query($sql); 108 118 … … 116 126 117 127 $sql = "DELETE FROM endpointman_mac_list WHERE id=".$_REQUEST['id']; 128 $endpoint->db->query($sql); 129 $sql = "DELETE FROM endpointman_line_list WHERE mac_id=".$_REQUEST['id']; 118 130 $endpoint->db->query($sql); 119 131 } elseif((isset($_REQUEST['button_add_selected_phones'])) AND (isset($_REQUEST['add']))) { … … 122 134 $num = $_REQUEST['add'][$i]; 123 135 if($mac = $endpoint->mac_check_clean($_REQUEST['mac_'.$num])) { 124 $sql = "SELECT * FROM endpointman_ mac_list WHERE ext = ".$_REQUEST['ext_list_'.$num];136 $sql = "SELECT * FROM endpointman_line_list WHERE ext = ".$_REQUEST['ext_list_'.$num]; 125 137 $res =& $endpoint->db->query($sql); 126 138 $count_macs = $res->numRows(); … … 130 142 131 143 132 $sql = 'SELECT endpointman_product_list. * , endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \''.$_REQUEST['model_list_'.$num].'\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id';133 $row =& $endpoint->db->getAll($sql,array(),DB_FETCHMODE_ASSOC);134 135 136 $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, ` ext`, `description`) VALUES ('".$mac."', '".$_REQUEST['model_list_'.$num]."', '".$_REQUEST['ext_list_'.$num]."', '".$name."')";144 //$sql = 'SELECT endpointman_product_list. * , endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \''.$_REQUEST['model_list_'.$num].'\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; 145 //$row =& $endpoint->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); 146 147 148 $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `template_id`) VALUES ('".$mac."', '".$_REQUEST['model_list_'.$num]."', '0')"; 137 149 $endpoint->db->query($sql); 138 150 139 $sql = 'SELECT id FROM endpointman_mac_list WHERE ext ='. $_REQUEST['ext_list_'.$num]; 140 $mac_new_id =& $endpoint->db->getOne($sql,array(),DB_FETCHMODE_ASSOC); 141 142 $row_new = $endpoint->get_phone_info($mac_new_id); 151 $sql = 'SELECT last_insert_id()'; 152 $ext_id =& $endpoint->db->getOne($sql); 153 154 if(!isset($_REQUEST['line_list_'.$num])) { 155 $_REQUEST['line_list_'.$num] = 1; 156 } 157 158 $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$ext_id."', '".$_REQUEST['ext_list_'.$num]."', '".$_REQUEST['line_list_'.$num]."', '".$name."')"; 159 $endpoint->db->query($sql); 160 161 $row_new = $endpoint->get_phone_info($ext_id); 143 162 $endpoint->prepare_configs($row_new); 144 163 … … 170 189 foreach($_REQUEST['selected'] as $key => $data) { 171 190 $sql = "DELETE FROM endpointman_mac_list WHERE id=".$_REQUEST['selected'][$key]; 191 $endpoint->db->query($sql); 192 $sql = "DELETE FROM endpointman_line_list WHERE mac_id=".$_REQUEST['selected'][$key]; 172 193 $endpoint->db->query($sql); 173 194 } … … 283 304 } 284 305 285 $sql = 'SELECT endpointman_mac_list.id , endpointman_mac_list.mac , endpointman_model_list.model, endpointman_model_list.enabled , endpointman_ mac_list.ext , endpointman_mac_list.description , endpointman_brand_list.name, endpointman_mac_list.custom_cfg_data, endpointman_mac_list.custom_cfg_templateFROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list WHERE ( endpointman_model_list.id = endpointman_mac_list.model ) AND ( endpointman_model_list.brand = endpointman_brand_list.id )';306 $sql = 'SELECT endpointman_mac_list.id , endpointman_mac_list.mac , endpointman_model_list.model, endpointman_model_list.enabled , endpointman_brand_list.name, endpointman_mac_list.global_custom_cfg_data, endpointman_mac_list.template_id FROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list WHERE ( endpointman_model_list.id = endpointman_mac_list.model ) AND ( endpointman_model_list.brand = endpointman_brand_list.id )'; 286 307 287 308 $devices_list =& $endpoint->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); … … 290 311 $i = 0; 291 312 $list = array(); 292 foreach($devices_list as $row) { #Displays the phones in the database with edit and delete buttons 293 $list[$i] = $row; 294 if (($row['custom_cfg_template'] == 0) && (isset($row['custom_cfg_data'])) ) { 295 $list[$i]['template_name'] = "Custom-".$row['mac']; 296 } elseif((!isset($row['custom_cfg_data'])) && ($row['custom_cfg_template'] == 0)) { 297 $list[$i]['template_name'] = "N/A"; 298 } else { 299 $sql = "SELECT name FROM endpointman_template_list WHERE id =".$row['custom_cfg_template']; 300 $row2 =& $endpoint->db->getOne($sql); 301 $list[$i]['template_name'] = $row2; 302 } 303 if (!$row['enabled']) { 304 $list[$i]['model'] = $row['model']."<i>(Disabled)</i>"; 313 foreach($devices_list as $devices_row) { 314 $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = '.$devices_row['id']; 315 $line_list =& $endpoint->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); 316 $list[$i] = $devices_row; 317 $z = 0; 318 foreach($line_list as $line_row) { 319 $list[$i]['ext'] = $line_row['ext']; 320 $list[$i]['line'] = $line_row['line']; 321 $list[$i]['description'] = $line_row['description']; 322 if (($devices_row['template_id'] == 0) && (isset($devices_row['global_custom_cfg_data'])) ) { 323 $list[$i]['template_name'] = "Custom-".$devices_row['mac']; 324 } elseif((!isset($devices_row['custom_cfg_data'])) && ($devices_row['template_id'] == 0)) { 325 $list[$i]['template_name'] = "N/A"; 326 } else { 327 $sql = "SELECT name FROM endpointman_template_list WHERE id =".$devices_row['template_id']; 328 $template_name =& $endpoint->db->getOne($sql); 329 $list[$i]['template_name'] = $template_name; 330 } 331 if (!$devices_row['enabled']) { 332 $list[$i]['model'] = $devices_row['model']."<i>(Disabled)</i>"; 333 } 334 $z++; 305 335 } 306 336 $i++; … … 375 405 $tpl->assign("models_ava", $ma); 376 406 $tpl->assign("display_ext", $endpoint->displayExtension($edit_row['ext'])); 377 $tpl->assign("display_templates", $endpoint->display_templates($edit_row['product_id'],$edit_row[' custom_cfg_template']));407 $tpl->assign("display_templates", $endpoint->display_templates($edit_row['product_id'],$edit_row['template_id'])); 378 408 $tpl->assign("edit_id", $edit_row['id']); 379 409 } else { contributed_modules/modules/endpointman/includes/export.php
r10219 r10240 18 18 $outstream = fopen("php://output",'w'); 19 19 20 $sql = 'SELECT endpointman_mac_list.mac, endpointman_brand_list.name, endpointman_model_list.model, endpointman_ mac_list.ext FROM endpointman_mac_list, endpointman_model_list, endpointman_brand_list WHEREendpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.brand = endpointman_brand_list.id';20 $sql = 'SELECT endpointman_mac_list.mac, endpointman_brand_list.name, endpointman_model_list.model, endpointman_line_list.ext FROM endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_line_list WHERE endpointman_line_list.mac_id = endpointman_mac_list.id AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.brand = endpointman_brand_list.id'; 21 21 22 22 $result = $endpoint->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); contributed_modules/modules/endpointman/includes/functions.inc
r10233 r10240 157 157 if($res->numRows()) { 158 158 //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, 159 $sql = "SELECT endpointman_mac_list.config_files_override, endpointman_mac_list. user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.ext, endpointman_mac_list.custom_cfg_template, endpointman_mac_list.custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, users.name as description, sip.data as secret FROM endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list, sip, users WHERE endpointman_mac_list.id = ".$mac_id." AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.ext = sip.id AND sip.keyword = 'secret' AND endpointman_mac_list.ext = users.extension";159 $sql = "SELECT endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_line_list.ext, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, users.name as description, sip.data as secret FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list, sip, users WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND endpointman_line_list.ext = users.extension AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = ". $mac_id; 160 160 161 161 $phone_info =& $this->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); … … 166 166 167 167 //If there is a template associated with this phone then pull that information and put it into the array 168 if ($phone_info[' custom_cfg_template'] > 0) {169 $sql = "SELECT name, custom_cfg_data, config_files_override FROM endpointman_template_list WHERE id = ".$phone_info['custom_cfg_template'];168 if ($phone_info['template_id'] > 0) { 169 $sql = "SELECT name, global_custom_cfg_data, config_files_override FROM endpointman_template_list WHERE id = ".$phone_info['template_id']; 170 170 171 171 $phone_info['template_data'] =& $this->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); … … 217 217 //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) 218 218 if($custom == 0) { 219 $sql = "SELECT endpointman_model_list.model as model_name, endpointman_ product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = ".$id;220 } else { 221 $sql = "SELECT endpointman_model_list.model as model_name, endpointman_ product_list.config_files, endpointman_mac_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=".$id."AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id";219 $sql = "SELECT endpointman_model_list.model as model_name, endpointman_template_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = ".$id; 220 } else { 221 $sql = "SELECT endpointman_model_list.model as model_name, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_line_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id=".$id." AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; 222 222 } 223 223 … … 241 241 $tpl->assign("models_ava", $ma); 242 242 } 243 244 $tpl->assign("area_ava", $this->areaAvailable($row['model_id'])); 243 245 //Start the display of the html file in the product folder 244 246 if($row['config_files_override'] == "") { … … 278 280 279 281 if($row['template_data'] != "") { 280 $out = $this->generate_gui_html($row['template_data'],$row[' custom_cfg_data'],TRUE);282 $out = $this->generate_gui_html($row['template_data'],$row['global_custom_cfg_data'],TRUE); 281 283 } else { 282 284 echo "No Template Data has been defined for this Product<br />"; … … 312 314 //No custom template so let's pull the default values for this model into the custom_cfg_data array and populate it from there so that we won't have to make two completely different functions below 313 315 foreach($cfg_data as $key => $data) { 314 if(($data['type'] != 'group') && ($data['type'] != 'break') ) {316 if(($data['type'] != 'group') && ($data['type'] != 'break') && ($data['type'] != 'loop')) { 315 317 $key_default = str_replace('$','',$data['variable']); 316 318 if(!is_array($data['default_value'])) { … … 350 352 $template_variables_array[$group_count]['title'] = $cfg_data[$i]['description']; 351 353 $variables_count = 0; 352 } elseif ($cfg_data[$i]['type'] == "input") { 353 if((!$admin) && (isset($user_cfg_data[$key]['value']))) { 354 $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; 355 } 356 $template_variables_array[$group_count]['data'][$variables_count]['type'] = "input"; 357 $template_variables_array[$group_count]['data'][$variables_count]['key'] = $key; 358 $template_variables_array[$group_count]['data'][$variables_count]['value'] = $custom_cfg_data[$key]['value']; 359 $template_variables_array[$group_count]['data'][$variables_count]['description'] = $cfg_data[$i]['description']; 360 } elseif ($cfg_data[$i]['type'] == "radio") { 361 if((!$admin) && (isset($user_cfg_data[$key]['value']))) { 362 $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; 363 } 364 $num = $custom_cfg_data[$key]['value']; 365 $template_variables_array[$group_count]['data'][$variables_count]['type'] = "radio"; 366 $template_variables_array[$group_count]['data'][$variables_count]['key'] = $key; 367 $template_variables_array[$group_count]['data'][$variables_count]['description'] = $cfg_data[$i]['description']; 368 $z = 0; 369 while($z < count($cfg_data[$i]['data'])) { 370 $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['key'] = $key; 371 $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['value'] = $cfg_data[$i]['data'][$z]['value']; 372 $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['description'] = $cfg_data[$i]['data'][$z]['text']; 373 if ($cfg_data[$i]['data'][$z]['value'] == $num) { 374 $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['checked'] = 'checked'; 354 } elseif ($cfg_data[$i]['type'] == "loop") { 355 $group_count++; 356 $template_variables_array[$group_count]['title'] = $cfg_data[$i]['description']; 357 $loop_start = $cfg_data[$i]['loop_start']; 358 $loop_end = $cfg_data[$i]['loop_end']; 359 $variables_count = 0; 360 for($a=$loop_start;$a<=$loop_end;$a++) { 361 foreach($cfg_data[$i]['data']['item'] as $items) { 362 if(isset($items['description'])) { 363 $items['description'] = str_replace('{$count}',$a,$items['description']); 364 $key = str_replace('$','',$items['variable'])."_".$a; 365 if(array_key_exists($key,$custom_cfg_data)) { 366 $custom_cfg_data[$key]['value'] = $custom_cfg_data[$key][$a]; 367 } else { 368 $custom_cfg_data[$key]['value'] = ''; 369 } 370 } 371 $items[$i] = $items; 372 $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($i,$items,$key,$custom_cfg_data); 373 $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; 374 $variables_count++; 375 375 } 376 $z++; 377 } 378 } elseif ($cfg_data[$i]['type'] == "list") { 379 if((!$admin) && (isset($user_cfg_data[$key]['value']))) { 380 $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; 381 } 382 $num = $custom_cfg_data[$key]['value']; 383 $template_variables_array[$group_count]['data'][$variables_count]['type'] = "list"; 384 $template_variables_array[$group_count]['data'][$variables_count]['key'] = $key; 385 $template_variables_array[$group_count]['data'][$variables_count]['description'] = $cfg_data[$i]['description']; 386 $z = 0; 387 while($z < count($cfg_data[$i]['data'])) { 388 $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['value'] = $cfg_data[$i]['data'][$z]['value']; 389 $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['description'] = $cfg_data[$i]['data'][$z]['text']; 390 if ($cfg_data[$i]['data'][$z]['value'] == $num) { 391 $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['selected'] = 'selected'; 392 } 393 $z++; 394 } 395 } elseif ($cfg_data[$i]['type'] == "break") { 396 $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; 397 } 398 if(($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data[$i]['type'] != "break") AND ($cfg_data[$i]['type'] != "group")) { 399 $template_variables_array[$group_count]['data'][$variables_count]['aried'] = 1; 400 $template_variables_array[$group_count]['data'][$variables_count]['ari']['key'] = $key; 401 if(isset($custom_cfg_data[$key]['ari'])) { 402 $template_variables_array[$group_count]['data'][$variables_count]['ari']['checked'] = "checked"; 403 } 404 } 405 $variables_count++; 376 } 377 } else { 378 $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($i,$cfg_data,$key,$custom_cfg_data); 379 $variables_count++; 380 } 406 381 } 407 382 } 408 383 return($template_variables_array); 409 384 } 385 386 function generate_form_data ($i,$cfg_data,$key,$custom_cfg_data) { 387 $admin = TRUE; 388 if ($cfg_data[$i]['type'] == "input") { 389 if((!$admin) && (isset($user_cfg_data[$key]['value']))) { 390 $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; 391 } 392 $template_variables_array['type'] = "input"; 393 $template_variables_array['key'] = $key; 394 $template_variables_array['value'] = $custom_cfg_data[$key]['value']; 395 $template_variables_array['description'] = $cfg_data[$i]['description']; 396 } elseif ($cfg_data[$i]['type'] == "radio") { 397 if((!$admin) && (isset($user_cfg_data[$key]['value']))) { 398 $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; 399 } 400 $num = $custom_cfg_data[$key]['value']; 401 $template_variables_array['type'] = "radio"; 402 $template_variables_array['key'] = $key; 403 $template_variables_array['description'] = $cfg_data[$i]['description']; 404 $z = 0; 405 while($z < count($cfg_data[$i]['data'])) { 406 $template_variables_array['data'][$z]['key'] = $key; 407 $template_variables_array['data'][$z]['value'] = $cfg_data[$i]['data'][$z]['value']; 408 $template_variables_array['data'][$z]['description'] = $cfg_data[$i]['data'][$z]['text']; 409 if ($cfg_data[$i]['data'][$z]['value'] == $num) { 410 $template_variables_array['data'][$z]['checked'] = 'checked'; 411 } 412 $z++; 413 } 414 } elseif ($cfg_data[$i]['type'] == "list") { 415 if((!$admin) && (isset($user_cfg_data[$key]['value']))) { 416 $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; 417 } 418 $num = $custom_cfg_data[$key]['value']; 419 $template_variables_array['type'] = "list"; 420 $template_variables_array['key'] = $key; 421 $template_variables_array['description'] = $cfg_data[$i]['description']; 422 $z = 0; 423 while($z < count($cfg_data[$i]['data'])) { 424 $template_variables_array['data'][$z]['value'] = $cfg_data[$i]['data'][$z]['value']; 425 $template_variables_array['data'][$z]['description'] = $cfg_data[$i]['data'][$z]['text']; 426 if ($cfg_data[$i]['data'][$z]['value'] == $num) { 427 $template_variables_array['data'][$z]['selected'] = 'selected'; 428 } 429 $z++; 430 } 431 } elseif ($cfg_data[$i]['type'] == "break") { 432 $template_variables_array['type'] = "break"; 433 } 434 if(($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data[$i]['type'] != "break") AND ($cfg_data[$i]['type'] != "group")) { 435 $template_variables_array['aried'] = 1; 436 $template_variables_array['ari']['key'] = $key; 437 if(isset($custom_cfg_data[$key]['ari'])) { 438 $template_variables_array['ari']['checked'] = "checked"; 439 } 440 } 441 return($template_variables_array); 442 } 410 443 411 444 function save_template($id, $custom, $variables) { 412 445 //Custom Means specific to that MAC 413 if($custom == "0") { 446 //This function is reversed. Not sure why 447 if($custom != "0") { 448 $sql = "SELECT endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=".$id." AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; 449 } else { 414 450 $sql = "SELECT endpointman_brand_list.directory, endpointman_product_list.cfg_dir, endpointman_product_list.config_files, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_brand_list, endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = ".$id; 415 } else {416 $sql = "SELECT endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=".$id." AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id";417 451 } 418 452 … … 434 468 } 435 469 } 470 } elseif ($cfg_data[$i]['type'] == 'loop') { 471 $loop_start = $cfg_data[$i]['loop_start']; 472 $loop_end = $cfg_data[$i]['loop_end']; 473 $variables_count = 0; 474 for($a=$loop_start;$a<=$loop_end;$a++) { 475 foreach($cfg_data[$i]['data']['item'] as $items) { 476 if(isset($items['description'])) { 477 $items['description'] = str_replace('{$count}',$a,$items['description']); 478 $temping = str_replace('$','',$items['variable'])."_".$a; 479 $temping_ari = "ari_" . $temping; 480 if(array_key_exists($temping, $_REQUEST)) { 481 $custom_cfg_data[$temping][$a] = $_REQUEST[$temping]; 482 if(array_key_exists($temping_ari, $_REQUEST)) { 483 if($_REQUEST[$temping_ari] == "on") { 484 $custom_cfg_data[$temping]['ari'] = 1; 485 } 486 } 487 } 488 } 489 } 490 } 436 491 } 437 492 } … … 456 511 457 512 if($custom == "0") { 458 $sql = 'UPDATE endpointman_template_list SET config_files_override = \''.addslashes($config_files_selected).'\', custom_cfg_data = \''.addslashes($save).'\' WHERE id ='.$id;513 $sql = 'UPDATE endpointman_template_list SET config_files_override = \''.addslashes($config_files_selected).'\', global_custom_cfg_data = \''.addslashes($save).'\' WHERE id ='.$id; 459 514 $location = "template_manager"; 460 515 } else { 461 $sql = 'UPDATE endpointman_mac_list SET config_files_override = \''.addslashes($config_files_selected).'\', custom_cfg_template = 0,custom_cfg_data = \''.addslashes($save).'\' WHERE id ='.$id;516 $sql = 'UPDATE endpointman_mac_list SET config_files_override = \''.addslashes($config_files_selected).'\', template_id = 0, global_custom_cfg_data = \''.addslashes($save).'\' WHERE id ='.$id; 462 517 $location = "devices_manager"; 463 518 } 519 464 520 $this->db->query($sql); 465 521 … … 471 527 472 528 } else { 473 $sql = 'SELECT id FROM endpointman_mac_list WHERE custom_cfg_template= '.$id;529 $sql = 'SELECT id FROM endpointman_mac_list WHERE template_id = '.$id; 474 530 $phones = $this->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 475 531 foreach($phones as $data) { … … 535 591 536 592 if(is_array($phone_info['template_data'])) { 537 $template_data = unserialize($phone_info['template_data']['custom_cfg_data']); 538 } else { 539 $template_data = unserialize($phone_info['custom_cfg_data']); 540 } 541 593 $template_data = unserialize($phone_info['template_data']['global_custom_cfg_data']); 594 } else { 595 $template_data = unserialize($phone_info['global_custom_cfg_data']); 596 } 542 597 $new_template_data = array(); 543 598 if(is_array($template_data)) { 544 599 foreach($template_data as $key => $data) { 545 $new_template_data = array_merge($new_template_data, array($key => $data['value'])); 600 if(array_key_exists('value', $data)) { 601 $new_template_data[$key] = $data['value']; 602 } else { 603 $key = explode('_',$key); 604 $new_template_data[$key[0]][$key[2]][$key[1]] = $data[$key[2]]; 605 } 546 606 } 547 607 } … … 616 676 fwrite($fp, $data); 617 677 fclose($fp); 678 if(!file_exists($this->global_cfg['config_location'].$key)) { 679 $this->error['parse_configs'] = "File not written to hard drive!"; 680 } 618 681 } 619 682 } 620 683 $provisioner_lib->reboot(); 621 622 684 } 623 685 … … 939 1001 $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); 940 1002 if($data) { 941 $sql = "UPDATE endpointman_product_list SET short_name = '".$short_name."', long_name = '".$family_line_xml['data']['name']."', cfg_ver = '".$family_line_xml['data']['version']."', config_files='".$family_line_xml['data']['configuration_files']."' , hidden = '0'WHERE id = '".$brand_id.$family_line_xml['data']['id']."'";1003 $sql = "UPDATE endpointman_product_list SET short_name = '".$short_name."', long_name = '".$family_line_xml['data']['name']."', cfg_ver = '".$family_line_xml['data']['version']."', config_files='".$family_line_xml['data']['configuration_files']."' WHERE id = '".$brand_id.$family_line_xml['data']['id']."'"; 942 1004 } else { 943 1005 $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('".$brand_id.$family_line_xml['data']['id']."', '".$brand_id."', '".$short_name."', '".$family_line_xml['data']['name']."', '".$family_line_xml['data']['directory']."', '".$family_line_xml['data']['version']."','".$family_line_xml['data']['configuration_files']."', '0')"; … … 953 1015 $template_list = $model_list['template_data']['files']; 954 1016 } 955 $m_data =& $this->db->getOne("SELECT id FROM endpointman_model_list WHERE id='".$brand_id.$family_line_xml['data']['id']. "-".$model_list['id']."'", array(), DB_FETCHMODE_ASSOC);1017 $m_data =& $this->db->getOne("SELECT id FROM endpointman_model_list WHERE id='".$brand_id.$family_line_xml['data']['id'].$model_list['id']."'", array(), DB_FETCHMODE_ASSOC); 956 1018 if($m_data) { 957 $sql = "UPDATE endpointman_model_list SET m odel = '".$model_list['model']."', template_list = '".$template_list."', enabled = '0', hidden = '0' WHERE id = '".$brand_id.$family_line_xml['data']['id']."'";1019 $sql = "UPDATE endpointman_model_list SET max_lines = '".$model_list['lines']."', model = '".$model_list['model']."', template_list = '".$template_list."' WHERE id = '".$brand_id.$family_line_xml['data']['id'].$model_list['id']."'"; 958 1020 } else { 959 $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, ` product_id`, `template_list`, `enabled`, `hidden`) VALUES ('".$brand_id.$family_line_xml['data']['id'].$model_list['id']."', '".$brand_id."', '".$model_list['model']."', '".$brand_id.$family_line_xml['data']['id']."', '".$template_list."', '0', '0')";1021 $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('".$brand_id.$family_line_xml['data']['id'].$model_list['id']."', '".$brand_id."', '".$model_list['model']."', '".$model_list['lines']."', '".$brand_id.$family_line_xml['data']['id']."', '".$template_list."', '0', '0')"; 960 1022 } 961 1023 $this->db->query($sql); … … 1495 1557 } 1496 1558 } 1559 function areaAvailable($model,$area=NULL) { 1560 1561 $temp[0]['value'] = 'GLOBAL'; 1562 $temp[0]['text'] = 'GLOBAL'; 1563 $temp[0]['selected'] = 0; 1564 1565 $temp[1]['value'] = 'ALL'; 1566 $temp[1]['text'] = 'ALL LINES'; 1567 $temp[1]['selected'] = 0; 1568 1569 $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '". $model."'"; 1570 1571 $count = $this->db->getOne($sql); 1572 for($z=0;$z<$count;$z++) { 1573 $result[$z]['id'] = $z + 1; 1574 $result[$z]['model'] = $z + 1; 1575 } 1576 1577 $i = 2; 1578 foreach($result as $row) { 1579 if ($row['id'] == $model) { 1580 $temp[$i]['value'] = $row['id']; 1581 $temp[$i]['text'] = 'Line '.$row['model']; 1582 $temp[$i]['selected'] = 'selected'; 1583 }else { 1584 $temp[$i]['value'] = $row['id']; 1585 $temp[$i]['text'] = 'Line '.$row['model']; 1586 $temp[$i]['selected'] = 0; 1587 } 1588 $i++; 1589 } 1590 1591 return($temp); 1592 } 1497 1593 1498 1594 function modelsAvailable($model=NULL, $macAdd=NULL, $brand=NULL, $product=NULL) { … … 1535 1631 } 1536 1632 1633 function linesAvailable($model=NULL, $macid=NULL) { 1634 1635 if(isset($model)) { 1636 $sql="SELECT `max_lines` FROM `endpointman_model_list` WHERE `id` LIKE"; 1637 } 1638 1639 1640 $result1 =& $this->db->getAll($sql, array(),DB_FETCHMODE_ASSOC); 1641 1642 $i = 1; 1643 foreach($result1 as $row) { 1644 if ($row['id'] == $model) { 1645 $temp[$i]['value'] = $row['id']; 1646 $temp[$i]['text'] = $row['model']; 1647 $temp[$i]['selected'] = 'selected'; 1648 }else { 1649 $temp[$i]['value'] = $row['id']; 1650 $temp[$i]['text'] = $row['model']; 1651 $temp[$i]['selected'] = 0; 1652 } 1653 $i++; 1654 } 1655 1656 if(!isset($temp)) { 1657 $this->error['modelsAvailable'] = "You need to enable at least ONE model"; 1658 return(FALSE); 1659 } else { 1660 return($temp); 1661 } 1662 } 1663 1537 1664 function displayExtension($ext = NULL) { 1538 1665 if(!isset($ext)) { 1539 $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_ mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext ) ORDER BY devices.id";1540 } else { 1541 $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_ mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext AND endpointman_mac_list.ext !=".$ext." ) ORDER BY devices.id";1666 $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech='sip' AND devices.id = endpointman_line_list.ext ) ORDER BY devices.id"; 1667 } else { 1668 $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech='sip' AND devices.id = endpointman_line_list.ext AND endpointman_line_list.ext !=".$ext." ) ORDER BY devices.id"; 1542 1669 } 1543 1670 $result =& $this->db->getAll($not_added,array(), DB_FETCHMODE_ASSOC); contributed_modules/modules/endpointman/includes/template_manager.inc
r10233 r10240 69 69 } 70 70 71 $sql = 'SELECT endpointman_mac_list.id, endpointman_mac_list.mac,endpointman_mac_list.model,endpointman_mac_list.description, endpointman_model_list.model as model_clone, endpointman_product_list.short_name as model_class FROM endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.custom_cfg_data IS NOT NULL AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_mac_list.custom_cfg_template= 0';71 $sql = 'SELECT endpointman_mac_list.id, endpointman_mac_list.mac, endpointman_mac_list.model, endpointman_line_list.description, endpointman_model_list.model as model_clone, endpointman_product_list.short_name as model_class FROM endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.global_custom_cfg_data IS NOT NULL AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_mac_list.template_id = 0'; 72 72 $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 73 73 foreach($template_list as $row) { contributed_modules/modules/endpointman/install.php
r10233 r10240 93 93 } 94 94 95 $version = "2.2. 6";95 $version = "2.2.7"; 96 96 97 97 if(ep_table_exists("endpointman_global_vars")) { … … 139 139 } elseif($global_cfg['version'] == '2.2.6') { 140 140 $ver = "2.2.6"; 141 } elseif($global_cfg['version'] == '2.2.7') { 142 $ver = "2.2.7"; 141 143 } else { 142 144 $ver = "1000"; … … 785 787 } 786 788 789 if ($ver <= "2.2.6") { 790 $sql = "CREATE TABLE IF NOT EXISTS `endpointman_line_list` ( 791 `luid` int(11) NOT NULL AUTO_INCREMENT, 792 `mac_id` int(11) NOT NULL, 793 `line` smallint(2) NOT NULL, 794 `ext` varchar(15) NOT NULL, 795 `description` varchar(20) NOT NULL, 796 `custom_cfg_data` longblob NOT NULL, 797 `user_cfg_data` longblob NOT NULL, 798 PRIMARY KEY (`luid`) 799 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;"; 800 $db->query($sql); 801 802 $data = array(); 803 $data =& $db->getAll("SELECT * FROM endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); 804 foreach($data as $list) { 805 $sql = "INSERT INTO endpointman_line_list (mac_id, line, ext, description) VALUES ('".$list['id']."', '1', '".$list['ext']."', '".$list['description']."')"; 806 $db->query($sql); 807 } 808 809 $sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `data` `data` LONGBLOB NOT NULL'; 810 $db->query($sql); 811 812 $sql = 'ALTER TABLE `endpointman_mac_list` DROP `description`'; 813 $db->query($sql); 814 815 $sql = 'ALTER TABLE `endpointman_mac_list` DROP `ext`'; 816 $db->query($sql); 817 818 $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_template` `template_id` INT(11) NOT NULL'; 819 $db->query($sql); 820 821 $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `cfg_template_data` `global_template_id` LONGBLOB NOT NULL'; 822 $db->query($sql); 823 824 $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `user_cfg_data` `global_user_cfg_data` LONGBLOB NOT NULL'; 825 $db->query($sql); 826 827 $sql = 'ALTER TABLE `endpointman_model_list` ADD `max_lines` SMALLINT(2) NOT NULL AFTER `model`;'; 828 $db->query($sql); 829 830 $sql = 'ALTER TABLE `endpointman_model_list` CHANGE `template_data` `template_data` LONGBLOB NOT NULL'; 831 $db->query($sql); 832 833 $sql = 'ALTER TABLE `endpointman_template_list` CHANGE `custom_cfg_data` `global_custom_cfg_data` LONGBLOB NULL DEFAULT NULL'; 834 $db->query($sql); 835 836 $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_data` `global_custom_cfg_data` LONGBLOB NOT NULL'; 837 $db->query($sql); 838 839 } 840 841 if ($ver <= "2.2.7") { 842 843 } 844 787 845 788 846 … … 800 858 ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; 801 859 $db->query($sql); 860 861 out("Creating Line List Table"); 862 863 $sql = "CREATE TABLE IF NOT EXISTS `endpointman_line_list` ( 864 `luid` int(11) NOT NULL AUTO_INCREMENT, 865 `mac_id` int(11) NOT NULL, 866 `line` smallint(2) NOT NULL, 867 `ext` varchar(15) NOT NULL, 868 `description` varchar(20) NOT NULL, 869 `custom_cfg_data` longblob NOT NULL, 870 `user_cfg_data` longblob NOT NULL, 871 PRIMARY KEY (`luid`) 872 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;"; 873 $db->query($sql); 802 874 803 875 out("Creating Global Variables Table"); … … 837 909 out("Creating mac list Table"); 838 910 $sql = "CREATE TABLE IF NOT EXISTS `endpointman_mac_list` ( 839 `id` int(10) NOT NULL AUTO_INCREMENT, 840 `mac` varchar(12) DEFAULT NULL, 841 `model` varchar(11) NOT NULL, 842 `ext` varchar(15) DEFAULT 'Not Assigned', 843 `description` varchar(20) DEFAULT NULL, 844 `custom_cfg_template` int(11) NOT NULL, 845 `custom_cfg_data` blob NOT NULL, 846 `user_cfg_data` blob NOT NULL, 847 `config_files_override` text NOT NULL, 848 PRIMARY KEY (`id`), 849 UNIQUE KEY `mac` (`mac`) 850 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; 911 `id` int(10) NOT NULL AUTO_INCREMENT, 912 `mac` varchar(12) DEFAULT NULL, 913 `model` varchar(11) NOT NULL, 914 `template_id` int(11) NOT NULL, 915 `global_custom_cfg_data` longblob NOT NULL, 916 `global_user_cfg_data` blob NOT NULL, 917 `config_files_override` text NOT NULL, 918 PRIMARY KEY (`id`), 919 UNIQUE KEY `mac` (`mac`) 920 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; 851 921 $db->query($sql); 852 922 853 923 out("Creating model List Table"); 854 924 $sql = "CREATE TABLE IF NOT EXISTS `endpointman_model_list` ( 855 `id` varchar(11) NOT NULL COMMENT 'Key ', 856 `brand` int(11) NOT NULL COMMENT 'Brand', 857 `model` varchar(25) NOT NULL COMMENT 'Model', 858 `template_list` text NOT NULL, 859 `template_data` blob NOT NULL, 860 `product_id` varchar(11) NOT NULL, 861 `enabled` int(1) NOT NULL DEFAULT '0', 862 `hidden` int(1) NOT NULL DEFAULT '0', 863 PRIMARY KEY (`id`) 864 ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; 925 `id` varchar(11) NOT NULL COMMENT 'Key ', 926 `brand` int(11) NOT NULL COMMENT 'Brand', 927 `model` varchar(25) NOT NULL COMMENT 'Model', 928 `max_lines` smallint(2) NOT NULL, 929 `template_list` text NOT NULL, 930 `template_data` longblob NOT NULL, 931 `product_id` varchar(11) NOT NULL, 932 `enabled` int(1) NOT NULL DEFAULT '0', 933 `hidden` int(1) NOT NULL DEFAULT '0', 934 PRIMARY KEY (`id`) 935 ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; 865 936 $db->query($sql); 866 937 … … 878 949 out("Creating product List Table"); 879 950 $sql = "CREATE TABLE IF NOT EXISTS `endpointman_product_list` ( 880 `id` varchar(11) NOT NULL,881 `brand` int(11) NOT NULL,882 `long_name` varchar(255) NOT NULL,883 `short_name` varchar(255) NOT NULL,884 `cfg_dir` varchar(255) NOT NULL,885 `cfg_ver` varchar(255) NOT NULL,886 `hidden` int(1) NOT NULL DEFAULT '0',887 `firmware_vers` varchar(255) NOT NULL,888 `firmware_files` text NOT NULL,889 `config_files` text,890 `special_cfgs` blob NOT NULL,891 PRIMARY KEY (`id`)892 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;";951 `id` varchar(11) NOT NULL, 952 `brand` int(11) NOT NULL, 953 `long_name` varchar(255) NOT NULL, 954 `short_name` varchar(255) NOT NULL, 955 `cfg_dir` varchar(255) NOT NULL, 956 `cfg_ver` varchar(255) NOT NULL, 957 `hidden` int(1) NOT NULL DEFAULT '0', 958 `firmware_vers` varchar(255) NOT NULL, 959 `firmware_files` text NOT NULL, 960 `config_files` text, 961 `special_cfgs` blob NOT NULL, 962 PRIMARY KEY (`id`) 963 ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; 893 964 $db->query($sql); 894 965 895 966 out("Creating Template List Table"); 896 967 $sql = "CREATE TABLE IF NOT EXISTS `endpointman_template_list` ( 897 `id` int(11) NOT NULL AUTO_INCREMENT,898 `product_id` varchar(11) NOT NULL,899 `model_id` varchar(10) NOT NULL,900 `name` varchar(255) NOT NULL,901 `custom_cfg_data`blob,902 `config_files_override` text,903 PRIMARY KEY (`id`)904 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";968 `id` int(11) NOT NULL AUTO_INCREMENT, 969 `product_id` varchar(11) NOT NULL, 970 `model_id` varchar(10) NOT NULL, 971 `name` varchar(255) NOT NULL, 972 `global_custom_cfg_data` longblob, 973 `config_files_override` text, 974 PRIMARY KEY (`id`) 975 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; 905 976 $db->query($sql); 906 977 contributed_modules/modules/endpointman/module.xml
r10238 r10240 19 19 </changelog> 20 20 <info>http://projects.colsolgrp.net/projects/show/endpointman</info> 21 <location>contributed_modules/release/endpointman-2. 2.6.tgz</location>21 <location>contributed_modules/release/endpointman-2.0.0.tgz</location> 22 22 23 <md5sum> cc4c2f4d8ce1eb5ddcfffd000449dd43</md5sum>23 <md5sum>b1341a35ef60d0fad17348803a0a7833</md5sum> 24 24 </module> contributed_modules/modules/endpointman/templates/devices_manager.html
r10233 r10240 23 23 <table align='center' width='90%'> 24 24 <tr> 25 <td align='center' width='5px'></td> 26 <td width="11%" align='center'><h3><?=_('Mac Address')?></h3></td> 27 <td width="13%" align='center'><h3><?=_('Brand')?></h3></td> 28 <td width="25%" align='center'><h3><?=_('Model of Phone')?></h3></td> 29 <td width="19%" align='center'><h3><?=_('Extension Number')?></h3></td> 30 <td width="18%" align='center'><h3><?=_('Template')?></h3></td> 31 32 <td width="9%" align='center'></td> 25 <td align='center' width='45'></td> 26 <td width="157" align='center'><h3><?=_('Mac Address')?></h3></td> 27 <td width="187" align='center'><h3><?=_('Brand')?></h3></td> 28 <td width="216" align='center'><h3><?=_('Model of Phone')?></h3></td> 29 <td width="172" align='center'><h3><?=_('Line')?></h3></td> 30 <td width="275" align='center'><h3><?=_('Extension Number')?></h3></td> 31 <td width="154" align='center'><h3><?=_('Template')?></h3></td> 32 33 <td width="234" align='center'></td> 33 34 </tr><tr> 34 35 {if condition="$no_add == FALSE"} 35 36 <form action='config.php{$web_var}&display=epm_devices' method='POST'> 36 <td align='center' width='5px'><input type="checkbox" name="checkbox" id="checkbox" disabled></td>37 37 <td align='center' width='2%'> </td> 38 38 39 <td align='center'> 39 40 {if condition="$mode == 'EDIT'"} … … 53 54 {/if} 54 55 </td> 55 <td align='center'> 56 <td align='center'> 56 57 <label> 57 58 {if condition="$mode == 'EDIT'"} … … 64 65 </select> 65 66 {else} 66 <select name="model_list" id="model_new"><option></option></select>67 {/if} 67 <select name="model_list" id="model_new"><option></option></select> 68 {/if} 68 69 </label></td> 69 <td align='center'> 70 <td align='center'> 71 <label> 72 {if condition="$mode == 'EDIT'"} 73 <select name="line_list" id="line_list" disabled> 74 <option value="1">1</option> 75 </select> 76 {else} 77 <select name="line_list" id="line_list" disabled><option></option></select> 78 {/if} 79 </label></td> 80 <td align='center'> 70 81 <select name="ext_list" id="select"> 71 82 {loop name="display_ext"} … … 89 100 </td> 90 101 {$edit} 91 <td width="5%"align='center'><input type='reset' value='<?=_('Reset')?>'></td>102 <td align='center'><input type='reset' value='<?=_('Reset')?>'></td> 92 103 </tr> 93 104 </table> … … 99 110 <td align='center'> </td> 100 111 <td align='center'> </td> 101 <td align='center'> </td>102 <td colspan=" 2" align='center'><h3><?=_('Unmanaged Extensions')?></h3></td>112 <td align='center'> </td> 113 <td colspan="3" align='center'><h3><?=_('Unmanaged Extensions')?></h3></td> 103 114 <td align='center'> </td> 104 115 <td align='center'> </td> … … 111 122 <input name="mac_{$value.id}" type="hidden" value="{$value.mac_strip}"> 112 123 <tr> 113 <td align='center' width=' 5px'><input type="checkbox" name="add[]" value="{$value.id}"></td>114 <td align='center' width='1 1%'>{$value.mac_strip}<br />({$value.ip})</td>115 <td width="1 3%" align='center'>{$value.brand}</td>116 <td width="2 5%" align='center'>117 124 <td align='center' width='20'><input type="checkbox" name="add[]" value="{$value.id}"></td> 125 <td align='center' width='148'>{$value.mac_strip}<br />({$value.ip})</td> 126 <td width="188" align='center'>{$value.brand}</td> 127 <td width="216" align='center'> 128 118 129 <select name="model_list_{$value.id}"> 119 130 120 131 {loop name="value.list"} 121 132 122 133 <option value="{$value.id}">{$value.model}</option> 123 134 124 135 {/loop} 125 136 126 137 </select></td> 127 <td width="19%" align='center'> 138 <td width="141" align='center'> 139 <select name="line_list_{$value.id}" id="line_list" disabled> 140 <option value="1">1</option> 141 </select> 142 </td> 143 144 <td width="276" align='center'> 128 145 <select name="ext_list_{$value.id}" id="ext"> 129 146 130 147 {loop name="display_ext"} 131 148 132 149 <option value="{$value.value}">{$value.text}</option> 133 150 134 151 {/loop} 135 152 136 153 </select></td> 137 <td align='center' width=' 18%'> </td>138 <td align='center' width=' 9%'></td>139 <td align='center' width=' 5%'> </td>154 <td align='center' width='220'> </td> 155 <td align='center' width='154'></td> 156 <td align='center' width='73'> </td> 140 157 </tr> 141 158 {/loop} … … 154 171 <table width='90%' align='center'> 155 172 <tr> 156 <td align='center'> </td>157 <td align='center'> </td> 158 <td align='center'> </td> 159 <td colspan=" 2" align='center'><h3><?=_('Current Managed Extensions')?></h3></td>160 <td align='center'> </td>173 <td width="2%" align='center'> </td> 174 <td align='center'> </td> 175 <td align='center'> </td> 176 <td colspan="3" align='center'><h3><?=_('Current Managed Extensions')?></h3></td> 177 <td align='center'> </td> 161 178 <td align='center'><h3>Edit</h3></td> 162 179 <td align='center'><h3>Delete</h3></td> … … 165 182 {loop name="list"} 166 183 <tr> 167 <td align='center' width='5px'><input type="checkbox" name="selected[]" value="{$value.id}"></td>184 <td align='center' ><input type="checkbox" name="selected[]" value="{$value.id}"></td> 168 185 <td align='center' width='11%'>{$value.mac}</td> 169 186 <td width="13%" align='center'>{$value.name}</td> 170 <td width="25%" align='center'>{$value.model}</td> 187 <td width="14%" align='center'>{$value.model}</td> 188 <td width="10%" align='center'>{$value.line}</td> 171 189 <td width="19%" align='center'>{$value.ext} - {$value.description}</td> 172 <td align='center' width='1 8%'>{$value.template_name}</td>190 <td align='center' width='15%'>{$value.template_name}</td> 173 191 <td align='center' width='9%'><a href=config.php?type=tool&display=epm_devices&editready=true&display=epm_devices&id={$value.id}><img src='{$web_path}templates/images/edit.gif' ALT='<?=_('Edit')?>' border='0'></a></td> 174 <td align='center' width=' 5%'><a href=config.php?type=tool&display=epm_devices&deleteready=true&display=epm_devices&id={$value.id}><img src='{$web_path}templates/images/delete.gif' ALT='<?=_('Delete')?>' border='0'></a></td>192 <td align='center' width='7%'><a href=config.php?type=tool&display=epm_devices&deleteready=true&display=epm_devices&id={$value.id}><img src='{$web_path}templates/images/delete.gif' ALT='<?=_('Delete')?>' border='0'></a></td> 175 193 </tr> 176 194 {/loop} 177 195 </table> 196 178 197 <hr> 179 198 <center> … … 211 230 <option value="{$value.value}">{$value.text}</option> 212 231 {/loop} 213 </select> <?=_('with')?> 232 </select> <?=_('with')?> 214 233 <label> 215 234 <select name="template_selector" id="template_selector"> 216 235 <option></option> 217 </select> 236 </select> 218 237 <input type="submit" name="button_rebuild_reboot" value="<?=_('Rebuild & Reboot')?>"> 219 238 </label></td> contributed_modules/modules/endpointman/templates/global_header.html
r10218 r10240 62 62 $("#template_list").html(options); 63 63 $('#template_list option:first').attr('selected', 'selected'); 64 }) 64 }), 65 $.ajaxSetup({ cache: false }); 66 $.getJSON("config.php?type=tool&quietmode=1&handler=file&module=endpointman&file=ajax_select.html.php&atype=lines",{id: $(this).val()}, function(j){ 67 var options = ''; 68 for (var i = 0; i < j.length; i++) { 69 options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; 70 } 71 $("#line_list").html(options); 72 $('#line_list option:first').attr('selected', 'selected'); 73 }) 65 74 }) 66 75 }) 76 67 77 $(function(){ 68 78 $("select#brand_list_selected").change(function(){ … … 94 104 {/if} 95 105 </head> 96 <body face="Arial" onload="focus();displaymac.mac.focus()">106 <body face="Arial"> 97 107 <br> 98 108 <h1><face="Arial"><center><?=_('End Point Configuration Manager')?></center></h1> contributed_modules/modules/endpointman/templates/template_editor.html
r10233 r10240 20 20 <strong><?=_('Template Name')?>:</strong> <i>Custom Template: Extension {$ext}</i><br /> 21 21 <strong><?=_('Product Line')?>:</strong> {$product}<br /> 22 <strong><?=_('Clone of Model')?>:</strong> {$model} 22 <strong><?=_('Clone of Model')?>:</strong> {$model}<br /> 23 <strong><?=_('Area')?>:</strong> 24 <select name="area_list" disabled> 25 {loop name="area_ava"} 26 <option value="{$value.value}" {if condition="!empty($value.selected)"}selected{/if}>{$value.text}</option> 27 {/loop} 28 </select> 23 29 {/if} 24 30 {if condition="$custom == 0"} … … 28 34 <select name="model_list"> 29 35 {loop name="models_ava"} 36 <option value="{$value.value}" {if condition="!empty($value.selected)"}selected{/if}>{$value.text}</option> 37 {/loop} 38 </select> 39 <strong><?=_('Area')?>:</strong> 40 <select name="area_list"> 41 {loop name="area_ava"} 30 42 <option value="{$value.value}" {if condition="!empty($value.selected)"}selected{/if}>{$value.text}</option> 31 43 {/loop} … … 63 75 <td nowrap> 64 76 {if condition="$value.type == 'input'"} 77 65 78 <label>{$value.description}: <input type='text' name='{$value.key}' value='{$value.value}' size="40"></label> 66 79 {elseif condition="$value.type == 'radio'"} contributed_modules/modules/endpointman/uninstall.php
r9907 r10240 54 54 $result = $db->query($sql); 55 55 56 $sql = "DROP TABLE `endpointman_line_list`"; 57 $result = $db->query($sql); 58 56 59 $sql = "DROP TABLE `endpointman_model_list`"; 57 60 $result = $db->query($sql);
