Index: /modules/branches/2.2/phonebook/i18n/it_IT/LC_MESSAGES/phonebook.po =================================================================== --- /modules/branches/2.2/phonebook/i18n/it_IT/LC_MESSAGES/phonebook.po (revision 2125) +++ /modules/branches/2.2/phonebook/i18n/it_IT/LC_MESSAGES/phonebook.po (revision 2125) @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1.0\n" +"Report-Msgid-Bugs-To: osdevel@webrainstorm.it\n" +"POT-Creation-Date: 2006-05-29 11:35+0200\n" +"PO-Revision-Date: 2006-05-29 11:35\n" +"Last-Translator: Edoardo Serra \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: page.phonebook.php:47 +msgid "Phonebook entry" +msgstr "Voce di rubrica" + +#: page.phonebook.php:47 +msgid "deleted" +msgstr "cancellata" + +#: page.phonebook.php:52 +msgid "Phonebook entries" +msgstr "Voci di rubrica" + +#: page.phonebook.php:56 +msgid "Name" +msgstr "Nome" + +#: page.phonebook.php:57 +msgid "Number" +msgstr "Numero" + +#: page.phonebook.php:69 +msgid "Delete" +msgstr "Cancella" + +#: page.phonebook.php:71 +msgid "Edit" +msgstr "Modifica" + +#: page.phonebook.php:82 +msgid "Add or replace entry" +msgstr "Aggiungi o sostituisci voce" + +#: page.phonebook.php:85 +msgid "Name:" +msgstr "Nome:" + +#: page.phonebook.php:85 +msgid "Enter the name" +msgstr "Inserire il nome" + +#: page.phonebook.php:89 +msgid "Number:" +msgstr "Numero:" + +#: page.phonebook.php:90 +msgid "" +"Enter the number (For caller ID lookup to work it should match the caller ID " +"received from network)" +msgstr "" +"Inserire il numero (Per far funzionare la ricerca dell'ID chiamante" +"deve corrispondere all'ID chiamante ricevuto dalla rete)" Index: /modules/branches/2.2/phonebook/module.xml =================================================================== --- /modules/branches/2.2/phonebook/module.xml (revision 2125) +++ /modules/branches/2.2/phonebook/module.xml (revision 2125) @@ -0,0 +1,13 @@ + + phonebook + Phonebook + 1.0.3 + tool + Module + + Asterisk Phonebook + + release/phonebook-1.0.3.tgz + xx + http://freepbx.org/wiki/AsteriskPhonebook + Index: /modules/branches/2.2/phonebook/page.phonebook.php =================================================================== --- /modules/branches/2.2/phonebook/page.phonebook.php (revision 2125) +++ /modules/branches/2.2/phonebook/page.phonebook.php (revision 2125) @@ -0,0 +1,189 @@ + + + + + + + +
+'._("Phonebook entry").' '.$itemid.' '._("deleted").' !'; +elseif ($action == 'import') + echo '

'._("Imported").' '.$i.' '._("lines of").' '.$n.' '.'!

'; +elseif ($action == 'empty') + echo '

'._("Phonebook emptied").' !

'; + +if (is_array($numbers)) { + +?> + + + +');"> + + + + + + + + + + + + + + + $name) { + print(''); + printf('', $num, $name); + printf('', + $_SERVER['PHP_SELF'], urlencode($dispnum), urlencode($num), _("Are you sure you want to delete this entry ?"), _("Delete")); + printf('', + $num, addslashes($name), $num, _("Edit")); + print(''); + } + +?> + + + + + + +

  
%s%s%s%s

">
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+

">
+ + + + + + + + + + + + + + + + + + + +

+

">
+ Index: /modules/branches/2.2/phonebook/functions.inc.php =================================================================== --- /modules/branches/2.2/phonebook/functions.inc.php (revision 2125) +++ /modules/branches/2.2/phonebook/functions.inc.php (revision 2125) @@ -0,0 +1,121 @@ +connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { + $list = $astman->database_show(); + foreach ($list as $k => $v) { + if (substr($k, 1, 7) == 'cidname') + $numbers[substr($k, 9)] = $v ; + } + + if (is_array($numbers)) + natcasesort($numbers); + + return $numbers; + } else { + fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); + } + +} + +function phonebook_del($number){ + require_once('common/php-asmanager.php'); + global $amp_conf; + + $astman = new AGI_AsteriskManager(); + if ($res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { + $astman->database_del("cidname",$number); + } else { + fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); + } +} + +function phonebook_empty(){ + require_once('common/php-asmanager.php'); + global $amp_conf; + + $astman = new AGI_AsteriskManager(); + if ($res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { + $astman->database_deltree("cidname"); + } else { + fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); + } +} + +function phonebook_add($number, $name){ + require_once('common/php-asmanager.php'); + global $amp_conf; + + if(!phonebook_chk($number)) + return false; + + $astman = new AGI_AsteriskManager(); + if ($res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { + $astman->database_put("cidname",$number, '"'.$name.'"'); + } else { + fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); + } +} + + +// TODO: ensures post vars is valid +function phonebook_chk($post){ + return true; +} + +function fgetcsvfromline ($line, $columnCount, $delimiterChar = ';', $enclosureChar = '"') { + $regExpSpecialChars = array ( + "|" => "\\|", + "&" => "\\&", + "$" => "\\$", + "(" => "\\(", + ")" => "\\)", + "^" => "\\^", + "[" => "\\[", + "]" => "\\]", + "{" => "\\{", + "}" => "\\}", + "." => "\\.", + "*" => "\\*", + "\\" => "\\\\", + "/" => "\\/" + ); + + $matches = array(); + $delimiterChar = strtr($delimiterChar, $regExpSpecialChars); + $enclosureChar = strtr($enclosureChar, $regExpSpecialChars); + + $regExp = "/^"; + for ($i = 0; $i < $columnCount; $i++) { + $regExp .= '('.$enclosureChar.'?)(.*)\\'.(2*$i + 1).$delimiterChar; // construct the regular expression + } + $regExp = substr($regExp, 0, (strlen($regExp) - strlen($delimiterChar)))."/"; // format the regular expression + + if (preg_match($regExp, $line, $matches)) { + $result = array(); + for ($i = 1; $i < count($matches)/2; $i++) { + if (strlen($matches[2*$i]) < 1) + $matches[2*$i] = ""; + $result[$i] = $matches[2*$i]; // get only the fields but not the delimiters + } + return $result; + } + return FALSE; +} + +?> Index: /modules/branches/2.2/phonebook/ChangeLog =================================================================== --- /modules/branches/2.2/phonebook/ChangeLog (revision 2125) +++ /modules/branches/2.2/phonebook/ChangeLog (revision 2125) @@ -0,0 +1,24 @@ +phonebook (1.0.3) + + * Added 'Import from CSV' function + * Added an 'Empty Phonebook' button + * Added js confirmation to Delete link + * Added licensing information in every php file + * Created this ChangeLog + + -- Edoardo, 2006-06-25 + +phonebook (1.0.3) + + * Is now possible to insert a name with a space in it (Bug signaled by jcwoltz) + * Fixed a little bug in editing the a number associated with a name + * Suppressed warnings when the phonebook was empty + * Swapped Number and name columns and fields + + -- Edoardo, 2006-06-18 + +phonebook (1.0.1) + + * Initial phonebook release + + -- Edoardo, 2006-05-29