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

yuchenghu@hawebs.net


git-svn-id: https://svn.code.sf.net/p/hawebs/svn@588 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-11-16 05:42:23 +00:00
parent e79b344aa7
commit cd9ddbc67f
11 changed files with 0 additions and 500 deletions
@@ -1,57 +0,0 @@
<?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 $app_strings, $mod_strings, $current_language, $currentModule, $theme,$current_user;
require_once('Smarty_setup.php');
require_once('modules/CustomerPortal/PortalUtils.php');
require('user_privileges/user_privileges_'.$current_user->id.'.php');
if(!$is_admin) {
echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>
<table border='0' cellpadding='5' cellspacing='0' width='98%'>
<tbody><tr>
<td rowspan='2' width='11%'><img src= " . vtiger_imageurl('denied.gif', $theme) . " ></td>
<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'>
<span class='genHeaderSmall'>$app_strings[LBL_PERMISSION]</span></td>
</tr>
<tr>
<td class='small' align='right' nowrap='nowrap'>
<a href='javascript:window.history.back();'>$app_strings[LBL_GO_BACK]</a><br>
</td>
</tr>
</tbody></table>
</div>";
echo "</td></tr></table>";
exit;
}
$mode = $_REQUEST['mode'];
if($mode !='' && $mode == 'save') {
cp_saveAdvancedSettings($_REQUEST);
}
$category = getParentTab();
$smarty = new vtigerCRM_Smarty();
$smarty->assign("THEME", $theme);
$smarty->assign('MOD', $mod_strings);
$smarty->assign('APP', $app_strings);
$smarty->assign('MODULE', $currentModule);
$smarty->assign('CATEGORY', $category);
$smarty->assign('BUTTONS', $list_buttons);
$smarty->assign('CHECK', $tool_buttons);
$smarty->assign('IMAGE_PATH', "themes/$theme/images/");
$smarty->assign('MODULE_VIEWALL',cp_getContactsViewInfo());
$smarty->assign('USERS', cp_getUsers());
$smarty->assign('USERID',cp_getCurrentUser());
$smarty->display(vtlib_getModuleTemplate($currentModule,'AdvancedSettings.tpl'));
?>
@@ -1,40 +0,0 @@
/*********************************************************************************
** 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 move_module(tabid,move){
//$('vtbusy_info').style.display = "block";
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: 'module=CustomerPortal&action=CustomerPortalAjax&file=ListView&sub_mode=movemodules&parenttab=Settings&tabid='+tabid+'&move='+move+'&ajax=true',
onComplete: function(response) {
$("portallist").innerHTML=response.responseText;
//$('vtbusy_info').style.display = "none";
}
}
);
}
function toggleModule(tabid, action) {
var data = 'module=CustomerPortal&action=CustomerPortalAjax&file=ListView&tabid='+tabid+'&sub_mode=enable_disable&status='+action;
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'command'},
method: 'post',
postBody: data,
onComplete: function(response) {
// Reload the page to apply the effect of module setting
window.location.href = "index.php?module=CustomerPortal&action=index&parenttab=Settings";
}
}
);
}
@@ -1,70 +0,0 @@
<?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.
*******************************************************************************/
class CustomerPortal {
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType) {
require_once('include/utils/utils.php');
global $adb,$mod_strings;
if($eventType == 'module.postinstall') {
$portalmodules = array("HelpDesk","Faq","Invoice","Quotes","Products","Services","Documents","Contacts","Accounts",);
$query = "SELECT max(sequence) AS max_tabseq FROM vtiger_customerportal_tabs";
$res = $adb->pquery($query,array());
$tabseq = $adb->query_result($res,0,'max_tabseq');
$i = ++$tabseq;
foreach($portalmodules as $modules) {
++$i;
$tabid = getTabid($modules);
$adb->query("INSERT INTO vtiger_customerportal_tabs (tabid,visible,sequence) VALUES ($tabid,1,$i)");
}
for($j = 0; $j< count($portalmodules); $j++) {
$tabid = getTabid($portalmodules[$j]);
$adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES ($tabid,'showrelatedinfo',1)");
}
$adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (0,'userid',1)");
// Mark the module as Standard module
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
$fieldid = $adb->getUniqueID('vtiger_settings_field');
$blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
$seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
if ($adb->num_rows($seq_res) > 0) {
$cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
if ($cur_seq != null) $seq = $cur_seq + 1;
}
$adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'LBL_CUSTOMER_PORTAL', 'portal_icon.png', 'PORTAL_EXTENSION_DESCRIPTION', 'index.php?module=CustomerPortal&action=index&parenttab=Settings', $seq));
} else if($eventType == 'module.disabled') {
// TODO Handle actions when this module is disabled.
} else if($eventType == 'module.enabled') {
// TODO Handle actions when this module is enabled.
} else if($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else if($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else if($eventType == 'module.postupdate') {
// TODO Handle actions after this module is updated.
}
}
}
?>
@@ -1,12 +0,0 @@
<?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');
?>
@@ -1,17 +0,0 @@
<?php
/** YOUR LICENSE TEXT HERE **/
class CustomerPortalHandler extends VTEventHandler {
function handleEvent($eventName, $data) {
if($eventName == 'vtiger.entity.beforesave') {
// Entity is about to be saved, take required action
}
if($eventName == 'vtiger.entity.aftersave') {
// Entity has been saved, take next action
}
}
}
?>
@@ -1,76 +0,0 @@
<?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 $app_strings, $mod_strings, $current_language, $currentModule, $theme,$current_user;
require_once('Smarty_setup.php');
require_once('include/ListView/ListView.php');
require_once('modules/CustomView/CustomView.php');
require_once('include/DatabaseUtil.php');
require_once('modules/CustomerPortal/PortalUtils.php');
require('user_privileges/user_privileges_'.$current_user->id.'.php');
if(!$is_admin) {
echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>
<table border='0' cellpadding='5' cellspacing='0' width='98%'>
<tbody><tr>
<td rowspan='2' width='11%'><img src= " . vtiger_imageurl('denied.gif', $theme) . " ></td>
<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'>
<span class='genHeaderSmall'>$app_strings[LBL_PERMISSION]</span></td>
</tr>
<tr>
<td class='small' align='right' nowrap='nowrap'>
<a href='javascript:window.history.back();'>$app_strings[LBL_GO_BACK]</a><br>
</td>
</tr>
</tbody></table>
</div>";
echo "</td></tr></table>";
exit;
}
if($_REQUEST['sub_mode'] != '' && isset($_REQUEST['sub_mode'])){
$sub_mode =$_REQUEST['sub_mode'];
}
if($sub_mode == 'movemodules'){
$tabid = $_REQUEST['tabid'];
$move = $_REQUEST['move'];
if($tabid != ''){
cp_changeTabOrder($tabid,$move);
}
}elseif($sub_mode == 'enable_disable') {
$tabid = $_REQUEST['tabid'];
$status =$_REQUEST['status'];
if($status != '' && $tabid != ''){
cp_changeModuleVisibility($tabid,$status);
}
}
$category = getParentTab();
$smarty = new vtigerCRM_Smarty();
$portalmodules = cp_getPortalModuleinfo();
$smarty->assign('PORTALMODULES',$portalmodules);
$smarty->assign("THEME", $theme);
$smarty->assign('MOD', $mod_strings);
$smarty->assign('APP', $app_strings);
$smarty->assign('MODULE', $currentModule);
$smarty->assign('CATEGORY', $category);
$smarty->assign('BUTTONS', $list_buttons);
$smarty->assign('CHECK', $tool_buttons);
$smarty->assign('IMAGE_PATH', "themes/$theme/images/");
$smarty->assign('MODE',$mode);
if($_REQUEST['ajax'] != true) {
$smarty->display(vtlib_getModuleTemplate($currentModule,'BasicSetttings.tpl'));
}
else {
$smarty->display(vtlib_getModuleTemplate($currentModule,'BasicSetttingsContents.tpl'));
}
?>
@@ -1,136 +0,0 @@
<?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/utils/utils.php');
/* Function to get a list of modules that is supporting Customer Portal
*/
function cp_getPortalModuleinfo(){
global $adb;
$query = $adb->query("SELECT vtiger_customerportal_tabs.*,vtiger_tab.name from vtiger_customerportal_tabs
INNER JOIN vtiger_tab ON vtiger_customerportal_tabs.tabid = vtiger_tab.tabid and vtiger_tab.presence = 0
ORDER BY vtiger_customerportal_tabs.sequence");
$rows = $adb->num_rows($query);
for($i = 0;$i < $rows; $i++){
$portalmodules[$i]['tabid'] = $adb->query_result($query,$i,'tabid');
$portalmodules[$i]['visible'] = $adb->query_result($query,$i,'visible');
$portalmodules[$i]['sequence'] = $adb->query_result($query,$i,'sequence');
$portalmodules[$i]['name'] = $adb->query_result($query,$i,'name');
}
return $portalmodules;
}
/* Function is used to change the order of modules in Customer portal
*
*/
function cp_changeTabOrder($tabid,$move) {
global $adb,$log;
$log->fatal("$tabid,$move");
if($move == 'Down'){
$sequence = $adb->pquery("SELECT sequence FROM vtiger_customerportal_tabs WHERE tabid = ?", array($tabid));
$oldsequence = $adb->query_result($sequence,0,'sequence');
$nexttab = $adb->pquery("SELECT sequence,tabid FROM vtiger_customerportal_tabs WHERE sequence > ? ORDER BY SEQUENCE LIMIT 0,1", array($oldsequence));
$newsequence = $adb->query_result($nexttab,0,'sequence');
$righttabid = $adb->query_result($nexttab,0,'tabid');
$adb->pquery("UPDATE vtiger_customerportal_tabs set sequence=? WHERE tabid = ?", array($newsequence, $tabid));
$adb->pquery("UPDATE vtiger_customerportal_tabs set sequence=? WHERE tabid = ?", array($oldsequence, $righttabid));
}elseif ($move == 'Up') {
$sequence = $adb->pquery("SELECT sequence FROM vtiger_customerportal_tabs WHERE tabid = ?", array($tabid));
$oldsequence = $adb->query_result($sequence,0,'sequence');
$nexttab = $adb->pquery("SELECT sequence,tabid FROM vtiger_customerportal_tabs WHERE sequence < ? ORDER BY SEQUENCE DESC LIMIT 0,1", array($oldsequence));
$newsequence = $adb->query_result($nexttab,0,'sequence');
$lefttabid = $adb->query_result($nexttab,0,'tabid');
$adb->pquery("UPDATE vtiger_customerportal_tabs SET sequence=? WHERE tabid = ?", array($newsequence, $tabid));
$adb->pquery("UPDATE vtiger_customerportal_tabs SET sequence=? WHERE tabid = ?", array($oldsequence, $lefttabid));
}
}
/* Function to obtain related info for Customer Portal(contacts can see other contacts info ar not)
*/
function cp_getContactsViewInfo() {
global $adb;
$relatedinfo = $adb->query("SELECT vtiger_customerportal_prefs.*,vtiger_tab.name FROM vtiger_customerportal_prefs
INNER JOIN vtiger_tab ON vtiger_tab.tabid = vtiger_customerportal_prefs.tabid
WHERE prefkey = 'showrelatedinfo' AND vtiger_tab.presence = 0");
$norows = $adb->num_rows($relatedinfo);
for($i = 0;$i < $norows;$i++) {
$module_viewall[$i]['module'] = $adb->query_result($relatedinfo,$i,'name');
$module_viewall[$i]['value'] = $adb->query_result($relatedinfo,$i,'prefvalue');
}
return $module_viewall;
}
/* Function to show/hide the tabs(modules) in Customer Portal
*/
function cp_changeModuleVisibility($tabid,$status) {
global $adb,$log;
if($status == 'module_disable'){
$updatevisibility = $adb->pquery("UPDATE vtiger_customerportal_tabs SET visible = 0 WHERE tabid = ?", array($tabid));
}else {
$updatevisibility = $adb->pquery("UPDATE vtiger_customerportal_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
}
}
/* Function to save Advanced info fro Customer Portal
*/
function cp_saveAdvancedSettings($input) {
global $adb;
$portalmodules = array("Accounts","Contacts","HelpDesk","Invoice","Quotes","Documents","Faq","Services","Products");
foreach($portalmodules as $modules) {
$view = $input['view_'.$modules];
$tabid = getTabid($modules);
if($view == 'showall'){
$adb->pquery("UPDATE vtiger_customerportal_prefs SET prefvalue = 1 WHERE prefkey = 'showrelatedinfo' and tabid = ?", array($tabid));
}else {
$adb->pquery("UPDATE vtiger_customerportal_prefs SET prefvalue = 0 WHERE prefkey = 'showrelatedinfo' and tabid = ?", array($tabid));
}
}
//user update
$userid = $input['userid'];
$adb->pquery("UPDATE vtiger_customerportal_prefs SET prefvalue = ? WHERE prefkey = 'userid' and tabid = 0", array($userid));
}
/* It gives you a list of users
*
*/
function cp_getUsers(){
global $adb;
$res = $adb->query("SELECT id,user_name from vtiger_users");
$norows = $adb->num_rows($res);
for($i = 0;$i < $norows;$i++) {
$users[$i]['id'] = $adb->query_result($res,$i,'id');
$users[$i]['name'] = $adb->query_result($res,$i,'user_name');
}
return $users;
}
/* Function to get the customer portal user id
*/
function cp_getCurrentUser() {
global $adb;
$res = $adb->query("SELECT prefvalue FROM vtiger_customerportal_prefs WHERE prefkey = 'userid' AND tabid = 0");
$userid = $adb->query_result($res,0,'prefvalue');
if($userid != '') {
return $userid;
}
return false;
}
?>
@@ -1,36 +0,0 @@
<?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 $currentModule,$current_user,$app_strings;
require('user_privileges/user_privileges_'.$current_user->id.'.php');
if(!$is_admin) {
echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>
<table border='0' cellpadding='5' cellspacing='0' width='98%'>
<tbody><tr>
<td rowspan='2' width='11%'><img src= " . vtiger_imageurl('denied.gif', $theme) . " ></td>
<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'>
<span class='genHeaderSmall'>$app_strings[LBL_PERMISSION]</span></td>
</tr>
<tr>
<td class='small' align='right' nowrap='nowrap'>
<a href='javascript:window.history.back();'>$app_strings[LBL_GO_BACK]</a><br>
</td>
</tr>
</tbody></table>
</div>";
echo "</td></tr></table>";
exit;
}
include_once("modules/$currentModule/ListView.php");
?>
@@ -1,22 +0,0 @@
<?php
/** YOUR LICENSE TEXT HERE **/
$mod_strings = Array (
'CustomerPortal' => 'CustomerPortal',
'LBL_BASIC_SETTINGS'=>'Basic Settings',
'LBL_ADVANCED_SETTINGS'=>'Advanced Settings',
'LBL_MODULE'=>'Module',
'LBL_VIEW_ALL_RECORD'=>'View All Related Records ?',
'YES'=>'Yes',
'NO'=>'No',
'LBL_USER_DESCRIPTION'=>'The above selected User\'s profile will be selected to control the fields that appear in the Customer Portal
You can enable/disable the fields that show in the customer Portal.',
'SELECT_USERS'=>'Select the Users',
'LBL_DISABLE'=>'Disable',
'LBL_ENABLE' =>'Enable',
'Module' => 'Module',
'Sequence' =>'Sequence',
'Visible'=>'Visible'
);
?>
@@ -1,21 +0,0 @@
<?php
/** YOUR LICENSE TEXT HERE **/
$mod_strings = Array (
'CustomerPortal' => '客户门户 ',
'LBL_BASIC_SETTINGS'=>'基本设置',
'LBL_ADVANCED_SETTINGS'=>'高级设置',
'LBL_MODULE'=>'模块',
'LBL_VIEW_ALL_RECORD'=>'查看所有相关记录 ?',
'YES'=>'是',
'NO'=>'否',
'LBL_USER_DESCRIPTION'=>'您可以通过设置来决定上述选定的用户的相关权限,比如字段是否可见,模块是否可用等.',
'SELECT_USERS'=>'选择用户',
'LBL_DISABLE'=>'禁用',
'LBL_ENABLE' =>'启用',
'Module' => '模块',
'Sequence' =>'次序',
'Visible'=>'可见'
);
?>
@@ -1,13 +0,0 @@
<?xml version='1.0'?>
<schema>
<tables>
<table>
<name>vtiger_customerportal_fields</name>
<sql><![CDATA[CREATE TABLE `vtiger_customerportal_fields` (
`tabid` int(19) NOT NULL,
`fieldid` int(19) default NULL,
`visible` int(1) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8]]></sql>
</table>
</tables>
</schema>