This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
<?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): ______________________________________..
********************************************************************************/
/*
Removes Relationships, input is a form POST
ARGS:
$_REQUEST['module']; : the module associated with this Bean instance (will be used to get the class name)
$_REQUEST['record']; : the id of the Bean instance
$_REQUEST['linked_field']; : the linked field name of the Parent Bean
$_REQUEST['linked_id']; : the id of the Related Bean instance to
$_REQUEST['return_url']; : the URL to redirect to
or use:
1) $_REQUEST['return_id']; :
2) $_REQUEST['return_module']; :
3) $_REQUEST['return_action']; :
*/
//_ppd($_REQUEST);
require_once('include/formbase.php');
global $beanFiles,$beanList;
$bean_name = $beanList[$_REQUEST['module']];
require_once($beanFiles[$bean_name]);
$focus = new $bean_name();
if ( empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record']))
{
die("need linked_field, linked_id and record fields");
}
$linked_field = $_REQUEST['linked_field'];
$record = $_REQUEST['record'];
$linked_id = $_REQUEST['linked_id'];
if($bean_name == 'Team')
{
$focus->retrieve($record);
$focus->remove_user_from_team($linked_id);
}
else
{
// cut it off:
$focus->load_relationship($linked_field);
if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto')
unset($focus->$linked_field->_relationship->relationship_role_column);
$focus->$linked_field->delete($record,$linked_id);
}
if ($bean_name == 'Campaign' and $linked_field=='prospectlists' ) {
$query="SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists ";
$query.=" left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id";
$query.=" where email_marketing.campaign_id='$record'";
$query.=" and email_marketing_prospect_lists.prospect_list_id='$linked_id'";
$result=$focus->db->query($query);
while (($row=$focus->db->fetchByAssoc($result)) != null) {
$del_query =" update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=".db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format(),time())."'",'datetime');
$del_query.=" WHERE email_marketing_prospect_lists.id='{$row['id']}'";
$focus->db->query($del_query);
}
$focus->db->query($query);
}
if ($bean_name == "Meeting") {
$focus->retrieve($record);
$user = new User();
$user->retrieve($linked_id);
if (!empty($user->id)) { //make sure that record exists. we may have a contact on our hands.
if($focus->update_vcal)
{
vCal::cache_sugar_vcal($user);
}
}
}
if(!empty($_REQUEST['return_url'])){
$_REQUEST['return_url'] =urldecode($_REQUEST['return_url']);
}
$GLOBALS['log']->debug("deleted relationship: bean: $bean_name, linked_field: $linked_field, linked_id:$linked_id" );
if(empty($_REQUEST['refresh_page'])){
handleRedirect();
}
exit;
?>

337
include/generic/LayoutManager.php Executable file
View File

@@ -0,0 +1,337 @@
<?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/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
require_once('include/generic/SugarWidgets/SugarWidgetReportField.php');
require_once('include/database/DBHelper.php');
class LayoutManager
{
var $defs = array();
var $widget_prefix = 'SugarWidget';
var $default_widget_name = 'Field';
var $DBHelper;
function LayoutManager()
{
// set a sane default for context
$this->defs['context'] = 'Detail';
$this->DBHelper = $GLOBALS['db']->getHelper();
}
function setAttribute($key,$value)
{
$this->defs[$key] = $value;
}
function setAttributePtr($key,&$value)
{
$this->defs[$key] = $value;
}
function getAttribute($key)
{
if ( isset($this->defs[$key]))
{
return $this->defs[$key];
} else {
return null;
}
}
// Take the class name from the widget definition and use the class to look it up
// $use_default will default classes to SugarWidgetFieldxxxxx
function getClassFromWidgetDef($widget_def, $use_default = false)
{
static $class_map = array(
'SugarWidgetSubPanelTopCreateButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopButton',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LBL_NEW_BUTTON_LABEL',
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopButtonQuickCreate' => array(
'widget_class'=>'SugarWidgetSubPanelTopButtonQuickCreate',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LBL_NEW_BUTTON_LABEL',
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopScheduleMeetingButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopScheduleMeetingButton',
'module'=>'Meetings',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LNK_NEW_MEETING',
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopScheduleCallButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopScheduleCallButton',
'module'=>'Calls',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LNK_NEW_CALL',
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopCreateTaskButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopCreateTaskButton',
'module'=>'Tasks',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LNK_NEW_TASK',
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopCreateNoteButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopCreateNoteButton',
'module'=>'Notes',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LNK_NEW_NOTE',
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopCreateContactAccountButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopButton',
'module'=>'Contacts',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LBL_NEW_BUTTON_LABEL',
'additional_form_fields' => array(
'primary_address_street' => 'shipping_address_street',
'primary_address_city' => 'shipping_address_city',
'primary_address_state' => 'shipping_address_state',
'primary_address_country' => 'shipping_address_country',
'primary_address_postalcode' => 'shipping_address_postalcode',
'to_email_addrs' => 'email1'
),
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopCreateContact' => array(
'widget_class'=>'SugarWidgetSubPanelTopButton',
'module'=>'Contacts',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LBL_NEW_BUTTON_LABEL',
'additional_form_fields' => array(
'account_id' => 'account_id',
'account_name' => 'account_name',
),
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopCreateRevisionButton'=> array(
'widget_class'=>'SugarWidgetSubPanelTopButton',
'module'=>'DocumentRevisions',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LBL_NEW_BUTTON_LABEL',
'additional_form_fields' => array(
'parent_name'=>'document_name',
'document_name' => 'document_name',
'document_revision' => 'latest_revision',
'document_filename' => 'filename',
'document_revision_id' => 'document_revision_id',
),
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopCreateDirectReport' => array(
'widget_class'=>'SugarWidgetSubPanelTopButton',
'module'=>'Contacts',
'title'=>'LBL_NEW_BUTTON_TITLE',
'access_key'=>'LBL_NEW_BUTTON_KEY',
'form_value'=>'LBL_NEW_BUTTON_LABEL',
'additional_form_fields' => array(
'reports_to_name' => 'name',
'reports_to_id' => 'id',
),
'ACL'=>'edit',
),
'SugarWidgetSubPanelTopSelectFromReportButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopSelectButton',
'module'=>'Reports',
'title'=>'LBL_SELECT_REPORTS_BUTTON_LABEL',
'access_key'=>'LBL_SELECT_BUTTON_KEY',
'form_value'=>'LBL_SELECT_REPORTS_BUTTON_LABEL',
'ACL'=>'edit',
'add_to_passthru_data'=>array (
'return_type'=>'report',
)
),
'SugarWidgetSubPanelAddToProspectListButton' => array(
'widget_class'=>'SugarWidgetSubPanelTopSelectButton',
'module'=>'ProspectLists',
'title'=>'LBL_ADD_TO_PROSPECT_LIST_BUTTON_LABEL',
'access_key'=>'LBL_ADD_TO_PROSPECT_LIST_BUTTON_KEY',
'form_value'=>'LBL_ADD_TO_PROSPECT_LIST_BUTTON_LABEL',
'ACL'=>'edit',
'add_to_passthru_data'=>array (
'return_type'=>'addtoprospectlist',
'parent_module'=>'ProspectLists',
'parent_type'=>'ProspectList',
'child_id'=>'target_id',
'link_attribute'=>'target_type',
'link_type'=>'polymorphic', //polymorphic or default
)
),
);
$fieldDef = $this->getFieldDef($widget_def);
if(!empty($fieldDef) && !empty($fieldDef['type']) && strtolower(trim($fieldDef['type'])) == 'multienum'){
$widget_def['widget_class'] = 'Fieldmultienum';
}
if(!empty($fieldDef) && !empty($fieldDef['type']) && strtolower(trim($fieldDef['type'])) == 'bool'){
$widget_def['widget_class'] = 'Fieldbool';
}
if($use_default) {
switch($widget_def['name']) {
case 'assigned_user_id':
$widget_def['widget_class'] = 'Fielduser_name';
break;
default:
$widget_def['widget_class'] = 'Field' . $this->DBHelper->getFieldType($widget_def);
}
}
if(!empty($widget_def['name']) && $widget_def['name'] == 'team_set_id'){
$widget_def['widget_class'] = 'Fieldteam_set_id';
}
if(empty($widget_def['widget_class']))
{
// Default the class to SugarWidgetField
$class_name = $this->widget_prefix.$this->default_widget_name;
}
else
{
$class_name = $this->widget_prefix.$widget_def['widget_class'];
}
// Check to see if this is one of the known class mappings.
if(!empty($class_map[$class_name]))
{
if (empty($class_map[$class_name]['widget_class'])) {
$widget = new SugarWidgetSubPanelTopButton($class_map[$class_name]);
} else {
if (!class_exists($class_map[$class_name]['widget_class'])) {
require_once('include/generic/SugarWidgets/'.$class_map[$class_name]['widget_class'].'.php');
}
$widget = new $class_map[$class_name]['widget_class']($class_map[$class_name]);
}
return $widget;
}
// At this point, we have a class name and we do not have a valid class defined.
if(!class_exists($class_name))
{
// The class does not exist. Try including it.
if (file_exists('custom/include/generic/SugarWidgets/'.$class_name.'.php'))
require_once('custom/include/generic/SugarWidgets/'.$class_name.'.php');
else if (file_exists('include/generic/SugarWidgets/'.$class_name.'.php'))
require_once('include/generic/SugarWidgets/'.$class_name.'.php');
if(!class_exists($class_name))
{
// If we still do not have a class, oops....
die("LayoutManager: Class not found:".$class_name);
}
}
$widget = new $class_name($this); // cache disabled $this->getClassFromCache($class_name);
return $widget;
}
// 27426
function getFieldDef($widget_def){
static $beanCache;
if(!empty($widget_def['module']) &&!empty($GLOBALS['beanList'][$widget_def['module']]) && !empty($GLOBALS['beanFiles'][$GLOBALS['beanList'][$widget_def['module']]])){
if (!isset($beanCache[$widget_def['module']])){
$beanCache[$widget_def['module']] = new $GLOBALS['beanList'][$widget_def['module']]();
}
$bean = $beanCache[$widget_def['module']];
if(!empty($widget_def['name']) && !empty($bean->field_name_map) &&!empty($bean->field_name_map[$widget_def['name']]) ){
return $bean->field_name_map[$widget_def['name']];
}
}
return null;
}
function widgetDisplay($widget_def, $use_default = false)
{
$theclass = $this->getClassFromWidgetDef($widget_def, $use_default);
$label = isset($widget_def['module']) ? $widget_def['module'] : '';
if (is_subclass_of($theclass, 'SugarWidgetSubPanelTopButton')) {
$label = $theclass->get_subpanel_relationship_name($widget_def);
}
$theclass->setWidgetId($label);
//#27426
$fieldDef = $this->getFieldDef($widget_def);
if(!empty($fieldDef) && !empty($fieldDef['type']) && strtolower(trim($fieldDef['type'])) == 'multienum'){
$widget_def['fields'] = sugarArrayMerge($widget_def['fields'] , $fieldDef);
$widget_def['fields']['module'] = $label;
}
//end
return $theclass->display($widget_def);
}
function widgetQuery($widget_def, $use_default = false)
{
$theclass = $this->getClassFromWidgetDef($widget_def, $use_default);
// _pp($theclass);
return $theclass->query($widget_def);
}
// display an input field
// module is the parent module of the def
function widgetDisplayInput($widget_def, $use_default = false)
{
$theclass = $this->getClassFromWidgetDef($widget_def, $use_default);
return $theclass->displayInput($widget_def);
}
}
?>

226
include/generic/Save2.php Executable file
View File

@@ -0,0 +1,226 @@
<?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): ______________________________________..
********************************************************************************/
/*
ARGS:
$_REQUEST['method']; : options: 'SaveRelationship','Save','DeleteRelationship','Delete'
$_REQUEST['module']; : the module associated with this Bean instance (will be used to get the class name)
$_REQUEST['record']; : the id of the Bean instance
// $_REQUEST['related_field']; : the field name on the Bean instance that contains the relationship
// $_REQUEST['related_record']; : the id of the related record
// $_REQUEST['related_']; : the
// $_REQUEST['return_url']; : the URL to redirect to
//$_REQUEST['return_type']; : when set the results of a report will be linked with the parent.
*/
require_once('include/formbase.php');
function add_prospects_to_prospect_list($query,$parent_module,$parent_type,$parent_id,$child_id,$link_attribute,$link_type) {
$GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$query);
$GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$parent_module);
$GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$parent_type);
$GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$parent_id);
$GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$child_id);
$GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$link_attribute);
$GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$link_type);
if (!class_exists($parent_type)) {
require_once('modules/'.$parent_module.'/'.$parent_type.'.php');
}
$focus = new $parent_type();
$focus->retrieve($parent_id);
//if link_type is default then load relationship once and add all the child ids.
$relationship_attribute=$link_attribute;
//find all prospects based on the query
$db = DBManagerFactory::getInstance();
$result=$db->query($query);
while(($row=$db->fetchByAssoc($result)) != null) {
$GLOBALS['log']->debug('target_id'.$row[$child_id]);
if ($link_type != 'default') {
$relationship_attribute=strtolower($row[$link_attribute]);
}
$GLOBALS['log']->debug('add_prospects_to_prospect_list:relationship_attribute:'.$relationship_attribute);
//load relationship for the first time or on change of relationship atribute.
if (empty($focus->$relationship_attribute)) {
$focus->load_relationship($relationship_attribute);
}
//add
$focus->$relationship_attribute->add($row[$child_id]);
}
}
//Link rows returned by a report to parent record.
function save_from_report($report_id,$parent_id, $module_name, $relationship_attr_name) {
global $beanFiles;
global $beanList;
$GLOBALS['log']->debug("Save2: Linking with report output");
$GLOBALS['log']->debug("Save2:Report ID=".$report_id);
$GLOBALS['log']->debug("Save2:Parent ID=".$parent_id);
$GLOBALS['log']->debug("Save2:Module Name=".$module_name);
$GLOBALS['log']->debug("Save2:Relationship Attribute Name=".$relationship_attr_name);
$bean_name = $beanList[$module_name];
$GLOBALS['log']->debug("Save2:Bean Name=".$bean_name);
require_once($beanFiles[$bean_name]);
$focus = new $bean_name();
$focus->retrieve($parent_id);
$focus->load_relationship($relationship_attr_name);
//fetch report definition.
global $current_language, $report_modules, $modules_report;
$mod_strings = return_module_language($current_language,"Reports");
$saved = new SavedReport();
$saved->disable_row_level_security = true;
$saved->retrieve($report_id, false);
//initiailize reports engine with the report definition.
require_once('modules/Reports/Report.php');
$report = new Report($saved->content);
$report->run_query();
$sql = $report->query_list[0];
$GLOBALS['log']->debug("Save2:Report Query=".$sql);
$result = $report->db->query($sql);
while($row = $report->db->fetchByAssoc($result))
{
$focus->$relationship_attr_name->add($row['primaryid']);
}
}
$refreshsubpanel=true;
if (isset($_REQUEST['return_type']) && $_REQUEST['return_type'] == 'report') {
save_from_report($_REQUEST['subpanel_id'] //report_id
,$_REQUEST['record'] //parent_id
,$_REQUEST['module'] //module_name
,$_REQUEST['subpanel_field_name'] //link attribute name
);
} else if (isset($_REQUEST['return_type']) && $_REQUEST['return_type'] == 'addtoprospectlist') {
$GLOBALS['log']->debug(print_r($_REQUEST,true));
add_prospects_to_prospect_list(urldecode($_REQUEST['query']),$_REQUEST['parent_module'],$_REQUEST['parent_type'],$_REQUEST['subpanel_id'],
$_REQUEST['child_id'],$_REQUEST['link_attribute'],$_REQUEST['link_type']);
$refreshsubpanel=false;
}else if (isset($_REQUEST['return_type']) && $_REQUEST['return_type'] == 'addcampaignlog') {
//if param is set to "addcampaignlog", then we need to create a campaign log entry
//for each campaign id passed in.
//get list of campaign's selected'
if (isset($_REQUEST['subpanel_id']) && !empty($_REQUEST['subpanel_id'])) {
$campaign_ids = $_REQUEST['subpanel_id'];
global $beanFiles;
global $beanList;
//retrieve current bean
$bean_name = $beanList[$_REQUEST['module']];
require_once($beanFiles[$bean_name]);
$focus = new $bean_name();
$focus->retrieve($_REQUEST['record']);
require_once('modules/Campaigns/utils.php');
//call util function to create the campaign log entry
foreach($campaign_ids as $id){
create_campaign_log_entry($id, $focus, $focus->module_dir,$focus, $focus->id);
}
$refreshsubpanel=true;
}
}
else {
global $beanFiles,$beanList;
$bean_name = $beanList[$_REQUEST['module']];
require_once($beanFiles[$bean_name]);
$focus = new $bean_name();
$focus->retrieve($_REQUEST['record']);
if($bean_name == 'Team'){
$subpanel_id = $_REQUEST['subpanel_id'];
if(is_array($subpanel_id)){
foreach($subpanel_id as $id){
$focus->add_user_to_team($id);
}
}
else{
$focus->add_user_to_team($subpanel_id);
}
} else{
//find request paramters with with prefix of REL_ATTRIBUTE_
//convert them into an array of name value pairs add pass them as
//parameters to the add metod.
$add_values =array();
foreach ($_REQUEST as $key=>$value) {
if (strpos($key,"REL_ATTRIBUTE_") !== false) {
$add_values[substr($key,14)]=$value;
}
}
$focus->load_relationship($_REQUEST['subpanel_field_name']);
$focus->$_REQUEST['subpanel_field_name']->add($_REQUEST['subpanel_id'],$add_values);
}
}
if ($refreshsubpanel) {
//refresh contents of the sub-panel.
$GLOBALS['log']->debug("Location: index.php?sugar_body_only=1&module=".$_REQUEST['module']."&subpanel=".$_REQUEST['subpanel_module_name']."&action=SubPanelViewer&inline=1&record=".$_REQUEST['record']);
if( empty($_REQUEST['refresh_page']) || $_REQUEST['refresh_page'] != 1){
$inline = isset($_REQUEST['inline'])?$_REQUEST['inline']: $inline;
header("Location: index.php?sugar_body_only=1&module=".$_REQUEST['module']."&subpanel=".$_REQUEST['subpanel_module_name']."&action=SubPanelViewer&inline=$inline&record=".$_REQUEST['record']);
}
}
exit;
?>

View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidget
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
//TODO move me out of generic
class SugarWidget
{
var $layout_manager = null;
var $widget_id;
function SugarWidget(&$layout_manager)
{
$this->layout_manager = $layout_manager;
}
function display(&$layout_def)
{
return 'display class undefined';
}
/**
* getSubpanelWidgetId
* This is a utility function to return a widget's unique id
* @return id String label of the widget's unique id
*/
public function getWidgetId() {
return $this->widget_id;
}
/**
* setSubpanelWidgetId
* This is a utility function to set the id for a widget
* @param id String value to set the widget's unique id
*/
public function setWidgetId($id='') {
$this->widget_id = $id;
}
}
?>

View File

