Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* ****************************************************************************** */
function proper_case($module) {
return $module;
}
require_once('include/MVC/Controller/SugarController.php');
class ControllerFactory {
/**
* Obtain an instance of the correct controller.
*
* @return an instance of SugarController
*/
function getController($module) {
$class = ucfirst($module) . 'Controller';
$customClass = 'Custom' . $class;
if (file_exists('custom/modules/' . $module . '/controller.php')) {
$customClass = 'Custom' . $class;
require_once('custom/modules/' . $module . '/controller.php');
if (class_exists($customClass)) {
$controller = new $customClass();
} else if (class_exists($class)) {
$controller = new $class();
}
} elseif (file_exists('modules/' . $module . '/controller.php')) {
require_once('modules/' . $module . '/controller.php');
if (class_exists($customClass)) {
$controller = new $customClass();
} else if (class_exists($class)) {
$controller = new $class();
}
} else {
if (file_exists('custom/include/MVC/Controller/SugarController.php')) {
require_once('custom/include/MVC/Controller/SugarController.php');
}
if (class_exists('CustomSugarController')) {
$controller = new CustomSugarController();
} else {
$controller = new SugarController();
}
}
//setup the controller
$controller->setup($module);
return $controller;
}
}
?>

View File

@@ -0,0 +1,833 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
class SugarController{
/**
* remap actions in here
* e.g. make all detail views go to edit views
* $action_remap = array('detailview'=>'editview');
*/
protected $action_remap = array('index'=>'listview');
/**
* The name of the current module.
*/
public $module = 'Home';
/**
* The name of the target module.
*/
public $target_module = null;
/**
* The name of the current action.
*/
public $action = 'index';
/**
* The id of the current record.
*/
public $record = '';
/**
* The name of the return module.
*/
public $return_module = null;
/**
* The name of the return action.
*/
public $return_action = null;
/**
* The id of the return record.
*/
public $return_id = null;
/**
* If the action was remapped it will be set to do_action and then we will just
* use do_action for the actual action to perform.
*/
protected $do_action = 'index';
/**
* If a bean is present that set it.
*/
public $bean = null;
/**
* url to redirect to
*/
public $redirect_url = '';
/**
* any subcontroller can modify this to change the view
*/
public $view = 'classic';
/**
* this array will hold the mappings between a key and an object for use within the view.
*/
public $view_object_map = array();
/**
* This array holds the methods that handleAction() will invoke, in sequence.
*/
protected $tasks = array(
'pre_action',
'do_action',
'post_action'
);
/**
* List of options to run through within the process() method.
* This list is meant to easily allow additions for new functionality as well as
* the ability to add a controller's own handling.
*/
public $process_tasks = array(
'blockFileAccess',
'handleEntryPoint',
'callLegacyCode',
'remapAction',
'handle_action',
'handleActionMaps',
);
/**
* Whether or not the action has been handled by $process_tasks
*
* @var bool
*/
protected $_processed = false;
/**
* Map an action directly to a file
*/
/**
* Map an action directly to a file. This will be loaded from action_file_map.php
*/
protected $action_file_map = array();
/**
* Map an action directly to a view
*/
/**
* Map an action directly to a view. This will be loaded from action_view_map.php
*/
protected $action_view_map = array();
/**
* This can be set from the application to tell us whether we have authorization to
* process the action. If this is set we will default to the noaccess view.
*/
public $hasAccess = true;
/**
* Map case sensitive filenames to action. This is used for linux/unix systems
* where filenames are case sensitive
*/
public static $action_case_file = array(
'editview'=>'EditView',
'detailview'=>'DetailView',
'listview'=>'ListView'
);
/**
* Constructor. This ie meant tot load up the module, action, record as well
* as the mapping arrays.
*/
function SugarController(){
}
/**
* Called from SugarApplication and is meant to perform the setup operations
* on the controller.
*
*/
public function setup($module = ''){
if(empty($module) && !empty($_REQUEST['module']))
$module = $_REQUEST['module'];
//set the module
if(!empty($module))
$this->setModule($module);
if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') {
$this->target_module = $_REQUEST['target_module'];
}
//set properties on the controller from the $_REQUEST
$this->loadPropertiesFromRequest();
//load the mapping files
$this->loadMappings();
}
/**
* Set the module on the Controller
*
* @param object $module
*/
public function setModule($module){
$this->module = $module;
}
/**
* Set properties on the Controller from the $_REQUEST
*
*/
private function loadPropertiesFromRequest(){
if(!empty($_REQUEST['action']))
$this->action = $_REQUEST['action'];
if(!empty($_REQUEST['record']))
$this->record = $_REQUEST['record'];
if(!empty($_REQUEST['view']))
$this->view = $_REQUEST['view'];
if(!empty($_REQUEST['return_module']))
$this->return_module = $_REQUEST['return_module'];
if(!empty($_REQUEST['return_action']))
$this->return_action = $_REQUEST['return_action'];
if(!empty($_REQUEST['return_id']))
$this->return_id = $_REQUEST['return_id'];
}
/**
* Load map files for use within the Controller
*
*/
private function loadMappings(){
$this->loadMapping('action_view_map');
$this->loadMapping('action_file_map');
$this->loadMapping('action_remap', true);
}
/**
* Given a record id load the bean. This bean is accessible from any sub controllers.
*/
public function loadBean(){
if(!empty($GLOBALS['beanList'][$this->module])){
$class = $GLOBALS['beanList'][$this->module];
if(!empty($GLOBALS['beanFiles'][$class])){
require_once($GLOBALS['beanFiles'][$class]);
$this->bean = new $class();
if(!empty($this->record)){
$this->bean->retrieve($this->record);
if($this->bean)
$GLOBALS['FOCUS'] = $this->bean;
}
}
}
}
/**
* Generic load method to load mapping arrays.
*/
private function loadMapping($var, $merge = false){
$$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module);
if(!$$var){
if($merge && !empty($this->$var)){
$$var = $this->$var;
}else{
$$var = array();
}
if(file_exists('include/MVC/Controller/'. $var . '.php')){
require('include/MVC/Controller/'. $var . '.php');
}
if(file_exists('modules/'.$this->module.'/'. $var . '.php')){
require('modules/'.$this->module.'/'. $var . '.php');
}
if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){
require('custom/modules/'.$this->module.'/'. $var . '.php');
}
if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){
require('custom/include/MVC/Controller/'. $var . '.php');
}
sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var);
}
$this->$var = $$var;
}
/**
* This method is called from SugarApplication->execute and it will bootstrap the entire controller process
*/
final public function execute(){
$this->process();
if(!empty($this->view)){
$this->processView();
}elseif(!empty($this->redirect_url)){
$this->redirect();
}
}
/**
* Display the appropriate view.
*/
private function processView(){
$view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module);
$GLOBALS['current_view'] = $view;
if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if(isset($this->errors)){
$view->errors = $this->errors;
}
$view->process();
}
/**
* Meant to be overridden by a subclass and allows for specific functionality to be
* injected prior to the process() method being called.
*/
public function preProcess()
{}
/**
* if we have a function to support the action use it otherwise use the default action
*
* 1) check for file
* 2) check for action
*/
public function process(){
$GLOBALS['action'] = $this->action;
$GLOBALS['module'] = $this->module;
//mz, quick repair currencies acces
if ($this->module=='Currencies') $this->hasAccess=true;
//check to ensure we have access to the module.
if($this->hasAccess){
$this->do_action = $this->action;
$file = self::getActionFilename($this->do_action);
$this->loadBean();
$processed = false;
foreach($this->process_tasks as $process){
$this->$process();
if($this->_processed)
break;
}
$this->redirect();
}else{
$this->no_access();
}
}
/**
* This method is called from the process method. I could also be called within an action_* method.
* It allows a developer to override any one of these methods contained within,
* or if the developer so chooses they can override the entire action_* method.
*
* @return true if any one of the pre_, do_, or post_ methods have been defined,
* false otherwise. This is important b/c if none of these methods exists, then we will run the
* action_default() method.
*/
protected function handle_action(){
$processed = false;
foreach($this->tasks as $task){
$processed = ($this->$task() || $processed);
}
$this->_processed = $processed;
}
/**
* Perform an action prior to the specified action.
* This can be overridde in a sub-class
*/
private function pre_action(){
$function = 'pre_' . $this->action;
if($this->hasFunction($function)){
$GLOBALS['log']->debug('Performing pre_action');
$this->$function();
return true;
}
return false;
}
/**
* Perform the specified action.
* This can be overridde in a sub-class
*/
private function do_action(){
$function = 'action_'. strtolower($this->do_action);
if($this->hasFunction($function)){
$GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module);
$this->$function();
return true;
}
return false;
}
/**
* Perform an action after to the specified action has occurred.
* This can be overridde in a sub-class
*/
private function post_action(){
$function = 'post_' . $this->action;
if($this->hasFunction($function)){
$GLOBALS['log']->debug('Performing post_action');
$this->$function();
return true;
}
return false;
}
/**
* If there is no action found then display an error to the user.
*/
protected function no_action(){
sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']);
}
/**
* The default action handler for instances where we do not have access to process.
*/
protected function no_access(){
$this->view = 'noaccess';
}
///////////////////////////////////////////////
/////// HELPER FUNCTIONS
///////////////////////////////////////////////
/**
* Determine if a given function exists on the objects
* @param function - the function to check
* @return true if the method exists on the object, false otherwise
*/
protected function hasFunction($function){
return method_exists($this, $function);
}
/**
* Set the url to which we will want to redirect
*
* @param string url - the url to which we will want to redirect
*/
protected function set_redirect($url){
$this->redirect_url = $url;
}
/**
* Perform redirection based on the redirect_url
*
*/
protected function redirect(){
if(!empty($this->redirect_url))
SugarApplication::redirect($this->redirect_url);
}
////////////////////////////////////////////////////////
////// DEFAULT ACTIONS
///////////////////////////////////////////////////////
/*
* Save a bean
*/
/**
* Do some processing before saving the bean to the database.
*/
public function pre_save(){
if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){
$this->bean->notify_on_save = true;
}
$GLOBALS['log']->debug("SugarController:: performing pre_save.");
require_once('include/SugarFields/SugarFieldHandler.php');
$sfh = new SugarFieldHandler();
foreach($this->bean->field_defs as $field => $properties) {
$type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type'];
$sf = $sfh->getSugarField(ucfirst($type), true);
if($sf != null){
$sf->save($this->bean, $_POST, $field, $properties);
}
if(isset($_POST[$field])) {
if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) {
if(empty($_POST[$field][0])) {
unset($_POST[$field][0]);
}
$_POST[$field] = encodeMultienumValue($_POST[$field]);
}
$this->bean->$field = $_POST[$field];
} else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) {
$this->bean->$field = '';
}
}
foreach($this->bean->relationship_fields as $field=>$link){
if(!empty($_POST[$field])){
$this->bean->$field = $_POST[$field];
}
}
if(!$this->bean->ACLAccess('save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$this->bean->unformat_all_fields();
}
/**
* Perform the actual save
*/
public function action_save(){
$this->bean->save(!empty($this->bean->notify_on_save));
}
/**
* Specify what happens after the save has occurred.
*/
protected function post_save(){
$module = (!empty($this->return_module) ? $this->return_module : $this->module);
$action = (!empty($this->return_action) ? $this->return_action : 'DetailView');
$id = (!empty($this->return_id) ? $this->return_id : $this->bean->id);
$url = "index.php?module=".$module."&action=".$action."&record=".$id;
$this->set_redirect($url);
}
/*
* Delete a bean
*/
/**
* Perform the actual deletion.
*/
protected function action_delete(){
//do any pre delete processing
//if there is some custom logic for deletion.
if(!empty($_REQUEST['record'])){
if(!$this->bean->ACLAccess('Delete')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$this->bean->mark_deleted($_REQUEST['record']);
}else{
sugar_die("A record number must be specified to delete");
}
}
/**
* Specify what happens after the deletion has occurred.
*/
protected function post_delete(){
$return_module = isset($_REQUEST['return_module']) ?
$_REQUEST['return_module'] :
$GLOBALS['sugar_config']['default_module'];
$return_action = isset($_REQUEST['return_action']) ?
$_REQUEST['return_action'] :
$GLOBALS['sugar_config']['default_action'];
$return_id = isset($_REQUEST['return_id']) ?
$_REQUEST['return_id'] :
'';
$url = "index.php?module=".$return_module."&action=".$return_action."&record=".$return_id;
$this->set_redirect($url);
}
/**
* Perform the actual massupdate.
*/
protected function action_massupdate(){
if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){
if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete')
|| (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
set_time_limit(0);//I'm wondering if we will set it never goes timeout here.
require_once("include/MassUpdate.php");
require_once('modules/MySettings/StoreQuery.php');
$seed = loadBean($_REQUEST['module']);
$mass = new MassUpdate();
$mass->setSugarBean($seed);
if(isset($_REQUEST['entire']) && empty($_POST['mass'])) {
$mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']);
}
$mass->handleMassUpdate();
$storeQuery = new StoreQuery();//restore the current search. to solve bug 24722 for multi tabs massupdate.
$temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']);
if($_REQUEST['return_module'] == 'Emails') {
if(!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) {
$this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']); //specificly for My Achieves
}
}
$_REQUEST = array();
$_REQUEST = unserialize(base64_decode($temp_req['current_query_by_page']));
unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page
$storeQuery->saveFromRequest($_REQUEST['module']);
$_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page.
}else{
sugar_die("You must massupdate at least one record");
}
}
/**
* Specify what happens after the massupdate has occurred.
*/
protected function post_massupdate(){
$return_module = isset($_REQUEST['return_module']) ?
$_REQUEST['return_module'] :
$GLOBALS['sugar_config']['default_module'];
$return_action = isset($_REQUEST['return_action']) ?
$_REQUEST['return_action'] :
$GLOBALS['sugar_config']['default_action'];
$url = "index.php?module=".$return_module."&action=".$return_action;
if($return_module == 'Emails'){//specificly for My Achieves
if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) {
$url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id'];
}
}
$this->set_redirect($url);
}
/**
* Perform the listview action
*/
protected function action_listview(){
$this->view_object_map['bean'] = $this->bean;
$this->view = 'list';
}
/*
//THIS IS HANDLED IN ACTION_REMAP WHERE INDEX IS SET TO LISTVIEW
function action_index(){
}
*/
/**
* Action to handle when using a file as was done in previous versions of Sugar.
*/
protected function action_default(){
$this->view = 'classic';
}
/**
* this method id used within a Dashlet when performing an ajax call
*/
protected function action_callmethoddashlet(){
if(!empty($_REQUEST['id'])) {
$id = $_REQUEST['id'];
$requestedMethod = $_REQUEST['method'];
$dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config
if(!empty($dashletDefs[$id])) {
require_once($dashletDefs[$id]['fileLocation']);
$dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array()));
if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) {
echo $dashlet->$requestedMethod();
}
else {
echo 'no method';
}
}
}
}
/**
* this method is used within a Dashlet when the options configuration is posted
*/
protected function action_configuredashlet(){
global $current_user, $mod_strings;
if(!empty($_REQUEST['id'])) {
$id = $_REQUEST['id'];
$dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config
require_once($dashletDefs[$id]['fileLocation']);
$dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array()));
if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings
$dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST);
$current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']);
}
else { // display options
$json = getJSONobj();
return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'],
'body' => $dashlet->displayOptions())));
}
}
else {
return '0';
}
}
/**
* getActionFilename
*/
public static function getActionFilename($action) {
if(isset(self::$action_case_file[$action])) {
return self::$action_case_file[$action];
}
return $action;
}
/********************************************************************/
// PROCESS TASKS
/********************************************************************/
/**
* Given the module and action, determine whether the super/admin has prevented access
* to this url. In addition if any links specified for this module, load the links into
* GLOBALS
*
* @return true if we want to stop processing, false if processing should continue
*/
private function blockFileAccess(){
//check if the we have enabled file_access_control and if so then check the mappings on the request;
if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){
$this->loadMapping('file_access_control_map');
//since we have this turned on, check the mapping file
$module = strtolower($this->module);
$action = strtolower($this->do_action);
if(!empty($this->file_access_control_map['modules'][$module]['links'])){
$GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links'];
}
if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){
//check params
if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){
$block = true;
$params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params'];
foreach($params as $param => $paramVals){
if(!empty($_REQUEST[$param])){
if(!in_array($_REQUEST[$param], $paramVals)){
$block = false;
break;
}
}
}
if($block){
$this->_processed = true;
$this->no_access();
}
}else{
$this->_processed = true;
$this->no_access();
}
}
}else
$this->_processed = false;
}
/**
* This code is part of the entry points reworking. We have consolidated all
* entry points to go through index.php. Now in order to bring up an entry point
* it will follow the format:
* 'index.php?entryPoint=download'
* the download entry point is mapped in the following file: entry_point_registry.php
*
*/
private function handleEntryPoint(){
if(!empty($_REQUEST['entryPoint'])){
$this->loadMapping('entry_point_registry');
$entryPoint = $_REQUEST['entryPoint'];
if(!empty($this->entry_point_registry[$entryPoint])){
require_once($this->entry_point_registry[$entryPoint]['file']);
$this->_processed = true;
$this->view = '';
}
}
}
/**
* Checks to see if the requested entry point requires auth
*
* @param $entrypoint string name of the entrypoint
* @return bool true if auth is required, false if not
*/
public function checkEntryPointRequiresAuth($entryPoint)
{
$this->loadMapping('entry_point_registry');
if ( isset($this->entry_point_registry[$entryPoint]['auth'])
&& !$this->entry_point_registry[$entryPoint]['auth'] )
return false;
return true;
}
/**
* Meant to handle old views e.g. DetailView.php.
*
*/
protected function callLegacyCode()
{
$file = self::getActionFilename($this->do_action);
if ( isset($this->action_view_map[strtolower($this->do_action)]) ) {
$action = $this->action_view_map[strtolower($this->do_action)];
}
else {
$action = $this->do_action;
}
// index actions actually maps to the view.list.php view
if ( $action == 'index' ) {
$action = 'list';
}
if ((file_exists('modules/' . $this->module . '/'. $file . '.php')
&& !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php'))
|| (file_exists('custom/modules/' . $this->module . '/'. $file . '.php')
&& !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php'))
) {
// A 'classic' module, using the old pre-MVC display files
// We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own
unset($GLOBALS['FOCUS']);
$GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file);
$this->action_default();
$this->_processed = true;
}
}
/**
* If the action has been remapped to a different action as defined in
* action_file_map.php or action_view_map.php load those maps here.
*
*/
private function handleActionMaps(){
if(!empty($this->action_file_map[strtolower($this->do_action)])){
$this->view = '';
$GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]);
require_once($this->action_file_map[strtolower($this->do_action)]);
$this->_processed = true;
}elseif(!empty($this->action_view_map[strtolower($this->do_action)])){
$GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]);
$this->view = $this->action_view_map[strtolower($this->do_action)];
$this->_processed = true;
}else
$this->no_action();
}
/**
* Actually remap the action if required.
*
*/
protected function remapAction(){
if(!empty($this->action_remap[$this->do_action])){
$this->action = $this->action_remap[$this->do_action];
$this->do_action = $this->action;
}
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Apr 23, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$action_file_map['subpanelviewer'] = 'include/SubPanel/SubPanelViewer.php';
$action_file_map['save2'] = 'include/generic/Save2.php';
$action_file_map['targetlistupdate'] = 'modules/ProspectLists/TargetListUpdate.php';
$action_file_map['deleterelationship'] = 'include/generic/DeleteRelationship.php';
$action_file_map['import'] = 'modules/Import/index.php';
$action_file_map['viewsugarfieldcollection'] = 'include/SugarFields/Fields/Collection/view.sugarfieldcollection.php';
?>

View File

@@ -0,0 +1,63 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on May 14, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
//format '<action_name>' => '<view_name>'
$action_view_map['multieditview']= 'multiedit';
$action_view_map['detailview']= 'detail';
$action_view_map['editview']= 'edit';
$action_view_map['popup']= 'popup';
$action_view_map['vcard']= 'vcard';
$action_view_map['importvcard']= 'importvcard';
$action_view_map['importvcardsave']= 'importvcardsave';
$action_view_map['modulelistmenu']= 'modulelistmenu';
// SugarPDF
$action_view_map['sugarpdf']= 'sugarpdf';
$action_view_map['dc'] = 'dc';
$action_view_map['dcajax'] = 'dcajax';
$action_view_map['quick'] = 'quick';
$action_view_map['quickcreate'] = 'quickcreate';
$action_view_map['spot'] = 'spot';
$action_view_map['inlinefield'] = 'inlinefield';
$action_view_map['inlinefieldsave'] = 'inlinefieldsave';
$action_view_map['pluginlist'] = 'plugins';
$action_view_map['downloadplugin'] = 'downloadplugin';
?>

View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$entry_point_registry = array(
'download' => array('file' => 'download.php', 'auth' => true),
'export' => array('file' => 'export.php', 'auth' => true),
'export_dataset' => array('file' => 'export_dataset.php', 'auth' => true),
'Changenewpassword' => array('file' => 'modules/Users/Changenewpassword.php', 'auth' => false),
'GeneratePassword' => array('file' => 'modules/Users/GeneratePassword.php', 'auth' => false),
'vCard' => array('file' => 'vCard.php', 'auth' => true),
'pdf' => array('file' => 'pdf.php', 'auth' => true),
'minify' => array('file' => 'jssource/minify.php', 'auth' => true),
'json' => array('file' => 'json.php', 'auth' => true),
'json_server' => array('file' => 'json_server.php', 'auth' => true),
'HandleAjaxCall' => array('file' => 'HandleAjaxCall.php', 'auth' => true),
'TreeData' => array('file' => 'TreeData.php', 'auth' => true),
'image' => array('file' => 'modules/Campaigns/image.php', 'auth' => false),
'campaign_trackerv2' => array('file' => 'modules/Campaigns/Tracker.php', 'auth' => false),
'WebToLeadCapture' => array('file' => 'modules/Campaigns/WebToLeadCapture.php', 'auth' => false),
'removeme' => array('file' => 'modules/Campaigns/RemoveMe.php', 'auth' => false),
'acceptDecline' => array('file' => 'modules/Contacts/AcceptDecline.php', 'auth' => false),
'leadCapture' => array('file' => 'modules/Leads/Capture.php', 'auth' => false),
'process_queue' => array('file' => 'process_queue.php', 'auth' => true),
'zipatcher' => array('file' => 'zipatcher.php', 'auth' => true),
'mm_get_doc' => array('file' => 'modules/MailMerge/get_doc.php', 'auth' => true),
'getImage' => array('file' => 'include/SugarTheme/getImage.php', 'auth' => false),
'getCSS' => array('file' => 'include/SugarTheme/getCSS.php', 'auth' => false),
'GenerateQuickComposeFrame' => array('file' => 'modules/Emails/GenerateQuickComposeFrame.php', 'auth' => true),
'DetailUserRole' => array('file' => 'modules/ACLRoles/DetailUserRole.php', 'auth' => true),
'getYUIComboFile' => array('file' => 'include/javascript/getYUIComboFile.php', 'auth' => false),
'UploadFileCheck' => array('file' => 'modules/Configurator/UploadFileCheck.php', 'auth' => false),
//add mz 2014-12-30
'HandleEcmAjax' => array('file' => 'include/ECM/HandleEcmAjax.php', 'auth' => true),
//add db 2015-04-21
'uploadAjaxFile' => array('file' => 'uploadAjaxFile.php', 'auth' => true),
);
?>

View File

@@ -0,0 +1,70 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$file_access_control_map = array(
'modules' => array(
'administration' => array(
'actions' => array(
'backups',
'updater',
),
'links' => array(
'update',
'backup_management',
'upgrade_wizard',
'moduleBuilder',
),
),
'upgradewizard' => array(
'actions' => array(
'index',
),
),
'modulebuilder' => array(
'actions' => array(
'index' => array('params' => array('type' => array('mb'))),
),
),
)
);
?>

View File

@@ -0,0 +1,616 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* ****************************************************************************** */
/*
* Created on Mar 21, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/MVC/Controller/ControllerFactory.php');
require_once('include/MVC/View/ViewFactory.php');
class SugarApplication {
var $controller = null;
var $headerDisplayed = false;
var $default_module = 'Home';
var $default_action = 'index';
function SugarApplication() {
}
/**
* Perform execution of the application. This method is called from index2.php
*/
function execute() {
global $sugar_config;
if (!empty($sugar_config['default_module']))
$this->default_module = $sugar_config['default_module'];
$module = $this->default_module;
if (!empty($_REQUEST['module']))
$module = $_REQUEST['module'];
insert_charset_header();
$this->setupPrint();
$controller = new ControllerFactory();
/* if ($module=='Administration' ) {
if($current_user->id!='1'){
header("Location: index.php");
}
}*/
$this->controller = $controller->getController($module);
unset($controller);
// if the entry point is defined to not need auth, then don't authenicate
if (empty($_REQUEST['entryPoint']) || $this->controller->checkEntryPointRequiresAuth($_REQUEST['entryPoint'])) {
$this->loadUser();
$this->ACLFilter();
$this->preProcess();
$this->controller->preProcess();
$this->checkHTTPReferer();
}
SugarThemeRegistry::buildRegistry();
$this->loadLanguages();
$this->checkDatabaseVersion();
$this->loadDisplaySettings();
$this->loadLicense();
$this->loadGlobals();
$this->setupResourceManagement($module);
global $current_user;
if($current_user->id=='b8562902-eca9-5804-472e-563b31f4e1ec'){
if($_REQUEST['module']=='EcmInvoiceOuts' || $_REQUEST['module']=='EcmReports' || $_REQUEST['module']=='EcmStockStates'){
} else {
die("Brak dostępu");
}
}
$this->controller->execute();
sugar_cleanup();
}
/**
* Load the authenticated user. If there is not an authenticated user then redirect to login screen.
*/
function loadUser() {
global $authController, $sugar_config;
// Double check the server's unique key is in the session. Make sure this is not an attempt to hijack a session
$user_unique_key = (isset($_SESSION['unique_key'])) ? $_SESSION['unique_key'] : '';
$server_unique_key = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : '';
$allowed_actions = (!empty($this->controller->allowed_actions)) ? $this->controller->allowed_actions : $allowed_actions = array('Authenticate', 'Login',);
if (($user_unique_key != $server_unique_key) && (!in_array($this->controller->action, $allowed_actions)) &&
(!isset($_SESSION['login_error']))) {
session_destroy();
$post_login_nav = '';
if (!empty($this->controller->module)) {
$post_login_nav .= '&login_module=' . $this->controller->module;
}
if (!empty($this->controller->action)) {
if (in_array(strtolower($this->controller->action), array('delete')))
$post_login_nav .= '&login_action=DetailView';
elseif (in_array(strtolower($this->controller->action), array('save')))
$post_login_nav .= '&login_action=EditView';
elseif (isset($_REQUEST['massupdate']) || isset($_GET['massupdate']) || isset($_POST['massupdate']))
$post_login_nav .= '&login_action=index';
else
$post_login_nav .= '&login_action=' . $this->controller->action;
}
if (!empty($this->controller->record)) {
$post_login_nav .= '&login_record=' . $this->controller->record;
}
header('Location: index.php?action=Login&module=Users' . $post_login_nav);
exit();
}
$authController = new AuthenticationController((!empty($GLOBALS['sugar_config']['authenticationClass']) ? $GLOBALS['sugar_config']['authenticationClass'] : 'SugarAuthenticate'));
$GLOBALS['current_user'] = new User();
if (isset($_SESSION['authenticated_user_id'])) {
// set in modules/Users/Authenticate.php
if (!$authController->sessionAuthenticate()) {
// if the object we get back is null for some reason, this will break - like user prefs are corrupted
$GLOBALS['log']->fatal('User retrieval for ID: (' . $_SESSION['authenticated_user_id'] . ') does not exist in database or retrieval failed catastrophically. Calling session_destroy() and sending user to Login page.');
session_destroy();
SugarApplication::redirect('index.php?action=Login&module=Users');
die();
}//fi
} elseif (!($this->controller->module == 'Users' && in_array($this->controller->action, $allowed_actions))) {
session_destroy();
SugarApplication::redirect('index.php?action=Login&module=Users');
die();
}
$GLOBALS['log']->debug('Current user is: ' . $GLOBALS['current_user']->user_name);
//set cookies
if (isset($_SESSION['authenticated_user_id'])) {
$GLOBALS['log']->debug("setting cookie ck_login_id_20 to " . $_SESSION['authenticated_user_id']);
self::setCookie('ck_login_id_20', $_SESSION['authenticated_user_id'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_theme'])) {
$GLOBALS['log']->debug("setting cookie ck_login_theme_20 to " . $_SESSION['authenticated_user_theme']);
self::setCookie('ck_login_theme_20', $_SESSION['authenticated_user_theme'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_theme_color'])) {
$GLOBALS['log']->debug("setting cookie ck_login_theme_color_20 to " . $_SESSION['authenticated_user_theme_color']);
self::setCookie('ck_login_theme_color_20', $_SESSION['authenticated_user_theme_color'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_theme_font'])) {
$GLOBALS['log']->debug("setting cookie ck_login_theme_font_20 to " . $_SESSION['authenticated_user_theme_font']);
self::setCookie('ck_login_theme_font_20', $_SESSION['authenticated_user_theme_font'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_language'])) {
$GLOBALS['log']->debug("setting cookie ck_login_language_20 to " . $_SESSION['authenticated_user_language']);
self::setCookie('ck_login_language_20', $_SESSION['authenticated_user_language'], time() + 86400 * 90);
}
//check if user can access
}
function ACLFilter() {
$acl = new ACLController();
$acl->filterModuleList($GLOBALS['moduleList']);
$acl->filterModuleList($GLOBALS['modInvisListActivities']);
// ACLController :: filterModuleList($GLOBALS['moduleList']);
// ACLController :: filterModuleList($GLOBALS['modInvisListActivities']);
}
/**
* setupResourceManagement
* This function initialize the ResourceManager and calls the setup method
* on the ResourceManager instance.
*
*/
function setupResourceManagement($module) {
require_once('include/resource/ResourceManager.php');
$resourceManager = ResourceManager::getInstance();
$resourceManager->setup($module);
}
function setupPrint() {
$GLOBALS['request_string'] = '';
// merge _GET and _POST, but keep the results local
// this handles the issues where values come in one way or the other
// without affecting the main super globals
$merged = array_merge($_GET, $_POST);
foreach ($merged as $key => $val) {
if (is_array($val)) {
foreach ($val as $k => $v) {
$GLOBALS['request_string'] .= urlencode($key) . '[]=' . urlencode($v) . '&';
}
} else {
$GLOBALS['request_string'] .= urlencode($key) . '=' . urlencode($val) . '&';
}
}
$GLOBALS['request_string'] .= 'print=true';
}
function preProcess() {
$config = new Administration;
$config->retrieveSettings();
if (!empty($_SESSION['authenticated_user_id'])) {
if (isset($_SESSION['hasExpiredPassword']) && $_SESSION['hasExpiredPassword'] == '1') {
if ($this->controller->action != 'Save' && $this->controller->action != 'Logout') {
$this->controller->module = 'Users';
$this->controller->action = 'ChangePassword';
$record = $GLOBALS['current_user']->id;
} else {
$this->handleOfflineClient();
}
} else {
$ut = $GLOBALS['current_user']->getPreference('ut');
if (empty($ut) && $this->controller->action != 'AdminWizard' && $this->controller->action != 'EmailUIAjax' && $this->controller->action != 'Wizard' && $this->controller->action != 'SaveAdminWizard' && $this->controller->action != 'SaveUserWizard' && $this->controller->action != 'SaveTimezone' && $this->controller->action != 'Logout') {
$this->controller->module = 'Users';
$this->controller->action = 'SetTimezone';
$record = $GLOBALS['current_user']->id;
} else {
if ($this->controller->action != 'AdminWizard' && $this->controller->action != 'EmailUIAjax' && $this->controller->action != 'Wizard' && $this->controller->action != 'SaveAdminWizard' && $this->controller->action != 'SaveUserWizard') {
$this->handleOfflineClient();
}
}
}
}
$this->handleAccessControl();
}
function handleOfflineClient() {
if (isset($GLOBALS['sugar_config']['disc_client']) && $GLOBALS['sugar_config']['disc_client']) {
if (isset($_REQUEST['action']) && $_REQUEST['action'] != 'SaveTimezone') {
if (!file_exists('modules/Sync/file_config.php')) {
if ($_REQUEST['action'] != 'InitialSync' && $_REQUEST['action'] != 'Logout' &&
($_REQUEST['action'] != 'Popup' && $_REQUEST['module'] != 'Sync')) {
//echo $_REQUEST['action'];
//die();
$this->controller->module = 'Sync';
$this->controller->action = 'InitialSync';
}
} else {
require_once ('modules/Sync/file_config.php');
if (isset($file_sync_info['is_first_sync']) && $file_sync_info['is_first_sync']) {
if ($_REQUEST['action'] != 'InitialSync' && $_REQUEST['action'] != 'Logout' &&
( $_REQUEST['action'] != 'Popup' && $_REQUEST['module'] != 'Sync')) {
$this->controller->module = 'Sync';
$this->controller->action = 'InitialSync';
}
}
}
}
global $moduleList, $sugar_config, $sync_modules;
require_once('modules/Sync/SyncController.php');
$GLOBALS['current_user']->is_admin = '0'; //No admins for disc client
}
}
/**
* Handles everything related to authorization.
*/
function handleAccessControl() {
if (is_admin($GLOBALS['current_user']) || is_admin_for_any_module($GLOBALS['current_user']))
return;
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == "RetrieveEmail")
return;
if (!is_admin($GLOBALS['current_user']) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]['all']) && (empty($GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action]) || $GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action] != 'allow')) {
$this->controller->hasAccess = false;
return;
}
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader']))
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
if (in_array($this->controller->module, $GLOBALS['modInvisList']) &&
((in_array('Activities', $GLOBALS['moduleList']) &&
in_array('Calendar', $GLOBALS['moduleList'])) &&
in_array($this->controller->module, $GLOBALS['modInvisListActivities']))
) {
$this->controller->hasAccess = false;
return;
}
}
/**
* Load application wide languages as well as module based languages so they are accessible
* from the module.
*/
function loadLanguages() {
if (!empty($_SESSION['authenticated_user_language'])) {
$GLOBALS['current_language'] = $_SESSION['authenticated_user_language'];
} else {
$GLOBALS['current_language'] = $GLOBALS['sugar_config']['default_language'];
}
$GLOBALS['log']->debug('current_language is: ' . $GLOBALS['current_language']);
//set module and application string arrays based upon selected language
$GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
if (empty($GLOBALS['current_user']->id))
$GLOBALS['app_strings']['NTC_WELCOME'] = '';
if (!empty($GLOBALS['system_config']->settings['system_name']))
$GLOBALS['app_strings']['LBL_BROWSER_TITLE'] = $GLOBALS['system_config']->settings['system_name'];
$GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
$GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], $this->controller->module);
}
/**
* checkDatabaseVersion
* Check the db version sugar_version.php and compare to what the version is stored in the config table.
* Ensure that both are the same.
*/
function checkDatabaseVersion($dieOnFailure = true) {
$row_count = sugar_cache_retrieve('checkDatabaseVersion_row_count');
if (empty($row_count)) {
global $sugar_db_version;
$version_query = 'SELECT count(*) as the_count FROM config WHERE category=\'info\' AND name=\'sugar_version\'';
if ($GLOBALS['db']->dbType == 'oci8') {
} else if ($GLOBALS['db']->dbType == 'mssql') {
$version_query .= " AND CAST(value AS varchar(8000)) = '$sugar_db_version'";
} else {
$version_query .= " AND value = '$sugar_db_version'";
}
$result = $GLOBALS['db']->query($version_query);
$row = $GLOBALS['db']->fetchByAssoc($result, -1, true);
$row_count = $row['the_count'];
sugar_cache_put('checkDatabaseVersion_row_count', $row_count);
}
if ($row_count == 0 && empty($GLOBALS['sugar_config']['disc_client'])) {
$sugar_version = $GLOBALS['sugar_version'];
if ($dieOnFailure)
sugar_die("Sugar CRM $sugar_version Files May Only Be Used With A Sugar CRM $sugar_db_version Database.");
else
return false;
}
return true;
}
/**
* Load the themes/images.
*/
function loadDisplaySettings() {
global $theme;
// load the user's default theme
$theme = $GLOBALS['current_user']->getPreference('user_theme');
if (is_null($theme)) {
$theme = !empty($_SESSION['authenticated_user_theme']) ? $_SESSION['authenticated_user_theme'] : $GLOBALS['sugar_config']['default_theme'];
if (isset($_SESSION['authenticated_user_theme']) && $_SESSION['authenticated_user_theme'] != '') {
$_SESSION['theme_changed'] = false;
}
}
SugarThemeRegistry::set($theme);
require_once('include/utils/layout_utils.php');
$GLOBALS['image_path'] = SugarThemeRegistry::current()->getImagePath() . '/';
if (defined('TEMPLATE_URL'))
$GLOBALS['image_path'] = TEMPLATE_URL . '/' . $GLOBALS['image_path'];
if (isset($GLOBALS['current_user'])) {
$GLOBALS['gridline'] = (int) ($GLOBALS['current_user']->getPreference('gridline') == 'on');
$GLOBALS['current_user']->setPreference('user_theme', $theme, 0, 'global');
}
}
function loadLicense() {
loadLicense();
global $user_unique_key, $server_unique_key;
$user_unique_key = (isset($_SESSION['unique_key'])) ? $_SESSION['unique_key'] : '';
$server_unique_key = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : '';
}
function loadGlobals() {
global $currentModule;
$currentModule = $this->controller->module;
if ($this->controller->module == $this->default_module) {
$_REQUEST['module'] = $this->controller->module;
if (empty($_REQUEST['action']))
$_REQUEST['action'] = $this->default_action;
}
}
/**
* Actions that modify data in this controller's instance and thus require referrers
* @var array
*/
protected $modifyActions = array();
/**
* Actions that always modify data and thus require referrers
* save* and delete* hardcoded as modified
* @var array
*/
private $globalModifyActions = array(
'massupdate', 'configuredashlet', 'import', 'importvcardsave', 'inlinefieldsave',
'wlsave', 'quicksave'
);
/**
* Modules that modify data and thus require referrers for all actions
*/
private $modifyModules = array(
'Administration' => true,
'UpgradeWizard' => true,
'Configurator' => true,
'Studio' => true,
'ModuleBuilder' => true,
'Emails' => true,
'DCETemplates' => true,
'DCEInstances' => true,
'DCEActions' => true,
'Trackers' => array('trackersettings'),
'SugarFavorites' => array('tag'),
'Import' => array('last', 'undo'),
);
protected function isModifyAction() {
$action = strtolower($this->controller->action);
if (substr($action, 0, 4) == "save" || substr($action, 0, 6) == "delete") {
return true;
}
if (isset($this->modifyModules[$this->controller->module])) {
if ($this->modifyModules[$this->controller->module] == true) {
return true;
}
if (in_array($this->controller->action, $this->modifyModules[$this->controller->module])) {
return true;
}
}
if (in_array($this->controller->action, $this->globalModifyActions)) {
return true;
}
if (in_array($this->controller->action, $this->modifyActions)) {
return true;
}
return false;
}
/**
*
* Checks a request to ensure the request is coming from a valid source or it is for one of the white listed actions
*/
function checkHTTPReferer() {
global $sugar_config;
$whiteListActions = (!empty($sugar_config['http_referer']['actions'])) ? $sugar_config['http_referer']['actions'] : array('index', 'ListView', 'DetailView', 'Authenticate', 'Login', 'wizard');
// Bug 39691 - Make sure localhost and 127.0.0.1 are always valid HTTP referers
$whiteListReferers = array('127.0.0.1', 'localhost');
$strong = empty($sugar_config['http_referer']['weak']);
if (!empty($sugar_config['http_referer']['list'])) {
$whiteListReferers = array_merge($whiteListReferers, $sugar_config['http_referer']['list']);
}
if ($strong && empty($_SERVER['HTTP_REFERER']) && !in_array($this->controller->action, $whiteListActions) && $this->isModifyAction()) {
$whiteListActions[] = $this->controller->action;
$whiteListString = "'" . implode("', '", $whiteListActions) . "'";
header("Cache-Control: no-cache, must-revalidate");
echo <<<EOQ
<div align='center' style='background:lightgray'>
<h3 style='color:red'>Possible Cross Site Request Forgery (XSRF) Attack Detected</h3>
<h4>You've made a request to {$this->controller->action} but your HTTP Referer header is blank.</h4>
<h4><a href='javascript:void(0);' onclick='document.getElementById("directions").style.display="";'>Click here for directions to allow the HTTP Referer to not be set</a></h4>
</div>
<div id='directions' style='display:none'>
<h3>Directions to allow HTTP Referer to not be set. This will cause your system to be insecure:</h3>
<ol>
<li>On your file system go to the root of your SugarCRM instance
<li>Open the file config_override.php. If it does not exist, create it. (it should be at the same level as index.php and config.php)
<li>Make sure the file starts with <pre>&lt;?php</pre> followed by a new line
<li>Add the following line to your config_override.php file<br> <pre>\$sugar_config['http_referer']['weak']= true;</pre>
<li>Save the file and it should work
</ol>
<h3>Attempted action ({$this->controller->action}):</h3>
If you feel this is a valid action that should be allowed with or without an HTTP Referer, add the following to your config_override.php file
<ul><li><pre>\$sugar_config['http_referer']['actions'] =array( $whiteListString ); </pre></ul>
</div>
EOQ;
sugar_cleanup(true);
} else if (!empty($_SERVER['HTTP_REFERER']) && !empty($_SERVER['SERVER_NAME'])) {
$http_ref = parse_url($_SERVER['HTTP_REFERER']);
if ($http_ref['host'] !== $_SERVER['SERVER_NAME'] && !in_array($this->controller->action, $whiteListActions) &&
(empty($whiteListReferers) || !in_array($http_ref['host'], $whiteListReferers))) {
header("Cache-Control: no-cache, must-revalidate");
$whiteListActions[] = $this->controller->action;
$whiteListString = "'" . implode("', '", $whiteListActions) . "'";
echo <<<EOQ
<div align='center' style='background:lightgray'>
<h3 style='color:red'>Possible Cross Site Request Forgery (XSRF) Attack Detected</h3>
<h4>If you think this is a mistake please ask your administrator to add the following site to the acceptable referer list</h4>
<h3>{$http_ref['host']}</h3>
<h4><a href='javascript:void(0);' onclick='document.getElementById("directions").style.display="";'>Click here for directions to add this site to the acceptable referer list</a></h4>
</div>
<div id='directions' style='display:none'>
<h3>Directions:</h3>
<ol>
<li>On your file system go to the root of your SugarCRM instance
<li>Open the file config_override.php. If it does not exist, create it. (it should be at the same level as index.php and config.php)
<li>Make sure the file starts with <pre>&lt;?php</pre> followed by a new line
<li>Add the following line to your config_override.php file<br> <pre>\$sugar_config['http_referer']['list'][] = '{$http_ref['host']}';</pre>
<li>Save the file and it should work
</ol>
<h3>Attempted action ({$this->controller->action}):</h3>
If you feel this is a valid action that should be allowed from any referer, add the following to your config_override.php file
<ul><li><pre>\$sugar_config['http_referer']['actions'] =array( $whiteListString ); </pre></ul>
</div>
EOQ;
sugar_cleanup(true);
}
}
}
function startSession() {
$sessionIdCookie = isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : null;
if (isset($_REQUEST['MSID'])) {
session_id($_REQUEST['MSID']);
session_start();
if (isset($_SESSION['user_id']) && isset($_SESSION['seamless_login'])) {
unset($_SESSION['seamless_login']);
} else {
if (isset($_COOKIE['PHPSESSID'])) {
self::setCookie('PHPSESSID', '', time() - 42000, '/');
}
sugar_cleanup(false);
session_destroy();
exit('Not a valid entry method');
}
} else {
if (can_start_session()) {
session_start();
}
}
if (isset($_REQUEST['login_module']) && isset($_REQUEST['login_action']) && !($_REQUEST['login_module'] == 'Home' && $_REQUEST['login_action'] == 'index')) {
if (!is_null($sessionIdCookie) && empty($_SESSION)) {
self::setCookie('loginErrorMessage', 'LBL_SESSION_EXPIRED', time() + 30, '/');
}
}
}
function endSession() {
session_destroy();
}
/**
* Redirect to another URL
*
* @access public
* @param string $url The URL to redirect to
*/
function redirect(
$url
) {
/*
* If the headers have been sent, then we cannot send an additional location header
* so we will output a javascript redirect statement.
*/
if (headers_sent()) {
echo "<script>document.location.href='$url';</script>\n";
} else {
//@ob_end_clean(); // clear output buffer
session_write_close();
header('HTTP/1.1 301 Moved Permanently');
header("Location: " . $url);
}
exit();
}
/**
* Wrapper for the PHP setcookie() function, to handle cases where headers have
* already been sent
*/
public static function setCookie(
$name, $value, $expire = 0, $path = '/', $domain = null, $secure = false, $httponly = false
) {
if (is_null($domain))
if (isset($_SERVER["HTTP_HOST"]))
$domain = $_SERVER["HTTP_HOST"];
else
$domain = 'localhost';
if (!headers_sent())
setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
$_COOKIE[$name] = $value;
}
}

105
include/MVC/SugarModule.php Executable file
View File

@@ -0,0 +1,105 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class SugarModule
{
protected static $_instances = array();
protected $_moduleName;
public static function get(
$moduleName
)
{
if ( !isset(self::$_instances[$moduleName]) )
self::$_instances[$moduleName] = new SugarModule($moduleName);
return self::$_instances[$moduleName];
}
public function __construct(
$moduleName
)
{
$this->_moduleName = $moduleName;
}
/**
* Returns true if the given module implements the indicated template
*
* @param string $template
* @return bool
*/
public function moduleImplements(
$template
)
{
$focus = self::loadBean();
if ( !$focus )
return false;
return is_a($focus,$template);
}
/**
* Returns the bean object of the given module
*
* @return object
*/
public function loadBean()
{
global $beanList, $beanFiles;
if ( !isset($beanList) || !isset($beanFiles) )
require('include/modules.php');
if ( isset($beanList[$this->_moduleName]) ) {
$bean = $beanList[$this->_moduleName];
if (isset($beanFiles[$bean])) {
require_once($beanFiles[$bean]);
$focus = new $bean;
}
else
return false;
}
else
return false;
return $focus;
}
}

File diff suppressed because it is too large Load Diff

243
include/MVC/View/ViewFactory.php Executable file
View File

@@ -0,0 +1,243 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* ViewFactory
*
* View factory class. This file is used by the controller along with a view paramter to build the
* requested view.
*/
require_once('include/MVC/View/SugarView.php');
class ViewFactory{
/**
* load the correct view
* @param string $type View Type
* @return valid view
*/
function loadView($type = 'default', $module, $bean = null, $view_object_map = array(), $target_module=''){
$type = strtolower($type);
$viewF = new ViewFactory();
//first let's check if the module handles this view
$view = null;
$view = null;
if(!empty($target_module)) {
if(file_exists('custom/modules/'.$target_module.'/views/view.'.$type.'.php')){
$view = $viewF->_buildFromFile('custom/modules/'.$target_module.'/views/view.'.$type.'.php', $bean, $view_object_map, $type, $target_module);
}else if(file_exists('modules/'.$target_module.'/views/view.'.$type.'.php')){
$view = $viewF->_buildFromFile('modules/'.$target_module.'/views/view.'.$type.'.php', $bean, $view_object_map, $type, $target_module);
}
}
if(!isset($view)) {
if(file_exists('custom/modules/'.$module.'/views/view.'.$type.'.php')){
$view = $viewF->_buildFromFile('custom/modules/'.$module.'/views/view.'.$type.'.php', $bean, $view_object_map, $type, $module);
}else if(file_exists('modules/'.$module.'/views/view.'.$type.'.php')){
$view = $viewF->_buildFromFile('modules/'.$module.'/views/view.'.$type.'.php', $bean, $view_object_map, $type, $module);
}else if(file_exists('custom/include/MVC/View/views/view.'.$type.'.php')){
$view = $viewF->_buildFromFile('custom/include/MVC/View/views/view.'.$type.'.php', $bean, $view_object_map, $type, $module);
}else{
//if the module does not handle this view, then check if Sugar handles it OOTB
$file = 'include/MVC/View/views/view.'.$type.'.php';
if(file_exists($file)){
//it appears Sugar does have the proper logic for this file.
$view = $viewF->_buildFromFile($file, $bean, $view_object_map, $type, $module);
}
}
}
// Default to SugarView if still nothing found/built
if (!isset($view))
$view = new SugarView();
$viewF->_loadConfig($view, $type);
return $view;
}
/**
* Load the view_<view>_config.php file which holds options used by the view.
*/
function _loadConfig(&$view, $type){
$view_config_custom = array();
$view_config_module = array();
$view_config_root_cstm = array();
$view_config_root = array();
$view_config_app = array();
$config_file_name = 'view.'.$type.'.config.php';
$view_config = sugar_cache_retrieve("VIEW_CONFIG_FILE_".$view->module."_TYPE_".$type);
if(!$view_config){
if(file_exists('custom/modules/'.$view->module.'/views/'.$config_file_name)){
require_once('custom/modules/'.$view->module.'/views/'.$config_file_name);
$view_config_custom = $view_config;
}
if(file_exists('modules/'.$view->module.'/views/'.$config_file_name)){
require_once('modules/'.$view->module.'/views/'.$config_file_name);
$view_config_module = $view_config;
}
if(file_exists('custom/include/MVC/View/views/'.$config_file_name)){
require_once('custom/include/MVC/View/views/'.$config_file_name);
$view_config_root_cstm = $view_config;
}
if(file_exists('include/MVC/View/views/'.$config_file_name)){
require_once('include/MVC/View/views/'.$config_file_name);
$view_config_root = $view_config;
}
if(file_exists('include/MVC/View/views/view.config.php')){
require_once('include/MVC/View/views/view.config.php');
$view_config_app = $view_config;
}
$view_config = array('actions' => array(), 'req_params' => array(),);
//actions
if(!empty($view_config_app) && !empty($view_config_app['actions']))
$view_config['actions'] = array_merge($view_config['actions'], $view_config_app['actions']);
if(!empty($view_config_root) && !empty($view_config_root['actions']))
$view_config['actions'] = array_merge($view_config['actions'], $view_config_root['actions']);
if(!empty($view_config_root_cstm) && !empty($view_config_root_cstm['actions']))
$view_config['actions'] = array_merge($view_config['actions'], $view_config_root_cstm['actions']);
if(!empty($view_config_module) && !empty($view_config_module['actions']))
$view_config['actions'] = array_merge($view_config['actions'], $view_config_module['actions']);
if(!empty($view_config_custom) && !empty($view_config_custom['actions']))
$view_config['actions'] = array_merge($view_config['actions'], $view_config_custom['actions']);
//req_params
if(!empty($view_config_app) && !empty($view_config_app['req_params']))
$view_config['req_params'] = array_merge($view_config['req_params'], $view_config_app['req_params']);
if(!empty($view_config_root) && !empty($view_config_root['req_params']))
$view_config['req_params'] = array_merge($view_config['req_params'], $view_config_root['req_params']);
if(!empty($view_config_root_cstm) && !empty($view_config_root_cstm['req_params']))
$view_config['req_params'] = array_merge($view_config['req_params'], $view_config_root_cstm['req_params']);
if(!empty($view_config_module) && !empty($view_config_module['req_params']))
$view_config['req_params'] = array_merge($view_config['req_params'], $view_config_module['req_params']);
if(!empty($view_config_custom) && !empty($view_config_custom['req_params']))
$view_config['req_params'] = array_merge($view_config['req_params'], $view_config_custom['req_params']);
sugar_cache_put("VIEW_CONFIG_FILE_".$view->module."_TYPE_".$type, $view_config);
}
$action = strtolower($view->action);
$config = null;
if(!empty($view_config['req_params'])){
//try the params first
foreach($view_config['req_params'] as $key => $value){
if(!empty($_REQUEST[$key]) && $_REQUEST[$key] == "false") {
$_REQUEST[$key] = false;
}
if(!empty($_REQUEST[$key])){
if(!is_array($value['param_value'])){
if($value['param_value'] == $_REQUEST[$key]){
$config = $value['config'];
break;
}
}else{
foreach($value['param_value'] as $v){
if($v == $_REQUEST[$key]){
$config = $value['config'];
break;
}
}
}
}
}
}
if($config == null && !empty($view_config['actions']) && !empty($view_config['actions'][$action])){
$config = $view_config['actions'][$action];
}
if($config != null)
$view->options = $config;
}
/**
* This is a private function which just helps the getView function generate the
* proper view object
*
* @return a valid SugarView
*/
function _buildFromFile($file, &$bean, $view_object_map, $type, $module){
require_once($file);
//try ModuleViewType first then try ViewType if that fails then use SugarView
$class = ucfirst($module).'View'.ucfirst($type);
$customClass = 'Custom' . $class;
if(class_exists($customClass)){
return ViewFactory::_buildClass($customClass, $bean, $view_object_map);
}
if(class_exists($class)){
return ViewFactory::_buildClass($class, $bean, $view_object_map);
}
//Now try the next set of possibilites if it was none of the above
$class = 'View'.ucfirst($type);
$customClass = 'Custom' . $class;
if(class_exists($customClass)){
return ViewFactory::_buildClass($customClass, $bean, $view_object_map);
}
if(class_exists($class)){
return ViewFactory::_buildClass($class, $bean, $view_object_map);
}
//Now check if there is a custom SugarView for generic handling
if(file_exists('custom/include/MVC/View/SugarView.php')){
require_once('custom/include/MVC/View/SugarView.php');
if(class_exists('CustomSugarView')){
return new CustomSugarView($bean, $view_object_map);
}
}
//if all else fails return SugarView
return new SugarView($bean, $view_object_map);
}
/**
* instantiate the correct view and call init to pass on any obejcts we need to
* from the controller.
*
* @param string class - the name of the class to instantiate
* @param object bean = the bean to pass to the view
* @param array view_object_map - the array which holds obejcts to pass between the
* controller and the view.
*
* @return SugarView
*/
function _buildClass($class, $bean, $view_object_map){
$view = new $class();
$view->init($bean, $view_object_map);
if($view instanceof SugarView){
return $view;
}else
return new SugarView($bean, $view_object_map);
}
}
?>

View File

@@ -0,0 +1,54 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
require_once('include/MVC/Controller/SugarController.php');
class ViewAjax extends SugarView{
function ViewAjax(){
$this->options['show_title'] = false;
$this->options['show_header'] = false;
$this->options['show_footer'] = false;
$this->options['show_javascript'] = false;
$this->options['show_subpanels'] = false;
$this->options['show_search'] = false;
parent::SugarView();
}
function display(){
}
}
?>

View File

@@ -0,0 +1,67 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Apr 23, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$view_config = array(
'req_params' =>
array(
'print' => array('param_value' => true,
'config' => array(
'show_header' => true,
'show_footer' => false,
'view_print' => true,
'show_title' => false,
'show_subpanels' => false,
'show_javascript' => true,
'show_search' => false,)
),
'to_pdf' => array('param_value' => true,
'config' => array(
'show_all' => false
),
),
'to_csv' => array('param_value' => true,
'config' => array(
'show_all' => false
),
),
),
);
?>

View File

@@ -0,0 +1,58 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
require_once('include/MVC/Controller/SugarController.php');
class ViewClassic extends SugarView{
function ViewClassic(){
parent::SugarView();
$this->type = $this->action;
}
function display(){
// Call SugarController::getActionFilename to handle case sensitive file names
$file = SugarController::getActionFilename($this->action);
if(file_exists('custom/modules/' . $this->module . '/'. $file . '.php')){
$this->includeClassicFile('custom/modules/'. $this->module . '/'. $file . '.php');
return true;
}elseif(file_exists('modules/' . $this->module . '/'. $file . '.php')){
$this->includeClassicFile('modules/'. $this->module . '/'. $file . '.php');
return true;
}
return false;
}
}
?>

View File

@@ -0,0 +1,119 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Apr 23, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$view_config = array(
'actions' =>
array(
'ajaxformsave' => array(
'show_all' => false
),
'popup' => array(
'show_header' => false,
'show_subpanels' => false,
'show_search' => false,
'show_footer' => false,
'show_javascript' => true,
),
'authenticate' => array(
'show_header' => false,
'show_subpanels' => false,
'show_search' => false,
'show_footer' => false,
'show_javascript' => true,
),
'subpanelcreates' => array(
'show_header' => false,
'show_subpanels' => false,
'show_search' => false,
'show_footer' => false,
'show_javascript' => true,
),
),
'req_params' =>
array(
'print' => array('param_value' => true,
'config' => array(
'show_header' => true,
'show_footer' => false,
'view_print' => true,
'show_title' => false,
'show_subpanels' => false,
'show_javascript' => true,
'show_search' => false,)
),
'action' => array('param_value' => array('Delete','Save'),
'config' => array(
'show_all' => false
),
),
'to_pdf' => array('param_value' => true,
'config' => array(
'show_all' => false
),
),
'to_csv' => array('param_value' => true,
'config' => array(
'show_all' => false
),
),
'sugar_body_only' => array('param_value' => true,
'config' => array(
'show_all' => false
),
),
'view' => array('param_value' => 'documentation',
'config' => array(
'show_all' => false
),
),
'show_js' => array('param_value' => true,
'config' => array(
'show_header' => false,
'show_footer' => false,
'view_print' => false,
'show_title' => false,
'show_subpanels' => false,
'show_javascript' => true,
'show_search' => false,)
),
),
);
?>

View File

@@ -0,0 +1,93 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/DetailView/DetailView2.php');
class ViewDetail extends SugarView{
var $type ='detail';
var $dv;
function ViewDetail(){
$this->options['show_subpanels'] = true;
parent::SugarView();
}
function preDisplay(){
$metadataFile = null;
$foundViewDefs = false;
if(file_exists('custom/modules/' . $this->module . '/metadata/detailviewdefs.php')){
$metadataFile = 'custom/modules/' . $this->module . '/metadata/detailviewdefs.php';
$foundViewDefs = true;
}else{
if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['detailviewdefs'])){
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
require_once('modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['detailviewdefs'])){
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=". $metadataFile);
if(!$foundViewDefs && file_exists('modules/'.$this->module.'/metadata/detailviewdefs.php')){
$metadataFile = 'modules/'.$this->module.'/metadata/detailviewdefs.php';
}
$this->dv = new DetailView2();
$this->dv->ss =& $this->ss;
$this->dv->setup($this->module, $this->bean, $metadataFile, 'include/DetailView/DetailView.tpl');
}
function display(){
if(empty($this->bean->id)){
global $app_strings;
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$this->dv->process();
echo $this->dv->display();
}
}

View File

@@ -0,0 +1,96 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/EditView/EditView2.php');
class ViewEdit extends SugarView{
var $ev;
var $type ='edit';
var $useForSubpanel = false; //boolean variable to determine whether view can be used for subpanel creates
var $useModuleQuickCreateTemplate = false; //boolean variable to determine whether or not SubpanelQuickCreate has a separate display function
var $showTitle = true;
function ViewEdit(){
parent::SugarView();
echo $this->module;
}
function preDisplay(){
$metadataFile = null;
$foundViewDefs = false;
if(file_exists('custom/modules/' . $this->module . '/metadata/editviewdefs.php')){
$metadataFile = 'custom/modules/' . $this->module . '/metadata/editviewdefs.php';
$foundViewDefs = true;
}else{
if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['editviewdefs'])){
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
require_once('modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['editviewdefs'])){
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=". $metadataFile);
if(!$foundViewDefs && file_exists('modules/'.$this->module.'/metadata/editviewdefs.php')){
$metadataFile = 'modules/'.$this->module.'/metadata/editviewdefs.php';
}
$this->ev = new EditView();
$this->ev->ss =& $this->ss;
$this->ev->setup($this->module, $this->bean, $metadataFile, 'include/EditView/EditView.tpl');
}
function display(){
$this->ev->process();
echo $this->ev->display($this->showTitle);
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
class ViewHtml extends SugarView{
function ViewHtml(){
parent::SugarView();
}
function display(){
}
}
?>

View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/vCard.php');
class ViewImportvcard extends SugarView
{
var $type = 'detail';
public function __construct()
{
parent::SugarView();
}
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings, $app_list_strings;
$this->ss->assign("ERROR_TEXT", $app_strings['LBL_EMPTY_VCARD']);
$this->ss->assign("HEADER", $app_strings['LBL_IMPORT_VCARD']);
$this->ss->assign("MODULE", $_REQUEST['module']);
$middleText = "<a href='index.php?module={$_REQUEST['module']}&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a><span class='pointer'>&raquo;</span>{$app_strings['LBL_IMPORT_VCARD_BUTTON_LABEL']}";
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $middleText, true);
if ( file_exists('custom/include/MVC/View/tpls/Importvcard.tpl') )
$this->ss->display('custom/include/MVC/View/tpls/Importvcard.tpl');
else
$this->ss->display('include/MVC/View/tpls/Importvcard.tpl');
}
}
?>

View File

@@ -0,0 +1,69 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/vCard.php');
class ViewImportvcardsave extends SugarView
{
var $type = 'detail';
public function __construct()
{
parent::SugarView();
}
/**
* @see SugarView::display()
*/
public function display()
{
if ( isset($_FILES['vcard']['tmp_name']) && isset($_FILES['vcard']['size']) > 0 ) {
$vcard = new vCard();
$record = $vcard->importVCard($_FILES['vcard']['tmp_name'],$_REQUEST['module']);
SugarApplication::redirect("index.php?action=DetailView&module={$_REQUEST['module']}&record=$record");
}
else
SugarApplication::redirect("index.php?action=Importvcard&module={$_REQUEST['module']}");
}
}
?>

View File

@@ -0,0 +1,64 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class ViewJson extends SugarView{
var $type ='detail';
function ViewJson(){
parent::SugarView();
}
function display(){
global $beanList;
$module = $GLOBALS['module'];
$json = getJSONobj();
$bean = $this->bean;
$all_fields = array_merge($bean->column_fields,$bean->additional_column_fields);
$js_fields_arr = array();
foreach($all_fields as $field) {
if(isset($bean->$field)) {
$bean->$field = from_html($bean->$field);
$bean->$field = preg_replace('/\r\n/','<BR>',$bean->$field);
$bean->$field = preg_replace('/\n/','<BR>',$bean->$field);
$js_fields_arr[$field] = addslashes($bean->$field);
}
}
$out = $json->encode($js_fields_arr, true);
ob_clean();
print($out);
sugar_cleanup(true);
}
}
?>

View File

@@ -0,0 +1,298 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
require_once('include/ListView/ListViewSmarty.php');
require_once('modules/MySettings/StoreQuery.php');
class ViewList extends SugarView{
var $type ='list';
var $lv;
var $searchForm;
var $use_old_search;
var $headers;
var $seed;
var $params;
var $listViewDefs;
var $storeQuery;
var $where = '';
function ViewList(){
parent::SugarView();
}
function oldSearch(){
}
function newSearch(){
}
function listViewPrepare(){
$module = $GLOBALS['module'];
$metadataFile = null;
$foundViewDefs = false;
if(file_exists('custom/modules/' . $module. '/metadata/listviewdefs.php')){
$metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php';
$foundViewDefs = true;
}else{
if(file_exists('custom/modules/'.$module.'/metadata/metafiles.php')){
require_once('custom/modules/'.$module.'/metadata/metafiles.php');
if(!empty($metafiles[$module]['listviewdefs'])){
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
}elseif(file_exists('modules/'.$module.'/metadata/metafiles.php')){
require_once('modules/'.$module.'/metadata/metafiles.php');
if(!empty($metafiles[$module]['listviewdefs'])){
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
}
}
if(!$foundViewDefs && file_exists('modules/'.$module.'/metadata/listviewdefs.php')){
$metadataFile = 'modules/'.$module.'/metadata/listviewdefs.php';
}
if( !file_exists($metadataFile) )
sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION'] );
require_once($metadataFile);
$this->listViewDefs = $listViewDefs;
if(!empty($this->bean->object_name) && isset($_REQUEST[$module.'2_'.strtoupper($this->bean->object_name).'_offset'])) {//if you click the pagination button, it will poplate the search criteria here
if(!empty($_REQUEST['current_query_by_page'])) {//The code support multi browser tabs pagination
$blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'request_data', 'current_query_by_page',$module.'2_'.strtoupper($this->bean->object_name).'_ORDER_BY' );
if(isset($_REQUEST['lvso'])){
$blockVariables[] = 'lvso';
}
$current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page']));
foreach($current_query_by_page as $search_key=>$search_value) {
if($search_key != $module.'2_'.strtoupper($this->bean->object_name).'_offset' && !in_array($search_key, $blockVariables)) {
if (!is_array($search_value)) {
$_REQUEST[$search_key] = $GLOBALS['db']->quoteForEmail($search_value);
}
else {
foreach ($search_value as $key=>&$val) {
$val = $GLOBALS['db']->quoteForEmail($val);
}
$_REQUEST[$search_key] = $search_value;
}
}
}
}
}
if(!empty($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select']!='_none') {
if(empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query']!='true')) {
$this->saved_search = loadBean('SavedSearch');
$this->saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']);
$this->saved_search->populateRequest();
}
elseif(!empty($_REQUEST['button'])) { // click the search button, after retrieving from saved_search
$_SESSION['LastSavedView'][$_REQUEST['module']] = '';
unset($_REQUEST['saved_search_select']);
unset($_REQUEST['saved_search_select_name']);
}
}
$this->storeQuery = new StoreQuery();
if(!isset($_REQUEST['query'])){
$this->storeQuery->loadQuery($this->module);
$this->storeQuery->populateRequest();
}else{
$this->storeQuery->saveFromRequest($this->module);
}
$this->seed = $this->bean;
$displayColumns = array();
if(!empty($_REQUEST['displayColumns'])) {
foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if(!empty($this->listViewDefs[$module][$col]))
$displayColumns[$col] = $this->listViewDefs[$module][$col];
}
}
else {
foreach($this->listViewDefs[$module] as $col => $this->params) {
if(!empty($this->params['default']) && $this->params['default'])
$displayColumns[$col] = $this->params;
}
}
$this->params = array('massupdate' => true);
if(!empty($_REQUEST['orderBy'])) {
$this->params['orderBy'] = $_REQUEST['orderBy'];
$this->params['overrideOrder'] = true;
if(!empty($_REQUEST['sortOrder'])) $this->params['sortOrder'] = $_REQUEST['sortOrder'];
}
$this->lv->displayColumns = $displayColumns;
$this->seed = $this->seed;
$this->module = $module;
$this->prepareSearchForm();
if(isset($this->options['show_title']) && $this->options['show_title']) {
$moduleName = isset($this->seed->module_dir) ? $this->seed->module_dir : $GLOBALS['mod_strings']['LBL_MODULE_NAME'];
echo $this->getModuleTitle(true);
}
}
function listViewProcess(){
$this->processSearchForm();
$this->lv->searchColumns = $this->searchForm->searchColumns;
if(!$this->headers)
return;
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
$this->lv->ss->assign("SEARCH",true);
$this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
echo $this->lv->display();
}
}
function prepareSearchForm(){
$this->searchForm = null;
//search
$view = 'basic_search';
if(!empty($_REQUEST['search_form_view']) && $_REQUEST['search_form_view'] == 'advanced_search')
$view = $_REQUEST['search_form_view'];
$this->headers = true;
if(!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only'])
$this->headers = false;
elseif(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$view = 'advanced_search';
}else {
$view = 'basic_search';
}
}
$this->use_old_search = true;
if ((file_exists('modules/' . $this->module . '/SearchForm.html')
&& !file_exists('modules/' . $this->module . '/metadata/searchdefs.php'))
|| (file_exists('custom/modules/' . $this->module . '/SearchForm.html')
&& !file_exists('custom/modules/' . $this->module . '/metadata/searchdefs.php'))){
require_once('include/SearchForm/SearchForm.php');
$this->searchForm = new SearchForm($this->module, $this->seed);
}else{
$this->use_old_search = false;
require_once('include/SearchForm/SearchForm2.php');
/* if(!empty($metafiles[$this->module]['searchdefs']))
require_once($metafiles[$this->module]['searchdefs']);
elseif(file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
*/
if (file_exists('custom/modules/'.$this->module.'/metadata/searchdefs.php'))
{
require_once('custom/modules/'.$this->module.'/metadata/searchdefs.php');
}
elseif (!empty($metafiles[$this->module]['searchdefs']))
{
require_once($metafiles[$this->module]['searchdefs']);
}
elseif (file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
{
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
}
if(!empty($metafiles[$this->module]['searchfields']))
require_once($metafiles[$this->module]['searchfields']);
elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php'))
require_once('modules/'.$this->module.'/metadata/SearchFields.php');
if(file_exists('custom/modules/'.$this->module.'/metadata/SearchFields.php')){
require_once('custom/modules/'.$this->module.'/metadata/SearchFields.php');
}
$this->searchForm = new SearchForm($this->seed, $this->module, $this->action);
$this->searchForm->setup($searchdefs, $searchFields, 'include/SearchForm/tpls/SearchFormGeneric.tpl', $view, $this->listViewDefs);
$this->searchForm->lv = $this->lv;
}
}
function processSearchForm(){
if(isset($_REQUEST['query']))
{
// we have a query
if(!empty($_SERVER['HTTP_REFERER']) && preg_match('/action=EditView/', $_SERVER['HTTP_REFERER'])) { // from EditView cancel
$this->searchForm->populateFromArray($this->storeQuery->query);
}
else {
$this->searchForm->populateFromRequest();
}
$where_clauses = $this->searchForm->generateSearchWhere(true, $this->seed->module_dir);
if (count($where_clauses) > 0 )$this->where = '('. implode(' ) AND ( ', $where_clauses) . ')';
$GLOBALS['log']->info("List View Where Clause: $this->where");
}
if($this->use_old_search){
switch($view) {
case 'basic_search':
$this->searchForm->setup();
$this->searchForm->displayBasic($this->headers);
break;
case 'advanced_search':
$this->searchForm->setup();
$this->searchForm->displayAdvanced($this->headers);
break;
case 'saved_views':
echo $this->searchForm->displaySavedViews($this->listViewDefs, $this->lv, $this->headers);
break;
}
}else{
echo $this->searchForm->display($this->headers);
}
}
function preDisplay(){
$this->lv = new ListViewSmarty();
}
function display(){
if(!$this->bean || !$this->bean->ACLAccess('list')){
ACLController::displayNoAccess();
} else {
$this->listViewPrepare();
$this->listViewProcess();
}
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
class ViewModulelistmenu extends SugarView
{
public function __construct()
{
$this->options['show_title'] = false;
$this->options['show_header'] = false;
$this->options['show_footer'] = false;
$this->options['show_javascript'] = false;
$this->options['show_subpanels'] = false;
$this->options['show_search'] = false;
parent::SugarView();
}
public function display()
{
//last viewed
$tracker = new Tracker();
$history = $tracker->get_recently_viewed($GLOBALS['current_user']->id,$this->module);
foreach ( $history as $key => $row ) {
$history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
$history[$key]['image'] = SugarThemeRegistry::current()
->getImage($row['module_name'],'border="0" align="absmiddle" alt="'.$row['item_summary'].'"');
}
$this->ss->assign('LAST_VIEWED',$history);
$this->ss->display('include/MVC/View/tpls/modulelistmenu.tpl');
}
}
?>

View File

@@ -0,0 +1,84 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/EditView/EditView2.php');
class ViewMultiedit extends SugarView{
var $type ='edit';
function ViewMultiedit(){
parent::SugarView();
}
function display(){
global $beanList, $beanFiles;
if($this->action == 'AjaxFormSave'){
echo "<a href='index.php?action=DetailView&module=".$this->module."&record=".$this->bean->id."'>".$this->bean->id."</a>";
}else{
if(!empty($_REQUEST['modules'])){
$js_array = 'Array(';
$count = count($_REQUEST['modules']);
$index = 1;
foreach($_REQUEST['modules'] as $module){
$js_array .= "'form_".$module."'";
if($index < $count)
$js_array .= ',';
$index++;
}
//$js_array = "Array(".implode(",", $js_array). ")";
$js_array .= ');';
echo "<script language='javascript'>var ajaxFormArray = new ".$js_array."</script>";
if($count > 1)
echo '<input type="button" class="button" value="Save All" id=\'ajaxsaveall\' onclick="return saveForms(\'Saving...\', \'Save Complete\');"/>';
foreach($_REQUEST['modules'] as $module){
$bean = $beanList[$module];
require_once($beanFiles[$bean]);
$GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], $module);
$ev = new EditView($module);
$ev->process();
echo "<div id='multiedit_form_".$module."'>";
echo $ev->display(true, true);
echo "</div>";
}
}
}
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/vCard.php');
class ViewNoaccess extends SugarView{
var $type ='noaccess';
function ViewNoaccess(){
parent::SugarView();
}
function display(){
echo '<p class="error">Warning: You do not have permission to access this module.</p>';
}
}
?>

View File

@@ -0,0 +1,167 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class ViewPopup extends SugarView{
var $type ='list';
function ViewPopup(){
parent::SugarView();
}
function display(){
global $popupMeta, $mod_strings;
if(($this->bean instanceOf SugarBean) && !$this->bean->ACLAccess('list')){
ACLController::displayNoAccess();
sugar_cleanup(true);
}
if(isset($_REQUEST['metadata']) && strpos($_REQUEST['metadata'], "..") !== false)
die("Directory navigation attack denied.");
if(!empty($_REQUEST['metadata']) && $_REQUEST['metadata'] != 'undefined' && file_exists('modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php')) // if custom metadata is requested
require_once('modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php');
elseif(file_exists('custom/modules/' . $this->module . '/metadata/popupdefs.php'))
require_once('custom/modules/' . $this->module . '/metadata/popupdefs.php');
elseif(file_exists('modules/' . $this->module . '/metadata/popupdefs.php'))
require_once('modules/' . $this->module . '/metadata/popupdefs.php');
if(!empty($popupMeta) && !empty($popupMeta['listviewdefs'])){
if(is_array($popupMeta['listviewdefs'])){
//if we have an array, then we are not going to include a file, but rather the
//listviewdefs will be defined directly in the popupdefs file
$listViewDefs[$this->module] = $popupMeta['listviewdefs'];
}else{
//otherwise include the file
require_once($popupMeta['listviewdefs']);
}
}elseif(file_exists('custom/modules/' . $this->module . '/metadata/listviewdefs.php')){
require_once('custom/modules/' . $this->module . '/metadata/listviewdefs.php');
}elseif(file_exists('modules/' . $this->module . '/metadata/listviewdefs.php')){
require_once('modules/' . $this->module . '/metadata/listviewdefs.php');
}
//check for searchdefs as well
if(empty($searchdefs) && file_exists('custom/modules/'.$this->module.'/metadata/searchdefs.php')){
require_once('custom/modules/'.$this->module.'/metadata/searchdefs.php');
}elseif(!empty($popupMeta) && !empty($popupMeta['searchdefs'])){
if(is_array($popupMeta['searchdefs'])){
//if we have an array, then we are not going to include a file, but rather the
//searchdefs will be defined directly in the popupdefs file
$searchdefs[$this->module]['layout']['advanced_search'] = $popupMeta['searchdefs'];
}else{
//otherwise include the file
require_once($popupMeta['searchdefs']);
}
}else if(empty($searchdefs) && file_exists('modules/'.$this->module.'/metadata/searchdefs.php')){
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
}
if(!empty($this->bean) && isset($_REQUEST[$this->module.'2_'.strtoupper($this->bean->object_name).'_offset'])) {//if you click the pagination button, it will poplate the search criteria here
if(!empty($_REQUEST['current_query_by_page'])) {
$blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page');
$current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page']));
foreach($current_query_by_page as $search_key=>$search_value) {
if($search_key != $this->module.'2_'.strtoupper($this->bean->object_name).'_offset' && !in_array($search_key, $blockVariables)) {
if (!is_array($search_value)) {
$_REQUEST[$search_key] = $GLOBALS['db']->quoteForEmail($search_value);
}
else {
foreach ($search_value as $key=>&$val) {
$val = $GLOBALS['db']->quoteForEmail($val);
}
$_REQUEST[$search_key] = $search_value;
}
}
}
}
}
if(!empty($listViewDefs) && !empty($searchdefs)){
require_once('include/Popups/PopupSmarty.php');
$displayColumns = array();
$filter_fields = array();
$popup = new PopupSmarty($this->bean, $this->module);
foreach($listViewDefs[$this->module] as $col => $params) {
$filter_fields[strtolower($col)] = true;
if(!empty($params['related_fields'])) {
foreach($params['related_fields'] as $field) {
//id column is added by query construction function. This addition creates duplicates
//and causes issues in oracle. #10165
if ($field != 'id') {
$filter_fields[$field] = true;
}
}
}
if(!empty($params['default']) && $params['default'])
$displayColumns[$col] = $params;
}
$popup->displayColumns = $displayColumns;
$popup->filter_fields = $filter_fields;
$popup->mergeDisplayColumns = true;
//check to see if popupdes contains searchdefs
$popup->_popupMeta = $popupMeta;
$popup->listviewdefs = $listViewDefs;
$popup->searchdefs = $searchdefs;
if(isset($_REQUEST['query'])){
$popup->searchForm->populateFromRequest();
}
$massUpdateData = '';
if(isset($_REQUEST['mass'])) {
foreach(array_unique($_REQUEST['mass']) as $record) {
$massUpdateData .= "<input style='display: none' checked type='checkbox' name='mass[]' value='$record'>\n";
}
}
$popup->massUpdateData = $massUpdateData;
$popup->setup('include/Popups/tpls/PopupGeneric.tpl');
insert_popup_header();
echo $popup->display();
}else{
if(file_exists('modules/' . $this->module . '/Popup_picker.php')){
require_once('modules/' . $this->module . '/Popup_picker.php');
}else{
require_once('include/Popups/Popup_picker.php');
}
$popup = new Popup_Picker();
$popup->_hide_clear_button = true;
echo $popup->process_page();
}
}
}
?>

View File

@@ -0,0 +1,67 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/MVC/View/views/view.detail.php');
class ViewQuick extends ViewDetail{
var $type ='detail';
function ViewQuick(){
parent::SugarView();
$this->options['show_subpanels'] = false;
$this->options['show_title'] = false;
$this->options['show_header'] = false;
$this->options['show_footer'] = false;
$this->options['show_javascript'] = false;
}
function display(){
$this->dv->showVCRControl = false;
$this->dv->th->ss->assign('hideHeader', true);
if(empty($this->bean->id)){
global $app_strings;
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$this->dv->process();
ob_clean();
echo json_encode(array('title'=> $this->bean->name, 'url'=>'index.php?module=' . $this->bean->module_dir . '&action=DetailView&record=' . $this->bean->id ,'html'=> $this->dv->display(false)));
}
}

View File

@@ -0,0 +1,158 @@
<?php
//FILE SUGARCRM flav=pro || flav=sales
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/views/view.ajax.php');
require_once('include/EditView/EditView2.php');
class ViewQuickcreate extends ViewAjax
{
private $_isDCForm = false;
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
if(!empty($_REQUEST['source_module']) && $_REQUEST['source_module'] != 'undefined' && !empty($_REQUEST['record'])) {
$this->bean = loadBean($_REQUEST['source_module']);
if ( $this->bean instanceOf SugarBean
&& !in_array($this->bean->object_name,array('EmailMan')) ) {
$this->bean->retrieve($_REQUEST['record']);
if(!empty($this->bean->id))$_REQUEST['parent_id'] = $this->bean->id;
if(!empty($this->bean->module_dir))$_REQUEST['parent_type'] = $this->bean->module_dir;
if(!empty($this->bean->name))$_REQUEST['parent_name'] = $this->bean->name;
if(!empty($this->bean->id))$_REQUEST['return_id'] = $this->bean->id;
if(!empty($this->bean->module_dir))$_REQUEST['return_module'] = $this->bean->module_dir;
//Now preload any related fields
if(isset($_REQUEST['module'])) {
$target_bean = loadBean($_REQUEST['module']);
foreach($target_bean->field_defs as $fields) {
if($fields['type'] == 'relate' && isset($fields['module']) && $fields['module'] == $_REQUEST['source_module'] && isset($fields['rname'])) {
$rel_name = $fields['rname'];
if(isset($this->bean->$rel_name)) {
$_REQUEST[$fields['name']] = $this->bean->$rel_name;
}
if(!empty($_REQUEST['record']) && !empty($fields['id_name'])) {
$_REQUEST[$fields['id_name']] = $_REQUEST['record'];
}
}
}
}
}
$this->_isDCForm = true;
}
}
/**
* @see SugarView::display()
*/
public function display()
{
$view = (!empty($_REQUEST['target_view']))?$_REQUEST['target_view']: 'QuickCreate';
$module = $_REQUEST['module'];
// locate the best viewdefs to use: 1. custom/module/quickcreatedefs.php 2. module/quickcreatedefs.php 3. custom/module/editviewdefs.php 4. module/editviewdefs.php
$base = 'modules/' . $module . '/metadata/';
$source = 'custom/' . $base . strtolower($view) . 'defs.php';
if (!file_exists( $source))
{
$source = $base . strtolower($view) . 'defs.php';
if (!file_exists($source))
{
//if our view does not exist default to EditView
$view = 'EditView';
$source = 'custom/' . $base . 'editviewdefs.php';
if (!file_exists($source))
{
$source = $base . 'editviewdefs.php';
}
}
}
$ev = new EditView();
$ev->view = $view;
$ev->ss = new Sugar_Smarty();
$ev->ss->assign('isDCForm', $this->_isDCForm);
//$_REQUEST['return_action'] = 'SubPanelViewer';
$ev->setup($module, null, $source);
$ev->showSectionPanelsTitles = false;
$ev->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl';
$ev->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl';
$ev->defs['templateMeta']['form']['buttons'] = array('DCMENUSAVE', 'DCMENUCANCEL', 'DCMENUFULLFORM');
$ev->defs['templateMeta']['form']['button_location'] = 'bottom';
$ev->defs['templateMeta']['form']['hidden'] = '<input type="hidden" name="is_ajax_call" value="1" />';
$ev->defs['templateMeta']['form']['hidden'] .= '<input type="hidden" name="from_dcmenu" value="1" />';
$defaultProcess = true;
if(file_exists('modules/'.$module.'/views/view.edit.php')) {
include('modules/'.$module.'/views/view.edit.php');
$c = $module . 'ViewEdit';
if(class_exists($c)) {
$view = new $c;
if($view->useForSubpanel) {
$defaultProcess = false;
//Check if we shold use the module's QuickCreate.tpl file
if($view->useModuleQuickCreateTemplate && file_exists('modules/'.$module.'/tpls/QuickCreate.tpl')) {
$ev->defs['templateMeta']['form']['headerTpl'] = 'modules/'.$module.'/tpls/QuickCreate.tpl';
}
$view->ev = & $ev;
$view->ss = & $ev->ss;
$class = $GLOBALS['beanList'][$module];
if(!empty($GLOBALS['beanFiles'][$class])){
require_once($GLOBALS['beanFiles'][$class]);
$bean = new $class();
$view->bean = $bean;
}
$view->ev->formName = 'form_DC'.$view->ev->view .'_'.$module;
$view->showTitle = false; // Do not show title since this is for subpanel
$view->display();
}
}
} //if
if($defaultProcess) {
$form_name = 'form_DC'.$ev->view .'_'.$module;
$ev->formName = $form_name;
$ev->process(true, $form_name);
echo $ev->display(false, true);
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class ViewSerialized extends SugarView{
var $type ='detail';
function ViewSerialized(){
parent::SugarView();
}
function display(){
ob_clean();
echo serialize($this->bean->toArray());
sugar_cleanup(true);
}
}
?>

View File

@@ -0,0 +1,55 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$view_config = array(
'actions' => array(
'sugarpdf' => array(
'show_header' => false,
'show_subpanels' => false,
'show_search' => false,
'show_footer' => false,
'show_javascript' => false,
),
),
'req_params' => array(
'to_pdf' => array(
'param_value' => true,
'config' => array('show_all' => false),
),
),
);
?>

View File

@@ -0,0 +1,85 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/Sugarpdf/SugarpdfFactory.php');
class ViewSugarpdf extends SugarView{
var $type ='sugarpdf';
/**
* It is set by the "sugarpdf" request parameter and it is use by SugarpdfFactory to load the good sugarpdf class.
* @var String
*/
var $sugarpdf='default';
/**
* The sugarpdf object (Include the TCPDF object).
* The atributs of this object are destroy in the output method.
* @var Sugarpdf object
*/
var $sugarpdfBean=NULL;
function ViewSugarpdf(){
parent::SugarView();
if (isset($_REQUEST["sugarpdf"]))
$this->sugarpdf = $_REQUEST["sugarpdf"];
else
header('Location:index.php?module='.$_REQUEST['module'].'&action=DetailView&record='.$_REQUEST['record']);
}
function preDisplay(){
$this->sugarpdfBean = SugarpdfFactory::loadSugarpdf($this->sugarpdf, $this->module, $this->bean, $this->view_object_map);
// ACL control
if(!empty($this->bean) && !$this->bean->ACLAccess($this->sugarpdfBean->aclAction)){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if(isset($this->errors)){
$this->sugarpdfBean->errors = $this->errors;
}
}
function display(){
$this->sugarpdfBean->process();
$this->sugarpdfBean->Output($this->sugarpdfBean->fileName,'I');
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/vCard.php');
class ViewVcard extends SugarView
{
var $type ='detail';
public function __construct()
{
parent::SugarView();
}
/**
* @see SugarView::display()
*/
public function display()
{
$vcard = new vCard();
$vcard->loadContact($this->bean->id, $this->module);
$vcard->saveVCard();
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class ViewXML extends SugarView{
var $type ='detail';
function ViewXML(){
parent::SugarView();
}
function display(){
echo 'Not implemented';
}
}
?>