Formatting MUCH closer to where I want to be. Still need to fully handle
authorBen Klang <ben@alkaloid.net>
Sat, 12 Nov 2005 10:29:52 +0000 (10:29 +0000)
committerBen Klang <ben@alkaloid.net>
Sat, 12 Nov 2005 10:29:52 +0000 (10:29 +0000)
manual priority changes and of course merge in Application XML stuff.

git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@93 06cd67b6-e706-0410-b29e-9de616bca6e9

andrew.webprj
lib/Dialplan.php
lib/Shout.php
templates/dialplan/manager.inc
templates/javascript/dialplan.js
templates/users/userlist.inc
themes/screen.css

index 86e93e2..0130f57 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE webproject>
 <webproject>
-  <project usePreviewPrefix="0" previewPrefix="" type="Local" usePersistentBookmarks="0" name="Shout" encoding="iso 8859-1" enableEvents="true" >
+  <project usePreviewPrefix="0" type="Local" previewPrefix="" usePersistentBookmarks="0" name="Shout" encoding="iso 8859-1" enableEvents="true" >
     <upload/>
     <defaultDTD>-//w3c//dtd xhtml 1.0 strict//en</defaultDTD>
     <item url="config/" uploadstatus="1" />
@@ -11,9 +11,9 @@
     <item url="lib/Driver/" uploadstatus="1" />
     <item modified_time="1131765770" url="lib/Driver/ldap.php" uploadstatus="1" />
     <item modified_time="1131497449" url="lib/base.php" uploadstatus="1" />
-    <item modified_time="1131769562" url="lib/Dialplan.php" uploadstatus="1" />
+    <item modified_time="1131786947" url="lib/Dialplan.php" uploadstatus="1" />
     <item modified_time="1130769960" url="lib/Driver.php" uploadstatus="1" />
-    <item modified_time="1131593364" url="lib/Shout.php" uploadstatus="1" />
+    <item modified_time="1131789833" url="lib/Shout.php" uploadstatus="1" />
     <item modified_time="1121689003" url="lib/System.php" uploadstatus="1" />
     <item modified_time="1130769961" url="lib/User.php" uploadstatus="1" />
     <item url="main/" uploadstatus="1" />
@@ -30,7 +30,7 @@
     <item modified_time="1121689030" url="templates/dialplan/priority-form-end.inc" uploadstatus="1" />
     <item modified_time="1121689030" url="templates/dialplan/priority-form-line.inc" uploadstatus="1" />
     <item url="templates/users/" uploadstatus="1" />
-    <item modified_time="1131594877" url="templates/users/userlist.inc" uploadstatus="1" />
+    <item modified_time="1131787996" url="templates/users/userlist.inc" uploadstatus="1" />
     <item modified_time="1120174958" url="templates/common-header.inc" uploadstatus="1" />
     <item modified_time="1120073766" url="templates/content_page" uploadstatus="1" />
     <item modified_time="1131772201" url="templates/menu.inc" uploadstatus="1" />
@@ -40,7 +40,7 @@
     <item url="themes/graphics/" uploadstatus="1" />
     <item modified_time="1121581526" url="themes/graphics/add-extension.gif" uploadstatus="1" />
     <item modified_time="1130861777" url="themes/graphics/add-user.gif" uploadstatus="1" />
-    <item modified_time="1131744337" url="themes/screen.css" uploadstatus="1" />
+    <item modified_time="1131788314" url="themes/screen.css" uploadstatus="1" />
     <item url="users/" uploadstatus="1" />
     <item modified_time="1122704539" url="users/add.php" uploadstatus="1" />
     <item modified_time="1122704539" url="users/delete.php" uploadstatus="1" />
         <uploadeditem upload_time="1130769960" url="dialplan/edit.php" />
         <uploadeditem upload_time="1131593241" url="index.php" />
         <uploadeditem upload_time="0" url="lib/" />
-        <uploadeditem upload_time="1131769562" url="lib/Dialplan.php" />
+        <uploadeditem upload_time="1131786947" url="lib/Dialplan.php" />
         <uploadeditem upload_time="1130769960" url="lib/Driver.php" />
         <uploadeditem upload_time="0" url="lib/Driver/" />
         <uploadeditem upload_time="1131765770" url="lib/Driver/ldap.php" />
