phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] sms ./init.php inc/class.sms.inc.php inc/class....


From: Sigurd Nes
Subject: [Phpgroupware-cvs] sms ./init.php inc/class.sms.inc.php inc/class....
Date: Tue, 16 May 2006 13:56:05 +0000

CVSROOT:        /sources/phpgroupware
Module name:    sms
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/05/16 13:56:05

Modified files:
        .              : init.php 
        inc            : class.sms.inc.php class.uisms.inc.php 
        templates/base : sms.xsl 
Added files:
        inc            : class.bosms.inc.php 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/init.php.diff?tr1=1.1.1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.bosms.inc.php?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.sms.inc.php.diff?tr1=1.1.1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.uisms.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/templates/base/sms.xsl.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.1.1.1 sms/inc/class.sms.inc.php:1.2
--- sms/inc/class.sms.inc.php:1.1.1.1   Mon May 15 10:29:23 2006
+++ sms/inc/class.sms.inc.php   Tue May 16 13:56:05 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.1.1.1 2006/05/15 10:29:23 
sigurdne Exp $
+       * @version $Id: class.sms.inc.php,v 1.2 2006/05/16 13:56:05 sigurdne 
Exp $
        */
 
        /**
@@ -446,30 +446,6 @@
                        return true;
                }
                
-               // INCLUDE Custom Functions
-               // 
----------------------------------------------------------------------------
-/*
-               include "$this->apps_path[inc]/custom_function.php";
-               echo "$this->apps_path[plug]/gateway/$gateway_module/fn.php";
-               if 
(file_exists("$this->apps_path[plug]/gateway/$gateway_module/fn.php"))
-               {
-                   include 
"$this->apps_path[plug]/gateway/$gateway_module/fn.php";
-               }
-               else
-               {
-                   if ($gateway_module)
-                   {
-                       die ("ERROR: Gateway module '$gateway_module' does not 
exists - please contact system administrator");
-                   }
-                   else
-                   {
-                       die("ERROR: No selected gateway module available - 
please contact system administrator");
-                   }
-               }
-*/             
-
-
-
                
                function 
