Changeset 7313

Show
Ignore:
Timestamp:
12/11/08 21:31:32 (4 years ago)
Author:
p_lindheimer
Message:

add rnav checkboxes to collapse/expand extension section and finish complete rewrite of module that was mostly done in 2.5

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.6/printextensions/module.xml

    r7029 r7313  
    22  <rawname>printextensions</rawname> 
    33  <name>Print Extensions</name> 
    4   <version>2.5.0.3</version> 
     4  <version>2.6.0.0</version> 
    55  <type>tool</type> 
    6   <category>Third Party Addon</category> 
    7   <description>Creates a printable list of names and extension numbers</description> 
     6  <category>System Administration</category> 
     7  <description>Creates a printable list of extension numbers used throughout the system from all modules that provide an internal callable number</description> 
    88  <menuitems> 
    99    <printextensions>Print Extensions</printextensions> 
    1010  </menuitems> 
    1111  <changelog> 
     12    *2.6.0.0* add rnav checkboxes to collapse/expand extension sections 
    1213    *2.5.0.3* fixes to get localization working from other module domains 
    1314    *2.5.0.2* formating cleanup, code removed 
  • modules/branches/2.6/printextensions/page.printextensions.php

    r6956 r7313  
    1 <?php /* $Id: page.printextensions.php 1197 2006-04-26 21:12 KerryG $ */ 
    2 //Copyright (C) 2006 Kerry Garrison (kgarrison at servicepointe dot net
     1<?php /* $Id */ 
     2// Copyright (C) 2008 Philippe Lindheimer & Bandwidth.com (plindheimer at bandwidth dot com
    33// 
    4 //This program is free software; you can redistribute it and/or 
    5 //modify it under the terms of the GNU General Public License 
    6 //as published by the Free Software Foundation; either version 2 
    7 //of the License, or (at your option) any later version
     4// This program is free software; you can redistribute it and/or 
     5// modify it under the terms of the GNU General Public License 
     6// as published by the Free Software Foundation, version 2 
     7// of the License
    88// 
    9 //This program is distributed in the hope that it will be useful, 
    10 //but WITHOUT ANY WARRANTY; without even the implied warranty of 
    11 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    12 //GNU General Public License for more details. 
     9// This program is distributed in the hope that it will be useful, 
     10// but WITHOUT ANY WARRANTY; without even the implied warranty of 
     11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     12// GNU General Public License for more details. 
    1313 
    14 $dispnum = 'printextensions'; //used for switch on config.php 
     14$dispnum = 'printextensions'; 
     15global $active_modules; 
    1516 
    16 //isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action=''; 
     17$html_txt = '<div class="content">'; 
    1718 
    18  
    19 ?> 
    20  
    21 <div class="content"> 
    22 <?php 
    23 if (!$quietmode) { 
    24   echo "<br /><a href=\"config.php?type=tool&display=printextensions&quietmode=on\" target=\"_blank\"><b>"._("Printer Friendly Page")."</b></a>\n"; 
    25 } 
    2619if (!$extdisplay) { 
    27   echo '<br><h2>'._("PBX Extension Layout").'</h2><table border="0" width="95%">'; 
    28   echo "<tr width=90%><td align=left><b>"._("Name")."</b></td><td width=\"10%\" align=\"right\"><b>"._("Extension")."</b></td></tr>"; 
     20  $html_txt .= '<br><h2>'._("FreePBX Extension Layout").'</h2><table border="0" width="75%">'; 
     21  $html_txt .= "<tr width=90%><td align=left><b>"._("Name")."</b></td><td width=\"10%\" align=\"right\"><b>"._("Extension")."</b></td></tr></table>\n"; 
    2922} 
    3023 
    31 global $active_modules; 
    3224$full_list = framework_check_extension_usage(true); 
    33 // get all featurecodes 
    34 $featurecodes = featurecodes_getAllFeaturesDetailed(); 
    3525foreach ($full_list as $key => $value) { 
    36   $txtdom = $active_modules[$key]['rawname']; 
    37   if ($txtdom == 'core') $txtdom = 'amp'; 
    38   echo "<tr colspan=\"2\" width='100%'><td><br /><strong>".sprintf("%s",dgettext($txtdom,$active_modules[$key]['name']))."</strong></td></tr>"; 
     26 
     27  $sub_heading_id = $txtdom = $active_modules[$key]['rawname']; 
     28  if ($active_modules[$key]['rawname'] == 'featurecodeadmin' || ($quietmode && !isset($_REQUEST[$sub_heading_id]))) { 
     29    continue; // featurecodes are fetched below 
     30  } 
     31  if ($txtdom == 'core') { 
     32    $txtdom = 'amp'; 
     33  } 
     34  $sub_heading =  dgettext($txtdom,$active_modules[$key]['name']); 
     35  $module_select[$sub_heading_id] = $sub_heading; 
     36  $sub_heading .=  " "._("Extensions"); 
     37  $html_txt_arr[$sub_heading] =  "<div class=\"$sub_heading_id\"><table border=\"0\" width=\"75%\"><tr colspan=\"2\" width='100%'><td><br /><strong>".sprintf("%s",$sub_heading)."</strong></td></tr>\n"; 
    3938  foreach ($value as $exten => $item) { 
    4039    $description = explode(":",$item['description'],2); 
    41     // if from featurecodeadmin then skip as we deal with those later 
    42     if ($active_modules[$key]['rawname'] != 'featurecodeadmin') 
    43         { 
    44         echo "<tr width=\"90%\"><td>".(trim($description[1])==''?$exten:$description[1])."</td><td width=\"10%\" align=\"right\">".$exten."</td></tr>"; 
    45         } 
     40    $html_txt_arr[$sub_heading] .= "<tr width=\"90%\"><td>".(trim($description[1])==''?$exten:$description[1])."</td><td width=\"10%\" align=\"right\">".$exten."</td></tr>\n"; 
     41  } 
     42  $html_txt_arr[$sub_heading] .= "</table></div>"; 
     43
     44 
     45// Now, get all featurecodes. 
     46// 
     47$sub_heading_id =  'featurecodeadmin'; 
     48if (!$quietmode || isset($_REQUEST[$sub_heading_id])) { 
     49  $featurecodes = featurecodes_getAllFeaturesDetailed(); 
     50  $sub_heading =  dgettext($txtdom,$active_modules['featurecodeadmin']['name']); 
     51  $module_select[$sub_heading_id] = $sub_heading; 
     52  $html_txt_arr[$sub_heading] =  "<div class=\"$sub_heading_id\"><table border=\"0\" width=\"75%\"><tr colspan=\"2\" width='100%'><td><br /><strong>".sprintf("%s",$sub_heading)."</strong></td></tr>\n"; 
     53  foreach ($featurecodes as $item) { 
     54    $bind_domains = array(); 
     55    if (isset($bind_domains[$item['modulename']]) || (extension_loaded('gettext') && is_dir("modules/".$item['modulename']."/i18n"))) { 
     56      if (!isset($bind_domains[$item['modulename']])) { 
     57        $bind_domains[$item['modulename']] = true; 
     58        bindtextdomain($item['modulename'],"modules/".$item['modulename']."/i18n"); 
     59        bind_textdomain_codeset($item['modulename'], 'utf8'); 
     60      } 
    4661    } 
    47     } 
    48 // Now, get all featurecodes. Code gracefully 'borrowed' from featurecodeadmin 
    49 foreach($featurecodes as $item) { 
    50  $bind_domains = array(); 
    51   if (isset($bind_domains[$item['modulename']]) || (extension_loaded('gettext') && is_dir("modules/".$item['modulename']."/i18n"))) { 
    52    if (!isset($bind_domains[$item['modulename']])) { 
    53     $bind_domains[$item['modulename']] = true; 
    54     bindtextdomain($item['modulename'],"modules/".$item['modulename']."/i18n"); 
    55     bind_textdomain_codeset($item['modulename'], 'utf8'); 
    56    } 
     62    $moduleena = ($item['moduleenabled'] == 1 ? true : false); 
     63    $featureena = ($item['featureenabled'] == 1 ? true : false); 
     64    $featurecodedefault = (isset($item['defaultcode']) ? $item['defaultcode'] : ''); 
     65    $featurecodecustom = (isset($item['customcode']) ? $item['customcode'] : ''); 
     66    $thiscode = ($featurecodecustom != '') ? $featurecodecustom : $featurecodedefault; 
     67    $thismodena = ($moduleena != '') ? $featurecodecustom : $featurecodedefault; 
     68    $txtdom = $item['modulename']; 
     69    // if core then get translations from amp 
     70    if ($txtdom == 'core') { 
     71      $txtdom = 'amp'; 
     72    } 
     73    textdomain($txtdom); 
     74    if ($featureena && $moduleena) { 
     75      $html_txt_arr[$sub_heading] .= "<tr width=\"90%\"><td>".sprintf(dgettext($txtdom,$item['featuredescription']))."</td><td width=\"10%\" align=\"right\">".$thiscode."</td></tr>\n"; 
     76    } 
     77  } 
    5778} 
    58     $moduleena = ($item['moduleenabled'] == 1 ? true : false); 
    59     $featureena = ($item['featureenabled'] == 1 ? true : false); 
    60     $featurecodedefault = (isset($item['defaultcode']) ? $item['defaultcode'] : ''); 
    61     $featurecodecustom = (isset($item['customcode']) ? $item['customcode'] : ''); 
    62     $thiscode = ($featurecodecustom != '') ? $featurecodecustom : $featurecodedefault; 
    63     $thismodena = ($moduleena != '') ? $featurecodecustom : $featurecodedefault; 
    64     $txtdom = $item['modulename']; 
    65     // if core then get translations from amp 
    66     if ($txtdom == 'core') $txtdom = 'amp'; 
    67     textdomain($txtdom); 
    68     if ($featureena == true && $moduleena == true)  
    69    echo "<tr width=\"90%\"><td>".sprintf(dgettext($txtdom,$item['featuredescription']))."</td><td width=\"10%\" align=\"right\">".$thiscode."</td></tr>"; 
    70 }; 
     79$html_txt_arr[$sub_heading] .= "</table></div>"; 
     80ksort($html_txt_arr); 
     81$html_txt .= implode("\n",$html_txt_arr); 
     82 
     83if (!$quietmode) { 
     84  asort($module_select); 
     85  $rnav_txt = '<div class="rnav"><form name="print" action="'.$_SERVER['PHP_SELF'].'?quietmode=on&'.$_SERVER['QUERY_STRING'].'" target=\"_blank\" method="post"><ul>'; 
     86  foreach ($module_select as $id => $sub) { 
     87    $rnav_txt .= "<li><input type=\"checkbox\" value=\"$id\" name=\"$id\" id=\"$id\" class=\"disp_filter\" CHECKED /><label id=\"lab_$id\" name=\"lab_$id\" for=\"$id\">$sub</label></li>\n"; 
     88  } 
     89  $rnav_txt .= "</ul><hr><div style=\"text-align:center\"><input type=\"submit\" value=\""._("Printer Friendly Page")."\" /></div>\n"; 
     90  echo $rnav_txt; 
    7191?> 
    72 </table> 
    73 </div> 
     92  <script language="javascript"> 
     93  <!-- Begin 
     94 
     95  $(document).ready(function(){ 
     96    $(".disp_filter").click(function(){ 
     97      $("."+this.id).slideToggle(); 
     98    }); 
     99  }); 
     100 
     101  // End --> 
     102  </script> 
     103  </form></div> 
     104<?php 
     105
     106echo $html_txt."</div>"; 
     107?>