@@ -0,0 +1,228 @@
<?php
if(!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
/**
* SugarWidgetField
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidget.php');
class SugarWidgetField extends SugarWidget {
function SugarWidgetField(&$layout_manager) {
parent::SugarWidget($layout_manager);
}
function display($layout_def) {
//print $layout_def['start_link_wrapper']."===";
$context = $this->layout_manager->getAttribute('context'); //_ppd($context);
$func_name = 'display'.$context;
if (!empty ($context) && method_exists($this, $func_name)) {
return $this-> $func_name ($layout_def);
} else {
return 'display not found:'.$func_name;
}
}
function _get_column_alias($layout_def) {
$alias_arr = array ();
if (!empty ($layout_def['name']) && $layout_def['name'] == 'count') {
return 'count';
}
if (!empty ($layout_def['table_alias'])) {
array_push($alias_arr, $layout_def['table_alias']);
}
if (!empty ($layout_def['name'])) {
array_push($alias_arr, $layout_def['name']);
}
return implode("_", $alias_arr);
}
function & displayDetailLabel(& $layout_def) {
return '';
}
function & displayDetail($layout_def) {
return '';
}
function displayHeaderCellPlain($layout_def) {
$module_name = $this->layout_manager->getAttribute('module_name');
$header_cell_text = '';
$key = '';
if (!empty ($layout_def['label'])) {
$header_cell_text = $layout_def['label'];
}
elseif (!empty ($layout_def['vname'])) {
$key = $layout_def['vname'];
if (empty ($key)) {
$header_cell_text = $layout_def['name'];
} else {
$header_cell_text = translate($key, $module_name);
}
}
return $header_cell_text;
}
function displayHeaderCell($layout_def) {
$module_name = $this->layout_manager->getAttribute('module_name');
require_once ("include/ListView/ListView.php");
$this->local_current_module = $_REQUEST['module'];
$this->is_dynamic = true;
// don't show sort links if name isn't defined
if (empty ($layout_def['name'])) {
return $layout_def['label'];
}
if (isset ($layout_def['sortable']) && !$layout_def['sortable']) {
return $this->displayHeaderCellPlain($layout_def);
}
$header_cell_text = '';
$key = '';
if (!empty ($layout_def['vname'])) {
$key = $layout_def['vname'];
}
if (empty ($key)) {
$header_cell_text = $layout_def['name'];
} else {
$header_cell_text = translate($key, $module_name);
}
$subpanel_module = $layout_def['subpanel_module'];
if (empty ($this->base_URL)) {
$this->base_URL = ListView :: getBaseURL('CELL');
$split_url = explode('&to_pdf=true&action=SubPanelViewer&subpanel=', $this->base_URL);
$this->base_URL = $split_url[0];
$this->base_URL .= '&inline=true&to_pdf=true&action=SubPanelViewer&subpanel=';
}
$sort_by_name = $layout_def['name'];
if (isset ($layout_def['sort_by'])) {
$sort_by_name = $layout_def['sort_by'];
}
$sort_by = ListView :: getSessionVariableName('CELL', "ORDER_BY").'='.$sort_by_name;
$start = (empty ($layout_def['start_link_wrapper'])) ? '' : $layout_def['start_link_wrapper'];
$end = (empty ($layout_def['end_link_wrapper'])) ? '' : $layout_def['end_link_wrapper'];
$header_cell = "<a class=\"listViewThLinkS1\" href=\"".$start.$this->base_URL.$subpanel_module.'&'.$sort_by.$end."\">";
$header_cell .= $header_cell_text;
$header_cell .= "</a>";
$arrow_start = ListView :: getArrowStart($this->layout_manager->getAttribute('image_path'));
$arrow_end = ListView :: getArrowEnd($this->layout_manager->getAttribute('image_path'));
$imgArrow = '';
if (isset ($layout_def['sort'])) {
$imgArrow = $layout_def['sort'];
}
$header_cell .= " ".$arrow_start.$imgArrow.$arrow_end;
return $header_cell;
}
function displayList($layout_def) {
return $this->displayListPlain($layout_def);
}
function displayListPlain($layout_def) {
$value= $this->_get_list_value($layout_def);
if (isset($layout_def['widget_type']) && $layout_def['widget_type'] =='checkbox') {
if ($value != '' && ($value == 'on' || intval($value) == 1 || $value == 'yes'))
{
return "<input name='checkbox_display' class='checkbox' type='checkbox' disabled='true' checked>";
}
return "<input name='checkbox_display' class='checkbox' type='checkbox' disabled='true'>";
}
return $value;
}
function _get_list_value(& $layout_def) {
$key = '';
$value = '';
if (isset ($layout_def['varname'])) {
$key = strtoupper($layout_def['varname']);
} else {
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
if (isset ($layout_def['fields'][$key])) {
return $layout_def['fields'][$key];
}
return $value;
}
function & displayEditLabel($layout_def) {
return '';
}
function & displayEdit($layout_def) {
return '';
}
function & displaySearchLabel($layout_def) {
return '';
}
function & displaySearch($layout_def) {
return '';
}
function displayInput($layout_def) {
return ' -- Not Implemented --';
}
}
?>

View File

@@ -0,0 +1,73 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldBool extends SugarWidgetReportField
{
function queryFilterEquals(&$layout_def)
{
$bool_val = $layout_def['input_name0'][0];
if ($bool_val == 'yes' || $bool_val == '1')
{
return "(".$this->_get_column_select($layout_def)." LIKE 'on' OR ".$this->_get_column_select($layout_def)."='1')\n";
} else {
//return "(".$this->_get_column_select($layout_def)." is null OR ".$this->_get_column_select($layout_def)."='0' OR ".$this->_get_column_select($layout_def)."='off')\n";
return "(".$this->_get_column_select($layout_def)." is null OR ". $this->_get_column_select($layout_def)."='0')\n";
}
}
function & displayListPlain($layout_def)
{
$on_or_off = 'CHECKED';
$value = $this->_get_list_value($layout_def);
if ( empty($value) || $value == 'off')
{
$on_or_off = '';
}
$cell = "<input name='checkbox_display' class='checkbox' type='checkbox' disabled $on_or_off>";
return $cell;
}
function queryFilterStarts_With(&$layout_def)
{
return $this->queryFilterEquals($layout_def);
}
}
?>

View File

@@ -0,0 +1,44 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldChar extends SugarWidgetFieldVarchar
{
}
?>

View File

@@ -0,0 +1,115 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidget.php');
require_once('modules/Currencies/Currency.php');
global $current_user;
$global_currency_obj = null;
function get_currency()
{
global $current_user,$global_currency_obj;
if (empty($global_currency_obj))
{
$global_currency_obj = new Currency();
// $global_currency_symbol = '$';
if($current_user->getPreference('currency') )
{
$global_currency_obj->retrieve($current_user->getPreference('currency'));
}
else
{
$global_currency_obj->retrieve('-99');
}
}
return $global_currency_obj;
}
class SugarWidgetFieldCurrency extends SugarWidgetFieldInt
{
function & displayList($layout_def)
{
// $global_currency_obj = get_currency();
// $display = format_number($this->displayListPlain($layout_def), 2, 2, array('convert' => true, 'currency_symbol' => true));
// $display = $global_currency_obj->symbol. round($global_currency_obj->convertFromDollar($this->displayListPlain($layout_def)),2);
$display = $this->displayListPlain($layout_def);
return $display;
}
function displayListPlain($layout_def) {
// $value = $this->_get_list_value($layout_def);
$value = format_number(parent::displayListPlain($layout_def), 2, 2, array('convert' => false, 'currency_symbol' => false));
return $value;
}
function queryFilterEquals(&$layout_def)
{
$global_currency_obj = get_currency();
return $this->_get_column_select($layout_def)."=".$GLOBALS['db']->quote( round($global_currency_obj->convertToDollar($layout_def['input_name0'])))."\n";
}
function queryFilterNot_Equals(&$layout_def)
{
$global_currency_obj = get_currency();
return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote( round($global_currency_obj->convertToDollar($layout_def['input_name0'])))."\n";
}
function queryFilterGreater(&$layout_def)
{
$global_currency_obj = get_currency();
return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote( round($global_currency_obj->convertToDollar($layout_def['input_name0'])))."\n";
}
function queryFilterLess(&$layout_def)
{
$global_currency_obj = get_currency();
return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote( round($global_currency_obj->convertToDollar($layout_def['input_name0'])))."\n";
}
function queryFilterBetween(&$layout_def){
$global_currency_obj = get_currency();
return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote( round($global_currency_obj->convertToDollar($layout_def['input_name0']))). " AND ". $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote( round($global_currency_obj->convertToDollar($layout_def['input_name1'])))."\n";
}
}
?>

View File

@@ -0,0 +1,504 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFielddatetime.php');
class SugarWidgetFieldDate extends SugarWidgetFieldDateTime
{
function & displayList($layout_def)
{
global $timedate;
// i guess qualifier and column_function are the same..
if (! empty($layout_def['column_function']))
{
$func_name = 'displayList'.$layout_def['column_function'];
if ( method_exists($this,$func_name))
{
$display = $this->$func_name($layout_def);
return $display;
}
}
$content = $this->displayListPlain($layout_def);
return $content;
}
function get_date_part($date_time_value){
$date_parts=explode(' ', $date_time_value);
if (count($date_parts) == 2) {
$date=$date_parts[0];
} else {
$date=$date_time_value;
}
return $date;
}
function get_db_date($days,$time) {
global $timedate;
$begin = date($GLOBALS['timedate']->get_db_date_time_format(), time()+(86400 * $days)); //gmt date with day adjustment applied.
// $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
if ($time=='start') {
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
}
else if ($time=='end') {
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 23:59:59';
}
return $begin;
}
function get_time_part($date_time_value) {
$date_parts=explode(' ', $date_time_value);
if (count($date_parts) == 2) {
$time=$date_parts[1];
} else {
$time=$date_time_value;
}
return $time;
}
function queryFilterBefore_old(&$layout_def)
{
global $timedate;
return $this->_get_column_select($layout_def)."<'".$this->reporter->db->quote($layout_def['input_name0'])."'\n";
}
function queryFilterAfter_old(&$layout_def)
{
global $timedate;
return $this->_get_column_select($layout_def).">'".$this->reporter->db->quote($layout_def['input_name0'])."'\n";
}
function queryFilterBetween_Dates_old(&$layout_def)
{
global $timedate;
return "(".$this->_get_column_select($layout_def).">='".$this->reporter->db->quote($layout_def['input_name0'])."' AND \n". $this->_get_column_select($layout_def)."<='".$this->reporter->db->quote($layout_def['input_name1'])."')\n";
}
function queryFilterNot_Equals_str(& $layout_def) {
global $timedate;
$begin = $layout_def['input_name0'];
if ($this->reporter->db->dbType == 'oci8') {
} elseif($this->reporter->db->dbType == 'mssql') {
return "".$this->_get_column_select($layout_def)."!='".$this->reporter->db->quote($begin)."'\n";
}else{
return "ISNULL(".$this->_get_column_select($layout_def).") OR \n(".$this->_get_column_select($layout_def)."!='".$this->reporter->db->quote($begin)."')\n";
}
}
function queryFilterOn(& $layout_def) {
global $timedate;
$begin = $layout_def['input_name0'];
return $this->_get_column_select($layout_def)."='".$this->reporter->db->quote($begin)."'\n";
}
function queryFilterBefore(& $layout_def) {
global $timedate;
$begin = $layout_def['input_name0'];
return $this->_get_column_select($layout_def)."<'".$this->reporter->db->quote($begin)."'\n";
}
function queryFilterAfter(& $layout_def) {
global $timedate;
$begin = $layout_def['input_name0'];
return $this->_get_column_select($layout_def).">'".$this->reporter->db->quote($begin)."'\n";
}
function queryFilterBetween_Dates(& $layout_def) {
global $timedate;
$begin = $layout_def['input_name0'];
$end = $layout_def['input_name1'];
return "(".$this->_get_column_select($layout_def).">='".$this->reporter->db->quote($begin)."' AND \n".$this->_get_column_select($layout_def)."<='".$this->reporter->db->quote($end)."')\n";
}
function queryFilterTP_yesterday(& $layout_def) {
global $timedate, $current_user;
$begin_timestamp = time() - 86400;
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
$end = $begin_parts[0] . ' 23:59:59';
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_today(& $layout_def) {
global $timedate, $current_user;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
$end = $begin_parts[0] . ' 23:59:59';
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_tomorrow(& $layout_def) {
global $timedate, $current_user;
$begin_timestamp = time() + 86400;
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
$end = $begin_parts[0] . ' 23:59:59';
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_last_7_days(& $layout_def) {
global $timedate, $current_user;
$begin_timestamp = time() - (6 * 86400);
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$end_timestamp = time();
$end = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $end_timestamp);
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
$end_parts = explode(' ', $end);
$end = $end_parts[0] . ' 23:59:59';
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_7_days(& $layout_def) {
global $timedate, $current_user;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$end_timestamp = time() + (86400*6);
$end = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $end_timestamp);
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
$end_parts = explode(' ', $end);
$end = $end_parts[0] . ' 23:59:59';
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_last_month(& $layout_def) {
global $timedate;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$curr_date = explode('-',$begin_parts[0]);
//Get year and month from time stamp.
$curr_year=$curr_date[0];
$curr_month=$curr_date[1];
//get start date for last month and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 month",mktime(0,0,0,$curr_month,1,$curr_year)));
//get end date for last month and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 day",mktime(23,59,59,$curr_month,1,$curr_year)));
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_this_month(& $layout_def) {
global $timedate;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$curr_date = explode('-',$begin_parts[0]);
//Get year and month from time stamp.
$curr_year=$curr_date[0];
$curr_month=$curr_date[1];
//get start date for this month and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,$curr_month,1,$curr_year));
//get end date for this month and convert it to gmt and db format.
//first get the first day of next month and move back by one day.
if ($curr_month==12) {
$curr_month=1;
$curr_year+=1;
} else {
$curr_month+=1;
}
$end=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 day",mktime(23,59,59,$curr_month,1,$curr_year)));
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_month(& $layout_def) {
global $timedate;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$curr_date = explode('-',$begin_parts[0]);
//Get year and month from time stamp.
$curr_year=$curr_date[0];
$curr_month=$curr_date[1];
if ($curr_month==12) {
$curr_month=1;
$curr_year+=1;
} else {
$curr_month+=1;
}
//get start date for next month and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,$curr_month,1,$curr_year));
$end=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 day",(strtotime("1 month",mktime(23,59,59,$curr_month,1,$curr_year)))));
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_last_30_days(& $layout_def) {
global $timedate;
$begin_timestamp = time() - (29 * 86400);
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$end_timestamp = time();
$end = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $end_timestamp);
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
$end_parts = explode(' ', $end);
$end = $end_parts[0] . ' 23:59:59';
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_30_days(& $layout_def) {
global $timedate;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$end_timestamp = time() + (29 * 86400);
$end = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $end_timestamp);
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$begin = $begin_parts[0] . ' 00:00:00';
$end_parts = explode(' ', $end);
$end = $end_parts[0] . ' 23:59:59';
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_this_quarter(& $layout_def) {
}
function queryFilterTP_last_year(& $layout_def) {
global $timedate;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$curr_date = explode('-',$begin_parts[0]);
//Get year and month from time stamp.
$curr_year=$curr_date[0]-1;
//get start date for last year and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,1,1,$curr_year));
//get end date for last year and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(23,59,59,12,31,$curr_year));
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_this_year(& $layout_def) {
global $timedate;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$curr_date = explode('-',$begin_parts[0]);
//Get year and month from time stamp.
$curr_year=$curr_date[0];
//get start date for this year and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,1,1,$curr_year));
//get end date for this year and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(23,59,59,12,31,$curr_year));
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_year(& $layout_def) {
global $timedate;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$curr_date = explode('-',$begin_parts[0]);
//Get year and month from time stamp.
$curr_year=$curr_date[0]+1;
//get start date for this year and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,1,1,$curr_year));
//get end date for this year and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(23,59,59,12,31,$curr_year));
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
}
?>

View File

@@ -0,0 +1,63 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFielddatetime.php');
class SugarWidgetFieldDatePicker extends SugarWidgetFieldDateTime
{
function displayInput(&$layout_def)
{
global $timedate;
$cal_dateformat = $timedate->get_cal_date_format();
$LBL_ENTER_DATE = translate('LBL_ENTER_DATE', 'Charts');
$value = $timedate->swap_formats($layout_def['input_name0'], $timedate->dbDayFormat, $timedate->get_date_format());
$str = <<<EOHTML
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="{$layout_def['name']}" size='12' maxlength='10' id='{$layout_def['name']}' value='{$value}'>
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="{$layout_def['name']}_trigger" align="absmiddle">
<script type="text/javascript">
Calendar.setup ({
inputField : "{$layout_def['name']}", ifFormat : "{$cal_dateformat}", showsTime : false, button : "{$layout_def['name']}_trigger", singleClick : true, step : 1
});
</script>
EOHTML;
return $str;
}
}
?>

View File

@@ -0,0 +1,880 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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('modules/Users/User.php');
class SugarWidgetFieldDateTime extends SugarWidgetReportField {
var $reporter;
var $assigned_user=null;
function SugarWidgetFieldDateTime(&$layout_manager) {
parent::SugarWidgetReportField($layout_manager);
$this->reporter = $this->layout_manager->getAttribute('reporter');
}
// get the reporter attribute
// deprecated, now called in the constructor
function getReporter() {
// $this->reporter = $this->layout_manager->getAttribute('reporter');
}
// get the assigned user of the report
function getAssignedUser() {
$json_obj = getJSONobj();
$report_def_str = $json_obj->decode($this->reporter->report_def_str);
if(empty($report_def_str['assigned_user_id'])) return false;
$this->assigned_user = new User();
$this->assigned_user->retrieve($report_def_str['assigned_user_id']);
return true;
}
function queryFilterOn(& $layout_def) {
global $timedate;
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($layout_def['input_name0'] . ' 00:00:00', $timedate->get_db_date_time_format(), false, $this->assigned_user);
$end = $timedate->handle_offset($layout_def['input_name0'] . ' 23:59:59', $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else {
$begin = $layout_def['input_name0']." 00:00:00";
$end = $layout_def['input_name0']." 23:59:59";
}
return $this->_get_column_select($layout_def).">='".$this->reporter->db->quote($begin)."' AND ".$this->_get_column_select($layout_def)."<='".$this->reporter->db->quote($end)."'\n";
}
function queryFilterBefore(& $layout_def) {
global $timedate;
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($layout_def['input_name0'] . ' 00:00:00', $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else {
$begin = $layout_def['input_name0']." 00:00:00";
}
return $this->_get_column_select($layout_def)."<'".$this->reporter->db->quote($begin)."'\n";
}
function queryFilterAfter(& $layout_def) {
global $timedate;
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($layout_def['input_name0'] . ' 23:59:59', $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else {
$begin = $layout_def['input_name0']." 23:59:59";
}
return $this->_get_column_select($layout_def).">'".$this->reporter->db->quote($begin)."'\n";
}
function queryFilterBetween_Dates(& $layout_def) {
global $timedate;
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($layout_def['input_name0'] . ' 00:00:00', $timedate->get_db_date_time_format(), false, $this->assigned_user);
$end = $timedate->handle_offset($layout_def['input_name1'] . ' 23:59:59', $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else {
$begin = $layout_def['input_name0']." 00:00:00";
$end = $layout_def['input_name1']." 23:59:59";
}
return "(".$this->_get_column_select($layout_def).">='".$this->reporter->db->quote($begin)."' AND \n".$this->_get_column_select($layout_def)."<='".$this->reporter->db->quote($end)."')\n";
}
function queryFilterNot_Equals_str(& $layout_def) {
global $timedate;
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($layout_def['input_name0'] . ' 00:00:00', $timedate->get_db_date_time_format(), false, $this->assigned_user);
$end = $timedate->handle_offset($layout_def['input_name0'] . ' 23:59:59', $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else {
$begin = $layout_def['input_name0']." 00:00:00";
$end = $layout_def['input_name0']." 23:59:59";
}
if ($this->reporter->db->dbType == 'oci8') {
} elseif ($this->reporter->db->dbType == 'mssql'){
return "(".$this->_get_column_select($layout_def)."<'".$this->reporter->db->quote($begin)."' OR ".$this->_get_column_select($layout_def).">'".$this->reporter->db->quote($end)."')\n";
}else{
return "ISNULL(".$this->_get_column_select($layout_def).") OR \n(".$this->_get_column_select($layout_def)."<'".$this->reporter->db->quote($begin)."' OR ".$this->_get_column_select($layout_def).">'".$this->reporter->db->quote($end)."')\n";
}
}
function queryFilterTP_yesterday(& $layout_def) {
global $timedate, $current_user;
$begin_timestamp = time() - 86400;
// begin conversion (same code as queryFilterTP_today)
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
//kbrill bug #13884
//$begin = $timedate->to_display_date_time($begin);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$be = $begin_parts[0] . ' 00:00:00';
$en = $begin_parts[0] . ' 23:59:59';
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $this->assigned_user);
$end = $timedate->handle_offset($en, $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else{
$begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $current_user); // convert to GMT today relative to assigned_user
$end = $timedate->handle_offset($en, $timedate->get_db_date_time_format(), false, $current_user);
}
if ($this->reporter->db->dbType == 'oci8') {
}
if ($this->reporter->db->dbType == 'mysql')
{
if (isset ($layout_def['rel_field'])) {
$field_name = "CONCAT(".$this->_get_column_select($layout_def).",' ',".$layout_def['rel_field'].")";
} else {
$field_name = $this->_get_column_select($layout_def);
}
return $field_name.">='".$this->reporter->db->quote($begin)."' AND ".$field_name."<='".$this->reporter->db->quote($end)."'\n";
}
if ($this->reporter->db->dbType == 'mssql')
{
if (isset ($layout_def['rel_field'])) {
$field_name = $this->_get_column_select($layout_def) . " + ' ' + " . $layout_def['rel_field'].")";
} else {
$field_name = $this->_get_column_select($layout_def);
}
return $field_name.">='".$this->reporter->db->quote($begin)."' AND ".$field_name."<='".$this->reporter->db->quote($end)."'\n";
}
}
function queryFilterTP_today(& $layout_def) {
global $timedate, $current_user;
$begin_timestamp = time();
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp); // get GMT today
//kbrill bug #13884
//$begin = $timedate->to_display_date_time($begin); // convert and handle offset to user's 'display' today
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$be = $begin_parts[0] . ' 00:00:00';
$en = $begin_parts[0] . ' 23:59:59';
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $this->assigned_user); // convert to GMT today relative to assigned_user
$end = $timedate->handle_offset($en, $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else{
$begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $current_user); // convert to GMT today relative to assigned_user
$end = $timedate->handle_offset($en, $timedate->get_db_date_time_format(), false, $current_user);
}
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql'){
if (isset ($layout_def['rel_field'])) {
$field_name = "(".$this->_get_column_select($layout_def)." + ' ' + ".$layout_def['rel_field'].")";
} else {
$field_name = $this->_get_column_select($layout_def);
}
return $field_name.">='".$this->reporter->db->quote($begin)."' AND ".$field_name."<='".$this->reporter->db->quote($end)."'\n";
} else {
if (isset ($layout_def['rel_field'])) {
$field_name = "CONCAT(".$this->_get_column_select($layout_def).",' ',".$layout_def['rel_field'].")";
} else {
$field_name = $this->_get_column_select($layout_def);
}
return $field_name.">='".$this->reporter->db->quote($begin)."' AND ".$field_name."<='".$this->reporter->db->quote($end)."'\n";
}
}
function queryFilterTP_tomorrow(& $layout_def) {
global $timedate, $current_user;
// get tomorrow
$begin_timestamp =time()+ 86400;
// begin conversion (same code as queryFilterTP_today)
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format(), $begin_timestamp);
//kbrill bug #13884
//$begin = $timedate->to_display_date_time($begin);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user);
$begin_parts = explode(' ', $begin);
$be = $begin_parts[0] . ' 00:00:00';
$en = $begin_parts[0] . ' 23:59:59';
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $this->assigned_user);
$end = $timedate->handle_offset($en, $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else{
$begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $current_user);
$end = $timedate->handle_offset($en, $timedate->get_db_date_time_format(), false, $current_user);
}
if ($this->reporter->db->dbType == 'oci8') {
} else {
return $this->_get_column_select($layout_def).">='".$this->reporter->db->quote($begin)."' AND ".$this->_get_column_select($layout_def)."<='".$this->reporter->db->quote($end)."'\n";
}
}
/**
* Get assigned or logged in user's current date and time value.
* @param boolean $timestamp Format of return value, if set to true, return unix like timestamp , else a formatted date.
*/
function get_users_current_date_time($timestamp=false) {
global $current_user;
global $timedate;
$begin = gmdate($GLOBALS['timedate']->get_db_date_time_format());
//kbrill bug #13884
//$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
if (!$timestamp) {
return $begin;
} else {
$begin_parts = explode(' ', $begin);
$date_parts=explode('-', $begin_parts[0]);
$time_parts=explode(':', $begin_parts[1]);
$curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]);
return $curr_timestamp;
}
}
/**
* Get specified date and time for a particalur day, in current user's timezone.
* @param int $days Adjust date by this number of days, negative values are valid.
* @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time
*/
function get_db_date($days,$time) {
global $timedate;
$begin = date($GLOBALS['timedate']->get_db_date_time_format(), time()+(86400 * $days)); //gmt date with day adjustment applied.
//kbrill bug #13884
//$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user);
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
if ($time=='start') {
$begin_parts = explode(' ', $begin);
$be = $begin_parts[0] . ' 00:00:00';
}
else if ($time=='end') {
$begin_parts = explode(' ', $begin);
$be = $begin_parts[0] . ' 23:59:59';
} else {
$be=$begin;
}
//convert date to db format without converting to GMT.
$begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $this->assigned_user);
return $begin;
}
/**
* Get filter string for a date field.
* @param array layout_def field def for field being filtered
* @param string $begin start date value.
* @param string $end End date value.
*/
function get_start_end_date_filter(& $layout_def, $begin,$end) {
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql'){
if (isset ($layout_def['rel_field'])) {
$field_name = "(".$this->_get_column_select($layout_def)." + ' ' + ".$layout_def['rel_field'].")";
} else {
$field_name = $this->_get_column_select($layout_def);
}
return $field_name.">='".$this->reporter->db->quote($begin)."' AND ".$field_name."<='".$this->reporter->db->quote($end)."'\n";
} else {
if (isset ($layout_def['rel_field'])) {
$field_name = "CONCAT(".$this->_get_column_select($layout_def).",' ',".$layout_def['rel_field'].")";
} else {
$field_name = $this->_get_column_select($layout_def);
}
return $field_name.">='".$this->reporter->db->quote($begin)."' AND ".$field_name."<='".$this->reporter->db->quote($end)."'\n";
}
}
function queryFilterTP_last_7_days(& $layout_def) {
$begin=$this->get_db_date(-6,'start');
$end=$this->get_db_date(0,'end');
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_7_days(& $layout_def) {
$begin=$this->get_db_date(0,'start');
$end=$this->get_db_date(6,'end');
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_last_month(& $layout_def) {
global $timedate;
$curr_timestamp= $this->get_users_current_date_time(true);
//Get year and month from time stamp.
$curr_year=date('Y',$curr_timestamp);
$curr_month=date('m',$curr_timestamp);
//get start date for last month and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 month",mktime(0,0,0,$curr_month,1,$curr_year)));
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
//get end date for last month and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 day",mktime(23,59,59,$curr_month,1,$curr_year)));
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), false, $this->assigned_user);
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_this_month(& $layout_def) {
global $timedate;
$curr_timestamp= $this->get_users_current_date_time(true);
//Get year and month from time stamp.
$curr_year=date('Y',$curr_timestamp);
$curr_month=date('m',$curr_timestamp);
//get start date for this month and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,$curr_month,1,$curr_year));
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
//get end date for this month and convert it to gmt and db format.
//first get the first day of next month and move back by one day.
if ($curr_month==12) {
$curr_month=1;
$curr_year+=1;
} else {
$curr_month+=1;
}
$end=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 day",mktime(23,59,59,$curr_month,1,$curr_year)));
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), false, $this->assigned_user);
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_month(& $layout_def) {
global $timedate;
$curr_timestamp= $this->get_users_current_date_time(true);
//Get year and month from time stamp.
$curr_year=date('Y',$curr_timestamp);
$curr_month=date('m',$curr_timestamp);
if ($curr_month==12) {
$curr_month=1;
$curr_year+=1;
} else {
$curr_month+=1;
}
//get start date for next month and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,$curr_month,1,$curr_year));
$begin=$timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
//get end date for next month and convert it to gmt and db format.
//first get first day of the month after and move back by 1 day.
if ($curr_month==12) {
$curr_month=1;
$curr_year+=1;
} else {
$curr_month+=1;
}
$end=date($GLOBALS['timedate']->get_db_date_time_format(),strtotime("-1 day",(strtotime("1 month",mktime(23,59,59,$curr_month,1,$curr_year)))));
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), false, $this->assigned_user);
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_last_30_days(& $layout_def) {
$begin=$this->get_db_date(-29,'start');
$end=$this->get_db_date(0,'end');
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_30_days(& $layout_def) {
$begin=$this->get_db_date(0,'start');
$end=$this->get_db_date(29,'end');
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_last_quarter(& $layout_def) {
// return "LEFT(".$this->_get_column_select($layout_def).",10) BETWEEN (current_date + interval '1' month) AND current_date";
}
function queryFilterTP_this_quarter(& $layout_def) {
}
function queryFilterTP_last_year(& $layout_def) {
global $timedate;
$curr_timestamp= $this->get_users_current_date_time(true);
//Get year and month from time stamp.
$curr_year=date('Y',$curr_timestamp);
$curr_year-=1;
//get start date for last year and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,1,1,$curr_year));
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
//get end date for last year and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(23,59,59,12,31,$curr_year));
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), false, $this->assigned_user);
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_this_year(& $layout_def) {
global $timedate;
$curr_timestamp= $this->get_users_current_date_time(true);
//Get year and month from time stamp.
$curr_year=date('Y',$curr_timestamp);
//get start date for this year and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,1,1,$curr_year));
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
//get end date for this year and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(23,59,59,12,31,$curr_year));
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), false, $this->assigned_user);
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryFilterTP_next_year(& $layout_def) {
global $timedate;
$curr_timestamp= $this->get_users_current_date_time(true);
//Get year and month from time stamp.
$curr_year=date('Y',$curr_timestamp);
$curr_year+=1;
//get start date for this year and convert it to gmt and db format.
$begin=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(0,0,0,1,1,$curr_year));
$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
//get end date for this year and convert it to gmt and db format.
$end=date($GLOBALS['timedate']->get_db_date_time_format(),mktime(23,59,59,12,31,$curr_year));
$end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), false, $this->assigned_user);
return $this->get_start_end_date_filter($layout_def,$begin,$end);
}
function queryGroupBy($layout_def) {
// i guess qualifier and column_function are the same..
if (!empty ($layout_def['qualifier'])) {
$func_name = 'queryGroupBy'.$layout_def['qualifier'];
//print_r($layout_def);
//print $func_name;
if (method_exists($this, $func_name)) {
return $this-> $func_name ($layout_def)." \n";
}
}
return parent :: queryGroupBy($layout_def)." \n";
}
function queryOrderBy($layout_def) {
// i guess qualifier and column_function are the same..
if ($this->reporter->db->dbType == 'mssql'){
//do nothing if this is for mssql, do not run group by
}
elseif (!empty ($layout_def['qualifier'])) {
$func_name ='queryGroupBy'.$layout_def['qualifier'];
if (method_exists($this, $func_name)) {
return $this-> $func_name ($layout_def)."\n";
}
}
$order_by = parent :: queryOrderBy($layout_def)."\n";
return $order_by;
}
function displayListPlain($layout_def) {
global $timedate;
$content = parent:: displayListPlain($layout_def);
// awu: this if condition happens only in Reports where group by month comes back as YYYY-mm format
if (count(explode('-',$content)) == 2){
return $content;
// if date field
}elseif(substr_count($layout_def['type'], 'date') > 0){
// if date time field
if(substr_count($layout_def['type'], 'time') > 0 && $this->get_time_part($content)!= false){
$td = $timedate->to_display_date_time($content);
return $td;
}else{// if date only field
$td = $timedate->to_display_date($content, false); // avoid php notice of returing by reference
return $td;
}
}
}
function get_time_part($date_time_value) {
$date_parts=explode(' ', $date_time_value);
if (count($date_parts) == 2) {
$time=$date_parts[1];
} else {
$time=false;
}
return $time;
}
function displayList($layout_def) {
global $timedate;
// i guess qualifier and column_function are the same..
if (!empty ($layout_def['column_function'])) {
$func_name = 'displayList'.$layout_def['column_function'];
if (method_exists($this, $func_name)) {
return $this-> $func_name ($layout_def);
}
}
$content = parent :: displayListPlain($layout_def);
return $timedate->to_display_date_time($content);
}
function querySelect(& $layout_def) {
// i guess qualifier and column_function are the same..
if (!empty ($layout_def['column_function'])) {
$func_name = 'querySelect'.$layout_def['column_function'];
if (method_exists($this, $func_name)) {
return $this-> $func_name ($layout_def)." \n";
}
}
return parent :: querySelect($layout_def)." \n";
}
function & displayListday(& $layout_def) {
return parent:: displayListPlain($layout_def);
}
function & displayListyear(& $layout_def) {
global $app_list_strings;
//if ($this->reporter->db->dbType == 'oci8' || $this->reporter->db->dbType == 'mssql') {
return parent:: displayListPlain($layout_def);
//}
/*else{
$match = array();
if (preg_match('/(\d{4})/', $this->displayListPlain($layout_def), $match)) {
return $match[1];
}
$temp = null; // avoid notices
return $temp;
}*/
}
function & displayListmonth(& $layout_def) {
global $app_list_strings;
$display = '';
$match = array();
if (preg_match('/(\d{4})-(\d\d)/', $this->displayListPlain($layout_def), $match)) {
$match[2] = preg_replace('/^0/', '', $match[2]);
$display = $app_list_strings['dom_cal_month_long'][$match[2]]." {$match[1]}";
}
return $display;
}
function querySelectmonth(& $layout_def) {
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql') {
//return "LEFT( ".$this->_get_column_select($layout_def).",6 ) ".$this->_get_column_alias($layout_def)." \n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ",121),7)".$this->_get_column_alias($layout_def)." \n";
} else {
return "LEFT( ".$this->_get_column_select($layout_def).",7 ) ".$this->_get_column_alias($layout_def)." \n";
}
}
function queryGroupByMonth($layout_def) {
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql') {
//return "LEFT(".$this->_get_column_select($layout_def).", 6) \n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ", 121),7) \n";
}else {
return "LEFT(".$this->_get_column_select($layout_def).", 7) \n";
}
}
function querySelectday($layout_def) {
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql') {
//return "LEFT(".$this->_get_column_select($layout_def).", 6) \n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ",121),10)".$this->_get_column_alias($layout_def)." \n";
}else {
return "LEFT(".$this->_get_column_select($layout_def).", 10)".$this->_get_column_alias($layout_def)." \n";
}
}
function queryGroupByDay($layout_def) {
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql') {
//return "LEFT(".$this->_get_column_select($layout_def).", 6) \n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ", 121),10) \n";
}else {
return "LEFT(".$this->_get_column_select($layout_def).", 10) \n";
}
}
function querySelectyear(& $layout_def) {
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql') {
//return "LEFT( ".$this->_get_column_select($layout_def).",5 ) ".$this->_get_column_alias($layout_def)." \n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ",121),4) ".$this->_get_column_alias($layout_def)." \n";
} else {
return "LEFT( ".$this->_get_column_select($layout_def).",4 ) ".$this->_get_column_alias($layout_def)." \n";
}
}
function queryGroupByYear($layout_def) {
if ($this->reporter->db->dbType == 'oci8') {
}elseif($this->reporter->db->dbType == 'mssql') {
//return "LEFT(".$this->_get_column_select($layout_def).", 5) \n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ",121),4) \n";
} else {
return "LEFT(".$this->_get_column_select($layout_def).", 4) \n";
}
}
function querySelectquarter(& $layout_def) {
if ($this->reporter->db->dbType == 'oci8') {
}
elseif ($this->reporter->db->dbType == 'mysql')
{
return "CONCAT(LEFT(".$this->_get_column_select($layout_def).", 4), '-', QUARTER(".$this->_get_column_select($layout_def).") )".$this->_get_column_alias($layout_def)."\n";
}
elseif ($this->reporter->db->dbType == 'mssql')
{
//return "LEFT(".$this->_get_column_select($layout_def).", 4) + '-' + convert(varchar(20), DatePart(q," . $this->_get_column_select($layout_def).") ) ".$this->_get_column_alias($layout_def)."\n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ",121),4)+ '-' + convert(varchar(20), DatePart(q," . $this->_get_column_select($layout_def).") ) ".$this->_get_column_alias($layout_def)."\n";
}
}
function displayListquarter(& $layout_def) {
$match = array();
if (preg_match('/(\d{4})-(\d)/', $this->displayListPlain($layout_def), $match)) {
return "Q".$match[2]." ".$match[1];
}
return '';
}
function queryGroupByQuarter($layout_def) {
$this->getReporter();
if ($this->reporter->db->dbType == 'oci8') {
}elseif ($this->reporter->db->dbType == 'mysql')
{
return "CONCAT(LEFT(".$this->_get_column_select($layout_def).", 4), '-', QUARTER(".$this->_get_column_select($layout_def).") )\n";
}
elseif ($this->reporter->db->dbType == 'mssql')
{
//return "LEFT(".$this->_get_column_select($layout_def).", 4) + '-' + convert(varchar(20), DatePart(q," . $this->_get_column_select($layout_def).") )\n";
return "LEFT(CONVERT (varchar(20), ". $this->_get_column_select($layout_def). ",121),4) + '-' + convert(varchar(20), DatePart(q," . $this->_get_column_select($layout_def).") )\n";
}
}
function displayInput(&$layout_def) {
global $timedate, $image_path, $current_language, $app_strings;
$home_mod_strings = return_module_language($current_language, 'Home');
$filterTypes = array(' ' => $app_strings['LBL_NONE'],
'TP_today' => $home_mod_strings['LBL_TODAY'],
'TP_yesterday' => $home_mod_strings['LBL_YESTERDAY'],
'TP_tomorrow' => $home_mod_strings['LBL_TOMORROW'],
'TP_this_month' => $home_mod_strings['LBL_THIS_MONTH'],
'TP_this_year' => $home_mod_strings['LBL_THIS_YEAR'],
'TP_last_30_days' => $home_mod_strings['LBL_LAST_30_DAYS'],
'TP_last_7_days' => $home_mod_strings['LBL_LAST_7_DAYS'],
'TP_last_month' => $home_mod_strings['LBL_LAST_MONTH'],
'TP_last_year' => $home_mod_strings['LBL_LAST_YEAR'],
'TP_next_30_days' => $home_mod_strings['LBL_NEXT_30_DAYS'],
'TP_next_7_days' => $home_mod_strings['LBL_NEXT_7_DAYS'],
'TP_next_month' => $home_mod_strings['LBL_NEXT_MONTH'],
'TP_next_year' => $home_mod_strings['LBL_NEXT_YEAR'],
);
$cal_dateformat = $timedate->get_cal_date_format();
$str = "<select name='type_{$layout_def['name']}'>";
$str .= get_select_options_with_id($filterTypes, (empty($layout_def['input_name0']) ? '' : $layout_def['input_name0']));
// foreach($filterTypes as $value => $label) {
// $str .= '<option value="' . $value . '">' . $label. '</option>';
// }
$str .= "</select>";
/* $str .= "<input id='jscal_field{$layout_def['name']}' name='date_{$layout_def['name']}' onblur='parseDate(this, \"{$cal_dateformat}\");' tabindex='1' size='11' maxlength='10' type='text' value='{$layout_def['input_name0']}'>
<img src='themes/default/images/jscalendar.gif' alt='{$cal_dateformat}' id='jscal_trigger' align='absmiddle'>
<script type='text/javascript'>
Calendar.setup ({
inputField : 'jscal_field{$layout_def['name']}', ifFormat : '{$cal_dateformat}', onClose: function(cal) { cal.hide();}, showsTime : false, button : 'jscal_trigger', singleClick : true, step : 1
});
</script>";*/
return $str;
}
}
?>

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".
********************************************************************************/
require_once('include/generic/SugarWidgets/SugarWidgetFielddatetime.php');
class SugarWidgetFieldDateTimecombo extends SugarWidgetFieldDateTime {
var $reporter;
var $assigned_user=null;
function SugarWidgetFieldDateTimecombo(&$layout_manager) {
parent::SugarWidgetFieldDateTime($layout_manager);
$this->reporter = $this->layout_manager->getAttribute('reporter');
}
function queryFilterOn(& $layout_def) {
global $timedate;
if($this->getAssignedUser()) {
$ontime = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else {
$ontime = $layout_def['input_name0'];
}
return $this->_get_column_select($layout_def)."='".$this->reporter->db->quote($ontime)."' \n";
}
//TODO:now for date time field , we just search from date start to date end. The time is from 00:00:00 to 23:59:59
//If there is requirement, we can modify report.js::addFilterInputDatetimesBetween and this function
function queryFilterBetween_Datetimes(& $layout_def) {
global $timedate;
if($this->getAssignedUser()) {
$begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user);
$end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user);
}
else {
$begin = $layout_def['input_name0'];
$end = $layout_def['input_name1'];
}
return "(".$this->_get_column_select($layout_def).">='".$this->reporter->db->quote($begin)."' AND \n".$this->_get_column_select($layout_def)."<='".$this->reporter->db->quote($end)."')\n";
}
}
?>