-        <uploadeditem upload_time="1131593364" url="lib/Shout.php" />
+        <uploadeditem upload_time="1131789833" url="lib/Shout.php" />
         <uploadeditem upload_time="1121689003" url="lib/System.php" />
         <uploadeditem upload_time="1130769961" url="lib/User.php" />
         <uploadeditem upload_time="1131600576" url="lib/api.php" />
         <uploadeditem upload_time="1131723538" url="templates/dialplan/contexttree.inc" />
         <uploadeditem upload_time="1131593241" url="templates/dialplan/dialplanlist.inc" />
         <uploadeditem upload_time="1131767776" url="templates/dialplan/extensiondetail.inc" />
-        <uploadeditem upload_time="1131768673" url="templates/dialplan/manager.inc" />
+        <uploadeditem upload_time="1131784175" url="templates/dialplan/manager.inc" />
         <uploadeditem upload_time="1121689030" url="templates/dialplan/priority-form-begin.inc" />
         <uploadeditem upload_time="1121689030" url="templates/dialplan/priority-form-end.inc" />
         <uploadeditem upload_time="1121689030" url="templates/dialplan/priority-form-line.inc" />
         <uploadeditem upload_time="0" url="templates/javascript/" />
-        <uploadeditem upload_time="1131782749" url="templates/javascript/dialplan.js" />
+        <uploadeditem upload_time="1131790763" url="templates/javascript/dialplan.js" />
         <uploadeditem upload_time="1131772201" url="templates/menu.inc" />
         <uploadeditem upload_time="1121578596" url="templates/table-limiter-begin.inc" />
         <uploadeditem upload_time="1121578596" url="templates/table-limiter-end.inc" />
         <uploadeditem upload_time="0" url="templates/users/" />
-        <uploadeditem upload_time="1131594877" url="templates/users/userlist.inc" />
+        <uploadeditem upload_time="1131787996" url="templates/users/userlist.inc" />
         <uploadeditem upload_time="0" url="themes/" />
         <uploadeditem upload_time="0" url="themes/graphics/" />
         <uploadeditem upload_time="1121581526" url="themes/graphics/add-extension.gif" />
         <uploadeditem upload_time="1130861777" url="themes/graphics/add-user.gif" />
-        <uploadeditem upload_time="1131744337" url="themes/screen.css" />
+        <uploadeditem upload_time="1131788314" url="themes/screen.css" />
         <uploadeditem upload_time="1122704475" url="users.php" />
         <uploadeditem upload_time="0" url="users/" />
         <uploadeditem upload_time="1122704539" url="users/add.php" />
     <item modified_time="1131767776" url="templates/dialplan/extensiondetail.inc" uploadstatus="1" />
     <item modified_time="1131497712" url="security.php" uploadstatus="1" />
     <item url="templates/javascript/" uploadstatus="1" />
-    <item modified_time="1131782749" url="templates/javascript/dialplan.js" uploadstatus="1" />
-    <item modified_time="1131768673" url="templates/dialplan/manager.inc" />
+    <item modified_time="1131790763" url="templates/javascript/dialplan.js" uploadstatus="1" />
+    <item modified_time="1131784175" url="templates/dialplan/manager.inc" uploadstatus="1" />
     <treestatus>
       <openfolder url="lib" />
       <openfolder url="lib/Driver" />
       <openfolder url="templates" />
       <openfolder url="templates/dialplan" />
       <openfolder url="templates/javascript" />
+      <openfolder url="templates/users" />
       <openfolder url="themes" />
+      <openfolder url="users" />
     </treestatus>
   </project>
 </webproject>
index e1b5891..37a8aa5 100644 (file)
@@ -146,7 +146,7 @@ class Shout_Dialplan
         return true;
     }
 
-    function renderAppList()
+    function generateAppList()
     {
         # $applist = Shout::getApplist();
         print '<script language="JavaScript" type="text/javascript">'."\n";
@@ -204,7 +204,7 @@ class Shout_Dialplan
                         print '<div class="extensionBox" ';
                             print 'id="eBox-'.$extension.'" ';
                             print 'onclick="javascript:shout_dialplan_object_'.$this->_instance.'.highlightExten';
-                                print '('.$extension.');">'."\n";
+                                print '(\''.$extension.'\');">'."\n";
                             print Shout::exten2name($extension);
                         print '</div>'."\n";
                     print '<div id="pList-'.$extension.'">'."\n";
index fe927ba..9d960f6 100644 (file)
@@ -322,5 +322,49 @@ class Shout
             return 0;
         }
     }