websend2pv($username,$sms_to,$message,$sms_type="text",$unicode="0")
                {
Index: sms/inc/class.uisms.inc.php
diff -u sms/inc/class.uisms.inc.php:1.2 sms/inc/class.uisms.inc.php:1.3
--- sms/inc/class.uisms.inc.php:1.2     Mon May 15 13:22:39 2006
+++ sms/inc/class.uisms.inc.php Tue May 16 13:56:05 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.uisms.inc.php,v 1.2 2006/05/15 13:22:39 sigurdne 
Exp $
+       * @version $Id: class.uisms.inc.php,v 1.3 2006/05/16 13:56:05 sigurdne 
Exp $
        */
 
        /**
@@ -41,9 +41,29 @@
                        $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-//                     $this->bo                               = 
CreateObject($this->currentapp.'.bosms',False);
+
                        $this->bocommon                 = 
CreateObject($this->currentapp.'.bocommon');
-//                     $this->bocategory                       = 
CreateObject($this->currentapp.'.bocategory');
+//                     $this->bocategory                       = 
CreateObject($this->currentapp.'.bocategory');
+                       $this->config                           = 
CreateObject('phpgwapi.config');
+                       $this->config->read_repository();
+                       $this->gateway_number                   = 
$this->config->config_data['gateway_number'];
+                       $GLOBALS['phpgw_info']['sms_config']['gateway_module'] 
= $this->config->config_data['gateway_module'];
+                       $this->bo                               = 
CreateObject($this->currentapp.'.bosms',False);
+/*
+$GLOBALS['phpgw_info']['sms_config']['reserved_codes'] = $reserved_codes;
+$GLOBALS['phpgw_info']['sms_config']['web_title'] = $web_title;
+$GLOBALS['phpgw_info']['sms_config']['email_service'] = $email_service;
+$GLOBALS['phpgw_info']['sms_config']['email_footer'] = $email_footer;
+$GLOBALS['phpgw_info']['sms_config']['datetime_now'] = $datetime_now;
+$GLOBALS['phpgw_info']['sms_config']['apps_config'] = $apps_config;
+$GLOBALS['phpgw_info']['sms_config']['apps_path'] = $apps_path;
+$GLOBALS['phpgw_info']['sms_config']['feat_command_path'] = $feat_command_path;
+$GLOBALS['phpgw_info']['sms_config']['gateway_module'] = $gateway_module;
+$GLOBALS['phpgw_info']['sms_config']['gateway_number'] = $gateway_number;
+$GLOBALS['phpgw_info']['sms_config']['email_footer'] = $email_footer;
+$GLOBALS['phpgw_info']['sms_config']['gnokii_cfg'] = $gnokii_cfg;
+*/
+
                        $this->menu                             = 
CreateObject($this->currentapp.'.menu');
                        $this->grants                           = 
$this->bo->grants;
                        $this->start                            = 
$this->bo->start;
@@ -285,42 +305,32 @@
 
                function send()
                {
-                       $sms_id = get_var('sms_id',array('POST','GET'));
-                       $values         = get_var('values',array('POST'));
-
+                       $values                 = 
get_var('values',array('POST'));
+                       $values['p_num_text']           = 
get_var('p_num_text',array('POST'));
+                       $values['message']              = 
get_var('message',array('POST'));
+                       $values['msg_flash']            = 
get_var('msg_flash',array('POST'));
+                       $values['msg_unicode']          = 
get_var('msg_unicode',array('POST'));
+                       
                        $GLOBALS['phpgw']->xslttpl->add_file(array('sms'));
 
+                       $max_length = 160;
                        if (is_array($values))
                        {
                                if ($values['save'] || $values['apply'])
                                {
 
-                                       if(!$values['name'])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
-                                       }
-                                       if(!$values['address'])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please enter an address !'));
-                                       }
-                                       if(!$values['zip'])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please enter a zip code !'));
-                                       }
-                                       if(!$values['town'])
+                                       if(!$values['message'])
                                        {
-                                               
$receipt['error'][]=array('msg'=>lang('Please enter a town !'));
+                                               
$receipt['error'][]=array('msg'=>lang('Please enter a message !'));
                                        }
-
-                                       if($sms_id)
+                                       if(!$values['p_num_text'])
                                        {
-                                               $values['sms_id']=$sms_id;
-                                               $action='edit';
+                                               
$receipt['error'][]=array('msg'=>lang('Please enter a recipient !'));
                                        }
 
                                        if(!$receipt['error'])
                                        {
-                                               $receipt = 
$this->bo->save($values,$action);
+                                               $receipt = 
$this->bo->send_sms($values);
                                                $sms_id = $receipt['sms_id'];
 
                                                if ($values['save'])
@@ -354,45 +364,81 @@
 
                        $link_data = array
                        (
-                               'menuaction'    => 
$this->currentapp.'.uisms.outbox',
+                               'menuaction'    => 
$this->currentapp.'.uisms.send',
                                'sms_id'        => $sms_id
                        );
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
+                       $GLOBALS['phpgw_info']['flags']['java_script'] .= "\n"
+                               . '<script language="JavaScript">' ."\n"
+                               . 'function SmsCountKeyUp(maxChar)' ."\n"
+                               . '{' ."\n"
+                               . '    var msg  = 
document.forms.fm_sendsms.message;' ."\n"
+                               . '    var left = 
document.forms.fm_sendsms.charNumberLeftOutput;' ."\n"
+                               . '    var smsLenLeft = maxChar  - 
msg.value.length;' ."\n"
+                               . '    if (smsLenLeft >= 0) ' ."\n"
+                               . '    {' ."\n"
+                               . '     left.value = smsLenLeft;' ."\n"
+                               . '    } ' ."\n"
+                               . '    else ' ."\n"
+                               . '    {' ."\n"
+                               . '     var msgMaxLen = maxChar;' ."\n"
+                               . '     left.value = 0;' ."\n"
+                               . '     msg.value = msg.value.substring(0, 
msgMaxLen);' ."\n"
+                               . '    }' ."\n"
+                               . '}' ."\n"
+                               . 'function SmsCountKeyDown(maxChar)' ."\n"
+                               . '{' ."\n"
+                               . '    var msg  = 
document.forms.fm_sendsms.message;' ."\n"
+                               . '    var left = 
document.forms.fm_sendsms.charNumberLeftOutput;' ."\n"
+                               . '    var smsLenLeft = maxChar  - 
msg.value.length;' ."\n"
+                               . '    if (smsLenLeft >= 0) ' ."\n"
+                               . '    {' ."\n"
+                               . '     left.value = smsLenLeft;' ."\n"
+                               . '    } ' ."\n"
+                               . '    else ' ."\n"
+                               . '    {' ."\n"
+                               . '     var msgMaxLen = maxChar;' ."\n"
+                               . '     left.value = 0; ' ."\n"
+                               . '     msg.value = msg.value.substring(0, 
msgMaxLen);' ."\n"
+                               . '    }' ."\n"
+                               . '}' ."\n"
+                               . "</script>\n";
+
+
 
                        $data = array
                        (
-                               'value_title'                   => 
$values['title'],
-                               'value_entry_date'              => 
$values['entry_date'],
-                               'value_name'                    => 
$values['name'],
-                               'value_address'                 => 
$values['address'],
-                               'value_zip'                     => 
$values['zip'],
-                               'value_town'                    => 
$values['town'],
-                               'value_remark'                  => 
$values['remark'],
-
-                               'lang_entry_date'               => lang('Entry 
date'),
-                               'lang_name'                     => lang('name'),
-                               'lang_address'                  => 
lang('address'),
-                               'lang_zip'                      => lang('zip'),
-                               'lang_town'                     => lang('town'),
-                               'lang_remark'                   => 
lang('remark'),
+
+                               'lang_to'                       => lang('to'),
+                               'lang_from'                     => lang('from'),
+                               
+                               'value_sms_from'                => 
$this->gateway_number,
+                               'lang_format'                   => 
lang('International format'),
+                               'lang_message'                  => 
lang('message'),
+                               'lang_character_left'           => 
lang('character left'),                              
+                               
+                               'lang_send_as_flash'            => lang('send 
as flash message'),
+                               'lang_send_as_unicode'          => lang('send 
as unicode'),
+
+                               'value_max_length'              => $max_length,
 
                                'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_id'                       => 
lang('training ID'),
+
                                'lang_save'                     => lang('save'),
                                'lang_cancel'                   => 
lang('cancel'),
-                               'value_id'                      => $sms_id,
+
                                'lang_done_status_text'         => lang('Back 
to the list'),
                                'lang_save_status_text'         => lang('Save 
the training'),
                                'lang_apply'                    => 
lang('apply'),
                                'lang_apply_status_text'        => lang('Apply 
the values'),
                        );
 
-                       $appname                                        = 
lang('Place');
+                       $appname                                        = 
lang('send sms');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('send' => $data));
                }
 
Index: sms/init.php
diff -u sms/init.php:1.1.1.1 sms/init.php:1.2
--- sms/init.php:1.1.1.1        Mon May 15 10:29:22 2006
+++ sms/init.php        Tue May 16 13:56:05 2006
@@ -32,7 +32,6 @@
 // very important, do not try to remove it or change it
 define ("_SECURE_","1");
 
-
        $path_to_phpgroupware = dirname(__FILE__) . '/..';      // need to be 
adapted if this script is moved somewhere else
        $_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 
'default';
 
@@ -42,7 +41,6 @@
        );
        include($path_to_phpgroupware.'/header.inc.php');
 
-
        unset($GLOBALS['phpgw_info']['flags']['noapi']);
 
        $db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
@@ -124,13 +122,8 @@
     $gnokii_cfg = $db->f('config_value');
 }
 
-
-
     $web_title = 'test';
-//    $email_service = 'address@hidden';
     $email_footer = 'Mobile Portal System';
-//    $gateway_module ='gnokii';
-//    $gateway_number = '+4790665164';
 
 
 $GLOBALS['phpgw_info']['sms_config']['reserved_codes'] = $reserved_codes;
Index: sms/templates/base/sms.xsl
diff -u sms/templates/base/sms.xsl:1.1 sms/templates/base/sms.xsl:1.2
--- sms/templates/base/sms.xsl:1.1      Mon May 15 13:22:39 2006
+++ sms/templates/base/sms.xsl  Tue May 16 13:56:05 2006
@@ -1,4 +1,4 @@
-<!-- $Id: sms.xsl,v 1.1 2006/05/15 13:22:39 sigurdne Exp $ -->
+<!-- $Id: sms.xsl,v 1.2 2006/05/16 13:56:05 sigurdne Exp $ -->
 
        <xsl:template name="app_data">
                <xsl:choose>
@@ -137,7 +137,7 @@
        <xsl:template match="send">
                <div align="left">
                <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
-               <form method="post" action="{$form_action}">
+               <form name ="fm_sendsms" id="fm_sendsms" method="post" 
action="{$form_action}">
                <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -148,91 +148,74 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-                       <xsl:choose>
-                               <xsl:when test="value_id != ''">
-                               <tr>
-                               <td valign="top" width="30%">
-                                               <xsl:value-of select="lang_id"/>
-                                       </td>
-                                       <td align="left">
-                                               <xsl:value-of 
select="value_id"/>
-                                       </td>
-                               </tr>
                                <tr>
-                                       <td valign="top">
-                                               <xsl:value-of 
select="lang_entry_date"/>
-                                       </td>
-                                       <td>
-                                               <xsl:value-of 
select="value_entry_date"/>
+                                       <td valign="top" colspan = "2">
+                                               <xsl:value-of 
select="lang_from"/>
+                                               <xsl:text>: </xsl:text>
+                                               <xsl:value-of 
select="value_sms_from"/>
                                        </td>
                                </tr>
-                               </xsl:when>
-                       </xsl:choose>   
                        <tr>
                                <td valign="top" width="10%">
-                                       <xsl:value-of select="lang_name"/>
+                                       <xsl:value-of select="lang_to"/>
                                </td>
                                <td>
-                                       <input type="text" size="60" 
name="values[name]" value="{value_name}" onMouseout="window.status='';return 
true;">
+                                       <input type="text" size="20" 
maxlength="20" name="p_num_text" value="{value_p_num_text}" 
onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_name_status_text"/>
+                                                               <xsl:value-of 
select="lang_to_status_text"/>
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
+                                       <xsl:text> (</xsl:text>
+                                       <xsl:value-of select="lang_format"/>
+                                       <xsl:text>)</xsl:text>
                                </td>
                        </tr>
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_address"/>
+                                       <xsl:value-of select="lang_message"/>
                                </td>
                                <td>
-                                       <input type="text" size="60" 
name="values[address]" value="{value_address}" 
onMouseout="window.status='';return true;">
+                                       <textarea cols="39" rows="5" 
name="message" id="ta_sms_content" onKeyUp="javascript: 
SmsCountKeyUp({value_max_length});" onKeyDown="javascript: 
SmsCountKeyDown({value_max_length});" wrap="virtual" 
onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_address_status_text"/>
+                                                               <xsl:value-of 
select="lang_message_status_text"/>
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
-                                       </input>
+                                               <xsl:value-of 
select="value_message"/>          
+                                       </textarea>
                                </td>
                        </tr>
+               
                        <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_zip"/>
-                               </td>
                                <td>
-                                       <input type="text" size="6" 
name="values[zip]" value="{value_zip}" onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_zip_status_text"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                                       <xsl:value-of select="lang_town"/>
-                                       <input type="text" size="40" 
name="values[town]" value="{value_town}" onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_town_status_text"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
+                                       <xsl:value-of 
select="lang_character_left"/>
+                               </td>
+                               <td >
+                                       <input type="text" readonly = 
"readonly" size="3" maxlength="3" name="charNumberLeftOutput" 
id="charNumberLeftOutput" value="{value_max_length}" >
                                        </input>
                                </td>
-                       </tr>
+                       </tr>   
+
                        <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_remark"/>
+                               <td  colspan = "2">
+                                       <input type="checkbox" name="msg_flash" 
value="1" onMouseout="window.status='';return true;">
+                                       </input>
+                                       <xsl:text> </xsl:text>
+                                       <xsl:value-of 
select="lang_send_as_flash"/>
                                </td>
-                               <td>
-                                       <textarea cols="60" rows="10" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_remark_status_text"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_remark"/>           
-                                       </textarea>
+                       </tr>   
+                       <tr>
+                               <td  colspan = "2">
+                                       <input type="checkbox" 
name="msg_unicode" value="1" onMouseout="window.status='';return true;">
+                                       </input>
+                                       <xsl:text> </xsl:text>
+                                       <xsl:value-of 
select="lang_send_as_unicode"/>
                                </td>
-                       </tr>
+                       </tr>   
+
+               
                        <tr height="50">
                                <td colspan = "2" align = "center"><table><tr>
                                <td valign="bottom">




reply via email to

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