View File

@@ -0,0 +1,47 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldDecimal extends SugarWidgetFieldInt
{
function displayList($layout_def)
{
require_once('modules/Currencies/Currency.php');
return format_number($this->displayListPlain($layout_def), 2, 2);
}
}
?>

View File

@@ -0,0 +1,46 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldDouble extends SugarWidgetFieldInt
{
function SugarWidgetFieldDouble(&$layout_manager) {
parent::SugarWidgetFieldInt($layout_manager);
}
}
?>

View File

@@ -0,0 +1,44 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldEmail extends SugarWidgetFieldVarchar
{
}
?>

View File

@@ -0,0 +1,193 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldEnum extends SugarWidgetReportField {
function SugarWidgetFieldEnum(&$layout_manager) {
parent::SugarWidgetReportField($layout_manager);
$this->reporter = $this->layout_manager->getAttribute('reporter');
}
function queryFilterEmpty(&$layout_def)
{
if( $this->reporter->db->dbType == 'mysql') {
return '( '.$this->_get_column_select($layout_def).' IS NULL OR '.$this->_get_column_select($layout_def)."='' )\n";
}
elseif( $this->reporter->db->dbType == 'mssql') {
return '( '.$this->_get_column_select($layout_def).' IS NULL OR '.$this->_get_column_select($layout_def)." LIKE '' )\n";
}
}
function queryFilterNot_Empty(&$layout_def)
{
$reporter = $this->layout_manager->getAttribute("reporter");
if( $this->reporter->db->dbType == 'mysql') {
return '( '.$this->_get_column_select($layout_def).' IS NOT NULL AND '.$this->_get_column_select($layout_def)."<>'' )\n";
}
else if( $this->reporter->db->dbType == 'mssql') {
return $this->_get_column_select($layout_def).' IS NOT NULL ' . "\n";
}
}
function queryFilteris(& $layout_def) {
$input_name0 = $layout_def['input_name0'];
if (is_array($layout_def['input_name0'])) {
$input_name0 = $layout_def['input_name0'][0];
}
return $this->_get_column_select($layout_def)." = '".$GLOBALS['db']->quote($input_name0)."'\n";
}
function queryFilterone_of(& $layout_def) {
$arr = array ();
foreach ($layout_def['input_name0'] as $value) {
$arr[] = "'".$GLOBALS['db']->quote($value)."'";
}
$reporter = $this->layout_manager->getAttribute("reporter");
$str = implode(",", $arr);
return $this->_get_column_select($layout_def)." IN (".$str.")\n";
}
function & displayListPlain($layout_def) {
$field_def = $this->reporter->all_fields[$layout_def['column_key']];
if (empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))
$value = $this->_get_list_value($layout_def);
$cell = translate($field_def['options'], $field_def['module'], $value);
if (is_array($cell)) {
$cell = str_replace('^,^' ,', ', $value);
}
return $cell;
}
function & queryOrderBy($layout_def) {
$field_def = $this->reporter->all_fields[$layout_def['column_key']];
if (!empty ($field_def['sort_on'])) {
$order_by = $layout_def['table_alias'].".".$field_def['sort_on'];
} else {
$order_by = $this->_get_column_select($layout_def);
}
$list = translate($field_def['options'], $field_def['module']);
$order_by_arr = array ();
if (empty ($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') {
$order_dir = " DESC";
} else {
$order_dir = " ASC";
}
foreach ($list as $key => $value) {
array_push($order_by_arr, $order_by."='".$key."' $order_dir\n");
}
$thisarr = implode(',', $order_by_arr);
return $thisarr;
}
function displayInput(&$layout_def) {
global $app_list_strings;
if(!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) {
if ( isset($layout_def['options']) && is_array($layout_def['options']) ) {
$ops = $layout_def['options'];
}
elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){
$ops = $app_list_strings[$layout_def['options']];
if(array_key_exists('', $app_list_strings[$layout_def['options']])) {
unset($ops['']);
}
}
else{
$ops = array();
}
}
else {
$ops = $app_list_strings[$layout_def['options']];
}
$str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">';
$str .= get_select_options_with_id($ops, $layout_def['input_name0']);
$str .= '</select>';
return $str;
}
}
?>

