first bits of working FRI! woop!
authorivan <ivan>
Mon, 17 Mar 2008 02:48:15 +0000 (02:48 +0000)
committerivan <ivan>
Mon, 17 Mar 2008 02:48:15 +0000 (02:48 +0000)
fs_selfservice/fri/includes/login.php
fs_selfservice/fri/includes/main.conf.php
fs_selfservice/fri/locale/ari.po
fs_selfservice/fri/modules/billing.module [new file with mode: 0644]
fs_selfservice/fri/modules/callmonitor.module
fs_selfservice/fri/modules/dashboard.module [new file with mode: 0644]
fs_selfservice/fri/modules/myaccount.module [new file with mode: 0644]
fs_selfservice/fri/modules/settings.module
fs_selfservice/fri/theme/page.tpl.php

index d91b711..41bb7a6 100644 (file)
@@ -280,33 +280,40 @@ class Login {
       }
 
       // freeside login
-      $freeside = new FreesideSelfService()
+      $freeside = new FreesideSelfService();
       $domain = 'svc_phone';
       $response = $freeside->login( array( 
-        'username' => strtolower($_username),
+        'username' => strtolower($username),
         'domain'   => $domain,
         'password' => strtolower($password),
       ) );
       error_log("[login] received response from freeside: $response");
       $error = $response['error'];
 
