phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sms/inc class.sms.inc.php class.uiautoreplay.in...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] sms/inc class.sms.inc.php class.uiautoreplay.in...
Date: Mon, 29 May 2006 21:21:47 +0000

CVSROOT:        /sources/phpgroupware
Module name:    sms
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/05/29 21:21:47

Modified files:
        inc            : class.sms.inc.php class.uiautoreplay.inc.php 

Log message:
        no message

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.sms.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.uiautoreplay.inc.php.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: sms/inc/class.sms.inc.php
diff -u sms/inc/class.sms.inc.php:1.10 sms/inc/class.sms.inc.php:1.11
--- sms/inc/class.sms.inc.php:1.10      Fri May 26 08:06:04 2006
+++ sms/inc/class.sms.inc.php   Mon May 29 21:21:47 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage sms
-       * @version $Id: class.sms.inc.php,v 1.10 2006/05/26 08:06:04 sigurdne 
Exp $
+       * @version $Id: class.sms.inc.php,v 1.11 2006/05/29 21:21:47 sigurdne 
Exp $
        */
 
        /**
@@ -505,31 +505,36 @@
                        {
                                // check for SMS autoreply
                                $db_query = "SELECT autoreply_id FROM 
phpgw_sms_featautoreply WHERE autoreply_code='$code'";
-                               if ($db_result = dba_num_rows($db_query))
+                               $this->db->query($db_query,__LINE__,__FILE__);
+                               if($this->db->next_record())
                                {
                                        $ok = false;
                                }
                                // check for SMS board
                                $db_query = "SELECT board_id FROM 
phpgw_sms_featboard WHERE board_code='$code'";
-                               if ($db_result = dba_num_rows($db_query))
+                               $this->db->query($db_query,__LINE__,__FILE__);
+                               if($this->db->next_record())
                                {
                                        $ok = false;
                                }
                                // check for SMS command
                                $db_query = "SELECT command_id FROM 
phpgw_sms_featcommand WHERE command_code='$code'";
-                               if ($db_result = dba_num_rows($db_query))
+                               $this->db->query($db_query,__LINE__,__FILE__);
+                               if($this->db->next_record())
                                {
                                        $ok = false;
                                }
                                // check for SMS custom
                                $db_query = "SELECT custom_id FROM 
phpgw_sms_featcustom WHERE custom_code='$code'";
-                               if ($db_result = dba_num_rows($db_query))
+                               $this->db->query($db_query,__LINE__,__FILE__);
+                               if($this->db->next_record())
                                {
                                        $ok = false;
                                }
                                // check for SMS poll
                                $db_query = "SELECT poll_id FROM 
phpgw_sms_featpoll WHERE poll_code='$code'";
-                               if ($db_result = dba_num_rows($db_query))
+                               $this->db->query($db_query,__LINE__,__FILE__);
+                               if($this->db->next_record())
                                {
                                        $ok = false;
                                }
Index: sms/inc/class.uiautoreplay.inc.php
diff -u sms/inc/class.uiautoreplay.inc.php:1.1 
sms/inc/class.uiautoreplay.inc.php:1.2
--- sms/inc/class.uiautoreplay.inc.php:1.1      Mon May 29 12:58:57 2006
+++ sms/inc/class.uiautoreplay.inc.php  Mon May 29 21:21:47 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage autoreplay
-       * @version $Id: class.uiautoreplay.inc.php,v 1.1 2006/05/29 12:58:57 
sigurdne Exp $
+       * @version $Id: class.uiautoreplay.inc.php,v 1.2 2006/05/29 21:21:47 
sigurdne Exp $
        */
 
        /**
@@ -20,6 +20,8 @@
        {
                var $public_functions = array(
                        'index'         => True,
+                       'add'           => True,
+                       'add_yes'       => True,
                        'manage'        => True,
                        'delete'        => True,
                        'delete_scenario' => true
@@ -35,6 +37,7 @@
                //      $this->bo                               = 
CreateObject($this->currentapp.'.boconfig',true);
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->menu                             = 
CreateObject($this->currentapp.'.menu');
+                       $this->sms                              = 
CreateObject($this->currentapp.'.sms');
                        $this->acl                              = 
CreateObject('phpgwapi.acl');
                        $this->acl_location                     = '.config';
                        $this->menu->sub                        
=$this->acl_location;
@@ -64,7 +67,7 @@
 
                        echo parse_navbar();
 
-                       $err    = get_var('err',array('POST','GET'));
+                       $err    = urldecode(get_var('err',array('POST','GET')));
        
                        if ($err)
                        {
@@ -104,6 +107,118 @@
                        ";
                }
 
+               function add()
+               {
+               
+                       if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
+                       {
+                               $links = 
$this->menu->links('.config.autoreplay');
+                               $GLOBALS['phpgw_info']['flags']['xslt_app'] = 
True;
+                               $this->bocommon->no_access($links);
+                               return;
+                       }
+                       
+                       
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('SMS').' - '.lang('Add SMS autoreply');
+                       $GLOBALS['phpgw']->common->phpgw_header();
+
+                       echo parse_navbar();
+
+                       $err    = urldecode(get_var('err',array('POST','GET')));
+                       $add_autoreply_code     = 
get_var('add_autoreply_code',array('POST','GET'));
+
+                       if ($err)
+                       {
+                           $content = "<p><font color=red>$err</font><p>";
+                       }
+
+                       $add_data = array(
+                               'menuaction'    => 
$this->currentapp.'.uiautoreplay.add_yes',
+                               'autoreply_id' => $autoreply_id
+                               );
+                               
+                       $add_url = 
$GLOBALS['phpgw']->link('/index.php',$add_data);
+
+
+                       $content .= "
+                           <p>
+                           <form action=$add_url method=post>
+                           <p>SMS autoreply code: <input type=text size=10 
maxlength=10 name=add_autoreply_code value=\"$add_autoreply_code\">
+                           <p><input type=submit class=button value=Add>
+                           </form>
+                       ";
+
+
+                       $done_data = array('menuaction' => 
$this->currentapp.'.uiautoreplay.index');
+                       $done_url = 
$GLOBALS['phpgw']->link('/index.php',$done_data);
+
+                       $content .= "
+                           <p>
+                           <a href=\"$done_url\">[ Done ]</a>
+                           <p>
+                       ";
+
+
+                       echo $content;
+
+               }
+
+               function add_yes()
+               {
+               
+                       if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
+                       {
+                               $links = 
$this->menu->links('.config.autoreplay');
+                               $GLOBALS['phpgw_info']['flags']['xslt_app'] = 
True;
+                               $this->bocommon->no_access($links);
+                               return;
+                       }
+
+                       $add_autoreply_code     = 
strtoupper(get_var('add_autoreply_code',array('POST','GET')));
+
+                       $uid = $this->account;
+                       $target = 'add';
+
+                       if ($add_autoreply_code)
+                       {
+                           if 
($this->sms->checkavailablecode($add_autoreply_code))
+                           {
+                               $sql = "INSERT INTO phpgw_sms_featautoreply 
(uid,autoreply_code) VALUES ('$uid','$add_autoreply_code')";
+                               $this->db->transaction_begin();
+
+                               $this->db->query($sql,__LINE__,__FILE__);
+
+                               $new_uid = 
$this->db->get_last_insert_id(phpgw_sms_featautoreply,'autoreply_id');
+
+                               $this->db->transaction_commit();
+                                       
+                               if ($new_uid)
+                               {
+                                   $error_string = "SMS autoreply code 
`$add_autoreply_code` has been added";
+                                   $target = 'index';
+                               }
+                               else
+                               {
+                                   $error_string = "Fail to add SMS autoreply 
code `$add_autoreply_code`";
+                               }
+                           }
+                           else
+                           {
+                               $error_string = "SMS code `$add_autoreply_code` 
already exists, reserved or use by other feature!";
+                           }
+                       }
+                       else
+                       {
+                           $error_string = "You must fill all fields!";
+                       }
+
+                       $add_data = array(
+                               'menuaction'    => 
$this->currentapp.'.uiautoreplay.' . $target,
+                               'err' => urlencode($error_string)
+                               );
+
+                       
$GLOBALS['phpgw']->redirect_link('/index.php',$add_data);
+               }
 
                function manage()
                {
@@ -124,6 +239,7 @@
 
 
                        $autoreply_id   = 
get_var('autoreply_id',array('POST','GET'));
+                       $err    = urldecode(get_var('err',array('POST','GET')));
        
                        if (!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
                        {
@@ -231,7 +347,7 @@
                                        
                                $link_data['err'] = urlencode($error_string);
 
-                               
$GLOBALS['phpgw']->redirect_link($GLOBALS['phpgw']->link('/index.php',$link_data));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
@@ -270,8 +386,8 @@
 
                        $link_data = array
                        (
-                               'menuaction' => 
$this->currentapp.'.uiautoreplay.index',
-                               'autoreply_scenario_id' => 
$autoreply_scenario_id
+                               'menuaction' => 
$this->currentapp.'.uiautoreplay.manage',
+                               'autoreply_id' => $autoreply_id
                        );
 
                        if (get_var('confirm',array('POST')))
@@ -300,7 +416,7 @@
 
                                $link_data['err'] = urlencode($error_string);
 
-                               
$GLOBALS['phpgw']->redirect_link($GLOBALS['phpgw']->link('/index.php',$link_data));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]