+
+    function xml2applist()
+    {
+        $file = SHOUT_BASE . '/config/applist.xml';
+
+        $xml_parser = xml_parser_create();
+        $ShoutObject = new Shout;
+        xml_set_element_handler($xml_parser,
+            array($ShoutObject, '_xml2applist_startElement'),
+            array($ShoutObject, '_xml2applist_startElement'));
+        xml_set_character_data_handler($xml_parser,
+            array($ShoutObject, '_xml2applist_characterData'));
+
+        if (!$fp = fopen($file, 'r')) {
+            return PEAR::raiseError('Unable to open applist.xml for reading');
+        }
+
+        while ($data = fread($fp, 4096)) {
+            if (!xml_parse($xml_parser, $data, feof($fp))) {
+                return PEAR::raiseError(sprintf("Invalid XML %s at line %d",
+                    xml_error_string(xml_get_error_code($xml_parser)),
+                    xml_get_current_line_number($xml_parser)));
+            }
+        }
+        xml_parser_free($xml_parser);
+    }
+
+    function _xml2applist_startElement($parser, $name, $attrs = array())
+    {
+        print "Name: $name<br />\n";
+        print_r($attrs);
+        print "<br />\n";
+        print "<br />\n";
+    }
+
+    function _xml2applist_endElement($parser, $name)
+    {
+        echo '';
+    }
+
+    function _xml2applist_characterData($parser, $string)
+    {
+        print "Data: $string<br />\n";
+    }
 }
 // }}}
\ No newline at end of file
index b33e6fc..425ee59 100644 (file)
@@ -4,6 +4,6 @@
 
 <?php
 $dpgui->renderNavTree();
-$dpgui->renderAppList();
+$dpgui->generateAppList();
 $dpgui->renderExtensions();
 ?>