View File

@@ -0,0 +1,73 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldFloat extends SugarWidgetFieldInt
{
function displayList($layout_def)
{
require_once('modules/Currencies/Currency.php');
return format_number($this->displayListPlain($layout_def), 2, 2);
}
function queryFilterEquals(&$layout_def)
{
return $this->_get_column_select($layout_def)."= ".$GLOBALS['db']->quote($layout_def['input_name0'])."\n";
}
function queryFilterNot_Equals(&$layout_def)
{
return $this->_get_column_select($layout_def)."!=".$GLOBALS['db']->quote($layout_def['input_name0'])."\n";
}
function queryFilterGreater(&$layout_def)
{
return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote($layout_def['input_name0'])."\n";
}
function queryFilterLess(&$layout_def)
{
return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote($layout_def['input_name0'])."\n";
}
function queryFilterBetween(&$layout_def)
{
return $this->_get_column_select($layout_def)." BETWEEN ".$GLOBALS['db']->quote($layout_def['input_name0']). " AND " . $GLOBALS['db']->quote($layout_def['input_name1']) . "\n";
}
}
?>

View File

@@ -0,0 +1,51 @@
<?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/generic/SugarWidgets/SugarWidgetFieldname.php');
class SugarWidgetFieldFullname extends SugarWidgetFieldName
{
/*
function SugarWidgetFieldName(&$layout_manager) {
parent::SugarWidgetFieldVarchar($layout_manager);
$this->reporter = $this->layout_manager->getAttribute('reporter');
}*/
}
?>

View File