-      if ( ! $error ) {
+      if ( ! $error && $response['session_id'] ) {
 
           // sucessful freeside login
           error_log("[login] logged into freeside with session_id=$session_id");
       
           // store session id in your session store, to be used for other calls
           //$fs_session_id = $response['session_id'];
-          $_SESSION['fs_session'] = $response['session_id'];
+          $_SESSION['freeside_session_id'] = $response['session_id'];
+
+          $customer_info = $freeside->customer_info( array(
+            'session_id' => $_SESSION['freeside_session_id'] ,
+          ) );
+          //XXX error checking here too
+          $displayname = $customer_info['name'];
       
       } else {
       
           // unsucessful login
           error_log("[login] error logging into freeside: $error");
           $auth = false;
+          $extension = '';
 
           // display error message to user
-          $_SESSION=['ari_error'] = _("Incorrect Username or Password");
+          $_SESSION['ari_error'] = _("Incorrect Username or Password");
       
       }
 
index 31592ca..cedf60c 100644 (file)
@@ -108,7 +108,8 @@ $ARI_DEFAULT_ADMIN_PAGE = "callmonitor";
 # sets the default user page
 #   option: Comma delimited list of module names (ie voicemail,callmonitor,help,settings)
 #
-$ARI_DEFAULT_USER_PAGE = "voicemail";
+#$ARI_DEFAULT_USER_PAGE = "voicemail";
+$ARI_DEFAULT_USER_PAGE = "dashboard";
 
 #
 # enables ajax page refresh
index aff5a75..4e3493e 100644 (file)
@@ -324,7 +324,7 @@ msgstr ""
 #: ../modules/callmonitor.module:259
 #, php-format
 msgid "Call Monitor for %s (%s)"
-msgstr ""
+msgstr "Call Monitor for %s (%s)"
 
 #: ../modules/callmonitor.module:311 ../modules/voicemail.module:475
 msgid "select"
@@ -481,7 +481,7 @@ msgstr ""
 
 #: ../modules/settings.module:611
 msgid "Call Monitor Settings"
-msgstr ""
+msgstr "Call Monitor Settings"
 
 #: ../modules/settings.module:614
 msgid "Record INCOMING:"
diff --git a/fs_selfservice/fri/modules/billing.module b/fs_selfservice/fri/modules/billing.module
new file mode 100644 (file)
index 0000000..caa28b5
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * @file
+ * Functions for the interface to the help page
+ */
+
+/**
+  * Class for help
+  */
+class billing {
+
+  /*
+   * rank (for prioritizing modules)
+   */
+  function rank() {
+
+    $rank = -2;
+    return $rank;
+  }
+
+  /*
+   * init
+   */
+  function init() {
+  }
+
+  /*
+   * Adds menu item to nav menu
+   *
+   * @param $args
+   *   Common arguments
+   */
+  function navMenu($args) {
+
+    $ret .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=billing&f=display'>" . _("Billing") . "</a></small></small></p><br>";
+
+    return $ret;
+  }
+
+  /*
+   * Displays stats page
+   *
+   * @param $args
+   *   Common arguments
+   */
+  function display($args) {
+
+    global $ARI_HELP_FEATURE_CODES;
+
+    $display = new Display();
+
+    // args
+    $m = getArgument($args,'m');
+    $q = getArgument($args,'q');
+
+    $displayname = $_SESSION['ari_user']['displayname'];
+    $extension = $_SESSION['ari_user']['extension'];
+
+    // build page content
+    $ret .= checkErrorMessage();
+
+       $header_text = _("Billing");
+       if (!$_SESSION['ari_user']['admin_help']) {
+               $header_text .= sprintf(_(" for %s (%s)"), $displayname, $extension);
+       }
+
+    // build page content
+    $ret .= checkErrorMessage();
+
+    $ret .= $display->displayHeaderText($header_text);
+    $ret .= $display->displayLine();
+
+    $ret .= 'Billing goes here';
+
+    return $ret;
+  }
+
+}
+
+?>
index 25924d5..36f5f28 100644 (file)
@@ -33,7 +33,7 @@ class Callmonitor {
    */
   function navMenu($args) {
 
-    $ret .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=Callmonitor&f=display'>" . _("Call Monitor") . "</a></small></small></p><br>";
+    $ret .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=Callmonitor&f=display'>" . _("Call History") . "</a></small></small></p><br>";
 
     return $ret;
   }
@@ -253,9 +253,9 @@ class Callmonitor {
 
     // header
     if ($_SESSION['ari_user']['admin_callmonitor']) {
-      $header_text = _("Call Monitor");
+      $header_text = _("Call History");
     } else {
-      $header_text = sprintf(_("Call Monitor for %s (%s)"),$displayname,$extension);
+      $header_text = sprintf(_("Call History for %s (%s)"),$displayname,$extension);
     }
     $ret .= $display->displayHeaderText($header_text);
     $ret .= $display->displaySearchBlock('left',$m,$q,$url_opts,true);
diff --git a/fs_selfservice/fri/modules/dashboard.module b/fs_selfservice/fri/modules/dashboard.module
new file mode 100644 (file)
index 0000000..6fd24e0
--- /dev/null
@@ -0,0 +1,165 @@
+<?php
+
+/**
+ * @file
+ * Functions for the interface to the help page
+ */
+
+/**
+  * Class for help
+  */
+class dashboard {
+
+  /*
+   * rank (for prioritizing modules)
+   */
+  function rank() {
+
+    $rank = -4;
+    return $rank;
+  }
+
+  /*
+   * init
+   */
+  function init() {
+  }
+
+  /*
+   * Adds menu item to nav menu
+   *
+   * @param $args
+   *   Common arguments
+   */
+  function navMenu($args) {
+
+    $ret .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=dashboard&f=display'>" . _("Dashboard") . "</a></small></small></p><br>";
+
+    return $ret;
+  }
+
+  /*
+   * Displays stats page
+   *
+   * @param $args
+   *   Common arguments
+   */
+  function display($args) {
+
+    global $ARI_HELP_FEATURE_CODES;
+
+    $display = new Display();
+
+    // args
+    $m = getArgument($args,'m');
+    $q = getArgument($args,'q');
+
+    $displayname = $_SESSION['ari_user']['displayname'];
+    $extension = $_SESSION['ari_user']['extension'];
+
+    // build page content
+    $ret .= checkErrorMessage();
+
+       $header_text = _("Dashboard");
+       if (!$_SESSION['ari_user']['admin_help']) {
+               $header_text .= sprintf(_(" for %s (%s)"), $displayname, $extension);
+       }
+
+    // build page content
+    $ret .= checkErrorMessage();
+
+    $ret .= $display->displayHeaderText($header_text);
+    $ret .= $display->displayLine();
+
+    $freeside = new FreesideSelfService();
+    $fs_info = $freeside->customer_info( array(
+      'session_id' => $_SESSION['freeside_session_id'],
+    ) );
+    $error = $fs_info['error'];
+    if ( $error ) {
+      //$_SESSION['ari_error'] = _("Incorrect Username or Password");
+      $_SESSION['ari_error'] = $error; #// XXX report as ari_error???!
+    }
+
+    $ret .= $fs_info['small_custview'];
+    $ret .= '<BR>';
+    
+    if ( $fs_info['balance'] > 0 ) {
+  
+      // XXX correct URL
+      $ret .= '<B><A HREF="'. $url.
+              'make_payment">Make a payment</A></B><BR><BR>';
+
+    }
+
+    // XXX count() ???
+    if ( count($fs_info['open_invoices']) ) {
+  
+      $ret .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
+              '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Invoices</TH></TR>';
+      $link = '<A HREF="'. $url. 'myaccount'; // #XXX url
+      $col1 = "eeeeee";
+      $col2 = "cccccc";
+      $col = $col1;
+  
+      while ( $i = each($fs_info['open_invoices']) ) {
+  
+        $invoice = $i[value];
+  
+        $td = '<TD BGCOLOR="#'. $col. '">';
+        $a  = '<A HREF="'. $url. 'view_invoice;invnum='.
+              $invoice['invnum']. '">';
+        $ret .=
+          "<TR>$td$a". 'Invoice #'. $invoice['invnum']. "</A></TD>$td</TD>".
+          "$td$a". $invoice['date']. "</A></TD>$td</TD>".
+          '<TD BGCOLOR="#'. $col. '" ALIGN="right">'. $a. '$'. $invoice['owed'].
+            '</A></TD>'.
+          '</TR>';
+
+        if ( $col == $col1 ) {
+          $col = $col2;
+        } else {
+          $col = $col1;
+        }
+
+      }
+
+      $ret .= '</TABLE><BR>';
+    } else {
+      $ret .= 'You have no outstanding invoices.<BR><BR>';
+    }
+
+    $ret .= 'Received calls (10)<br><br>';
+    $ret .= 'Placed calls (10)';
+
+//    if ( @tickets ) {
+//      $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
+//              '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Tickets</TH></TR>'.
+//              '<TR><TH>#</TH><TH>Subject</TH><TH>Priority</TH><TH>Queue</TH>'.
+//              '<TH>Status</TH></TR>';
+//      my $col1 = "ffffff";
+//      my $col2 = "dddddd";
+//      my $col = $col1;
+//  
+//      foreach my $ticket ( @tickets ) {
+//        my $td = qq!<TD BGCOLOR="#$col">!;
+//        $OUT .=
+//          "<TR>$td". $ticket->{'id'}. "</TD>".
+//          $td. $ticket->{'subject'}. "</TD>".
+//          $td. ($ticket->{'content'} || $ticket->{'priority'}). "</TD>".
+//          $td. $ticket->{'name'}. "</TD>".
+//          $td. $ticket->{'status'}. "</TD>".
+//          '</TR>';
+//        $col = $col eq $col1 ? $col2 : $col1;
+//      }
+//      $OUT .= '</TABLE>';
+//    } else {
+//      $OUT .= '';
+//    }
+
+    return $ret;
+  }
+
+}
+
+?>
diff --git a/fs_selfservice/fri/modules/myaccount.module b/fs_selfservice/fri/modules/myaccount.module
new file mode 100644 (file)
index 0000000..d8af400
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * @file
+ * Functions for the interface to the help page
+ */
+
+/**
+  * Class for help
+  */
+class myaccount {
+
+  /*
+   * rank (for prioritizing modules)
+   */
+  function rank() {
+
+    $rank = 9;
+    return $rank;
+  }
+
+  /*
+   * init
+   */
+  function init() {
+  }
+
+  /*
+   * Adds menu item to nav menu
+   *
+   * @param $args
+   *   Common arguments
+   */
+  function navMenu($args) {
+
+    $ret .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=myaccount&f=display'>" . _("My Account") . "</a></small></small></p><br>";
+
+    return $ret;
+  }
+
+  /*
+   * Displays stats page
+   *
+   * @param $args
+   *   Common arguments
+   */
+  function display($args) {
+
+    global $ARI_HELP_FEATURE_CODES;
+
+    $display = new Display();
+
+    // args
+    $m = getArgument($args,'m');
+    $q = getArgument($args,'q');
+
+    $displayname = $_SESSION['ari_user']['displayname'];
+    $extension = $_SESSION['ari_user']['extension'];
+
+    // build page content
+    $ret .= checkErrorMessage();
+
+       $header_text = _("My Account");
+       if (!$_SESSION['ari_user']['admin_help']) {
+               $header_text .= sprintf(_(" for %s (%s)"), $displayname, $extension);
+       }
+
+    // build page content
+    $ret .= checkErrorMessage();
+
+    $ret .= $display->displayHeaderText($header_text);
+    $ret .= $display->displayLine();
+
+    $ret .= 'My Account goes here';
+
+    return $ret;
+  }
+
+}
+
+?>
index 314ce40..f20eb02 100644 (file)
@@ -53,7 +53,7 @@ class Settings {
        
        // and we are not logged in as admin
        if ($exten!=$ARI_ADMIN_USERNAME) {
-               $ret .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=Settings&f=display'>" . _("Settings") . "</a></small></small></p><br>";
+               $ret .= "<p><small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=Settings&f=display'>" . _("Phone Settings") . "</a></small></small></p><br>";
        }
 
     return $ret;
@@ -589,7 +589,7 @@ class Settings {
        // build page content
        $ret .= checkErrorMessage();
        
-       $headerText = sprintf(_("Settings for %s (%s)"),$displayname,$exten);
+       $headerText = sprintf(_("Phone Settings for %s (%s)"),$displayname,$exten);
        
        $ret .= $display->displayHeaderText($headerText);
        $ret .= $display->displayLine();
index 12b5a3b..9d54659 100644 (file)
@@ -64,8 +64,9 @@
     <!--begin footer-->
     <div id="ariFooter">
       <small>
-        &nbsp;&nbsp;<?php print($ari_version) ?> <?php echo _("Version")?><br>
-        &middot;&nbsp;<a href="http<?php print(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=''?'s':''); ?>://www.littlejohnconsulting.com">Based on ARI from Littlejohn Consulting</a>
+        <!--&nbsp;&nbsp;<?php print($ari_version) ?> <?php echo _("Version")?><br> -->
+        Freeside Recording Interface (c) 2008 Freeside Internet Services, Inc.<br>
+        <a href="http<?php print(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=''?'s':''); ?>://www.littlejohnconsulting.com">Based on ARI from Littlejohn Consulting</a>
       </small>
     </div>
     <!-- end footer -->