\ No newline at end of file
index 96db88e..f51549c 100644 (file)
@@ -43,69 +43,81 @@ Dialplan.prototype.highlightExten = function(exten)
 Dialplan.prototype.activatePriority = function(exten, prio)
 {
     prio = Number(prio);
-    if (this.curExten) {
-        this.deactivatePriority();
-    }
+    this.curPrio = Number(this.curPrio);
+    if (prio != this.curPrio || exten != this.curExten) {
+        if (this.curExten) {
+            this.deactivatePriority();
+        }
 
-    if (exten != this.curExten) {
-        this.highlightExten(exten);
-    }
+        if (exten != this.curExten) {
+            this.highlightExten(exten);
+        }
 
-    this.curPrio = prio;
-    document.getElementById('pButtons-'+exten+'-'+prio).className = 'pButtonsHighlight';
-    document.getElementById('pNumber-'+exten+'-'+prio).className = 'pElementHighlight';
-    document.getElementById('pApp-'+exten+'-'+prio).className = 'pElementHighlight';
-    document.getElementById('pArgs-'+exten+'-'+prio).className = 'pElementHighlight';
+        this.curPrio = prio;
+        document.getElementById('priority-'+exten+'-'+prio).className = 'priorityHighlight';
+        document.getElementById('pButtons-'+exten+'-'+prio).style['visibility'] = 'visible';
+    //     document.getElementById('pButtons-'+exten+'-'+prio).className = 'pButtonsHighlight';
+    //     document.getElementById('pNumber-'+exten+'-'+prio).className = 'pElementHighlight';
+    //     document.getElementById('pApp-'+exten+'-'+prio).className = 'pElementHighlight';
+    //     document.getElementById('pArgs-'+exten+'-'+prio).className = 'pElementHighlight';
+    } else {
+        var form = '';
+        //form += '<form id="renumber">';
+        form += '    <span class="priorityBox">';
+        form += '        <input type="text" size="3" maxlength="3" name="newprio" value="'+this.curPrio+'" />';
+        form += '    </span>';
+        //form += '</form>';
+        document.getElementById('pBox-'+this.curExten+'-'+this.curPrio).innerHTML = form;
+    }
 }
 
 Dialplan.prototype.deactivatePriority = function()
 {
     if (this.curPrio && document.getElementById('pButtons-'+this.curExten+'-'+this.curPrio)) {
-        document.getElementById('pButtons-'+this.curExten+'-'+this.curPrio).className = 'pButtons';
-        document.getElementById('pNumber-'+this.curExten+'-'+this.curPrio).className = 'pElement';
-        document.getElementById('pApp-'+this.curExten+'-'+this.curPrio).className = 'pElement';
-        document.getElementById('pArgs-'+this.curExten+'-'+this.curPrio).className = 'pElement';
+        document.getElementById('priority-'+this.curExten+'-'+this.curPrio).className = 'priority';
+        document.getElementById('pButtons-'+this.curExten+'-'+this.curPrio).style['visibility'] = 'hidden';
+//         document.getElementById('pButtons-'+this.curExten+'-'+this.curPrio).className = 'pButtons';
+//         document.getElementById('pNumber-'+this.curExten+'-'+this.curPrio).className = 'pElement';
+//         document.getElementById('pApp-'+this.curExten+'-'+this.curPrio).className = 'pElement';
+//         document.getElementById('pArgs-'+this.curExten+'-'+this.curPrio).className = 'pElement';
     }
 }
 
 Dialplan.prototype.drawPrioTable = function (exten)
 {
+    var table = '';
     if (!exten) {
         alert('Must first choose an extension to draw');
         return false;
     }
     //alert(document.getElementById('pList-'+exten).innerHTML);
-    table  = '<table class="pList" cellspacing="0">';
-    table += '  <tbody>\n';
-    table += '    <tr class="priority">\n';
     for (var p in this.dp[exten]['priorities']) {
-        table += '        <td class="pButtons" id="pButtons-'+exten+'-'+p+'"\n';
+        table += '<div class="priority" id="priority-'+exten+'-'+p+'">\n';
+        table += '        <span class="pButtons" id="pButtons-'+exten+'-'+p+'"\n';
         table += '            name="pButtons-'+exten+'-'+p+'">\n';
         table += '            <span class="add" onclick="javascript:'+this.object+'.addPrio(\''+exten+'\', \''+p+'\');">+</span>\n';
         table += '            <span class="remove" onclick="javascript:'+this.object+'.delPrio(\''+exten+'\', \''+p+'\');">-</span>\n';
-        table += '        </td>\n';
-        table += '        <td class="pElement" id="pNumber-'+exten+'-'+p+'"\n';
-        table += '            name="pNumber-'+exten+'-'+p+'"\n';
+        table += '        </span>\n';
+        table += '        <span class="pElement" id="pBox-'+exten+'-'+p+'"\n';
+        table += '            name="pBox-'+exten+'-'+p+'"\n';
         table += '            onclick="javascript:'+this.object+'.activatePriority(\''+exten+'\', \''+p+'\')">\n';
         table += '            <span class="priorityBox">'+p+'</span>\n';
-        table += '        </td>\n';
-        table += '        <td class="pElement" id="pApp-'+exten+'-'+p+'"\n';
+        table += '        </span>\n';
+        table += '        <span class="pElement" id="pApp-'+exten+'-'+p+'"\n';
         table += '            name="pApp-'+exten+'-'+p+'">\n';
         table += '            <span class="applicationBox"></span>\n';
         table += '                <select name="app['+exten+']['+p+']">\n';;
         table += this.genAppList(this.dp[exten]['priorities'][p]['application']);
         table += '                </select>\n';
         table += '            </span>\n';
-        table += '        </td>\n';
-        table += '        <td class="pElement" id="pArgs-'+exten+'-'+p+'"\n';
+        table += '        </span>\n';
+        table += '        <span class="pElement" id="pArgs-'+exten+'-'+p+'"\n';
         table += '            name="pArgs-'+exten+'-'+p+'">\n';
         table += '            <span class="argBox" id="args-'+exten+'-'+p+'"\n';
         table += '                name="args-'+exten+'-'+p+'">ARGS</span>\n';
-        table += '        </td>\n';
+        table += '        </span>\n';
+        table += '</div>\n';
     }
-    table += '    </tr>\n';
-    table += '  </tbody>\n';
-    table += '</table>\n';
     //alert(table);
     document.getElementById('pList-'+exten).innerHTML = table;
 }
@@ -128,6 +140,7 @@ Dialplan.prototype.addPrio = function(exten, prio)
         this._incrPrio(exten, prio);
     }
     this.dp[exten]['priorities'][prio] = new Array();