@@ -0,0 +1,49 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldId extends SugarWidgetReportField
{
function queryFilterIs(&$layout_def)
{
return $this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
}
?>

View File

@@ -0,0 +1,46 @@
<?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 SugarWidgetFieldImage extends SugarWidgetFieldVarchar
{
function displayListPlain($layout_def) {
$value = $this->_get_list_value($layout_def);
return "<a href=\"javascript:SUGAR.image.lightbox('index.php?entryPoint=download&id=$value&type=SugarFieldImage&isTempFile=1')\">"
. translate("LBL_VIEW_IMAGE") . '</a>';
}
}

View File

@@ -0,0 +1,76 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldInt extends SugarWidgetReportField
{
function displayList($layout_def)
{
require_once('modules/Currencies/Currency.php');
return $this->displayListPlain($layout_def);
}
function queryFilterEquals(&$layout_def)
{
return $this->_get_column_select($layout_def)."= '".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
function queryFilterNot_Equals(&$layout_def)
{
return $this->_get_column_select($layout_def)."!='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
function queryFilterGreater(&$layout_def)
{
return $this->_get_column_select($layout_def)." > '".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
function queryFilterLess(&$layout_def)
{
return $this->_get_column_select($layout_def)." < '".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
function queryFilterBetween(&$layout_def)
{
return $this->_get_column_select($layout_def)." BETWEEN '".$GLOBALS['db']->quote($layout_def['input_name0']). "' AND '" . $GLOBALS['db']->quote($layout_def['input_name1']) . "'\n";
}
}
?>

View File

@@ -0,0 +1,45 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFieldtext.php');
class SugarWidgetFieldLongtext extends SugarWidgetFieldText
{
}
?>

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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFieldenum.php');
class SugarWidgetFieldMultiEnum extends SugarWidgetFieldEnum {
function queryFilterone_of(& $layout_def) {
$arr = array ();
foreach ($layout_def['input_name0'] as $value) {
array_push($arr, "'".$GLOBALS['db']->quote($value)."'");
}
$reporter = $this->layout_manager->getAttribute("reporter");
$col_name = $this->_get_column_select($layout_def) . " LIKE " ;
$arr_count = count($arr);
$query = "";
foreach($arr as $key=>$val) {
$query .= $col_name;
$value = preg_replace("/^'/", "'%", $val, 1);
$value = preg_replace("/'$/", "%'", $value, 1);
$query .= $value;
if ($key != ($arr_count - 1))
$query.= " OR " ;
}
return '('.$query.')';
}
function queryFilteris(& $layout_def) {
$input_name0 = $layout_def['input_name0'];
if (is_array($layout_def['input_name0'])) {
$input_name0 = $layout_def['input_name0'][0];
}
return $this->_get_column_select($layout_def)." like '%".$GLOBALS['db']->quote($input_name0)."%'\n";
}
}
?>

View File

@@ -0,0 +1,210 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Sugar widget for fieldnames
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFieldvarchar.php');
class SugarWidgetFieldName extends SugarWidgetFieldVarchar
{
function SugarWidgetFieldName(&$layout_manager) {
parent::SugarWidgetFieldVarchar($layout_manager);
$this->reporter = $this->layout_manager->getAttribute('reporter');
}
function displayList(&$layout_def)
{
if(empty($layout_def['column_key']))
{
return $this->displayListPlain($layout_def);
}
$module = $this->reporter->all_fields[$layout_def['column_key']]['module'];
$name = $layout_def['name'];
$layout_def['name'] = 'id';
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
if(empty($layout_def['fields'][$key]))
{
$layout_def['name'] = $name;
return $this->displayListPlain($layout_def);
}
$record = $layout_def['fields'][$key];
$layout_def['name'] = $name;
$str = "<a target='_blank' class=\"listViewTdLinkS1\" href=\"index.php?action=DetailView&module=$module&record=$record\">";
$str .= $this->displayListPlain($layout_def);
$str .= "</a>";
return $str;
}
function _get_column_select($layout_def)
{
global $sugar_config;
// if $this->db->dbytpe is empty, then grab dbtype value from global array "$sugar_config[dbconfig]"
if(empty($this->db->dbType)){
$this->db->dbType = $sugar_config['dbconfig']['db_type'];
}
$field_def = $this->reporter->all_fields[$layout_def['column_key']];
if (empty($field_def['fields']) || empty($field_def['fields'][0]) || empty($field_def['fields'][1]))
{
return parent::_get_column_select($layout_def);
}
// 'fields' are the two fields to concat to create the name
$alias = '';
$endalias = '';
if ( ! empty($layout_def['table_alias']))
{
if ($this->db->dbType == 'mysql')
{
$alias .= "CONCAT(CONCAT(IFNULL("
.$layout_def['table_alias']."."
.$field_def['fields'][0].",''),' '),"
.$layout_def['table_alias']."."
.$field_def['fields'][1].")";
}
elseif ( $this->db->dbType == 'mssql' )
{
$alias .= $layout_def['table_alias'] . '.' . $field_def['fields'][0] . " + ' ' + "
. $layout_def['table_alias'] . '.' . $field_def['fields'][1]."";
}
}
elseif (! empty($layout_def['name']))
{
$alias = $layout_def['name'];
}
else
{
$alias .= "*";
}
$alias .= $endalias;
return $alias;
}
function queryFilterIs($layout_def)
{
require_once('include/generic/SugarWidgets/SugarWidgetFieldid.php');
$layout_def['name'] = 'id';
$layout_def['type'] = 'id';
$input_name0 = $layout_def['input_name0'];
if ( is_array($layout_def['input_name0']))
{
$input_name0 = $layout_def['input_name0'][0];
}
if ($input_name0 == 'Current User') {
global $current_user;
$input_name0 = $current_user->id;
}
return SugarWidgetFieldid::_get_column_select($layout_def)."='"
.$GLOBALS['db']->quote($input_name0)."'\n";
}
// $rename_columns, if true then you're coming from reports
function queryFilterone_of(&$layout_def, $rename_columns = true)
{
require_once('include/generic/SugarWidgets/SugarWidgetFieldid.php');
if($rename_columns) { // this was a hack to get reports working, sugarwidgets should not be renaming $name!
$layout_def['name'] = 'id';
$layout_def['type'] = 'id';
}
$arr = array();
foreach($layout_def['input_name0'] as $value)
{
if ($value == 'Current User') {
global $current_user;
array_push($arr,"'".$GLOBALS['db']->quote($current_user->id)."'");
}
else
array_push($arr,"'".$GLOBALS['db']->quote($value)."'");
}
$str = implode(",",$arr);
return SugarWidgetFieldid::_get_column_select($layout_def)." IN (".$str.")\n";
}
function &queryGroupBy($layout_def)
{
if( $this->reporter->db->dbType == 'mysql') {
if($layout_def['name'] == 'full_name') {
$layout_def['name'] = 'id';
$layout_def['type'] = 'id';
require_once('include/generic/SugarWidgets/SugarWidgetFieldid.php');
$group_by = SugarWidgetFieldid::_get_column_select($layout_def)."\n";
}
else {
// group by clause for user name passes through here.
// $layout_def['name'] = 'name';
// $layout_def['type'] = 'name';
$group_by = $this->_get_column_select($layout_def)."\n";
}
}
elseif( $this->reporter->db->dbType == 'mssql') {
$group_by = $this->_get_column_select($layout_def);
}
return $group_by;
}
}
?>

View File

@@ -0,0 +1,43 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldNum extends SugarWidgetFieldInt
{
}
?>

View File

@@ -0,0 +1,59 @@
<?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/generic/SugarWidgets/SugarWidgetFieldenum.php');
class SugarWidgetFieldparent_type extends SugarWidgetFieldEnum
{
function SugarWidgetFieldparent_type(&$layout_manager) {
parent::SugarWidgetFieldEnum($layout_manager);
$this->reporter = $this->layout_manager->getAttribute('reporter');
}
function displayListPlain($layout_def) {
$value= $this->_get_list_value($layout_def);
if (isset($layout_def['widget_type']) && $layout_def['widget_type'] =='checkbox') {
if ($value != '' && ($value == 'on' || intval($value) == 1 || $value == 'yes'))
{
return "<input name='checkbox_display' class='checkbox' type='checkbox' disabled='true' checked>";
}
return "<input name='checkbox_display' class='checkbox' type='checkbox' disabled='true'>";
}
return $value;
}
}
?>

View File

@@ -0,0 +1,44 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldPhone extends SugarWidgetFieldVarchar
{
}
?>

View File

@@ -0,0 +1,43 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFieldenum.php');
class SugarWidgetFieldRadioEnum extends SugarWidgetFieldEnum {
}
?>

View File

@@ -0,0 +1,53 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldRelate extends SugarWidgetReportField
{
function displayListPlain($layout_def) {
$reporter = $this->layout_manager->getAttribute("reporter");
$field_def = $reporter->all_fields[$layout_def['column_key']];
$display = strtoupper($field_def['secondary_table'].'_name');
$recordField = strtoupper($layout_def['table_alias']).'_'.strtoupper($layout_def['name']);
$record = $layout_def['fields'][$recordField];
$cell = "<a target='_blank' class=\"listViewTdLinkS1\" href=\"index.php?action=DetailView&module=".$field_def['ext2']."&record=$record\">";
$cell .= $layout_def['fields'][$display];
$cell .= "</a>";
return $cell;
}
}
?>

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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFieldenum.php');
class SugarWidgetFieldSingleEnum extends SugarWidgetFieldEnum {
function displayInput(&$layout_def) {
global $app_list_strings;
if(!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) {
if ( is_array($layout_def['options']) ) {
$ops = $layout_def['options'];
}
elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){
$ops = $app_list_strings[$layout_def['options']];
if(array_key_exists('', $app_list_strings[$layout_def['options']])) {
unset($ops['']);
}
}
else{
$ops = array();
}
}
else {
$ops = $app_list_strings[$layout_def['options']];
}
$str = '<select name="' . $layout_def['name'] . '">';
$str .= get_select_options_with_id($ops, $layout_def['input_name0']);
$str .= '</select>';
return $str;
}
}
?>

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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldText extends SugarWidgetFieldVarchar
{
function SugarWidgetFieldText(&$layout_manager) {
parent::SugarWidgetFieldVarchar($layout_manager);
$this->reporter = $this->layout_manager->getAttribute('reporter');
}
function queryFilterEquals(&$layout_def) {
if( $this->reporter->db->dbType == 'mysql') {
return parent::queryFilterEquals($layout_def);
}
elseif( $this->reporter->db->dbType == 'mssql') {
//return parent::queryFilterEquals($layout_def);
return $this->_get_column_select($layout_def)." like '".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
}
function queryFilterNot_Equals_Str(&$layout_def) {
if( $this->reporter->db->dbType == 'mysql') {
return parent::queryFilterNot_Equals_Str($layout_def);
}
elseif( $this->reporter->db->dbType == 'mssql') {
return parent::queryFilterNot_Equals_Str($layout_def);
}
}
function queryFilterNot_Empty(&$layout_def) {
if( $this->reporter->db->dbType == 'mysql') {
return parent::queryFilterNot_Empty($layout_def);
}
elseif( $this->reporter->db->dbType == 'mssql') {
return '( '.$this->_get_column_select($layout_def).' IS NOT NULL OR DATALENGTH('.$this->_get_column_select($layout_def).") > 0)\n";
}
}
function queryFilterEmpty(&$layout_def) {
if( $this->reporter->db->dbType == 'mysql') {
return parent::queryFilterEmpty($layout_def);
}
elseif( $this->reporter->db->dbType == 'mssql') {
return '( '.$this->_get_column_select($layout_def).' IS NULL OR DATALENGTH('.$this->_get_column_select($layout_def).") = 0)\n";
}
}
}
?>

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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldTime extends SugarWidgetFieldDateTime
{
function displayList($layout_def)
{
global $timedate;
// i guess qualifier and column_function are the same..
if (! empty($layout_def['column_function']))
{
$func_name = 'displayList'.$layout_def['column_function'];
if ( method_exists($this,$func_name))
{
return $this->$func_name($layout_def)." \n";
}
}
// Get the date context of the time, important for DST
$layout_def_date = $layout_def;
$layout_def_date['name'] = str_replace('time', 'date', $layout_def_date['name']);
$date = $this->displayListPlain($layout_def_date);
$content = $this->displayListPlain($layout_def);
if(!empty($date)) { // able to get the date context of the time
$td = explode(' ', $timedate->to_display_date_time($date . ' ' . $content));
return $td[1];
}
else { // assume there is no time context
return $timedate->to_display_time($content);
}
}
}
?>

View File

@@ -0,0 +1,43 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldURL extends SugarWidgetReportField
{
}
?>

View File

@@ -0,0 +1,50 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetFieldname.php');
class SugarWidgetFielduser_name extends SugarWidgetFieldname
{
function displayInput(&$layout_def)
{
$selected_users = empty($layout_def['input_name0']) ? '' : $layout_def['input_name0'];
$str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>';
return $str;
}
}
?>

View File

@@ -0,0 +1,81 @@
<?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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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 SugarWidgetFieldVarchar extends SugarWidgetReportField
{
function queryFilterEquals(&$layout_def)
{
return $this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
function queryFilterNot_Equals_Str(&$layout_def)
{
return $this->_get_column_select($layout_def)."!='".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
function queryFilterContains(&$layout_def)
{
return $this->_get_column_select($layout_def)." LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n";
}
function queryFilterStarts_With(&$layout_def)
{
return $this->_get_column_select($layout_def)." LIKE '".$GLOBALS['db']->quote($layout_def['input_name0'])."%'\n";
}
function queryFilterEnds_With(&$layout_def)
{
return $this->_get_column_select($layout_def)." LIKE '%".$GLOBALS['db']->quote($layout_def['input_name0'])."'\n";
}
function queryFilterone_of(&$layout_def)
{
foreach($layout_def['input_name0'] as $key => $value) {
$layout_def['input_name0'][$key] = $GLOBALS['db']->quote($value);
}
return $this->_get_column_select($layout_def) . " IN ('" . implode("','", $layout_def['input_name0']) . "')\n";
}
function displayInput(&$layout_def)
{
$str = '<input type="text" size="20" value="' . $layout_def['input_name0'] . '" name="' . $layout_def['name'] . '">';
return $str;
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetGetPriceFromPriceBook extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus;
$id = $layout_def['fields']['ID'];
$r=mysql_fetch_array(mysql_query("select price from ecmpricebooks_ecmproducts where ecmproduct_id='".$_REQUEST['record']."' and ecmpricebook_id='".$id."'"));
return number_format($r['price'],2,",",".");
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetProductName extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus;
$id = $layout_def['fields']['PRODUCT_ID'];
$r=mysql_fetch_array(mysql_query("select name from ecmproducts where id='".$id."'"));
return '<a href="index.php?module=EcmProducts&action=DetailView&record='.$id.'">'.$r['name'].'</a>';
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetPzName extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus;
$id = $layout_def['fields']['PZ_ID'];
$r=mysql_fetch_array(mysql_query("select name from ecmpzdocuments where id='".$id."'"));
return '<a href="index.php?module=EcmPzDocuments&action=DetailView&record='.$id.'">'.$r['name'].'</a>';
}
}
?>

View File

@@ -0,0 +1,376 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetField
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
$used_aliases = array();
$alias_map = array();
class SugarWidgetReportField extends SugarWidgetField
{
function SugarWidgetReportField(&$layout_manager) {
parent::SugarWidgetField($layout_manager);
}
function getSubClass($layout_def)
{
if (! empty($layout_def['type']))
{
if ($layout_def['type'] == 'time') {
$layout_def['widget_class'] = 'Fielddate';
} else {
$layout_def['widget_class'] = 'Field'.$layout_def['type'];
}
return $this->layout_manager->getClassFromWidgetDef($layout_def);
} else {
return $this;
}
}
function display($layout_def)
{
$obj = $this->getSubClass($layout_def);
$context = $this->layout_manager->getAttribute('context');//_ppd($context);
$func_name = 'display'.$context;
if ( ! empty($context) && method_exists($obj,$func_name))
{
return $obj->$func_name($layout_def);
} else
{
return 'display not found:'.$func_name;
}
}
function _get_column_select_special($layout_def)
{
$alias = '';
if ( ! empty($layout_def['table_alias']))
{
$alias = $layout_def['table_alias'];
}
$reporter = $this->layout_manager->getAttribute("reporter");
if ($layout_def['name'] == 'weighted_sum' )
{
return "SUM( ".$alias.".probability * ".$alias.".amount_usdollar * 0.01) ";
}
if ($layout_def['name'] == 'weighted_amount' )
{
return "AVG(".$alias.".probability * ".$alias.".amount_usdollar * 0.01) ";
}
}
function _get_column_select($layout_def)
{
global $reportAlias;
if (!isset($reportAlias)) {
$reportAlias = array();
}
$alias = '';
$endalias = '';
if ( ! empty($layout_def['group_function']) )
{
if ($layout_def['name'] == 'weighted_sum' || $layout_def['name'] == 'weighted_amount')
{
$alias = $this->_get_column_select_special($layout_def);
$reportAlias[$alias] = $layout_def;
return $alias;
}
$reporter = $this->layout_manager->getAttribute('reporter');
$alias .= $layout_def['group_function']."(";
$endalias = ')';
}
if ( ! empty($layout_def['table_alias']))
{
$alias .= $layout_def['table_alias'].".".$layout_def['name'];
}else if (! empty($layout_def['name'])) {
$alias = $layout_def['name'];
} else {
$alias .= "*";
}
$alias .= $endalias;
$reportAlias[$alias] = $layout_def;
return $alias;
}
function querySelect(&$layout_def)
{
return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)."\n";
}
function queryGroupBy($layout_def)
{
return $this->_get_column_select($layout_def)." \n";
}
function queryOrderBy($layout_def)
{
$reporter = $this->layout_manager->getAttribute('reporter');
if(!empty($reporter->all_fields[$layout_def['column_key']])) $field_def = $reporter->all_fields[$layout_def['column_key']];
if ( ! empty( $field_def['sort_on']))
{
$order_by = $layout_def['table_alias'].".".$field_def['sort_on'];
if(!empty($field_def['sort_on2']))
$order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2'];
}
else {
$order_by = $this->_get_column_alias($layout_def)." \n";
}
if ( empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
{
return $order_by." ASC";
} else {
return $order_by." DESC";
}
}
function queryFilter($layout_def)
{
$method_name = "queryFilter".$layout_def['qualifier_name'];
return $this->$method_name($layout_def);
}
function displayHeaderCell($layout_def)
{
global $start_link_wrapper,$end_link_wrapper;
require_once("include/ListView/ListView.php");
// don't show sort links if name isn't defined
$no_sort = $this->layout_manager->getAttribute('no_sort');
if(empty($layout_def['name']) || ! empty($no_sort) || ! empty($layout_def['no_sort']))
{
return $layout_def['label'];
}
$sort_by ='';
if ( ! empty($layout_def['table_key']) && ! empty($layout_def['name']) )
{
if (! empty($layout_def['group_function']) && $layout_def['group_function'] == 'count')
{
$sort_by = 'count';
} else {
$sort_by = $layout_def['table_key'].":".$layout_def['name'];
if ( ! empty($layout_def['column_function']))
{
$sort_by .= ':'.$layout_def['column_function'];
} else if ( ! empty($layout_def['group_function']) )
{
$sort_by .= ':'.$layout_def['group_function'];
}
}
}
else
{
return $this->displayHeaderCellPlain($layout_def);
}
$start = $start_link_wrapper;
$end = $end_link_wrapper;
$start = empty($start) ? '': $start;
$end = empty($end) ? '': $end;
// unable to retrieve the vardef here, exclude columns of type clob/text from being sortable
if(!in_array($layout_def['name'], array('description', 'account_description', 'lead_source_description', 'status_description', 'to_addrs', 'cc_addrs', 'bcc_addrs', 'work_log', 'objective', 'resolution'))) {
$header_cell = "<a class=\"listViewThLinkS1\" href=\"".$start.$sort_by.$end."\">";
$header_cell .= $this->displayHeaderCellPlain($layout_def);
$arrow_start = ListView::getArrowStart($this->layout_manager->getAttribute('image_path'));
$arrow_end = ListView::getArrowEnd($this->layout_manager->getAttribute('image_path'));
$imgArrow = '';
if (isset($layout_def['sort']))
{
$imgArrow = $layout_def['sort'];
}
$header_cell .= ' ' . $arrow_start.$imgArrow.$arrow_end."</a>";
}
else {
$header_cell = $this->displayHeaderCellPlain($layout_def);
}
return $header_cell;
}
function query($layout_def)
{
$obj = $this->getSubClass($layout_def);
$context = $this->layout_manager->getAttribute('context');
$func_name = 'query'.$context;
if ( ! empty($context) && method_exists($obj,$func_name))
{
return $obj->$func_name($layout_def);
} else
{
return '';
}
}
function _get_column_alias($layout_def)
{
$alias_arr = array();
if ($layout_def['table_key'] == 'self' && !empty($layout_def['name']) && $layout_def['name'] == 'id')
{
return 'primaryid';
}
if ( ! empty($layout_def['group_function']) && $layout_def['group_function']=='count')
{
return 'count';
}
if ( ! empty($layout_def['table_alias']))
{
array_push($alias_arr,$layout_def['table_alias']);
}
if ( ! empty($layout_def['group_function']) && $layout_def['group_function'] != 'weighted_amount' && $layout_def['group_function'] != 'weighted_sum')
{
array_push($alias_arr,$layout_def['group_function']);
} else if ( ! empty($layout_def['column_function']))
{
array_push($alias_arr,$layout_def['column_function']);
} else if ( ! empty($layout_def['qualifier']))
{
array_push($alias_arr,$layout_def['qualifier']);
}
if ( ! empty($layout_def['name']))
{
array_push($alias_arr,$layout_def['name']);
}
global $used_aliases,$alias_map;
$alias = strtolower(implode("_",$alias_arr));
$short_alias = substr($alias,0,28);
if ( empty($used_aliases[$short_alias]))
{
$alias_map[$alias] = $short_alias;
$used_aliases[$short_alias] = 1;
return $short_alias;
} else if ( ! empty($alias_map[$alias]) )
{
return $alias_map[$alias];
} else {
$alias_map[$alias] = $short_alias.'_'.$used_aliases[$short_alias];
$used_aliases[$short_alias]++;
return $alias_map[$alias];
}
}
function queryFilterEmpty(&$layout_def)
{
return '( '.$this->_get_column_select($layout_def).' IS NULL OR '.$this->_get_column_select($layout_def)."='' )\n";
}
function queryFilterIs(&$layout_def)
{
return '( '.$this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n";
}
function queryFilterNot_Empty(&$layout_def)
{
$reporter = $this->layout_manager->getAttribute("reporter");
return '( '.$this->_get_column_select($layout_def).' IS NOT NULL AND '.$this->_get_column_select($layout_def)."<>'' )\n";
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetStockName extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus;
$id = $layout_def['fields']['STOCK_ID'];
$r=mysql_fetch_array(mysql_query("select name from ecmstocks where id='".$id."'"));
return '<a href="index.php?module=EcmStocks&action=DetailView&record='.$id.'">'.$r['name'].'</a>';
}
}
?>

View File

@@ -0,0 +1,61 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopCreateAccountNameButton
*
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
require_once('modules/EcmDocuments/dirstree.php');
class SugarWidgetSubPanelAccountsEcmDocNo extends SugarWidgetField
{
function displayList(&$layout_def)
{
$record = $layout_def['fields']['ID'];
$name = $layout_def['fields']['NAME'];
$z="select ecmdocument_id from ecmdocuments_ecmdocs where ecmdoc_id='".$record."' and deleted=0";
$w=mysql_query($z);
while($r=mysql_fetch_array($w))$idp[]=$r['ecmdocument_id'];
$linked_path="";
if(mysql_num_rows($w)>0)
{
foreach($idp as $ids)
{
$bl=explode("||",$ids."||".check_block($ids,""));
for($i=count($bl)-1;$i>=0;$i--)
{
$z="select name,id,no from ecmdocuments where id='".$bl[$i]."'";
$w=mysql_query($z);
$r=mysql_fetch_array($w);
if($r['name'])$linked_path.='<a class=utilsLink href=index.php?module=EcmDocuments&action=DetailView&record='.$r['id'].'>'.$r['no'].'.'.$r['name'].'</a> / ';
}
$linked_path.="<br>";
}
}
return shortlinkdescription($name,255,$record,$linked_path,"","EcmDocs",1,$name);
}
}
?>

View File

@@ -0,0 +1,70 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelActivitiesStatusField
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
require_once('include/utils.php');
class SugarWidgetSubPanelActivitiesStatusField extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $current_language;
$app_list_strings = return_app_list_strings_language($current_language);
$module = empty($layout_def['module']) ? '' : $layout_def['module'];
if(isset($layout_def['varname']))
{
$key = strtoupper($layout_def['varname']);
}
else
{
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
$value = $layout_def['fields'][$key];
// cn: bug 5813, removing double-derivation of lang-pack value
return $value;
}
}
?>

View File

@@ -0,0 +1,59 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopSelectButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelAddToChangeOnPriceBook extends SugarWidgetSubPanelTopButton
{
//button_properties is a collection of properties associated with the widget_class definition. layoutmanager
function SugarWidgetSubPanelTopSelectButton($button_properties=array())
{
$this->button_properties=$button_properties;
}
//widget_data is the collection of attributes assoicated with the button in the layout_defs file.
function display(&$widget_data)
{
return '<input type="button" class="button" name="button" onclick="location.href=\'index.php?module=EcmPriceBooks&action=ListViewPriceBooksAddToChangeOn&product_id='.$_REQUEST['record'].'&return_module=EcmProducts&return_action=DetailView&return_id='.$_REQUEST['record'].'\';" value="Add To / Change On">';
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelAdditionalDetailsLink extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus, $theme;
$module_ = $layout_def['module'];
$record_ = $layout_def['fields']['ID'];
return "<span id='adspan_".$record_."' "
. "onmouseover=\"SUGAR.util.getAdditionalDetails( '".$module_."','".$record_."', 'adspan_".$record_."');\" "
. "onmouseout=\"SUGAR.util.clearAdditionalDetailsCall();return nd(1000);\"><img style='padding: 0px 5px 0px 2px' border='0' src='themes/$theme/images/MoreDetail2.png' width='12' height='12'></span>
";
}
}
?>

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 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
//TODO Rename this to close button field
class SugarWidgetSubPanelCloseButton extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $app_strings,$image_path;
$return_module = $_REQUEST['module'];
$return_id = $_REQUEST['record'];
$module_name = $layout_def['module'];
$record_id = $layout_def['fields']['ID'];
// calls and meetings are held.
$new_status = 'Held';
switch($module_name)
{
case 'Tasks':
$new_status = 'Completed';
break;
}
$html = "<a href='index.php?module=$module_name&action=EditView&record=$record_id&return_module=$return_module&return_action=DetailView&return_id=$return_id&status=$new_status'>".get_image($image_path."close_inline","title=".translate('LBL_LIST_CLOSE',$module_name)." border='0'")."</a>";
return $html;
}
}
?>

View File

@@ -0,0 +1,63 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDateTime
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelConcat extends SugarWidgetField
{
function displayList(&$layout_def)
{
$value='';
if (isset($layout_def['source']) and is_array($layout_def['source']) and isset($layout_def['fields']) and is_array($layout_def['fields'])) {
foreach ($layout_def['source'] as $field) {
if (isset($layout_def['fields'][strtoupper($field)])) {
$value.=$layout_def['fields'][strtoupper($field)];
} else {
$value.=$field;
}
}
}
return $value;
}
}
?>

View File

@@ -0,0 +1,140 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelDetailViewLink extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus;
$module = '';
$record = '';
if(isset($layout_def['varname']))
{
$key = strtoupper($layout_def['varname']);
}
else
{
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
if (empty($layout_def['fields'][$key])) {
return "";
} else {
$value = $layout_def['fields'][$key];
}
if(empty($layout_def['target_record_key']))
{
$record = $layout_def['fields']['ID'];
}
else
{
$record_key = strtoupper($layout_def['target_record_key']);
$record = $layout_def['fields'][$record_key];
}
if(!empty($layout_def['target_module_key'])) {
if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
$module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])];
}
}
if (empty($module)) {
if(empty($layout_def['target_module']))
{
$module = $layout_def['module'];
}
else
{
$module = $layout_def['target_module'];
}
}
//links to email module now need additional information.
//this is to resolve the information about the target of the emails. necessitated by feature that allow
//only on email record for the whole campaign.
$parent='';
if (!empty($layout_def['parent_info'])) {
if (!empty($focus)){
$parent="&parent_id=".$focus->id;
$parent.="&parent_module=".$focus->module_dir;
}
} else {
if(!empty($layout_def['parent_id'])) {
if (isset($layout_def['fields'][strtoupper($layout_def['parent_id'])])) {
$parent.="&parent_id=".$layout_def['fields'][strtoupper($layout_def['parent_id'])];
}
}
if(!empty($layout_def['parent_module'])) {
if (isset($layout_def['fields'][strtoupper($layout_def['parent_module'])])) {
$parent.="&parent_module=".$layout_def['fields'][strtoupper($layout_def['parent_module'])];
}
}
}
$action = 'DetailView';
$value = $layout_def['fields'][$key];
global $current_user;
if( !empty($record) &&
($layout_def['DetailView'] && !$layout_def['owner_module']
|| $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module'])
|| ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))){
if($layout_def['subpanel_id']=='ecmsalesw'){$module='EcmSales';}
if(!empty($parent)){
return '<a href="index.php?module='.$module.'&action='.$action.'&record='.$record.$parent.'" class="listViewTdLinkS1">'."$value</a>";
}
return "<a href='#' target='_blank'"
. " class='listViewTdLinkS1' onMouseOver=\"javascript:subp_nav('".$module.$parent."', '".$record."', 'd', this);\" "
." onFocus=\"javascript:subp_nav('".$module."', '".$record."', 'd', this);\">$value</a>";
}else{
return $value;
}
}
}
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
//require_once('modules/EcmDocuments/dirstree.php');
class SugarWidgetSubPanelDetailViewLinkAccountsEcmDocs extends SugarWidgetField
{
function displayList(&$layout_def)
{
$record = $layout_def['fields']['ACCOUNT_ID'];
$r=mysql_fetch_array(mysql_query("select name from accounts where id='".$record."'"));
$name=$r['name'];
return "<a class='listViewTdLinkS1' href='index.php?module=Accounts&action=DetailView&record=".$record."'>".$name."</a>";
}
}
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelDetailViewLinkEcmDocs extends SugarWidgetField
{
function displayList(&$layout_def)
{
$record = $layout_def['fields']['ID'];
$r=mysql_fetch_array(mysql_query("select file_id from ecmdocs where id='".$record."'"));
$file_id=$r['file_id'];
$r=mysql_fetch_array(mysql_query("select id from ecmfiles_versions where file_id='".$file_id."' order by version desc"));
$version_id=$r['id'];
return '<a href="DownloadEcmFile.php?record='.$version_id.'" class="listViewTdLinkS1">Download</a>';
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
require_once("modules/EcmDocuments/dirstree.php");
class SugarWidgetSubPanelDetailViewLinkEcmDocuments extends SugarWidgetField
{
function displayList(&$layout_def)
{
$iddir = $_REQUEST['record'];
$record = $layout_def['fields']['ID'];
$r=mysql_fetch_array(mysql_query("select description,name,no from ecmdocuments where id='".$record."'"));
$description = $r['description'];
$no=$r['no'];
$name=$r['name'];
$z="select id from ecmdocuments where id='".$record."'";
$w=mysql_query($z);
while($r=mysql_fetch_array($w))$idp[]=$r['id'];
foreach($idp as $ids)
{
$bl=explode("||",$ids."||".check_block($ids,""));
for($i=count($bl)-1;$i>=0;$i--)
{
$z="select name,id,no from ecmdocuments where id='".$bl[$i]."'";
$w=mysql_query($z);
$r=mysql_fetch_array($w);
if($r['name'])$linked_path.=$r['no'].".".$r['name']." / ";
if($r['no'])$numbers.=$r['no'].".";
}
$linked_path.="<br>";
}
//$numbers.=$no;
return shortlinkdescription($no.".".$name,25,$record,$linked_path,"[num]".$numbers,"EcmDocuments");
}
}
?>

View File

@@ -0,0 +1,53 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelRemoveButton
*
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelDownloadButton extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
$record = $layout_def['fields']['FILE_ID'];
//$record=$layout_def['file_id'];
$z="select id from ecmfiles_versions where file_id='".$record."' and deleted='0'";
if(mysql_num_rows(mysql_query($z))>0)$button='<a title="PDF" href="DownloadEcmFile.php?file_id='.$record.'"><img title="PDF" src="modules/EcmDocs/images/pdf.gif" border="0"></a>';
else $button='<img src="modules/EcmDocuments/images/pdf-off.gif" width="14" height="14" border="0" />';
return $button;
}
}
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelEcmDocVersion extends SugarWidgetField
{
function displayList(&$layout_def)
{
$record = $layout_def['fields']['ID'];
$r=mysql_fetch_array(mysql_query("select file_id from ecmdocs where id='".$record."'"));
$file_id=$r['file_id'];
$r=mysql_fetch_array(mysql_query("select version from ecmfiles_versions where file_id='".$file_id."' and deleted='0' order by version desc"));
$version=$r['version'];
return $version;
}
}
?>

