[Vtigercrm-developers] contributions invited for patches

Philip philip at vtiger.com
Thu Oct 5 01:03:53 PDT 2006



Hi Ding Jianting,

Thanks for your contribution of UTF-8, i have added it as a patch in trac.
 We'll be taking this up in one of our patch releases.

Regards,
Philip

---- On Wed, 04 Oct 2006 ding jianting <dfar2008 at gmail.com> wrote ---- 

Hi,
To support UTF-8 in vtiger CRM, I have made some changes .
1.Ajax chat
I contacted with developer of Ajax chat. I got solution for UTF-8 problem.
vchat.php:
From:
<script type="text/javascript" src="modules/Contacts/js/ajax.js"></script>
<script type="text/javascript"
src="modules/Contacts/js/dom-drag_p.js"></script>
<script type="text/javascript"
src="modules/Contacts/js/css-window_p.js"></script>
<script type="text/javascript" src="modules/Contacts/js/chat.js"></script>
To:
<script type="text/javascript" charset="iso-8859-1"
src="modules/Contacts/js/ajax.js"></script>
<script type="text/javascript" charset="iso-8859-1"
src="modules/Contacts/js/dom-drag_p.js"></script>
<script type="text/javascript" charset="iso-8859-1"
src="modules/Contacts/js/css-window_p.js"></script>
<script type="text/javascript" charset="iso-8859-1"
src="modules/Contacts/js/chat.js"></script>
chat.php:
From:
function submit($msg, $to=0)
{
    $msg = $this->msgParse($msg);
    ...
}
To:
function submit($msg, $to=0)
{
    $msg = utf8RawUrlDecode($msg);
    $msg = $this->msgParse($msg);
    ...
}

2.Add a function in PHP like unescape in javascript
utils.php:
/**
* the function is like unescape in javascript
* added by dingjianting on 2006-10-1 for picklist editor
*/
function utf8RawUrlDecode ($source) {
    $decodedStr = "";
    $pos = 0;
    $len = strlen ($source);
    while ($pos < $len) {
        $charAt = substr ($source, $pos, 1);
        if ($charAt == '%') {
            $pos++;
            $charAt = substr ($source, $pos, 1);
            if ($charAt == 'u') {
                // we got a unicode character
                $pos++;
                $unicodeHexVal = substr ($source, $pos, 4);
                $unicode = hexdec ($unicodeHexVal);
                $entity = "&#". $unicode . ';';
                $decodedStr .= utf8_encode ($entity);
                $pos += 4;
            }
            else {
                // we have an escaped ascii character
                $hexVal = substr ($source, $pos, 2);
                $decodedStr .= chr (hexdec ($hexVal));
                $pos += 2;
            }
        } else {
            $decodedStr .= $charAt;
            $pos++;
        }
    }
    return $decodedStr;
}


3. Picklist Editor
UpdateComboValues.php:
From:
$fldPickList =  $_REQUEST['listarea'];
To:
$fldPickList =  $_REQUEST['listarea'];
//changed by dingjianting on 2006-10-1 for picklist editor
$fldPickList = utf8RawUrlDecode($fldPickList);
4.Ajax Edit
DetailViewAjax.php in each entity module:
From:
$fieldvalue = $_REQUEST["fieldValue"];
To:
$fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);

5.Custom Fields for Asia language
include/js/customview.js:
From:
        var re1=/^[a-z\d\_ ]+$/i
        if (!re1.test(str))
        {
                alert("Special characters are not allowed in Label field")
                return false;
        }

To:
       /*
        changed by dingjianting on 2006-10-1 for custom fields in setting
module
        var re1=/^[a-z\d\_ ]+$/i
        if (!re1.test(str))
        {
                alert("Special characters are not allowed in Label field")
                return false;
        }
        */

If any problems , Pls feel free to let me know.

Thanks and regards,
Tim Ding



On 10/4/06, Richie <richie at vtiger.com> wrote:
>
> Hi!
>
> We have our hands full here and we still have more bugs to fix.
> All contributions are invited for the bug-fixes/features.
> Do put a blurb here and post it in the trac.
>
> Thanks,
> Richie
>
> _______________________________________________
> Get started with Online collaboration office & productivity tools -
> http://zoho.com?vt
>
>


-- 
________________________________________
中国开源客户关系管理系统: http://www.c3crm.com
-----------------------------------------------------------------------
_______________________________________________
Get started with Online collaboration office & productivity tools - http://zoho.com?vt 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20061005/24287885/attachment-0004.html 


More information about the vtigercrm-developers mailing list