Changeset 10233

Show
Ignore:
Timestamp:
08/29/10 02:59:02 (1 year ago)
Author:
tm1000
Message:

-Added nicer error/message area-box
-fixed progress bar. no more white spaces and waiting for the page to load forever!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/endpointman/config.php

    r10220 r10233  
    2121} 
    2222 
     23if(phpversion < '5.0.0') { 
     24    die(_('PHP Version MUST be greater than 5!')); 
     25} 
     26 
    2327include 'includes/functions.inc'; 
    2428 
     
    2731$endpoint = new endpointmanager(); 
    2832 
    29 if(!file_exists(PHONE_MODULES_PATH)) { 
    30   mkdir(PHONE_MODULES_PATH, 0764); 
    31 } 
    3233if(!file_exists(PHONE_MODULES_PATH."temp/")) { 
    33   mkdir(PHONE_MODULES_PATH."temp/", 0764); 
     34  mkdir(PHONE_MODULES_PATH."temp/", 0764, TRUE); 
    3435} 
    3536 
     
    3940 
    4041if(!is_writeable(PHONE_MODULES_PATH)) { 
    41   chmod(PHONE_MODULES_PATH, 0764); 
     42    chmod(PHONE_MODULES_PATH, 0764); 
     43    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHONE_MODULES_PATH), RecursiveIteratorIterator::SELF_FIRST);  
     44    foreach($iterator as $item) { 
     45        chmod($item, 0764); 
     46    } 
    4247} 
    4348 
  • contributed_modules/modules/endpointman/includes/advanced.inc

    r10227 r10233  
    1010$tpl = new RainTPL( LOCAL_PATH.'templates' ); 
    1111//Set the message variable to nothing, however we can set it later and it will show up on the page 
    12 $message = ""
     12$message = NULL
    1313$tpl->assign("message", $message); 
    1414$tpl->assign("web_vars", "?type=$type"); 
     
    121121                    $tpl->assign("xml", 0); 
    122122                } else { 
    123                     $message = $endpoint->file_upload_error_message($_FILES['package']['error']); 
    124                 } 
    125             } else { 
    126                 $message = "Invalid Extension"; 
     123                    $endpoint->error['manual_upload'] = $endpoint->file_upload_error_message($_FILES['package']['error']); 
     124                } 
     125            } else { 
     126                $endpoint->error['manual_upload'] = "Invalid File Extension"; 
    127127            } 
    128128             
     
    140140                    $tpl->assign("xml", $name); 
    141141                } else { 
    142                     $message = $endpoint->file_upload_error_message($_FILES['xml']['error']); 
    143                 } 
    144             } else { 
    145                 $message = "Invalid Extension"; 
     142                    $endpoint->error['manual_upload'] = $endpoint->file_upload_error_message($_FILES['xml']['error']); 
     143                } 
     144            } else { 
     145                $endpoint->error['manual_upload'] = "Invalid File Extension"; 
    146146            } 
    147147        } elseif(isset($_REQUEST['upload_brand'])) { 
     
    159159                        $i++; 
    160160                    } else { 
    161                         $error_message = $endpoint->file_upload_error_message($files['error']); 
     161                        $endpoint->error['manual_upload'] = $endpoint->file_upload_error_message($files['error']); 
    162162                        $error = TRUE; 
    163163                    } 
    164164                } else { 
    165                     $error_message = "Invalid Extension"; 
     165                    $endpoint->error['manual_upload'] = "Invalid File Extension"; 
    166166                    $error = TRUE; 
    167167                } 
     
    177177 
    178178        } 
    179         $tpl->assign("message", $message); 
     179        $error_message = NULL; 
     180        foreach($endpoint->error as $key => $error) { 
     181            $error_message .= $error; 
     182            if($endpoint->global_cfg['debug']) { 
     183                $error_message .= " Function: [".$key."]"; 
     184            } 
     185            $error_message .= "<br />"; 
     186        } 
     187        if(isset($message)) { 
     188            $endpoint->display_message_box($message,$tpl,0); 
     189        } 
     190        if(isset($error_message)) { 
     191            $endpoint->display_message_box($error_message,$tpl,1); 
     192        } 
    180193 
    181194        echo $tpl->draw( 'advanced_settings_manual_upload' ); 
     
    422435    case "settings": 
    423436    default: 
    424         $message = ""; 
    425437        if(isset($_REQUEST['button_update_globals'])) { 
    426438            $_POST['srvip'] = trim($_POST['srvip']);  #trim whitespace from IP address 
     
    444456                        $endpoint->db->query($sql); 
    445457                    } else { 
    446                         $message = "<h3><center><font color='red'>Directory Not Writable!</font></center></h3>"; 
     458                        $endpoint->error['config_dir'] = "Directory Not Writable!"; 
    447459                    } 
    448460                } else { 
    449                     $message = "<h3><center><font color='red'>Not a Vaild Directory</font></center></h3>"; 
    450                 } 
    451             } else { 
    452                 $message = "<h3><center><font color='red'>No Configuration Location Defined!</font></center></h3>"; 
     461                    $endpoint->error['config_dir'] = "Not a Vaild Directory"; 
     462                } 
     463            } else { 
     464                $endpoint->error['config_dir'] = "No Configuration Location Defined!"; 
    453465            } 
    454466 
     
    499511            $endpoint->db->query($sql); 
    500512 
    501             $message .= "<h3><center>Updated!</center></h3>"; 
     513            $message .= "Updated!"; 
    502514        } 
    503515        //Because we are working with global variables we probably updated them, so lets refresh those variables 
     
    534546        $tpl->assign("updates_selected", $updates_selected); 
    535547        $tpl->assign("debug_selected", $debug_selected); 
    536         $tpl->assign("message", $message); 
     548 
     549        $error_message = NULL; 
     550        foreach($endpoint->error as $key => $error) { 
     551            $error_message .= $error; 
     552            if($endpoint->global_cfg['debug']) { 
     553                $error_message .= " Function: [".$key."]"; 
     554            } 
     555            $error_message .= "<br />"; 
     556        } 
     557        if(isset($message)) { 
     558            $endpoint->display_message_box($message,$tpl,0); 
     559        } 
     560        if(isset($error_message)) { 
     561            $endpoint->display_message_box($error_message,$tpl,1); 
     562        } 
     563 
    537564        $tpl->assign("ip", $_SERVER["SERVER_ADDR"]); 
    538565        $tpl->assign("srvip", $endpoint->global_cfg['srvip']); 
  • contributed_modules/modules/endpointman/includes/brand_model_manager.inc

    r10227 r10233  
    1313//initialize a Rain TPL object 
    1414$tpl = new RainTPL( LOCAL_PATH.'templates' ); 
    15 $endpoint->error['brand_update_check'] = ""; 
     15 
    1616if((isset($_REQUEST['button_install'])) OR (isset($_REQUEST['button_update']))) { 
    1717  if(isset($_REQUEST['brand'])) { 
     
    126126} 
    127127 
    128 $tpl->assign("error", $error); 
    129128$tpl->assign("web_var", "?type=$type"); 
    130129$tpl->assign("brand2_list", $row_out); 
    131 $tpl->assign("error", $endpoint->error['brand_update_check']); 
     130 
     131$error_message = NULL; 
     132foreach($endpoint->error as $key => $error) { 
     133    $error_message .= $error; 
     134    if($endpoint->global_cfg['debug']) { 
     135        $error_message .= " Function: [".$key."]"; 
     136    } 
     137    $error_message .= "<br />"; 
     138
     139if(isset($error_message)) { 
     140    $endpoint->display_message_box($error_message,$tpl,1); 
     141
    132142 
    133143//draw the template  
  • contributed_modules/modules/endpointman/includes/devices_manager.inc

    r10227 r10233  
    1010//Set opened variables 
    1111$message = NULL; 
     12$error_message = NULL; 
     13 
     14 
    1215$no_add = FALSE; 
    1316$final = NULL; 
     
    151154} elseif((isset($_REQUEST['button_update_phones'])) AND (isset($_REQUEST['selected']))) { 
    152155    if(($_REQUEST['brand_list_selected'] > 0) AND ($_REQUEST['model_list_selected'] > 0)) { 
    153  
    154156        foreach($_REQUEST['selected'] as $key => $data) { 
    155157            $sql = "UPDATE endpointman_mac_list SET custom_cfg_data = '', custom_cfg_template = '', user_cfg_data = '', config_files_override = '', model = '".$_REQUEST['model_list_selected']."' WHERE id =  ". $_REQUEST['selected'][$key]; 
     
    160162 
    161163            $message = _("Saved")."!"; 
    162  
    163164        } 
    164165    } else { 
     
    382383    } 
    383384 
    384  
    385     $tpl->assign("message", $message); 
    386     $tpl->assign("debug", $debug); 
     385    foreach($endpoint->error as $key => $error) { 
     386        $error_message .= $error; 
     387        if($endpoint->global_cfg['debug']) { 
     388            $error_message .= " Function: [".$key."]"; 
     389        } 
     390        $error_message .= "<br />"; 
     391    } 
     392    if(isset($error_message)) { 
     393        $endpoint->display_message_box($error_message,$tpl,1); 
     394    } 
     395    if(isset($message)) { 
     396        $endpoint->display_message_box($message,$tpl,0); 
     397    } 
    387398 
    388399    //draw the template 
  • contributed_modules/modules/endpointman/includes/functions.inc

    r10231 r10233  
    5151        //include the local template class 
    5252        include LOCAL_PATH."includes/rain.tpl.class.php"; 
     53    } 
     54 
     55    function display_message_box($message, $tpl, $fatal_error=0) { 
     56        $tpl->assign("show_error_box", 1); 
     57        $tpl->assign("advanced_debug", $this->global_cfg['debug']); 
     58        $tpl->assign("fatal_error", $fatal_error); 
     59        $tpl->assign("error_message", $message); 
    5360    } 
    5461 
     
    142149        //You could screw up a phone if the mac_id is blank 
    143150        if (!isset($mac_id)) { 
    144             die("Can't get phone info!"); 
     151            $this->error['get_phone_info'] = "Mac ID is not set"; 
     152            return(FALSE); 
    145153        } 
    146154        $sql = "SELECT id,mac,model FROM  endpointman_mac_list WHERE model > 0 AND id =".$mac_id; 
     
    689697        $temp = $this->xml2array(PHONE_MODULES_PATH."endpoint/".$row['directory']."/".$row['cfg_dir']."/family_data.xml"); 
    690698        if($temp['data']['firmware_ver'] > $row['firmware_vers']) { 
    691             echo "Downloading firmware.."; 
     699            echo "<div style='float: left'>Downloading firmware...</div><div style='float: left' id=\"DivExample\">.</div>"; 
    692700            $this->download_file_with_progress_bar(UPDATE_PATH.$row['directory']."/". $temp['data']['firmware_pkg'], PHONE_MODULES_PATH."temp/".$temp['data']['firmware_pkg']); 
    693             echo "Done!<br />"; 
     701            echo "<script type='text/javascript'>document.getElementById('DivExample').innerHTML='Done!';</script><br />"; 
    694702            if(!file_exists(PHONE_MODULES_PATH."endpoint/".$row['directory']."/".$row['cfg_dir']."/firmware")) { 
    695703                mkdir(PHONE_MODULES_PATH."endpoint/".$row['directory']."/".$row['cfg_dir']."/firmware"); 
     
    733741        } else { 
    734742            if(!file_exists(PHONE_MODULES_PATH.'/'.$directory)) { 
    735                 mkdir(PHONE_MODULES_PATH.'/'.$directory); 
     743                mkdir(PHONE_MODULES_PATH.'/'.$directory,0764); 
    736744            } 
    737745            $destination_file = PHONE_MODULES_PATH.'/'.$directory.'/brand_data.xml'; 
     
    749757            } else { 
    750758                rename($temp_file, $destination_file); 
     759                chmod($destination_file,0764); 
    751760                return(TRUE); 
    752761            } 
     
    760769        $master_result = $this->download_xml(UPDATE_PATH . "master.xml"); 
    761770 
    762         $message = ""; 
    763771 
    764772        if(!$master_result) { 
    765             $message .= "Not able to connect to repository. Using local master file instead."; 
     773            $this->error['brand_update_check_master'] = "Not able to connect to repository. Using local master file instead."; 
    766774        } 
    767775 
     
    776784        if(($data == "") OR ($data <= $endpoint_last_mod)) { 
    777785            if((!$master_result) OR (!$this->download_file_no_progress_bar(UPDATE_PATH.'/'.$endpoint_package, PHONE_MODULES_PATH."temp/".$endpoint_package))) { 
    778                 $message .= "<br/>Not able to connect to repository. Using local Provisioner.net Package"; 
     786                $this->error['brand_update_check_xml'] = "<br/>Not able to connect to repository. Using local Provisioner.net Package"; 
    779787            } else { 
    780788                exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $endpoint_package ." -C ".PHONE_MODULES_PATH."temp/"); 
     
    803811                $result = $this->download_xml(UPDATE_PATH .$data['directory']."/".$data['directory'].".xml","endpoint/".$data['directory']); 
    804812                if(!$result) { 
    805                     $message .= "<br/>Not able to connect to repository. Using local brand [".$data['name']."] file instead."; 
     813                    $this->error['brand_update_check'] = "<br/>Not able to connect to repository. Using local brand [".$data['name']."] file instead."; 
    806814                } 
    807815 
     
    841849                    } 
    842850                } else { 
    843                     $message .= "<br/>Error: No Local File for ".$data['name']."!"; 
     851                    $this->error['brand_update_check_local_file'] = "<br/>Error: No Local File for ".$data['name']."!"; 
    844852                } 
    845853            } 
     
    863871            } 
    864872        } else { 
    865             $message .= "<br/>Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"; 
    866         } 
    867         $this->error['brand_update_check'] = $message; 
     873            $this->error['brand_update_check_master_file'] = "<br/>Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"; 
     874        } 
    868875 
    869876        return $out; 
     
    888895            $package = $temp['data']['brands']['package']; 
    889896 
    890             echo "Downloading Tarball......."; 
     897            echo "<div style='float: left'>Downloading Brand Package...</div><div style='float: left' id=\"DivExample\">.</div>"; 
    891898            $this->download_file_with_progress_bar(UPDATE_PATH.$row[0]['directory'].'/'.$package, PHONE_MODULES_PATH."temp/".$package); 
    892             echo "Done!<br />"; 
    893  
     899            echo "<script type='text/javascript'>document.getElementById('DivExample').innerHTML='Done!';</script><br />"; 
     900             
    894901            echo "Extracting Tarball........"; 
    895902            exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $package ." -C ".PHONE_MODULES_PATH."temp/"); 
     
    905912                    $dir = str_replace(PHONE_MODULES_PATH."temp/".$row[0]['directory']."/", "", $file); 
    906913                    if(!file_exists(PHONE_MODULES_PATH."endpoint/".$row[0]['directory']."/".$dir)) { 
    907                         mkdir(PHONE_MODULES_PATH."endpoint/".$row[0]['directory']."/".$dir); 
     914                        mkdir(PHONE_MODULES_PATH."endpoint/".$row[0]['directory']."/".$dir,0764); 
    908915                    } 
    909916                } else { 
     
    911918                        $dir = str_replace(PHONE_MODULES_PATH."temp/".$row[0]['directory']."/", "", $file); 
    912919                        rename($file, PHONE_MODULES_PATH."endpoint/".$row[0]['directory']."/".$dir); 
     920                        chmod(PHONE_MODULES_PATH."endpoint/".$row[0]['directory']."/".$dir,0764); 
    913921                    } 
    914922                } 
     
    10081016 
    10091017            if($key === FALSE) { 
     1018                $this->error['sync_model'] = "Can't locate model in family XML file"; 
    10101019                return(FALSE); 
    10111020            } else { 
     
    10561065 
    10571066            if(empty($template_data_array)) { 
     1067                $this->error['sync_model'] = "No Template Data Found"; 
    10581068                return(FALSE); 
    10591069            } 
     
    14021412        //If the user just wishes to use the local arp cache they can tell the function to not use nmap 
    14031413        //This results in a speed increase from 60 seconds to less than one second. 
    1404         if (($use_nmap) AND ($this->validate_netmask($netmask))) { 
     1414        if (($use_nmap) AND (file_exists($this->global_cfg['nmap_location'])) AND ($this->validate_netmask($netmask))) { 
    14051415            shell_exec($this->global_cfg['nmap_location'].' -v -sP '. $netmask); 
    14061416        } elseif(!$this->validate_netmask($netmask)) { 
     1417            $this->error['discover_new'] = "Invalid Netmask"; 
    14071418            return(FALSE); 
     1419        } elseif(!file_exists($this->global_cfg['nmap_location'])) { 
     1420            $this->error['discover_new'] = "Could Not Find NMAP, Using ARP Only"; 
     1421            //return(FALSE); 
    14081422        } 
    14091423        //Get arp list 
     
    14261440 
    14271441            //Pull out the IP address from row. It's always the first entry in the row and it can only be a max of 15 characters with the delimiters 
    1428             $ip = trim(substr($value, 0, 15)); 
     1442            preg_match_all("/\((.*?)\)/",$value,$matches); 
     1443            $ip = $matches[1]; 
     1444            $ip = $ip[0]; 
    14291445 
    14301446            //Pull out the mac address by looking for the delimiter 
     
    15121528 
    15131529        if(!isset($temp)) { 
    1514             $this->error['modelsAvailable'] = "SQL Statement came out empty!"; 
     1530            $this->error['modelsAvailable'] = "You need to enable at least ONE model"; 
    15151531            return(FALSE); 
    15161532        } else { 
     
    16161632} 
    16171633 
     1634function endpointman_flush_buffers(){ 
     1635    ob_end_flush(); 
     1636    //ob_flush(); 
     1637    flush(); 
     1638    ob_start(); 
     1639} 
     1640 
    16181641function endpointman_update_progress_bar($out) { 
    1619     echo "."
     1642    echo '<script type="text/javascript">document.getElementById(\'DivExample\').innerHTML="%'.$out.'";</script>'
    16201643} 
    16211644 
     
    16281651        $file_size = intval($regs[2]); 
    16291652    } 
    1630     ob_flush(); 
     1653    //ob_flush(); 
     1654    endpointman_flush_buffers(); 
    16311655    return $length; 
    16321656} 
     
    16461670    if($fout) 
    16471671        fwrite($fout, $string); 
    1648     ob_flush(); 
     1672    //ob_flush(); 
     1673    endpointman_flush_buffers(); 
    16491674    return $length; 
    16501675} 
    1651 ?> 
  • contributed_modules/modules/endpointman/includes/installer.php

    r10227 r10233  
    1010 
    1111$endpoint = new endpointmanager(); 
     12 
     13echo "<html><head><title>Installer</title></head><body>"; 
    1214 
    1315function out($text){ 
     
    193195} 
    194196 
    195 echo "<hr>\n\t<a href=\"#\" onclick=\"parent.close_module_actions(true);\" style=\"text-decoration:none\" />"._("Return")."</a>"; 
     197echo "<hr>\n\t<a href=\"#\" onclick=\"parent.close_module_actions(true);\" style=\"text-decoration:none\" />"._("Return")."</a></body></html>"; 
  • contributed_modules/modules/endpointman/includes/template_manager.inc

    r10227 r10233  
    88 */ 
    99$message = NULL; 
     10$error_message = NULL; 
     11 
    1012$no_add = FALSE; 
    1113$default_display = FALSE; 
     
    1820 
    1921if((!$product_list) && (!$mac_list)) { 
    20  $message = _("Welcome to Endpoint Manager")."!<br />"._("You have no products (Modules) installed, click")." <a href=\"config.php?display=epm_config&type=$type\">"._("here")."</a> "._("to install some"); 
    21  $no_add = TRUE; 
     22    $message = _("Welcome to Endpoint Manager")."!<br />"._("You have no products (Modules) installed, click")." <a href=\"config.php?display=epm_config&type=$type\">"._("here")."</a> "._("to install some"); 
     23    $no_add = TRUE; 
    2224} elseif(!$product_list) { 
    23  $message = "Thanks for upgrading to version 2.0! Please head on over to <a href=\"config.php?display=epm_config&type=$type\">\"Brand Configurations/Setup\"</a> to setup and install phone configurations"; 
    24  $no_add = TRUE; 
     25    $message = "Thanks for upgrading to version 2.0! Please head on over to <a href=\"config.php?display=epm_config&type=$type\">\"Brand Configurations/Setup\"</a> to setup and install phone configurations"; 
     26    $no_add = TRUE; 
    2527} 
    2628 
    2729if(isset($_REQUEST['edit_template'])) { 
    28  $endpoint->edit_template_display($_REQUEST['id'],$_REQUEST['custom']); 
     30    $endpoint->edit_template_display($_REQUEST['id'],$_REQUEST['custom']); 
    2931} elseif(isset($_REQUEST['button_save'])) { 
    30         if(($_REQUEST['model_class'] == 0) OR (empty($_REQUEST['template_name'])) OR ($_REQUEST['model_clone'] == 0)) { 
    31             $message = "No Valid Model/Template/Name Selected!"; 
    32             $default_display = TRUE; 
    33         } else { 
    34             $sql = "INSERT INTO endpointman_template_list (product_id, name, model_id) VALUES ('".$_REQUEST['model_class']."','".$_REQUEST['template_name']."','".$_REQUEST['model_clone']."')"; 
    35             $endpoint->db->query($sql); 
    36             $sql = "SELECT id FROM endpointman_template_list WHERE product_id = '".$_REQUEST['model_class']."' AND name = '".$_REQUEST['template_name']."'"; 
    37             $id = $endpoint->db->getOne($sql); 
    38             $endpoint->edit_template_display($id,0); 
    39        
     32    if(($_REQUEST['model_class'] == 0) OR (empty($_REQUEST['template_name'])) OR ($_REQUEST['model_clone'] == 0)) { 
     33        $message = "No Valid Model/Template/Name Selected!"; 
     34        $default_display = TRUE; 
     35    } else { 
     36        $sql = "INSERT INTO endpointman_template_list (product_id, name, model_id) VALUES ('".$_REQUEST['model_class']."','".$_REQUEST['template_name']."','".$_REQUEST['model_clone']."')"; 
     37        $endpoint->db->query($sql); 
     38        $sql = "SELECT id FROM endpointman_template_list WHERE product_id = '".$_REQUEST['model_class']."' AND name = '".$_REQUEST['template_name']."'"; 
     39        $id = $endpoint->db->getOne($sql); 
     40        $endpoint->edit_template_display($id,0); 
     41   
    4042} elseif(isset($_REQUEST['delete_template'])) { 
    41  $sql = "DELETE FROM endpointman_template_list WHERE id = ". $_REQUEST['id']; 
    42  $endpoint->db->query($sql); 
    43         $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = 0 WHERE custom_cfg_template = ".$_REQUEST['id']; 
    44  $endpoint->db->query($sql); 
    45  $default_display = TRUE; 
    46  $message = _('Deleted'); 
     43    $sql = "DELETE FROM endpointman_template_list WHERE id = ". $_REQUEST['id']; 
     44    $endpoint->db->query($sql); 
     45    $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = 0 WHERE custom_cfg_template = ".$_REQUEST['id']; 
     46    $endpoint->db->query($sql); 
     47    $default_display = TRUE; 
     48    $message = _('Deleted'); 
    4749} elseif((isset($_REQUEST['button_save_template'])) AND (isset($_REQUEST['custom']))) { 
    48  $endpoint->save_template($_REQUEST['id'],$_REQUEST['custom'],$_REQUEST); 
    49  $default_display = TRUE; 
    50  $message = _('Saved'); 
     50    $endpoint->save_template($_REQUEST['id'],$_REQUEST['custom'],$_REQUEST); 
     51    $default_display = TRUE; 
     52    $message = _('Saved'); 
    5153} else { 
    52  $default_display = TRUE; 
     54    $default_display = TRUE; 
    5355} 
    5456 
    5557if($default_display) { 
    56  $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; 
    57         $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
    58  $i = 0; 
    59         $row_out = array(); 
    60         foreach($template_list as $row) { 
    61                 $row_out[$i] = $row; 
    62    $row_out[$i]['custom'] = 0; 
    63                 if(!$row['enabled']) { 
    64                     $row_out[$i]['model_clone'] = $row_out[$i]['model_clone']."<i>(Disabled)</i>"; 
    65                
    66    $i++; 
    67 
     58    $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; 
     59    $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
     60    $i = 0; 
     61    $row_out = array(); 
     62    foreach($template_list as $row) { 
     63        $row_out[$i] = $row; 
     64        $row_out[$i]['custom'] = 0; 
     65        if(!$row['enabled']) { 
     66            $row_out[$i]['model_clone'] = $row_out[$i]['model_clone']."<i>(Disabled)</i>"; 
     67       
     68        $i++; 
     69   
    6870 
    69  $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'; 
    70         $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
    71         foreach($template_list as $row) { 
    72    $row_out[$i] = $row; 
    73    $row_out[$i]['custom'] = 1; 
    74    $row_out[$i]['name'] = $row['mac'] . "-(" .$row['description'].")"; 
    75    $i++; 
    76 
     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'; 
     72    $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
     73    foreach($template_list as $row) { 
     74        $row_out[$i] = $row; 
     75        $row_out[$i]['custom'] = 1; 
     76        $row_out[$i]['name'] = $row['mac'] . "-(" .$row['description'].")"; 
     77        $i++; 
     78   
    7779 
    78   $sql = "SELECT DISTINCT endpointman_product_list.* FROM endpointman_product_list, endpointman_model_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.hidden = 0 AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden != 1 AND endpointman_product_list.cfg_dir !=  ''"; 
    79          
    80         $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
    81   $i = 1; 
    82         $class_row[0]['value'] = 0; 
    83   $class_row[0]['text'] = ""; 
    84         foreach($template_list as $row) { 
    85     $class_row[$i]['value'] = $row['id']; 
    86     $class_row[$i]['text'] = $row['short_name']; 
    87     $i++; 
    88   } 
    89   $tpl = new RainTPL( LOCAL_PATH.'templates' ); 
    90         $tpl->assign("amp_conf_serial", "1"); 
    91   $tpl->assign("templates_list", $row_out); 
    92   $tpl->assign("class_list", $class_row); 
    93   $tpl->assign("no_add", $no_add); 
    94   $tpl->assign("debug", $debug); 
    95   $tpl->assign("message", $message); 
    96   echo $tpl->draw( 'template_manager' ); 
     80    $sql = "SELECT DISTINCT endpointman_product_list.* FROM endpointman_product_list, endpointman_model_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.hidden = 0 AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden != 1 AND endpointman_product_list.cfg_dir !=  ''"; 
     81 
     82    $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
     83    $i = 1; 
     84    $class_row[0]['value'] = 0; 
     85    $class_row[0]['text'] = ""; 
     86    foreach($template_list as $row) { 
     87        $class_row[$i]['value'] = $row['id']; 
     88        $class_row[$i]['text'] = $row['short_name']; 
     89        $i++; 
     90    } 
     91    $tpl = new RainTPL( LOCAL_PATH.'templates' ); 
     92    $tpl->assign("amp_conf_serial", "1"); 
     93    $tpl->assign("templates_list", $row_out); 
     94    $tpl->assign("class_list", $class_row); 
     95    $tpl->assign("no_add", $no_add); 
     96    $tpl->assign("debug", $debug); 
     97 
     98    foreach($endpoint->error as $key => $error) { 
     99        $error_message .= $error; 
     100        if($endpoint->global_cfg['debug']) { 
     101            $error_message .= " Function: [".$key."]"; 
     102        } 
     103        $error_message .= "<br />"; 
     104    } 
     105    if(isset($error_message)) { 
     106        $endpoint->display_message_box($error_message,$tpl,1); 
     107    } 
     108    if(isset($message)) { 
     109        $endpoint->display_message_box($message,$tpl,0); 
     110    } 
     111 
     112    echo $tpl->draw( 'template_manager' ); 
    97113} 
  • contributed_modules/modules/endpointman/install.php

    r10229 r10233  
    9393} 
    9494 
    95 $version = "2.2.5"; 
     95$version = "2.2.6"; 
    9696 
    9797if(ep_table_exists("endpointman_global_vars")) { 
     
    135135} elseif($global_cfg['version'] == '2.2.4') { 
    136136    $ver = "2.2.4"; 
     137} elseif($global_cfg['version'] == '2.2.5') { 
     138    $ver = "2.2.5"; 
     139} elseif($global_cfg['version'] == '2.2.6') { 
     140    $ver = "2.2.6"; 
    137141} else { 
    138142    $ver = "1000"; 
     
    764768 
    765769if ($ver <= "2.2.4") { 
    766 } 
    767  
    768 if ($ver <= "2.2.5") {   
    769770    out("Fix Debug Left on Error, this turns off debug."); 
    770771    $sql = 'UPDATE `asterisk`.`endpointman_global_vars` SET `value` = \'1\' WHERE `endpointman_global_vars`.`idnum` = 9 LIMIT 1;'; 
    771772    $db->query($sql); 
    772  
    773 
     773
     774 
     775if ($ver <= "2.2.5") {   
     776    out("Fixing Permissions of Phone Modules Directory"); 
     777    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHONE_MODULES_PATH), RecursiveIteratorIterator::SELF_FIRST); 
     778    foreach($iterator as $item) { 
     779        chmod($item, 0764); 
     780    } 
     781 
     782    out("Creating Endpoint Version Row"); 
     783    $sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'endpoint_vers\', \'\');'; 
     784    $db->query($sql); 
     785
     786 
     787 
    774788 
    775789if ($new_install) { 
  • contributed_modules/modules/endpointman/module.xml

    r10232 r10233  
    22  <rawname>endpointman</rawname> 
    33  <name>PBX End Point Manager</name> 
    4   <version>2.2.5</version> 
     4  <version>2.2.6</version> 
    55  <type>tool</type> 
    66  <category>End Point Manager</category> 
     
    1515   <description>PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones.</description> 
    1616   <changelog> 
     17                *2.2.6* Fixed download progress so that it displays.  
    1718    *2.2.5* Fixed Debug Always on Error &amp File download errors &amp Fix float error on install 
    1819        </changelog> 
    1920  <info>http://projects.colsolgrp.net/projects/show/endpointman</info> 
    20   <location>contributed_modules/release/endpointman-2.2.5.tgz</location> 
     21  <location>contributed_modules/release/endpointman-2.0.0.tgz</location> 
    2122 
    22 <md5sum>4b5eb8e4a5fa023256d7b83f2d3e8408</md5sum> 
     23<md5sum>b1341a35ef60d0fad17348803a0a7833</md5sum> 
    2324</module> 
  • contributed_modules/modules/endpointman/templates/advanced_settings_manual_upload.html

    r10220 r10233  
    1 <center><h3>{$message}</h3></center> 
     1{if condition="isset($show_error_box)"} 
     2    {include="message_box"} 
     3{/if} 
    24{if condition="isset($show_installer)"} 
    35<script> 
  • contributed_modules/modules/endpointman/templates/advanced_settings_settings.html

    r10218 r10233  
    1 <h3>{$message}</h3> 
     1{if condition="isset($show_error_box)"} 
     2    {include="message_box"} 
     3{/if} 
    24<form action='config.php{$web_vars}&display=epm_advanced&subpage=settings' method='POST'> 
    35<table width='90%' align='center'> 
  • contributed_modules/modules/endpointman/templates/brand_model_manager.html

    r10227 r10233  
    11{include="global_header"} 
     2{if condition="isset($show_error_box)"} 
     3    {include="message_box"} 
     4{/if} 
    25<style type="text/css"> 
    36<!-- 
     
    1922--> 
    2023</style> 
    21 <h3 align='center'><font color='red'>{$error}</font></h3> 
    2224<center> 
    2325<form action='config.php{$web_var}&display=epm_config' method='POST'> 
  • contributed_modules/modules/endpointman/templates/devices_manager.html

    r10227 r10233  
    11{include="global_header"} 
     2{if condition="isset($show_error_box)"} 
     3    {include="message_box"} 
     4{/if} 
    25<h2 align='center'>{$error}</h2> 
    36{if condition="isset($id)"} 
     
    69<br> 
    710<center> 
    8   {if condition="isset($message)"} 
    9   <h3 align='center'>{$message}</h3> 
    10   {/if} 
    1111  {if condition="$no_add == FALSE"} 
    1212  <form action='config.php{$web_var}&display=epm_devices' method='POST'> 
     
    112112    <tr> 
    113113    <td align='center' width='5px'><input type="checkbox" name="add[]" value="{$value.id}"></td> 
    114     <td align='center' width='11%'>{$value.mac_strip}</td> 
     114    <td align='center' width='11%'>{$value.mac_strip}<br />({$value.ip})</td> 
    115115    <td width="13%" align='center'>{$value.brand}</td> 
    116116    <td width="25%" align='center'> 
  • contributed_modules/modules/endpointman/templates/global_footer.html

    r10227 r10233  
    22<h6 align='center'>The Endpoint Configuration Manager is currently maintained by <a target="_blank" href=http://www.andrewsnagy.com/>Andrew Nagy</a> 
    33<br/><?=_("The Endpoint Configuration Manager was originally written by")?> <a target="_blank" href=http://www.mymcs.us>Ed Macri</a>, <a target="_blank" href=http://www.cohutta.com> John Mullinix.</a> and <a target="_blank" href=http://www.colsolgrp.com>Tony Shiffer</a> 
    4 <br/>Endpoint Configuration Manager uses code from the MPL licensed project Provisioner.net at <a href="http://https://www.assembla.com/code/provisioner/git/nodes?rev=master">https://www.assembla.com/code/provisioner/git/nodes?rev=master</a> co-written by Darren Schreiber &amp Andrew Nagy 
     4<br/>Endpoint Configuration Manager uses code from the MPL licensed project Provisioner.net at <a href="http://www.assembla.com/code/provisioner/git/nodes?rev=master">http://www.assembla.com/code/provisioner/git/nodes?rev=master</a> co-written by Darren Schreiber &amp Andrew Nagy 
    55<br> <?=_("The project is maintained at")?>  
    66<a target="_blank" href="http://projects.colsolgrp.net/projects/show/endpointman"> CSG Software Projects.</a> 
  • contributed_modules/modules/endpointman/templates/template_editor.html

    r10227 r10233  
    1818        {else} 
    1919  {if condition="$custom != 0"} 
    20         <?=_('a custom config template for extension')?> {$ext}, <?=_('Model')?>: {$model} 
     20        <strong><?=_('Template Name')?>:</strong> <i>Custom Template: Extension {$ext}</i><br /> 
     21        <strong><?=_('Product Line')?>:</strong> {$product}<br /> 
     22        <strong><?=_('Clone of Model')?>:</strong> {$model} 
    2123  {/if} 
    2224  {if condition="$custom == 0"} 
     
    4143            <br /> 
    4244            <?=_('You can also use certain variables in your configs')?>:<br />{noparse} 
    43   -"{$srvip}" = <?=_('Server IP')?><br /> 
     45  -"{$server.ip.1}" = <?=_('Server 1 IP')?><br /> 
     46        -"{$server.port.1}" = <?=_('Server 1 Port')?><br /> 
    4447  -"{$mac}" = <?=_('Device\'s Mac Address')?><br /> 
    45   -"{$ext}" = <?=_('Device\'s Default Extension (Line 1 or Master)')?><br /> 
    46   -"{$diplayname}" = <?=_('Device\'s Description in FreePBX (Usually the Full Name)')?><br />{/noparse} 
     48        -"{$model}" = <?=_('Device\'s Model')?><br /> 
     49  -"{$ext.line.1}" = <?=_('Device\'s Default Extension (Line 1 or Master)')?><br /> 
     50  -"{$displayname.line.1}" = <?=_('Device\'s Description in FreePBX (Usually the Full Name)')?><br />{/noparse} 
    4751            <br /> 
    4852            {/if} 
  • contributed_modules/modules/endpointman/templates/template_manager.html

    r10227 r10233  
    11{include="global_header"} 
    2 <h3><center>{$message}</center></h3> 
     2{if condition="isset($show_error_box)"} 
     3    {include="message_box"} 
     4{/if} 
    35{if condition="$no_add == FALSE"} 
    46<center>