View File

@@ -0,0 +1,69 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelEditButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
//TODO Rename this to edit link
class SugarWidgetSubPanelEditButton extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
$edit_icon_html = get_image($image_path . 'edit_inline',
'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"');
if($layout_def['EditView']){
return "<a href='#' onMouseOver=\"javascript:subp_nav('".$layout_def['module']."', '".$layout_def['fields']['ID']."', 'e', this);\""
. " onFocus=\"javascript:subp_nav('".$layout_def['module']."', '".$layout_def['fields']['ID']."', 'e', this);\""
. ' class="listViewTdToolsS1">' . $edit_icon_html . '&nbsp;' . $app_strings['LNK_EDIT'] .'</a>&nbsp;';
}else{
return '';
}
}
}
?>

View File

@@ -0,0 +1,75 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelEditRoleButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelEditRoleButton extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
$href = 'index.php?module=' . $layout_def['module']
. '&action=' . 'ContactOpportunityRelationshipEdit'
. '&record=' . $layout_def['fields']['OPPORTUNITY_ROLE_ID']
. '&return_module=' . $_REQUEST['module']
. '&return_action=' . 'DetailView'
. '&return_id=' . $_REQUEST['record'];
$edit_icon_html = get_image($image_path . 'edit_inline',
'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"');
//based on listview since that lets you select records
if($layout_def['ListView']){
return '<a href="' . $href . '"'
. 'class="listViewTdToolsS1">' . $edit_icon_html . '&nbsp;' . $app_strings['LNK_EDIT'] .'</a>&nbsp;';
}else{
return '';
}
}
}
?>

View File

@@ -0,0 +1,134 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelEmailLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelEmailLink extends SugarWidgetField {
function displayList(&$layout_def) {
global $current_user;
global $beanList;
global $focus;
global $sugar_config;
if(isset($layout_def['varname'])) {
$key = strtoupper($layout_def['varname']);
} else {
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
$value = $layout_def['fields'][$key];
if(isset($_REQUEST['action'])) $action = $_REQUEST['action'];
else $action = '';
if(isset($_REQUEST['module'])) $module = $_REQUEST['module'];
else $module = '';
if(isset($_REQUEST['record'])) $record = $_REQUEST['record'];
else $record = '';
if (!empty($focus->name)) {
$name = $focus->name;
} else {
if( !empty($focus->first_name) && !empty($focus->last_name)) {
$name = $focus->first_name . ' '. $focus->last_name;
} else {
if(!empty($focus->last_name)) {
$name = $focus->last_name;
} else {
$name = '*';
}
}
}
$userPref = $current_user->getPreference('email_link_type');
$defaultPref = $sugar_config['email_default_client'];
if($userPref != '') {
$client = $userPref;
} else {
$client = $defaultPref;
}
if($client == 'sugar') {
$link = '<a href="index.php?module=Emails&action=Compose'.
'&load_id='.$layout_def['fields']['ID'].
'&load_module='. $this->layout_manager->defs['module_name'] .
'&parent_type='.$this->layout_manager->defs['module_name'].
'&parent_id='.$layout_def['fields']['ID'].
'&parent_name='.urlencode($layout_def['fields']['FULL_NAME']).
'&return_module='.$module.
'&return_action='.$action.
'&return_id='.$record.'" '.
'class="listViewTdLinkS1">';
} else {
$link = '<a href="mailto:' . $value .'" class="listViewTdLinkS1">';
}
return $link.$value.'</a>';
}
} // end class def
?>

View File

@@ -0,0 +1,84 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelEditButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
//this widget is used only by the contracts module..
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelGetLatestButton extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
//if the contract has been executed or selected_revision is same as latest revision
//then hide the latest button.
//if the contract state is executed or document is not a template hide this action.
if ((!empty($layout_def['fields']['CONTRACT_STATUS']) && $layout_def['fields']['CONTRACT_STATUS']=='executed') or
$layout_def['fields']['SELECTED_REVISION_ID']== $layout_def['fields']['LATEST_REVISION_ID']) {
return "";
}
global $app_strings;
global $image_path;
$href = 'index.php?module=' . $layout_def['module']
. '&action=' . 'GetLatestRevision'
. '&record=' . $layout_def['fields']['ID']
. '&return_module=' . $_REQUEST['module']
. '&return_action=' . 'DetailView'
. '&return_id=' . $_REQUEST['record']
. '&get_latest_for_id=' . $layout_def['fields']['LINKED_ID'];
$edit_icon_html = get_image($image_path . 'getLatestDocument',
'align="absmiddle" alt="' . $app_strings['LNK_GET_LATEST'] . '" border="0"');
if($layout_def['EditView']){
return '<a href="' . $href . '"' . "title ='". $app_strings['LNK_GET_LATEST_TOOLTIP'] ."'"
. 'class="listViewTdToolsS1">' . $edit_icon_html . '&nbsp;' . $app_strings['LNK_GET_LATEST'] .'</a>&nbsp;';
}else{
return '';
}
}
}
?>

View File

@@ -0,0 +1,108 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelIcon
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelIcon extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
global $app_list_strings;
if(isset($layout_def['varname']))
{
$key = strtoupper($layout_def['varname']);
}
else
{
$key = $this->_get_column_alias($layout_def);
$key = strtoupper($key);
}
//add module image
$module = $layout_def['module'];
$action = 'DetailView';
$record = $layout_def['fields']['ID'];
$icon_img_html = get_image($image_path . $module . '', 'border="0" alt="' . $app_list_strings['moduleList'][$module] . '"');
if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) {
$ret="";
}else {
$ret= '<a href="index.php?module=' . $module
. '&action=' . $action
. '&record=' . $record
. '" class="listViewTdLinkS1">' . "$icon_img_html</a>";
}
//if requested, add attachement icon.
if(!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])){
if (is_array($layout_def['image2_url_field'])) {
$filepath="";
//Generate file url.
if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])])
and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]) ){
$key=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])];
$file=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])];
//$filepath=UploadFile :: get_url(from_html($file), $key);
$filepath="index.php?entryPoint=download&id=".$key."&type=".$layout_def['module'];
}
}
else {
if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) {
$filepath="index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module'];
}
}
$icon_img_html = get_image($image_path . $layout_def['image2'] . '', 'border="0" alt="' . $layout_def['image2'] . '"');
$ret.= (empty($filepath)) ? '' : '<a href="' . $filepath. '" class="listViewTdLinkS1">' . "$icon_img_html</a>";
}
// now handle attachments for Emails
else if(!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) {
$ret.= $layout_def['fields']['ATTACHMENT_IMAGE'];
}
return $ret;
}
}
?>

View File

@@ -0,0 +1,81 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelEditButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
//this widget is used only by the document subpanel under contracts.
class SugarWidgetSubPanelLoadSignedButton extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
$href = 'index.php?module=' . 'Documents'
. '&action=' . 'EditView'
. '&record=' . $layout_def['fields']['ID']
. '&return_module=' . $_REQUEST['module']
. '&return_action=' . 'DetailView'
. '&return_id=' . $_REQUEST['record']
. '&load_signed_id=' . $layout_def['fields']['LINKED_ID']
. '&parent_id=' . $_REQUEST['record']
. '&parent_name=' . $layout_def['fields']['CONTRACT_NAME']
. '&parent_type=' . $_REQUEST['module']
. '&selected_revision_id=' . $layout_def['fields']['SELECTED_REVISION_ID']
;
$edit_icon_html = get_image($image_path . 'loadSignedDocument',
'align="absmiddle" alt="' . $app_strings['LNK_LOAD_SIGNED'] . '" border="0"');
//if the contract state is executed or document is not a template hide this action.
if ((!empty($layout_def['fields']['CONTRACT_STATUS']) && $layout_def['fields']['CONTRACT_STATUS']=='executed') or
empty($layout_def['fields']['IS_TEMPLATE']) or $layout_def['fields']['IS_TEMPLATE']==0) {
return "";
}
return '<a href="' . $href . '"' . "title ='". $app_strings['LNK_LOAD_SIGNED_TOOLTIP']."'"
. 'class="listViewTdToolsS1">' . $edit_icon_html . '&nbsp;' . $app_strings['LNK_LOAD_SIGNED'] .'</a>&nbsp;';
}
}
?>

View File

@@ -0,0 +1,40 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
require_once("modules/EcmDocuments/dirstree.php");
class SugarWidgetSubPanelPathEcmDocuments extends SugarWidgetField
{
function displayList(&$layout_def)
{
$record = $layout_def['fields']['ID'];
return str_replace(" / ","/",print_title(check_block($record,"")));
}
}
?>

View File

@@ -0,0 +1,113 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelRemoveButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelRemoveButton extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
$parent_record_id = $_REQUEST['record'];
$parent_module = $_REQUEST['module'];
$action = 'DeleteRelationship';
$record = $layout_def['fields']['ID'];
$current_module=$layout_def['module'];
//in document revisions subpanel ,users are now allowed to
//delete the latest revsion of a document. this will be tested here
//and if the condition is met delete button will be removed.
$hideremove=false;
if ($current_module=='DocumentRevisions') {
if ($layout_def['fields']['ID']==$layout_def['fields']['LATEST_REVISION_ID']) {
$hideremove=true;
}
}
// Implicit Team-memberships are not "removeable"
elseif ($_REQUEST['module'] == 'Teams' && $current_module == 'Users') {
if($layout_def['fields']['UPLINE'] != translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) {
$hideremove = true;
}
}
$return_module = $_REQUEST['module'];
$return_action = 'SubPanelViewer';
$subpanel = $layout_def['subpanel_id'];
$return_id = $_REQUEST['record'];
if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) {
$linked_field= $layout_def['linked_field_set'] ;
} else {
$linked_field = $layout_def['linked_field'];
}
$refresh_page = 0;
if(!empty($layout_def['refresh_page'])){
$refresh_page = 1;
}
$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1";
$icon_remove_text = $app_strings['LNK_REMOVE'];
$icon_remove_html = get_image($image_path . 'delete_inline',
'align="absmiddle" alt="' . $icon_remove_text . '" border="0"');
//based on listview since that lets you select records
if($layout_def['ListView'] && !$hideremove) {
$retStr = "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'"
.", '$record', $refresh_page);\""
. ' class="listViewTdToolsS1"'
. " onclick=\"return sp_rem_conf();\""
. ">$icon_remove_html&nbsp;$icon_remove_text</a>";
return $retStr;
}else{
return '';
}
}
}
?>

View File

@@ -0,0 +1,121 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelRemoveButtonMeetings
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelRemoveButtonMeetings extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
$parent_record_id = $_REQUEST['record'];
$parent_module = $_REQUEST['module'];
$action = 'DeleteRelationship';
$record = $layout_def['fields']['ID'];
$return_module = $_REQUEST['module'];
$return_action = 'SubPanelViewer';
$subpanel = $layout_def['subpanel_id'];
$return_id = $_REQUEST['record'];
if(isset($GLOBALS['FOCUS'])) {
$focus = $GLOBALS['FOCUS'];
}
/* Handle case where we generate subpanels from MySettings/LoadTabSubpanels.php */
else if($return_module == 'MySettings') {
global $beanList, $beanFiles;
$return_module = $_REQUEST['loadModule'];
$class = $beanList[$return_module];
require_once($beanFiles[$class]);
$focus = new $class();
$focus->retrieve($return_id);
}
if($focus->assigned_user_id == $record) return '';
if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) {
$linked_field= $layout_def['linked_field_set'] ;
} else {
$linked_field = $layout_def['linked_field'];
}
$refresh_page = 0;
if(!empty($layout_def['refresh_page'])){
$refresh_page = 1;
}
$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1";
$icon_remove_text = $app_strings['LNK_REMOVE'];
$icon_remove_html = get_image($image_path . 'delete_inline',
'align="absmiddle" alt="' . $icon_remove_text . '" border="0"');
$remove_url = $layout_def['start_link_wrapper']
. "index.php?module=$parent_module"
. "&action=$action"
. "&record=$parent_record_id"
. "&linked_field=$linked_field"
. "&linked_id=$record"
. "&return_url=" . urlencode(urlencode($return_url))
. "&refresh_page=$refresh_page"
. $layout_def['end_link_wrapper'];
$remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION'];
//based on listview since that lets you select records
if($layout_def['ListView']) {
return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'"
.", '$record', $refresh_page);\""
. ' class="listViewTdToolsS1"'
. " onclick=\"return sp_rem_conf();\""
. ">$icon_remove_html&nbsp;$icon_remove_text</a>";
}else{
return '';
}
}
}
?>

View File

@@ -0,0 +1,126 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelRemoveButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelRemoveButtonProjects extends SugarWidgetField
{
function displayHeaderCell(&$layout_def)
{
return '&nbsp;';
}
function displayList(&$layout_def)
{
global $app_strings;
global $image_path;
global $current_user;
$parent_record_id = $_REQUEST['record'];
$parent_module = $_REQUEST['module'];
if ($layout_def['module'] == 'Holidays'){
$action = 'DeleteHolidayRelationship';
}
else if ($layout_def['module'] == 'Users' || $layout_def['module'] == 'Contacts'){
$action = 'DeleteResourceRelationship';
}
else{
$action = 'DeleteRelationship';
}
$record = $layout_def['fields']['ID'];
$current_module=$layout_def['module'];
$hideremove=false;
$return_module = $_REQUEST['module'];
$return_action = 'SubPanelViewer';
$subpanel = $layout_def['subpanel_id'];
$return_id = $_REQUEST['record'];
require_once('modules/Project/Project.php');
$focus = new Project();
$focus->retrieve($return_id);
if ($current_user->id == $focus->assigned_user_id){
$is_owner = true;
}
else{
$is_owner = false;
}
if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) {
$linked_field= $layout_def['linked_field_set'] ;
} else {
$linked_field = $layout_def['linked_field'];
}
$refresh_page = 0;
if(!empty($layout_def['refresh_page'])){
$refresh_page = 1;
}
$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1";
$icon_remove_text = $app_strings['LNK_REMOVE'];
$icon_remove_html = get_image($image_path . 'delete_inline',
'align="absmiddle" alt="' . $icon_remove_text . '" border="0"');
$remove_url = $layout_def['start_link_wrapper']
. "index.php?module=$parent_module"
. "&action=$action"
. "&record=$parent_record_id"
. "&linked_field=$linked_field"
. "&linked_id=$record"
. "&return_url=" . urlencode(urlencode($return_url))
. "&refresh_page=1"
. $layout_def['end_link_wrapper'];
$remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION'];
//based on listview since that lets you select records
if($layout_def['ListView'] && !$hideremove && $is_owner) {
return '<a href="' . $remove_url . '"'
. ' class="listViewTdToolsS1"'
. " onclick=\"return confirm('$remove_confirmation_text');\""
. ">$icon_remove_html&nbsp;$icon_remove_text</a>";
}else{
return '';
}
}
}
?>

View File

@@ -0,0 +1,19 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTaskCustomButton extends SugarWidgetSubPanelTopButton
{
function display($defines, $additionalFormFields = null)
{
$button = "<form method='get' action='index.php'>";
$button .= "<input type='hidden' name='module' value='Tasks'/>";
$button .= "<input type='hidden' name='action' value='EditView'/>";
$button .= "<input type='hidden' name='first_parent_id' value='".$_REQUEST['record']."'/>";
$button .= "<input type='hidden' name='first_parent_type' value='".$_REQUEST['module']."'/>";
$button .= "<input class='button' type='submit' name='cstm_create' value='Utwórz' />\n</form>";
return $button;
}
}
?>

View File

@@ -0,0 +1,82 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopCreateNoteButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopArchiveEmailButton extends SugarWidgetSubPanelTopButton
{
function display($defines)
{
if(ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)){
$temp = '';
return $temp;
}
global $app_strings;
global $mod_strings;
global $currentModule;
$title = $app_strings['LBL_TRACK_EMAIL_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_TRACK_EMAIL_BUTTON_KEY'];
$value = $app_strings['LBL_TRACK_EMAIL_BUTTON_LABEL'];
$this->module = 'Emails';
$additionalFormFields = array();
$additionalFormFields['type'] = 'archived';
// cn: bug 5727 - must override the parents' parent for contacts (which could be an Account)
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
$additionalFormFields['parent_id'] = $defines['focus']->id;
$additionalFormFields['parent_name'] = $defines['focus']->name;
if(isset($defines['focus']->email1))
{
$additionalFormFields['to_email_addrs'] = $defines['focus']->email1;
}
if(ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)){
$button = "<input title='$title' class='button' type='button' name='button' value=' $value ' disabled/>\n";
return $button;
}
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='$title' accesskey='$accesskey' class='button' type='submit' name='button' value=' $value '/>\n";
$button .= "</form>";
return $button;
}
}
?>

View File

