更新到 5.2 正式版后第一次 SVN 提交。

[email protected]


git-svn-id: https://svn.code.sf.net/p/hawebs/svn@629 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-11-16 15:14:53 +00:00
parent 1004bba11a
commit d6c0eb72eb
10 changed files with 508 additions and 0 deletions
@@ -0,0 +1,22 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
*******************************************************************************/
global $adb;
if(!isset($_REQUEST['record']))
die($mod_strings['ERR_DELETE_RECORD']);
$del_query = 'DELETE FROM vtiger_portal WHERE portalid=?';
$adb->pquery($del_query, array($_REQUEST['record']));
//code added for returning back to the current view after delete from list view
header("Location: index.php?action=PortalAjax&module=Portal&file=ListView&mode=ajax&datamode=manage");
?>
@@ -0,0 +1,78 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('Smarty_setup.php');
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
global $app_strings;
global $mod_strings;
global $currentModule;
global $current_language;
$current_module_strings = return_module_language($current_language, 'Portal');
global $adb;
$query="select * from vtiger_portal";
$result=$adb->pquery($query, array());
//Getting the Default URL Value if any
$default_url = $adb->query_result($result,0,'portalurl');
$no_of_portals=$adb->num_rows($result);
$portal_info=array();
//added as an enhancement to set default
?>
<script language="javascript" type="text/javascript">
var mysitesArray = new Array()
<?php
for($i=0 ; $i<$no_of_portals; $i++)
{
$portalname = $adb->query_result($result,$i,'portalname');
$portalurl = $adb->query_result($result,$i,'portalurl');
//added as an enhancement to set default value
$portalid = $adb->query_result($result,$i,'portalid');
$set_default = $adb->query_result($result,$i,'setdefault');
$portal_array['set_def'] = $set_default;
$portal_array['portalid'] = $portalid;
if($set_default == 1)
{
$def_ault = $portalurl;
}
$portal_array['portalname'] = (strlen($portalname) > 100) ? (substr($portalname,0,100).'...') : $portalname;
$portal_array['portalurl'] = $portalurl;
$portal_array['portaldisplayurl'] = (strlen($portalurl) > 100) ? (substr($portalurl,0,100).'...') : $portalurl;
$portal_info[]=$portal_array;
?>
mysitesArray['<?php echo $portalid;?>'] = "<?php echo $portalurl;?>";
<?php
}
?>
</script>
<?php
if($def_ault == '')
$def_ault = $adb->query_result($result,0,'portalurl');
$smarty = new vtigerCRM_Smarty;
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("DEFAULT_URL", $def_ault);
$smarty->assign("APP", $app_strings);
$smarty->assign("PORTAL_COUNT", count($portal_info));
$smarty->assign("PORTALS", $portal_info);
$smarty->assign("MODULE", $currentModule);
$smarty->assign("DEFAULT",'yes');
$smarty->assign("CATEGORY", getParentTab());
if($_REQUEST['datamode'] == 'data')
$smarty->display("MySitesContents.tpl");
elseif($_REQUEST['datamode'] == 'manage')
$smarty->display("MySitesManage.tpl");
else
$smarty->display("MySites.tpl");
?>
+67
View File
@@ -0,0 +1,67 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('modules/Portal/Portal.php');
global $app_strings,$app_list_strings,$mod_strings,$adb,$theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
if(isset($_REQUEST['record']) && $_REQUEST['record'] !='')
{
$portalid = $_REQUEST['record'];
$query="select * from vtiger_portal where portalid =?";
$result=$adb->pquery($query, array($portalid));
$portalname = $adb->query_result($result,0,'portalname');
$portalurl = $adb->query_result($result,0,'portalurl');
/* to remove http:// from portal url*/
$portalurl = preg_replace("/http:\/\//i","",$portalurl);
}
$portal_inputs='';
$portal_inputs.='<div style="display:block;position:relative;" id="orgLay" class="layerPopup">
<form onSubmit="OnUrlChange(); SaveSite(\''.$portalid.'\');return false;" >
<table border="0" cellpadding="3" cellspacing="0" width="100%" class="layerHeadingULine">
<tr>
<td class="layerPopupHeading" align="left" width="60%">' .$mod_strings['LBL_ADD'] .' '.$mod_strings['LBL_BOOKMARK'].'</td>
<td align="right" width="40%"><a href="javascript:fninvsh(\'orgLay\');"><img src="'. vtiger_imageurl('close.gif', $theme) .'" align="absmiddle" border="0"></a></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="5" width="95%" align="center">
<tr>
<td class="small" >
<table border="0" celspacing="0" cellpadding="5" width="100%" align="center" bgcolor="white">
<tr>
<td align="right" width="40%" ><b>'.$mod_strings['LBL_BOOKMARK'].' ' .$mod_strings['LBL_URL'] .' </b></td>
<td align="left" width="60%">http://<input name="portalurl" id="portalurl" class="txtBox" value="'.$portalurl.'" type="text" onkeyup="OnUrlChange();"></td>
</tr>
<tr>
<td align="right" width="40%"> <b>'.$mod_strings['LBL_BOOKMARK'].' ' .$mod_strings['LBL_NAME'] .' </b></td>
<td align="left" width="60%"><input name="portalname" id="portalname" value="'.$portalname.'" class="txtBox" type="text"></td>
</tr>
</table>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="layerPopupTransport">
<tr>
<td align="center">
<input name="save" value=" &nbsp;'.$app_strings['LBL_SAVE_BUTTON_LABEL'].'&nbsp; " class="crmbutton small save" type="submit">&nbsp;&nbsp;
<input name="cancel" value=" '.$app_strings['LBL_CANCEL_BUTTON_LABEL'].' " class="crmbutton small cancel" onclick="fninvsh(\'orgLay\');" type="button">
</td>
</tr>
</table>
</form>
</div>';
echo $portal_inputs;
?>
+146
View File
@@ -0,0 +1,146 @@
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
function fetchAddSite(id)
{
$("status").style.display="inline";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody:'module=Portal&action=PortalAjax&file=Popup&record='+id,
onComplete: function(response) {
$("status").style.display="none";
$('editportal_cont').innerHTML = response.responseText;
}
}
);
}
function fetchContents(mode)
{
// Reloading the window is better, If not reloaded ... mysitesArray variable needs to be updated
// using eval method on javascript.
if(mode == 'data') {
window.location.href = 'index.php?module=Portal&action=ListView&parenttab=Tools';
return;
}
$("status").style.display="inline";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody:'action=PortalAjax&mode=ajax&module=Portal&file=ListView&datamode='+mode,
onComplete: function(response) {
$("status").style.display="none";
$('portalcont').innerHTML = response.responseText;
}
}
);
}
function DeleteSite(id)
{
if(confirm(alert_arr.SURE_TO_DELETE))
{
$("status").style.display="inline";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody:'action=PortalAjax&mode=ajax&file=Delete&module=Portal&record='+id,
onComplete: function(response) {
$("status").style.display="none";
$('portalcont').innerHTML = response.responseText;
}
}
);
}
}
function SaveSite(id)
{
if ($('portalurl').value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) {
alert(alert_arr.SITEURL_CANNOT_BE_EMPTY)
return false;
}
if ($('portalname').value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) {
alert(alert_arr.SITENAME_CANNOT_BE_EMPTY)
return false;
}
Effect.Puff('orgLay');
$("status").style.display="inline";
var portalurl = document.getElementById('portalurl').value;
var portalurl = portalurl.replace(/&/g, "#$#$#");
var portalname = document.getElementById('portalname').value;
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody:'action=PortalAjax&mode=ajax&file=Save&module=Portal&portalname='+portalname+'&portalurl='+portalurl+'&record='+id,
onComplete: function(response) {
if(response.responseText.indexOf(":#:FAILURE") > -1)
{
alert(alert_arr.VALID_DATA)
}else
{
$('portalcont').innerHTML = response.responseText;
}
$("status").style.display="none";
}
}
);
}
function setSite(oUrllist)
{
//var url = oUrllist.options[oUrllist.options.selectedIndex].value;
var id = oUrllist.options[oUrllist.options.selectedIndex].value;
document.getElementById('locatesite').src = mysitesArray[id];
}
//added as an enhancement to set default value
function defaultMysites(oSelectlist)
{
var id = $("urllist").value;
$("status").style.display="block";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody:'action=PortalAjax&mode=ajax&file=Save&module=Portal&check=true&passing_var='+id,
onComplete: function(response) {
//alert(response.responseText);
$("status").style.display="none";
}
}
);
}
var oRegex = new Object() ;
oRegex.UriProtocol = new RegExp('') ;
oRegex.UriProtocol.compile( '^(((http|https|ftp|news):\/\/)|mailto:)', 'gi' ) ;
oRegex.UrlOnChangeProtocol = new RegExp('') ;
oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi' ) ;
function OnUrlChange()
{
var sUrl;
var sProtocol;
sUrl=document.getElementById("portalurl").value ;
sProtocol=oRegex.UrlOnChangeProtocol.exec( sUrl ) ;
if ( sProtocol )
{
sUrl = sUrl.substr( sProtocol[0].length ) ;
document.getElementById("portalurl").value = sUrl ;
}
}
@@ -0,0 +1,47 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
/** Function to save the portal in database
* @param $portalname : Type String
* @param $portalurl : Type String
* This function saves the portal with the given $portalname,$portalurl
* This Returns $portalid
*/
function SavePortal($portalname,$portalurl)
{
global $adb;
$adb->println("just entered the SavePortal method");
$portalid=$adb->getUniqueID('vtiger_portal');
$query="insert into vtiger_portal values(?,?,?,?,?)";
$params=array($portalid,$portalname,$portalurl,0,0);
$adb->println($query);
$result=$adb->pquery($query,$params);
return $portalid;
}
/** Function to update the portal in database
* @param $portalname : Type String
* @param $portalurl : Type String
* @param $portalid : Type Integer
* This function updates the portal with the given $portalname,$portalurl
* This Returns $portalid
*/
function UpdatePortal($portalname,$portalurl,$portalid)
{
global $adb;
$adb->println("just entered the SavePortal method");
$query="update vtiger_portal set portalname=? ,portalurl=? where portalid=?";
$params=array($portalname, $portalurl, $portalid);
$adb->println($query);
$result=$adb->pquery($query, $params);
return $portalid;
}
?>
@@ -0,0 +1,13 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/Ajax/CommonAjax.php');
?>
+44
View File
@@ -0,0 +1,44 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('modules/Portal/Portal.php');
global $default_charset,$adb;
$conv_pname = function_exists(iconv) ? @iconv("UTF-8",$default_charset, $_REQUEST['portalname']) : $_REQUEST['portalname'];
$conv_purl = function_exists(iconv) ? @iconv("UTF-8",$default_charset, $_REQUEST['portalurl']) : $_REQUEST['portalurl'];
$portlurl =str_replace(array("'",'"'),'',$conv_purl);
$portlname = from_html($conv_pname);
$portlurl = from_html($portlurl);
//added as an enhancement to set default value
if(isset($_REQUEST['check']) && $_REQUEST['check'] =='true')
{
$updateDefalt ="UPDATE vtiger_portal SET setdefault=1 WHERE portalid=?";
$set_def = $adb->pquery($updateDefalt, array($_REQUEST['passing_var']));
$updateZero = "UPDATE vtiger_portal SET setdefault=0 WHERE portalid not in(?)";
$set_default= $adb->pquery($updateZero, array($_REQUEST['passing_var']));
exit();
}
if($portlname != '' && $portlurl != '')
{
if(isset($_REQUEST['record']) && $_REQUEST['record'] !='')
{
$result=UpdatePortal($portlname,"http://".str_replace("#$#$#","&",$portlurl),$_REQUEST['record']);
}
else
{
$result=SavePortal($portlname,"http://".str_replace("#$#$#","&",$portlurl));
}
header("Location: index.php?action=PortalAjax&module=Portal&file=ListView&mode=ajax&datamode=manage");
}else
{
echo ":#:FAILURE";
}
?>
+13
View File
@@ -0,0 +1,13 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
include ('modules/Portal/ListView.php');
?>
@@ -0,0 +1,34 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
$mod_strings = Array(
// added for 5.0 beta
'LBL_BOOKMARKED_URL'=>"BookMarked URL's",
'LBL_MANAGE_BOOKMARKS'=>'Manage Bookmarks',
'LBL_BOOKMARK_LIST'=>'Bookmark List',
'LBL_MY_BOOKMARKS'=>'My Bookmarks',
'LBL_NEW_BOOKMARK'=>'New Bookmark',
'LBL_BOOKMARK'=>'Bookmark',
'LBL_NAME'=>'Name :',
'LBL_URL'=>'URL :',
'LBL_ADD'=>'Add',
'LBL_SNO'=>'#',
'LBL_BOOKMARK_NAME_URL'=>'Bookmark Name &amp; URL',
'LBL_TOOLS'=>'Tools',
'LBL_MANAGE_SITES'=>'Manage Sites',
'LBL_MY_SITES'=>'Sites',
// Added/Updated for vtiger CRM 5.0.4
//added as an enhancement
'LBL_SET_DEFAULT_BUTTON'=>'Set As Default',
);
?>
@@ -0,0 +1,44 @@
<?php
/**
* Copyright (C) 2006-2010 YUCHENG HU
*
* ---------------------------------------------
* HA WEBSYSTEMS
* http://www.hawebs.net
* https://www.hawebs.org/forums/computer/
*
* CONTACT
* [email protected] / [email protected]
*
* ---------------------------------------------
* [A] GNU GENERAL PUBLIC LICENSE GNU/LGPL
* [B] Apache License, Version 2.0
*
* ---------------------------------------------
* NOTE
* 1. 所有的语言配置文件请采用 UTF-8 编码
*
* ---------------------------------------------
*/
$mod_strings = Array(
// added for 5.0 beta
'LBL_BOOKMARKED_URL' => '书签网址的',
'LBL_MANAGE_BOOKMARKS' => '管理书签',
'LBL_BOOKMARK_LIST' => '书签列表',
'LBL_MY_BOOKMARKS' => '我的书签',
'LBL_NEW_BOOKMARK' => '新增书签',
'LBL_BOOKMARK' => '书签',
'LBL_NAME' => '名称:',
'LBL_URL' => '网址:',
'LBL_ADD' => '新增',
'LBL_SNO' => '#',
'LBL_BOOKMARK_NAME_URL' => '书签名称 &amp; 网址',
'LBL_TOOLS' => '工具',
'LBL_MANAGE_SITES' => '管理网站',
'LBL_MY_SITES' => '我的网站',
// Added/Updated for vtiger CRM 5.0.4
//added as an enhancement
'LBL_SET_DEFAULT_BUTTON'=>'预设',
);
?>