+    this.curPrio = 0;
     this.drawPrioTable(exten);
 }
 
@@ -149,9 +162,12 @@ Dialplan.prototype._incrPrio = function (exten, prio)
 
     for (p in this.dp[exten]['priorities']) {
         p = Number(p);
+        prio = Number(prio);
         // Make a notch for the new priority by incrementing all priorities greater
-        // than the requested one
-        if (p > prio) {
+        // than the requested one.  Try to exclude error handling priorities
+        // which are unrelated to the changed extension.  See README for
+        // more information.
+        if (p > prio && (p < 101 || p > prio + 100)) {
             tmp[p + 1] = this.dp[exten]['priorities'][p];
             plist[i] = p + 1;
         } else {
index f81680c..d260688 100644 (file)
@@ -1,13 +1,13 @@
-<div class="header" style="text-align: right">
-    <span class="contextHeader" style="padding-right: 20px">Context: <?php echo $context; ?></span>
+<div class="header">
+    Context: <?php echo $context; ?>
 </div>
 
-<div id="userlist">
+<div id="userList" class="userList">
     <table width="100%" cellspacing="0">
-        <tr class="header">
-            <td>Extension</td>
-            <td>Name</td>
-            <td>E-Mail Address</td>
+        <tr>
+            <td class="uheader">Extension</td>
+            <td class="uheader">Name</td>
+            <td class="uheader">E-Mail Address</td>
         </tr>
         <?php
             $line = 0;
index b3f270a..b559a31 100644 (file)
@@ -1,5 +1,5 @@
 .lighthint {
-    color: #ffffff;
+    color: #fff;
     font-size: 10px;
   }
 
@@ -9,26 +9,30 @@
     font-size: 10px;
   }
 
-.contextHeader {
-    color: #fff;
-    font-size: 15px;
-    right: auto;
-    position: relative;
+table {
+    width: 100%;
 }
 
-#userList table {
-    width: 100%;
+.header {
+    color: #fff;
+    background: #a22;
+    text-align: right;
+    font-style: italic;
+    font-weight: bold;
+    font-size: 14px;
 }
 
-#userList .header {
-    color: #777;
-    background: #fff;
+.userList{
+    border: 1px solid #000;
 }
 
-#userList .headerText {
-    font-style: italic;
+.uheader{
+    background: #fff;
+    color: #a22;
+    text-align: left;
     font-weight: bold;
-    font-size: 14px;
+    font-size: 130%;
+    border-bottom: 1px dashed #000;
 }
 
 #contextTree {
@@ -65,6 +69,7 @@
     border: 2px solid #000;
     background: inherit;
     padding: 5px;
+    width: 400px;
 }
 
 #extensionDetail .extensionHighlight {
 #extensionDetail .pList {
     border: 1px solid #787;
     background: inherit;
-    left: 10px;
-    position: relative;
+    /*left: 10px;
+    position: relative;*/
 }
 
 #extensionDetail .pListHighlight{
     border: 1px solid #fff;
     background: #fbb;
-    left: 10px;
-    position: relative;
+    /*left: 10px;
+    position: relative;*/
 }
 
 #extensionDetail .priority {
-    padding: 3px;
-    left: 20px;
-    position: relative;
+    padding: 4px;
+    /*left: 20px;
+    position: relative;*/
     background: inherit;
+    /*border: 1px solid #000;*/
+}
+#extensionDetail .priorityHighlight {
+    background: #ccf;
+    padding: 3px;
+    border: 1px solid #000;
+    /*text-decoration: none;
+    font-color: #000;*/
 }
 
-#extensionDetail .pElement {
+/*#extensionDetail .pElement {
     background: inherit;
     padding: 3px;
 }
     border-top: 1px solid #000;
     text-decoration: none;
     font-color: #000;
-}
+}*/
 
 #extensionDetail .priorityBox {
     background: #fff;
 
 #extensionDetail .pButtons {
     visibility: hidden;
-    padding: 3px;
+    padding: 1px;
 }
 
-#extensionDetail .pButtonsHighlight {
+/*#extensionDetail .pButtonsHighlight {
     visibility: visible;
     background: #ccf;
     padding: 3px;
     border-bottom: 1px solid #000;
     border-top: 1px solid #000;
-}
\ No newline at end of file
+}*/
\ No newline at end of file