@@ -0,0 +1,313 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidget.php');
class SugarWidgetSubPanelTopButton extends SugarWidget
{
var $module;
var $title;
var $access_key;
var $form_value;
var $additional_form_fields;
var $acl;
//TODO rename defines to layout defs and make it a member variable instead of passing it multiple layers with extra copying.
/** Take the keys for the strings and look them up. Module is literal, the rest are label keys
*/
function SugarWidgetSubPanelTopButton($module='', $title='', $access_key='', $form_value='')
{
global $app_strings;
if(is_array($module))
{
// it is really the class details from the mapping
$class_details = $module;
// If keys were passed into the constructor, translate them from keys to values.
if(!empty($class_details['module']))
$this->module = $class_details['module'];
if(!empty($class_details['title']))
$this->title = $app_strings[$class_details['title']];
if(!empty($class_details['access_key']))
$this->access_key = $app_strings[$class_details['access_key']];
if(!empty($class_details['form_value']))
$this->form_value = translate($class_details['form_value'], $this->module);
if(!empty($class_details['additional_form_fields']))
$this->additional_form_fields = $class_details['additional_form_fields'];
if(!empty($class_details['ACL'])){
$this->acl = $class_details['ACL'];
}
}
else
{
$this->module = $module;
// If keys were passed into the constructor, translate them from keys to values.
if(!empty($title))
$this->title = $app_strings[$title];
if(!empty($access_key))
$this->access_key = $app_strings[$access_key];
if(!empty($form_value))
$this->form_value = translate($form_value, $module);
}
}
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$relationship_name = $this->get_subpanel_relationship_name($defines);
$form = 'form' . $relationship_name;
$button = '<form action="index.php" method="post" name="form" id="' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
if($currentModule == 'Campaigns'){
$button .= '<input type="hidden" name="return_action" value="DetailView" />';
}else{
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
}
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
$button .= '<input type="hidden" name="return_relationship" value="' . $relationship_name . "\" />\n";
switch ( strtolower( $currentModule ) )
{
case 'prospects' :
$name = $defines['focus']->account_name ;
break ;
case 'documents' :
$name = $defines['focus']->document_name ;
break ;
case 'kbdocuments' :
$name = $defines['focus']->kbdocument_name ;
break ;
case 'leads' :
case 'contacts' :
$name = $defines['focus']->first_name . " " .$defines['focus']->last_name ;
break ;
default :
$name = (isset($defines['focus']->name)) ? $defines['focus']->name : "";
}
$button .= '<input type="hidden" name="return_name" value="' . $name . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
} else if($defines['focus']->object_name=='Contract') {
$additionalFormFields['contract_id'] = $defines['focus']->id;
} else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
if ($defines['focus']->object_name=='Opportunity') {
$additionalFormFields['account_id'] = $defines['focus']->account_id;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
if (!empty($defines['child_module_name']) and $defines['child_module_name']=='Contacts' and !empty($defines['parent_bean_name']) and $defines['parent_bean_name']=='contact' ) {
if (!empty($defines['focus']->id ) and !empty($defines['focus']->name)) {
$button .= '<input type="hidden" name="reports_to_id" value="'. $defines['focus']->id .'" />' . "\n";
$button .= '<input type="hidden" name="reports_to_name" value="'. $defines['focus']->name .'" />' . "\n";
}
}
$button .= '<input type="hidden" name="action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n";
}
}
return $button;
}
/** This default function is used to create the HTML for a simple button */
function display($defines, $additionalFormFields = null)
{
$temp='';
if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){
$button = "<input title='$this->title' class='button' type='button' name='" . $this->getWidgetId() . "_create_button' value=' $this->form_value ' disabled/>\n</form>";
return $temp;
}
global $app_strings;
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='$this->title' accesskey='$this->access_key' class='button' type='submit' name='" . $this->getWidgetId() . "_create_button' value=' $this->form_value ' />\n</form>";
return $button;
}
/**
* Returns a string that is the JSON encoded version of the popup request.
* Perhaps this function should be moved to a more globally accessible location?
*/
function _create_json_encoded_popup_request($popup_request_data)
{
$popup_request_array = array();
if(!empty($popup_request_data['call_back_function']))
{
$popup_request_array[] = '"call_back_function":"' . $popup_request_data['call_back_function'] . '"';
}
if(!empty($popup_request_data['form_name']))
{
$popup_request_array[] = '"form_name":"' . $popup_request_data['form_name'] . '"';
}
if(!empty($popup_request_data['field_to_name_array']))
{
$field_to_name_array = array();
foreach($popup_request_data['field_to_name_array'] as $field => $name)
{
$field_to_name_array[] = '"' . $field . '":"' . $name . '"';
}
$popup_request_array[] = '"field_to_name_array":{' . implode(',', $field_to_name_array) . '}';
}
if(!empty($popup_request_data['passthru_data']))
{
$passthru_array = array();
foreach($popup_request_data['passthru_data'] as $field => $name)
{
$passthru_array[] = '"' . $field . '":"' . $name . '"';
}
$popup_request_array[] = '"passthru_data":{' . implode(',', $passthru_array) . '}';
}
$encoded_popup_request = '{' . implode(',', $popup_request_array) . '}';
return $encoded_popup_request;
}
/**
* get_subpanel_relationship_name
* Get the relationship name based on the subapnel definition
* @param mixed $defines The subpanel definition
*/
function get_subpanel_relationship_name($defines) {
$relationship_name = '';
if(!empty($defines)) {
$relationship_name = isset($defines['module']) ? $defines['module'] : '';
$dataSource = $defines['subpanel_definition']->get_data_source_name() ;
if (!empty($dataSource)) {
$relationship_name = $dataSource;
//Try to set the relationship name to the real relationship, not the link.
if (!empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource])
&& !empty($defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship']))
{
$relationship_name = $defines['subpanel_definition']->parent_bean->field_defs[$dataSource]['relationship'];
}
}
}
return $relationship_name;
}
}
?>

View File

@@ -0,0 +1,161 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopButtonQuickCreate extends SugarWidgetSubPanelTopButton
{
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$form = 'form' . $defines['child_module_name'];
$button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['child_module_name']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\', \'' . strtolower($defines['child_module_name']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
if(!empty($defines['view']))
$button .= '<input type="hidden" name="target_view" value="'. $defines['view'] . '" />';
$button .= '<input type="hidden" name="to_pdf" value="true" />';
$button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />';
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
if(strtolower($defines['child_module_name']) =='contracts') {
//set variables to account name, or parent account name
if(strtolower($defines['parent_bean_name']) == 'account' ){
//if account is parent bean, then get focus id/focus name
if(isset($defines['focus']->id))$additionalFormFields['account_id'] = $defines['focus']->id;
if(isset($defines['focus']->name))$additionalFormFields['account_name'] = $defines['focus']->name;
}elseif(strtolower($defines['parent_bean_name']) == 'quote' ){
//if quote is parent bean, then get billing_account_id/billing_account_name
if(isset($defines['focus']->billing_account_id))$additionalFormFields['account_id'] = $defines['focus']->billing_account_id;
if(isset($defines['focus']->billing_account_name))$additionalFormFields['account_name'] = $defines['focus']->billing_account_name;
}else{
if(isset($defines['focus']->account_id))$additionalFormFields['account_id'] = $defines['focus']->account_id;
if(isset($defines['focus']->account_name))$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
}
$button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n";
$button .= '<input type="hidden" name="module" value="Home" />' . "\n";
$button .= '<input type="hidden" name="target_action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value=\'' . $value . '\' />' . "\n";
}
}
return $button;
}
}
?>

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopCreateNoteButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopComposeEmailButton extends SugarWidgetSubPanelTopButton
{
function display($defines)
{
global $app_strings,$current_user,$sugar_config,$beanList,$beanFiles;
$title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY'];
$value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL'];
$parent_type = $defines['focus']->module_dir;
$parent_id = $defines['focus']->id;
//martin Bug 19660
$userPref = $current_user->getPreference('email_link_type');
$defaultPref = $sugar_config['email_default_client'];
if($userPref != '') {
$client = $userPref;
} else {
$client = $defaultPref;
}
if($client != 'sugar') {
$class = $beanList[$parent_type];
require_once($beanFiles[$class]);
$bean = new $class();
$bean->retrieve($parent_id);
// awu: Not all beans have emailAddress property, we must account for this
if (isset($bean->emailAddress)){
$to_addrs = $bean->emailAddress->getPrimaryAddress($bean);
$button = "<input class='button' type='button' value='$value' name='$title' accesskey='$accesskey' title='$title' onclick=\"location.href='mailto:$to_addrs';return false;\" />";
}
else{
$button = "<input class='button' type='button' value='$value' name='$title' accesskey='$accesskey' title='$title' onclick=\"location.href='mailto:';return false;\" />";
}
}else{
$button = "<input title='$title' accesskey='$accesskey' onclick=\"window.location='index.php?module=Emails&action=Compose"
. "&parent_id=$parent_id&parent_type=$parent_type';\" class='button' type='submit' name='button' value='$value'";
}
return $button;
}
}
?>

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopCreateAccountNameButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopCreateAccountNameButton extends SugarWidgetSubPanelTopButtonQuickCreate
{
function display($defines)
{
global $app_strings;
global $currentModule;
$title = $app_strings['LBL_NEW_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_NEW_BUTTON_KEY'];
$value = $app_strings['LBL_NEW_BUTTON_LABEL'];
$this->module = 'Contacts';
if( ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)){
$button = "<input title='$title'class='button' type='button' name='button' value=' $value ' disabled/>\n";
return $button;
}
$additionalFormFields = array();
if(isset($defines['focus']->billing_address_street))
$additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street;
if(isset($defines['focus']->billing_address_city))
$additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city;
if(isset($defines['focus']->billing_address_state))
$additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state;
if(isset($defines['focus']->billing_address_country))
$additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country;
if(isset($defines['focus']->billing_address_postalcode))
$additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode;
if(isset($defines['focus']->phone_office))
$additionalFormFields['phone_work'] = $defines['focus']->phone_office;
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='$title' accesskey='$accesskey' class='button' type='submit' name='{$this->getWidgetId()}_create_button' id='{$this->getWidgetId()}_create_button' value=' $value '/>\n";
$button .= "</form>";
return $button;
}
}
?>

View File

@@ -0,0 +1,155 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
// $Id$
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopCreateCampaignLogEntryButton extends SugarWidgetSubPanelTopButton
{
function display($widget_data)
{
global $app_strings;
global $mod_strings;
global $currentModule;
$initial_filter = '';
$this->title = $app_strings['LBL_SELECT_BUTTON_TITLE'];
$this->accesskey = $app_strings['LBL_SELECT_BUTTON_KEY'];
$this->value = $app_strings['LBL_SELECT_BUTTON_LABEL'];
$this->module = 'Campaigns';//'CampaignLog';
$this->module_name = 'Campaigns';
$this->button_properties = $widget_data;
$focus = $widget_data['focus'];
if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){
$button = ' <input type="button" name="' . $this->getWidgetId() . '_select_button" id="' . $this->getWidgetId() . 'select_button" class="button"' . "\n"
. ' title="' . $this->title . '"'
. ' value="' . $this->value . "\"\n"
.' disabled />';
return $button;
}
//refresh the whole page after end of action?
$refresh_page = 0;
if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){
$refresh_page = 1;
}
$subpanel_definition = $widget_data['subpanel_definition'];
$button_definition = $subpanel_definition->get_buttons();
$subpanel_name = $this->module; //"Campaigns";//$subpanel_definition->get_module_name();
if (empty($this->module_name)) {
$this->module_name = $subpanel_name;
}
$link_field_name = $subpanel_definition->get_data_source_name(true);
$popup_mode='multiselect';
if(isset($widget_data['mode'])){
$popup_mode=$widget_data['mode'];
}
if(isset($widget_data['initial_filter_fields'])){
if (is_array($widget_data['initial_filter_fields'])) {
foreach ($widget_data['initial_filter_fields'] as $value=>$alias) {
if (isset($focus->$value) and !empty($focus->$value)) {
$initial_filter.="&".$alias . '='.$focus->$value;
}
}
}
}
$create="true";
if(isset($widget_data['create'])){
$create=$widget_data['create'];
}
$return_module = $_REQUEST['module'];
$return_action = 'SubPanelViewer';
$return_id = $_REQUEST['record'];
//field_to_name_array
$fton_array= array('id' => 'subpanel_id');
if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){
$fton_array=array_merge($fton_array,$widget_data['field_to_name_array']);
}
$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1";
$popup_request_data = array(
'call_back_function' => 'set_campaignlog_and_save_background',
'form_name' => 'DetailView',
'field_to_name_array' => $fton_array,
'passthru_data' => array(
'child_field' => $subpanel_name,
'return_url' => urlencode($return_url),
'link_field_name' => $link_field_name,
'module_name' => $subpanel_name,
'refresh_page'=>$refresh_page,
),
);
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) {
$popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']);
}
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) {
if ($this->button_properties['add_to_passthru_data']['return_type']=='report') {
$initial_filter = "&module_name=${widget_data['module']}";
}
if ($this->button_properties['add_to_passthru_data']['return_type']=='addtoprospectlist') {
if (isset($widget_data['query'])) {
$popup_request_data['passthru_data']['query']=$widget_data['query'];
}
}
}
$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
return '<form action="index.php?module=CampaignLog&action=AddCampaignLog&type=contact">' . "\n"
. ' <input type="button" name="' . $this->getWidgetId() . '_select_button" id="' . $this->getWidgetId() . '_select_button" class="button"' . "\n"
. ' title="' . $this->title . '"'
. ' accesskey="' . $this->accesskey . '"'
. ' value="' . $this->value . "\"\n"
. " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n";
}
}
?>

View File

@@ -0,0 +1,185 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
// $Id$
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopCreateEcmWorkItemButton extends SugarWidgetSubPanelTopButtonQuickCreate
{
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
$this->module="EcmWorkItems";
$this->subpanelDiv = "ecmworkitems";
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
if(!empty($this->subpanelDiv))
{
$defines['subpanelDiv'] = $this->subpanelDiv;
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$form = 'form' . $defines['child_module_name'];
$button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\', \'' . strtolower($defines['subpanelDiv']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
$button .= '<input type="hidden" name="to_pdf" value="true" />';
$button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />';
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
if($defines['focus']->module_dir == "Accounts") {
$additionalFormFields['account_id'] = $defines['focus']->id;
$additionalFormFields['account_name'] = $defines['focus']->name;
}
if($defines['focus']->module_dir == "Project") {
$additionalFormFields['account_id'] = $defines['focus']->account_id;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
$additionalFormFields['project_id'] = $defines['focus']->id;
$additionalFormFields['project_name'] = $defines['focus']->name;
}
if($defines['focus']->module_dir == "ProjectTask") {
$additionalFormFields['project_id'] = $defines['focus']->project_id;
$additionalFormFields['project_name'] = $defines['focus']->project_name;
require_once('modules/Project/Project.php');
$pr = new Project();
$pr->retrieve($defines['focus']->project_id);
$query = "select name from accounts where id='".$pr->account_id."' limit 1";
$row = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query($query));
$additionalFormFields['account_id'] = $pr->account_id;
$additionalFormFields['account_name'] = $row['name'];
$additionalFormFields['project_task_id'] = $defines['focus']->id;
$additionalFormFields['project_task_name'] = $defines['focus']->name;
}
require_once('modules/EcmWorkItems/EcmWorkItem.php');
$now_is = EcmWorkItem::CreateDefaultDate();
$additionalFormFields['datetime_start'] = $now_is;
$additionalFormFields['datetime_end'] = $now_is;
$button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n";
$button .= '<input type="hidden" name="module" value="Home" />' . "\n";
$button .= '<input type="hidden" name="target_action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n";
}
}
return $button;
}
}
?>

View File

@@ -0,0 +1,121 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopCreateAccountNameButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopCreateLeadNameButton extends SugarWidgetSubPanelTopButtonQuickCreate
{
function display($defines)
{
global $app_strings;
global $currentModule;
$title = $app_strings['LBL_NEW_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_NEW_BUTTON_KEY'];
$value = $app_strings['LBL_NEW_BUTTON_LABEL'];
$this->module = 'Leads';
if( ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)){
$button = "<input title='$title'class='button' type='button' name='button' value=' $value ' disabled/>\n";
return $button;
}
$additionalFormFields = array();
//from accounts
if ($defines['focus']->object_name == 'Account') {
if(isset($defines['focus']->billing_address_street))
$additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street;
if(isset($defines['focus']->billing_address_city))
$additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city;
if(isset($defines['focus']->billing_address_state))
$additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state;
if(isset($defines['focus']->billing_address_country))
$additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country;
if(isset($defines['focus']->billing_address_postalcode))
$additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode;
if(isset($defines['focus']->phone_office))
$additionalFormFields['phone_work'] = $defines['focus']->phone_office;
if(isset($defines['focus']->id))
$additionalFormFields['account_id'] = $defines['focus']->id;
}
//from contacts
if ($defines['focus']->object_name == 'Contact') {
if(isset($defines['focus']->salutation))
$additionalFormFields['salutation'] = $defines['focus']->salutation;
if(isset($defines['focus']->first_name))
$additionalFormFields['first_name'] = $defines['focus']->first_name;
if(isset($defines['focus']->last_name))
$additionalFormFields['last_name'] = $defines['focus']->last_name;
if(isset($defines['focus']->primary_address_street))
$additionalFormFields['primary_address_street'] = $defines['focus']->primary_address_street;
if(isset($defines['focus']->primary_address_city))
$additionalFormFields['primary_address_city'] = $defines['focus']->primary_address_city;
if(isset($defines['focus']->primary_address_state))
$additionalFormFields['primary_address_state'] = $defines['focus']->primary_address_state;
if(isset($defines['focus']->primary_address_country))
$additionalFormFields['primary_address_country'] = $defines['focus']->primary_address_country;
if(isset($defines['focus']->primary_address_postalcode))
$additionalFormFields['primary_address_postalcode'] = $defines['focus']->primary_address_postalcode;
if(isset($defines['focus']->phone_work))
$additionalFormFields['phone_work'] = $defines['focus']->phone_work;
if(isset($defines['focus']->id))
$additionalFormFields['contact_id'] = $defines['focus']->id;
}
//from opportunities
if ($defines['focus']->object_name == 'Opportunity') {
if(isset($defines['focus']->id))
$additionalFormFields['opportunity_id'] = $defines['focus']->id;
if(isset($defines['focus']->account_name))
$additionalFormFields['account_name'] = $defines['focus']->account_name;
if(isset($defines['focus']->account_id))
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='$title' accesskey='$accesskey' class='button' type='submit' name='{$this->getWidgetId()}_button' id='{$this->getWidgetId()}_create_button' value=' $value '/>\n";
$button .= "</form>";
return $button;
}
}
?>

View File

@@ -0,0 +1,152 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
// $Id$
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopCreateNote2Button extends SugarWidgetSubPanelTopButtonQuickCreate
{
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
$this->module="Notes";
$this->subpanelDiv = "notes";
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
if(!empty($this->subpanelDiv))
{
$defines['subpanelDiv'] = $this->subpanelDiv;
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$form = 'form' . $defines['child_module_name'];
$button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\', \'' . strtolower($defines['subpanelDiv']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
$button .= '<input type="hidden" name="to_pdf" value="true" />';
$button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />';
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
$button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n";
$button .= '<input type="hidden" name="module" value="Home" />' . "\n";
$button .= '<input type="hidden" name="target_action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n";
}
}
return $button;
}
}
?>

View File

@@ -0,0 +1,152 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
// $Id$
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopCreateNoteButton extends SugarWidgetSubPanelTopButtonQuickCreate
{
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
$this->module="Notes";
$this->subpanelDiv = "history";
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
if(!empty($this->subpanelDiv))
{
$defines['subpanelDiv'] = $this->subpanelDiv;
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$form = 'form' . $defines['child_module_name'];
$button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\', \'' . strtolower($defines['subpanelDiv']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
$button .= '<input type="hidden" name="to_pdf" value="true" />';
$button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />';
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
$button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n";
$button .= '<input type="hidden" name="module" value="Home" />' . "\n";
$button .= '<input type="hidden" name="target_action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n";
}
}
return $button;
}
}
?>

View File

@@ -0,0 +1,152 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
// $Id$
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopCreateTaskButton extends SugarWidgetSubPanelTopButtonQuickCreate
{
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
$this->module="Tasks";
$this->subpanelDiv = "activities";
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
if(!empty($this->subpanelDiv))
{
$defines['subpanelDiv'] = $this->subpanelDiv;
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$form = 'form' . $defines['child_module_name'];
$button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\', \'' . strtolower($defines['subpanelDiv']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
$button .= '<input type="hidden" name="to_pdf" value="true" />';
$button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />';
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
$button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n";
$button .= '<input type="hidden" name="module" value="Home" />' . "\n";
$button .= '<input type="hidden" name="target_action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n";
}
}
return $button;
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopHistoryFilterInputButton extends SugarWidgetSubPanelTopButton
{
function display(&$widget_data){
global $app_list_strings;
$subpanel_definition = $widget_data['subpanel_definition'];
$subpanel_name = $subpanel_definition->get_name();
$module_name = ($_REQUEST['module']?$_REQUEST['module']:'');
$id = ($_REQUEST['record']?$_REQUEST['record']:'');
$prior_search_params[$subpanel_name] = trim($_REQUEST['search_params']?$_REQUEST['search_params']:'');
$prior_selected[$subpanel_name] = trim($_REQUEST['search_module']?$_REQUEST['search_module']:'All');
$onclick = " current_child_field = '{$subpanel_name}';
url='index.php?sugar_body_only=1&module={$module_name}&subpanel={$subpanel_name}&entryPoint=filter_subpanel&inline=1&record={$id}&layout_def_key={$module_name}&search_params=' + escape(document.getElementById('filter_param_{$subpanel_name}').value) + '&search_module=' + escape(document.getElementById('filter_mod_param_{$subpanel_name}').value);
showSubPanel('{$subpanel_name}',url,true,'{$module_name}');
document.getElementById('show_link_{$subpanel_name}').style.display='none';
document.getElementById('hide_link_{$subpanel_name}').style.display='';
return false;";
$options = array();
$options[] = 'All';
foreach($subpanel_definition->_instance_properties['collection_list'] as $key=>$value){
$options[] = $app_list_strings['moduleList'][ucfirst($key)];
}
/*
foreach($options as $option){
if($option != ''){
$select .= "<option value='emails' ";
if($prior_selected[$subpanel_name] == $option) $select .= "selected";
$select .= ">{$option}</option>";
}
} */
$select.='<option value="All">Wszystko</option>';
$select.='<option value="Tasks">Zadania</option>';
$select.='<option value="Notes">Notatki</option>';
$select.='<option value="Emails">Emaile</option>';
$select.='<option value="Meetings">Spotkania</option>';
$select.='<option value="Calls">Rozmowy</option>';
$button = '';
$button .= "<form><input type='text' id='filter_param_{$subpanel_name}' name='search_params' value='{$prior_search_params[$subpanel_name]}'>";
$button .= "<select id='filter_mod_param_{$subpanel_name}' name='search_module'>{$select} </select>
";
$button .= "<input type='submit' onclick=\"{$onclick}\" href='javascript:void(0)' value='Filtuj'>";
$button .= "<input type='submit' onclick=\"document.getElementById('filter_param_' + current_child_field).value = '';{$onclick}\" href='javascript:void(0)' value='Wyczyść Filt'>";
$button .= "</form>";
return $button;
}
}

View File

@@ -0,0 +1,152 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
// $Id$
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopScheduleCallButton extends SugarWidgetSubPanelTopButtonQuickCreate
{
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
$this->module="Calls";
$this->subpanelDiv = "activities";
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
if(!empty($this->subpanelDiv))
{
$defines['subpanelDiv'] = $this->subpanelDiv;
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$form = 'form' . $defines['child_module_name'];
$button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\', \'' . strtolower($defines['subpanelDiv']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
$button .= '<input type="hidden" name="to_pdf" value="true" />';
$button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />';
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
$button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n";
$button .= '<input type="hidden" name="module" value="Home" />' . "\n";
$button .= '<input type="hidden" name="target_action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n";
}
}
return $button;
}
}
?>

View File

@@ -0,0 +1,151 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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".
*/
// $Id$
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
class SugarWidgetSubPanelTopScheduleMeetingButton extends SugarWidgetSubPanelTopButtonQuickCreate
{
function &_get_form($defines, $additionalFormFields = null)
{
global $app_strings;
global $currentModule;
$this->module="Meetings";
$this->subpanelDiv = "activities";
// Create the additional form fields with real values if they were not passed in
if(empty($additionalFormFields) && $this->additional_form_fields)
{
foreach($this->additional_form_fields as $key=>$value)
{
if(!empty($defines['focus']->$value))
{
$additionalFormFields[$key] = $defines['focus']->$value;
}
else
{
$additionalFormFields[$key] = '';
}
}
}
if(!empty($this->module))
{
$defines['child_module_name'] = $this->module;
}
else
{
$defines['child_module_name'] = $defines['module'];
}
if(!empty($this->subpanelDiv))
{
$defines['subpanelDiv'] = $this->subpanelDiv;
}
$defines['parent_bean_name'] = get_class( $defines['focus']);
$form = 'form' . $defines['child_module_name'];
$button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\', \'' . strtolower($defines['subpanelDiv']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n";
//module_button is used to override the value of module name
$button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n";
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n";
if(isset($defines['focus']->name))
{
$button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>";
}
$button .= '<input type="hidden" name="to_pdf" value="true" />';
$button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />';
$button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n";
$button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n";
$button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n";
// TODO: move this out and get $additionalFormFields working properly
if(empty($additionalFormFields['parent_type']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_type'] = 'Accounts';
}
else {
$additionalFormFields['parent_type'] = $defines['focus']->module_dir;
}
}
if(empty($additionalFormFields['parent_name']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_name'] = $defines['focus']->account_name;
$additionalFormFields['account_name'] = $defines['focus']->account_name;
}
else {
$additionalFormFields['parent_name'] = $defines['focus']->name;
}
}
if(empty($additionalFormFields['parent_id']))
{
if($defines['focus']->object_name=='Contact') {
$additionalFormFields['parent_id'] = $defines['focus']->account_id;
$additionalFormFields['account_id'] = $defines['focus']->account_id;
}
else {
$additionalFormFields['parent_id'] = $defines['focus']->id;
}
}
$button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n";
$button .= '<input type="hidden" name="module" value="Home" />' . "\n";
$button .= '<input type="hidden" name="target_action" value="EditView" />' . "\n";
// fill in additional form fields for all but action
foreach($additionalFormFields as $key => $value)
{
if($key != 'action')
{
$button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n";
}
}
return $button;
}
}
?>

View File

@@ -0,0 +1,168 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopSelectButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopSelectButton extends SugarWidgetSubPanelTopButton
{
//button_properties is a collection of properties associated with the widget_class definition. layoutmanager
function SugarWidgetSubPanelTopSelectButton($button_properties=array())
{
$this->button_properties=$button_properties;
}
//widget_data is the collection of attributes assoicated with the button in the layout_defs file.
function display(&$widget_data)
{
global $app_strings;
$initial_filter = '';
$this->title = $app_strings['LBL_SELECT_BUTTON_TITLE'];
$this->accesskey = $app_strings['LBL_SELECT_BUTTON_KEY'];
$this->value = $app_strings['LBL_SELECT_BUTTON_LABEL'];
if (is_array($this->button_properties)) {
if( isset($this->button_properties['title'])) {
$this->title = $app_strings[$this->button_properties['title']];
}
if( isset($this->button_properties['accesskey'])) {
$this->accesskey = $app_strings[$this->button_properties['accesskey']];
}
if( isset($this->button_properties['form_value'])) {
$this->value = $app_strings[$this->button_properties['form_value']];
}
if( isset($this->button_properties['module'])) {
$this->module_name = $this->button_properties['module'];
}
}
$focus = $widget_data['focus'];
if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){
$button = ' <input type="button" name="' . $this->getWidgetId() . '_select_button" id="' . $this->getWidgetId() . '_select_button" class="button"' . "\n"
. ' title="' . $this->title . '"'
. ' value="' . $this->value . "\"\n"
.' disabled />';
return $button;
}
//refresh the whole page after end of action?
$refresh_page = 0;
if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){
$refresh_page = 1;
}
$subpanel_definition = $widget_data['subpanel_definition'];
$button_definition = $subpanel_definition->get_buttons();
$subpanel_name = $subpanel_definition->get_name();
if (empty($this->module_name)) {
$this->module_name = $subpanel_definition->get_module_name();
}
$link_field_name = $subpanel_definition->get_data_source_name(true);
$popup_mode='Single';
if(isset($widget_data['mode'])){
$popup_mode=$widget_data['mode'];
}
if(isset($widget_data['initial_filter_fields'])){
if (is_array($widget_data['initial_filter_fields'])) {
foreach ($widget_data['initial_filter_fields'] as $value=>$alias) {
if (isset($focus->$value) and !empty($focus->$value)) {
$initial_filter.="&".$alias . '='.$focus->$value;
}
}
}
}
$create="true";
if(isset($widget_data['create'])){
$create=$widget_data['create'];
}
$return_module = $_REQUEST['module'];
$return_action = 'SubPanelViewer';
$return_id = $_REQUEST['record'];
//field_to_name_array
$fton_array= array('id' => 'subpanel_id');
if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){
$fton_array=array_merge($fton_array,$widget_data['field_to_name_array']);
}
$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1";
$popup_request_data = array(
'call_back_function' => 'set_return_and_save_background',
'form_name' => 'DetailView',
'field_to_name_array' => $fton_array,
'passthru_data' => array(
'child_field' => $subpanel_name,
'return_url' => urlencode($return_url),
'link_field_name' => $link_field_name,
'module_name' => $subpanel_name,
'refresh_page'=>$refresh_page,
),
);
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) {
$popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']);
}
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) {
if ($this->button_properties['add_to_passthru_data']['return_type']=='report') {
$initial_filter = "&module_name=${widget_data['module']}";
}
if ($this->button_properties['add_to_passthru_data']['return_type']=='addtoprospectlist') {
if (isset($widget_data['query'])) {
$popup_request_data['passthru_data']['query']=$widget_data['query'];
}
}
}
$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
return '<form action="index.php">' . "\n"
. ' <input type="button" name="' . $this->getWidgetId() . '_select_button" id="' . $this->getWidgetId() . '_select_button" class="button"' . "\n"
. ' title="' . $this->title . '"'
. ' accesskey="' . $this->accesskey . '"'
. ' value="' . $this->value . "\"\n"
. " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n";
}
}
?>

View File

@@ -0,0 +1,177 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopSelectButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopSelectButton.php');
class SugarWidgetSubPanelTopSelectContactsButton extends SugarWidgetSubPanelTopSelectButton
{
//button_properties is a collection of properties associated with the widget_class definition. layoutmanager
function SugarWidgetSubPanelTopSelectContactsButton($button_properties=array())
{
$this->button_properties=$button_properties;
}
//widget_data is the collection of attributes assoicated with the button in the layout_defs file.
function display(&$widget_data)
{
global $app_strings;
$initial_filter = '';
$this->title = $app_strings['LBL_SELECT_CONTACT_BUTTON_TITLE'];
$this->accesskey = $app_strings['LBL_SELECT_CONTACT_BUTTON_KEY'];
$this->value = $app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL'];
$this->module_name = 'Contacts';
if (is_array($this->button_properties)) {
if( isset($this->button_properties['title'])) {
$this->title = $app_strings[$this->button_properties['title']];
}
if( isset($this->button_properties['accesskey'])) {
$this->accesskey = $app_strings[$this->button_properties['accesskey']];
}
if( isset($this->button_properties['form_value'])) {
$this->value = $app_strings[$this->button_properties['form_value']];
}
if( isset($this->button_properties['module'])) {
$this->module_name = $this->button_properties['module'];
}
}
$focus = $widget_data['focus'];
if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){
$button = ' <input type="button" name="' .$this->getWidgetId() . '_select_button" id="' .$this->getWidgetId() . '_select_button" class="button"' . "\"\n"
. ' title="' . $this->title . '"'
. ' value="' . $this->value . "\"\n"
.' disabled />';
return $button;
}
//refresh the whole page after end of action?
$refresh_page = 0;
if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){
$refresh_page = 1;
}
$subpanel_definition = $widget_data['subpanel_definition'];
$button_definition = $subpanel_definition->get_buttons();
$subpanel_name = $subpanel_definition->get_module_name();
if (empty($this->module_name)) {
$this->module_name = $subpanel_name;
}
if ($subpanel_name == 'Project'){
$link_field_name = 'contact_resources';
}
else{
$link_field_name = $subpanel_definition->get_data_source_name(true);
}
$popup_mode='Single';
if(isset($widget_data['mode'])){
$popup_mode=$widget_data['mode'];
}
if(isset($widget_data['initial_filter_fields'])){
if (is_array($widget_data['initial_filter_fields'])) {
foreach ($widget_data['initial_filter_fields'] as $value=>$alias) {
if (isset($focus->$value) and !empty($focus->$value)) {
$initial_filter.="&".$alias . '='.$focus->$value;
}
}
}
}
$create="true";
if(isset($widget_data['create'])){
$create=$widget_data['create'];
}
$return_module = $_REQUEST['module'];
$return_action = 'SubPanelViewer';
$return_id = $_REQUEST['record'];
//field_to_name_array
$fton_array= array('id' => 'subpanel_id');
if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){
$fton_array=array_merge($fton_array,$widget_data['field_to_name_array']);
}
$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1";
$popup_request_data = array(
'call_back_function' => 'set_return_and_save_background',
'form_name' => 'DetailView',
'field_to_name_array' => $fton_array,
'passthru_data' => array(
'child_field' => $this->module_name,
'return_url' => urlencode($return_url),
'link_field_name' => $link_field_name,
'module_name' => $this->module_name,
'refresh_page'=>true,
),
);
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) {
$popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']);
}
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) {
if ($this->button_properties['add_to_passthru_data']['return_type']=='report') {
$initial_filter = "&module_name=${widget_data['module']}";
}
if ($this->button_properties['add_to_passthru_data']['return_type']=='addtoprospectlist') {
if (isset($widget_data['query'])) {
$popup_request_data['passthru_data']['query']=$widget_data['query'];
}
}
}
$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
return '<form action="index.php">' . "\n"
. ' <input type="button" name="' .$this->getWidgetId() . '_select_button" id="' .$this->getWidgetId() . '_select_button" class="button"' . "\"\n"
. ' title="' . $this->title . '"'
. ' accesskey="' . $this->accesskey . '"'
. ' value="' . $this->value . "\"\n"
. " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n";
}
}
?>

View File

@@ -0,0 +1,177 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopSelectButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopSelectButton.php');
class SugarWidgetSubPanelTopSelectUsersButton extends SugarWidgetSubPanelTopSelectButton
{
//button_properties is a collection of properties associated with the widget_class definition. layoutmanager
function SugarWidgetSubPanelTopSelectUsersButton($button_properties=array())
{
$this->button_properties=$button_properties;
}
//widget_data is the collection of attributes assoicated with the button in the layout_defs file.
function display(&$widget_data)
{
global $app_strings;
$initial_filter = '';
$this->title = $app_strings['LBL_SELECT_USER_BUTTON_TITLE'];
$this->accesskey = $app_strings['LBL_SELECT_USER_BUTTON_KEY'];
$this->value = $app_strings['LBL_SELECT_USER_BUTTON_LABEL'];
$this->module_name = 'Users';
if (is_array($this->button_properties)) {
if( isset($this->button_properties['title'])) {
$this->title = $app_strings[$this->button_properties['title']];
}
if( isset($this->button_properties['accesskey'])) {
$this->accesskey = $app_strings[$this->button_properties['accesskey']];
}
if( isset($this->button_properties['form_value'])) {
$this->value = $app_strings[$this->button_properties['form_value']];
}
if( isset($this->button_properties['module'])) {
$this->module_name = $this->button_properties['module'];
}
}
$focus = $widget_data['focus'];
if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){
$button = ' <input type="button" name="' .$this->getWidgetId() . '_select_button" id="' .$this->getWidgetId() . '_select_button" class="button"' . "\"\n"
. ' title="' . $this->title . '"'
. ' value="' . $this->value . "\"\n"
.' disabled />';
return $button;
}
//refresh the whole page after end of action?
$refresh_page = 0;
if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){
$refresh_page = 1;
}
$subpanel_definition = $widget_data['subpanel_definition'];
$button_definition = $subpanel_definition->get_buttons();
$subpanel_name = $subpanel_definition->get_module_name();
if (empty($this->module_name)) {
$this->module_name = $subpanel_name;
}
if ($subpanel_name == 'Project'){
$link_field_name = 'user_resources';
}
else{
$link_field_name = $subpanel_definition->get_data_source_name(true);
}
$popup_mode='Single';
if(isset($widget_data['mode'])){
$popup_mode=$widget_data['mode'];
}
if(isset($widget_data['initial_filter_fields'])){
if (is_array($widget_data['initial_filter_fields'])) {
foreach ($widget_data['initial_filter_fields'] as $value=>$alias) {
if (isset($focus->$value) and !empty($focus->$value)) {
$initial_filter.="&".$alias . '='.$focus->$value;
}
}
}
}
$create="true";
if(isset($widget_data['create'])){
$create=$widget_data['create'];
}
$return_module = $_REQUEST['module'];
$return_action = 'SubPanelViewer';
$return_id = $_REQUEST['record'];
//field_to_name_array
$fton_array= array('id' => 'subpanel_id');
if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){
$fton_array=array_merge($fton_array,$widget_data['field_to_name_array']);
}
$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1";
$popup_request_data = array(
'call_back_function' => 'set_return_and_save_background',
'form_name' => 'DetailView',
'field_to_name_array' => $fton_array,
'passthru_data' => array(
'child_field' => $this->module_name,
'return_url' => urlencode($return_url),
'link_field_name' => $link_field_name,
'module_name' => $this->module_name,
'refresh_page'=>true,
),
);
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) {
$popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']);
}
if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) {
if ($this->button_properties['add_to_passthru_data']['return_type']=='report') {
$initial_filter = "&module_name=${widget_data['module']}";
}
if ($this->button_properties['add_to_passthru_data']['return_type']=='addtoprospectlist') {
if (isset($widget_data['query'])) {
$popup_request_data['passthru_data']['query']=$widget_data['query'];
}
}
}
$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
return '<form action="index.php">' . "\n"
. ' <input type="button" name="' .$this->getWidgetId() . '_select_button" id="' .$this->getWidgetId() . '_select_button" class="button"' . "\"\n"
. ' title="' . $this->title . '"'
. ' accesskey="' . $this->accesskey . '"'
. ' value="' . $this->value . "\"\n"
. " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n";
}
}
?>

View File

@@ -0,0 +1,81 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelTopCreateNoteButton
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopSummaryButton extends SugarWidgetSubPanelTopButton
{
function display($widget_data)
{
global $app_strings;
global $currentModule;
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(),
);
$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
$title = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_TITLE'];
$accesskey = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_KEY'];
$value = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_LABEL'];
$module_name = 'Activities';
$id = $widget_data['focus']->id;
$initial_filter = "&record=$id&module_name=$currentModule";
if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'detail', true)){
$temp = '<input disabled type="button" name="summary_button" id="summary_button"'
. ' class="button"'
. ' title="' . $title . '"'
. ' value="' . $value . '"';
return $temp;
}
return '<input type="button" name="summary_button" id="summary_button"'
. ' class="button"'
. ' title="' . $title . '"'
. ' accesskey="' . $accesskey . '"'
. ' value="' . $value . '"'
. " onclick='open_popup(\"$module_name\",600,400,\"$initial_filter\",false,false,$json_encoded_php_array);' />\n";
}
}
?>

View File

@@ -0,0 +1,58 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarWidgetSubPanelDetailViewLink
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU 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 General Public License for more
* details.
*
* You should have received a copy of the GNU 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU 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/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetWzName extends SugarWidgetField
{
function displayList(&$layout_def)
{
global $focus;
$id = $layout_def['fields']['WZ_ID'];
$r=mysql_fetch_array(mysql_query("select name from ecmwzdocuments where id='".$id."'"));
return '<a href="index.php?module=EcmWzDocuments&action=DetailView&record='.$id.'">'.$r['name'].'</a>';
}
}
?>