init
This commit is contained in:
249
include/Dashlets/Dashlet.php
Executable file
249
include/Dashlets/Dashlet.php
Executable file
@@ -0,0 +1,249 @@
|
||||
<?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 Dashlet {
|
||||
/**
|
||||
* Id of the Dashlet
|
||||
* @var guid
|
||||
*/
|
||||
var $id;
|
||||
/**
|
||||
* Title of the Dashlet
|
||||
* @var string
|
||||
*/
|
||||
var $title = 'Generic Dashlet';
|
||||
/**
|
||||
* true if the Dashlet has configuration options.
|
||||
* @var bool
|
||||
*/
|
||||
var $isConfigurable = false;
|
||||
/**
|
||||
* true if the Dashlet is refreshable (ie charts that provide their own refresh)
|
||||
* @var bool
|
||||
*/
|
||||
var $isRefreshable = true;
|
||||
/**
|
||||
* true if the Dashlet contains javascript
|
||||
* @var bool
|
||||
*/
|
||||
var $hasScript = false;
|
||||
/**
|
||||
* Language strings, must be loaded at the Dashlet level w/ loadLanguage
|
||||
* @var array
|
||||
*/
|
||||
var $dashletStrings;
|
||||
|
||||
function Dashlet($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
function setConfigureIcon(){
|
||||
|
||||
|
||||
if($this->isConfigurable)
|
||||
$additionalTitle = '<td nowrap width="1%" style="padding-right: 0px;"><div class="dashletToolSet"><a href="#" onclick="SUGAR.mySugar.configureDashlet(\''
|
||||
. $this->id . '\'); return false;">'
|
||||
. SugarThemeRegistry::current()->getImage('dashlet-header-edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a>'
|
||||
. '';
|
||||
else
|
||||
$additionalTitle = '<td nowrap width="1%" style="padding-right: 0px;"><div class="dashletToolSet">';
|
||||
|
||||
return $additionalTitle;
|
||||
}
|
||||
|
||||
function setRefreshIcon(){
|
||||
|
||||
|
||||
$additionalTitle = '';
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
|
||||
. $this->id . '\'); return false;">'
|
||||
. SugarThemeRegistry::current()->getImage('dashlet-header-refresh','border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '"')
|
||||
. '</a>';
|
||||
return $additionalTitle;
|
||||
}
|
||||
|
||||
function setDeleteIcon(){
|
||||
global $image_path, $sugar_config, $current_user;
|
||||
if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true)
|
||||
return '</div></td></tr></table>';
|
||||
$additionalTitle = '';
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.deleteDashlet(\''
|
||||
. $this->id . '\'); return false;">'
|
||||
. SugarThemeRegistry::current()->getImage('dashlet-header-close','border="0" align="absmiddle" title="' . translate('LBL_DASHLET_DELETE', 'Home') . '" alt="' . translate('LBL_DASHLET_DELETE', 'Home') . '"')
|
||||
. '</a></div></td></tr></table>';
|
||||
return $additionalTitle;
|
||||
}
|
||||
|
||||
// No longer needed, replaced with getHeader/getFooter
|
||||
function getTitle($text = '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Dashlet is displayed
|
||||
*
|
||||
* @param string $text text after the title
|
||||
* @return string Header html
|
||||
*/
|
||||
function getHeader($text = '') {
|
||||
global $app_strings, $sugar_config;
|
||||
|
||||
$title = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text . '</td>';
|
||||
$title .= $this->setConfigureIcon();
|
||||
$title .= $this->setRefreshIcon();
|
||||
$title .= $this->setDeleteIcon();
|
||||
|
||||
if(!function_exists('get_form_header')) {
|
||||
global $theme;
|
||||
|
||||
}
|
||||
|
||||
$str = '<div ';
|
||||
if(empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) $str .= ' onmouseover="this.style.cursor = \'move\';"';
|
||||
$str .= 'id="dashlet_header_' . $this->id . '" class="hd"><div class="tl"></div><div class="hd-center">' . get_form_header($this->title, $title, false) . '</div><div class="tr"></div></div><div class="bd"><div class="ml"></div><div class="bd-center">';
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Dashlet is displayed
|
||||
*
|
||||
* @param string $text text after the title
|
||||
* @return string footer html
|
||||
*/
|
||||
function getFooter($text = '') {
|
||||
//$footer = '</div>';
|
||||
|
||||
$footer = '</div><div class="mr"></div></div><div class="ft"><div class="bl"></div><div class="ft-center"></div><div class="br"></div></div>';
|
||||
return $footer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Dashlet is displayed, override this
|
||||
*
|
||||
* @param string $text text after the title
|
||||
* @return string title html
|
||||
*/
|
||||
function display($text = '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Dashlets configuration options are called
|
||||
*
|
||||
*/
|
||||
function displayOptions() {
|
||||
}
|
||||
|
||||
/**
|
||||
* override if you need to do pre-processing before display is called
|
||||
*
|
||||
*/
|
||||
function process() {
|
||||
}
|
||||
|
||||
function save() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this if your dashlet is configurable (this is called when the the configureDashlet form is shown)
|
||||
* Filters the array for only the parameters it needs to save
|
||||
*
|
||||
* @param array $req the array to pull options from
|
||||
*
|
||||
* @return array options array
|
||||
*/
|
||||
function saveOptions($req) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the language strings
|
||||
*
|
||||
* @param string $dashletClassname classname of the dashlet
|
||||
*
|
||||
*/
|
||||
function loadLanguage($dashletClassname, $dashletDirectory = 'modules/Home/Dashlets/') {
|
||||
global $current_language, $dashletStrings;
|
||||
|
||||
if(!isset($dashletStrings[$dashletClassname])) {
|
||||
// load current language strings for current language, else default to english
|
||||
if(is_file($dashletDirectory . $dashletClassname . '/' . $dashletClassname . '.' . $current_language . '.lang.php'))
|
||||
require_once($dashletDirectory . $dashletClassname . '/' . $dashletClassname . '.' . $current_language . '.lang.php');
|
||||
else
|
||||
require_once($dashletDirectory . $dashletClassname . '/' . $dashletClassname . '.en_us.lang.php');
|
||||
}
|
||||
|
||||
$this->dashletStrings = $dashletStrings[$dashletClassname];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic way to store an options array into UserPreferences
|
||||
*
|
||||
* @param array $optionsArray the array to save
|
||||
*/
|
||||
function storeOptions($optionsArray) {
|
||||
global $current_user;
|
||||
$dashletDefs = $current_user->getPreference('dashlets', 'Home'); // load user's dashlets config
|
||||
$dashletDefs[$this->id]['options'] = $optionsArray;
|
||||
$current_user->setPreference('dashlets', $dashletDefs, 0, 'Home');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic way to retrieve options array from UserPreferences
|
||||
*
|
||||
* @return array options array stored in UserPreferences
|
||||
*/
|
||||
function loadOptions() {
|
||||
global $current_user;
|
||||
$dashletDefs = $current_user->getPreference('dashlets', 'Home'); // load user's dashlets config
|
||||
if(isset($dashletDefs[$this->id]['options']))
|
||||
return $dashletDefs[$this->id]['options'];
|
||||
else
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this in the subclass. It is used to determine whether the dashlet can be displayed.
|
||||
*
|
||||
* @return bool indicating whether or not the current user has access to display this Dashlet.
|
||||
*/
|
||||
function hasAccess(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
87
include/Dashlets/DashletCacheBuilder.php
Executable file
87
include/Dashlets/DashletCacheBuilder.php
Executable file
@@ -0,0 +1,87 @@
|
||||
<?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: Handles Generic Widgets
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
class DashletCacheBuilder {
|
||||
|
||||
/**
|
||||
* Builds the cache of Dashlets by scanning the system
|
||||
*/
|
||||
function buildCache() {
|
||||
global $beanList;
|
||||
$dashletFiles = array();
|
||||
$dashletFilesCustom = array();
|
||||
|
||||
getFiles($dashletFiles, 'modules', '/^.*\/Dashlets\/[^\.]*\.php$/');
|
||||
getFiles($dashletFilesCustom, 'custom/modules', '/^.*\/Dashlets\/[^\.]*\.php$/');
|
||||
$cacheDir = create_cache_directory('dashlets/');
|
||||
$allDashlets = array_merge($dashletFiles, $dashletFilesCustom);
|
||||
$dashletFiles = array();
|
||||
foreach($allDashlets as $num => $file) {
|
||||
if(substr_count($file, '.meta') == 0) { // ignore meta data files
|
||||
$class = substr($file, strrpos($file, '/') + 1, -4);
|
||||
$dashletFiles[$class] = array();
|
||||
$dashletFiles[$class]['file'] = $file;
|
||||
$dashletFiles[$class]['class'] = $class;
|
||||
if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
|
||||
$dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file);
|
||||
require($dashletFiles[$class]['meta']);
|
||||
if ( isset($dashletMeta[$class]['module']) )
|
||||
$dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
|
||||
}
|
||||
|
||||
$filesInDirectory = array();
|
||||
getFiles($filesInDirectory, substr($file, 0, strrpos($file, '/')), '/^.*\/Dashlets\/[^\.]*\.icon\.(jpg|jpeg|gif|png)$/i');
|
||||
if(!empty($filesInDirectory)) {
|
||||
$dashletFiles[$class]['icon'] = $filesInDirectory[0]; // take the first icon we see
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir . 'dashlets.php');
|
||||
}
|
||||
}
|
||||
?>
|
||||
485
include/Dashlets/DashletGeneric.php
Executable file
485
include/Dashlets/DashletGeneric.php
Executable file
@@ -0,0 +1,485 @@
|
||||
<?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/Dashlets/Dashlet.php');
|
||||
require_once('include/ListView/ListViewSmarty.php');
|
||||
require_once('include/generic/LayoutManager.php');
|
||||
|
||||
class DashletGeneric extends Dashlet {
|
||||
/**
|
||||
* Fields that are searchable
|
||||
* @var array
|
||||
*/
|
||||
var $searchFields;
|
||||
/**
|
||||
* Displayable columns (ones available to display)
|
||||
* @var array
|
||||
*/
|
||||
var $columns;
|
||||
/**
|
||||
* Bean file used in this Dashlet
|
||||
* @var bean
|
||||
*/
|
||||
var $seedBean;
|
||||
/**
|
||||
* collection of filters to apply
|
||||
* @var array
|
||||
*/
|
||||
var $filters = null;
|
||||
/**
|
||||
* Number of Rows to display
|
||||
* @var int
|
||||
*/
|
||||
var $displayRows = '5';
|
||||
/**
|
||||
* Actual columns to display, will be a subset of $columns
|
||||
* @var array
|
||||
*/
|
||||
var $displayColumns = null;
|
||||
/**
|
||||
* Flag to display only the current users's items.
|
||||
* @var bool
|
||||
*/
|
||||
var $myItemsOnly = true;
|
||||
/**
|
||||
* Flag to display "myItemsOnly" checkbox in the DashletGenericConfigure.
|
||||
* @var bool
|
||||
*/
|
||||
var $showMyItemsOnly = true;
|
||||
/**
|
||||
* location of Smarty template file for display
|
||||
* @var string
|
||||
*/
|
||||
var $displayTpl = 'include/Dashlets/DashletGenericDisplay.tpl';
|
||||
/**
|
||||
* location of smarty template file for configuring
|
||||
* @var string
|
||||
*/
|
||||
var $configureTpl = 'include/Dashlets/DashletGenericConfigure.tpl';
|
||||
/**
|
||||
* smarty object for the generic configuration template
|
||||
* @var string
|
||||
*/
|
||||
var $configureSS;
|
||||
/** search inputs to be populated in configure template.
|
||||
* modify this after processDisplayOptions, but before displayOptions to modify search inputs
|
||||
* @var array
|
||||
*/
|
||||
var $currentSearchFields;
|
||||
/**
|
||||
* ListView Smarty Class
|
||||
* @var Smarty
|
||||
*/
|
||||
var $lvs;
|
||||
var $layoutManager;
|
||||
|
||||
function DashletGeneric($id, $options = null) {
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
if(isset($options)) {
|
||||
if(!empty($options['filters'])) $this->filters = $options['filters'];
|
||||
if(!empty($options['title'])) $this->title = $options['title'];
|
||||
if(!empty($options['displayRows'])) $this->displayRows = $options['displayRows'];
|
||||
if(!empty($options['displayColumns'])) $this->displayColumns = $options['displayColumns'];
|
||||
if(isset($options['myItemsOnly'])) $this->myItemsOnly = $options['myItemsOnly'];
|
||||
}
|
||||
|
||||
$this->layoutManager = new LayoutManager();
|
||||
$this->layoutManager->setAttribute('context', 'Report');
|
||||
// fake a reporter object here just to pass along the db type used in many widgets.
|
||||
// this should be taken out when sugarwidgets change
|
||||
$temp = (object) array('db' => &$GLOBALS['db'], 'report_def_str' => '');
|
||||
$this->layoutManager->setAttributePtr('reporter', $temp);
|
||||
$this->lvs = new ListViewSmarty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the display options template
|
||||
*
|
||||
* @return string HTML that shows options
|
||||
*/
|
||||
function processDisplayOptions() {
|
||||
require_once('include/templates/TemplateGroupChooser.php');
|
||||
|
||||
$this->configureSS = new Sugar_Smarty();
|
||||
// column chooser
|
||||
$chooser = new TemplateGroupChooser();
|
||||
|
||||
$chooser->args['id'] = 'edit_tabs';
|
||||
$chooser->args['left_size'] = 5;
|
||||
$chooser->args['right_size'] = 5;
|
||||
$chooser->args['values_array'][0] = array();
|
||||
$chooser->args['values_array'][1] = array();
|
||||
|
||||
$this->loadCustomMetadata();
|
||||
$this->addCustomFields();
|
||||
if($this->displayColumns) {
|
||||
// columns to display
|
||||
foreach($this->displayColumns as $num => $name) {
|
||||
// defensive code for array being returned
|
||||
$translated = translate($this->columns[$name]['label'], $this->seedBean->module_dir);
|
||||
if(is_array($translated)) $translated = $this->columns[$name]['label'];
|
||||
$chooser->args['values_array'][0][$name] = trim($translated, ':');
|
||||
}
|
||||
// columns not displayed
|
||||
foreach(array_diff(array_keys($this->columns), array_values($this->displayColumns)) as $num => $name) {
|
||||
// defensive code for array being returned
|
||||
$translated = translate($this->columns[$name]['label'], $this->seedBean->module_dir);
|
||||
if(is_array($translated)) $translated = $this->columns[$name]['label'];
|
||||
$chooser->args['values_array'][1][$name] = trim($translated, ':');
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach($this->columns as $name => $val) {
|
||||
// defensive code for array being returned
|
||||
$translated = translate($this->columns[$name]['label'], $this->seedBean->module_dir);
|
||||
if(is_array($translated)) $translated = $this->columns[$name]['label'];
|
||||
if(!empty($val['default']) && $val['default'])
|
||||
$chooser->args['values_array'][0][$name] = trim($translated, ':');
|
||||
else
|
||||
$chooser->args['values_array'][1][$name] = trim($translated, ':');
|
||||
}
|
||||
}
|
||||
|
||||
$chooser->args['left_name'] = 'display_tabs';
|
||||
$chooser->args['right_name'] = 'hide_tabs';
|
||||
$chooser->args['max_left'] = '6';
|
||||
|
||||
$chooser->args['left_label'] = $GLOBALS['app_strings']['LBL_DISPLAY_COLUMNS'];
|
||||
$chooser->args['right_label'] = $GLOBALS['app_strings']['LBL_HIDE_COLUMNS'];
|
||||
$chooser->args['title'] = '';
|
||||
$this->configureSS->assign('columnChooser', $chooser->display());
|
||||
|
||||
$query = false;
|
||||
$count = 0;
|
||||
|
||||
if(!is_array($this->filters)) {
|
||||
// use default search params
|
||||
$this->filters = array();
|
||||
foreach($this->searchFields as $name => $params) {
|
||||
if(!empty($params['default']))
|
||||
$this->filters[$name] = $params['default'];
|
||||
}
|
||||
}
|
||||
foreach($this->searchFields as $name=>$params) {
|
||||
if(!empty($name)) {
|
||||
$name = strtolower($name);
|
||||
$currentSearchFields[$name] = array();
|
||||
$widgetDef = $this->seedBean->field_defs[$name];
|
||||
if($widgetDef['type'] == 'enum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
|
||||
if($widgetDef['name'] == 'assigned_user_name') $widgetDef['name'] = 'assigned_user_id';
|
||||
$widgetDef['input_name0'] = empty($this->filters[$name]) ? '' : $this->filters[$name];
|
||||
$currentSearchFields[$name]['label'] = !empty($params['label']) ? translate($params['label'], $this->seedBean->module_dir) : translate($widgetDef['vname'], $this->seedBean->module_dir);
|
||||
$currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->filters[$name]) ? '' : $this->filters[$name]));
|
||||
}
|
||||
else { // ability to create spacers in input fields
|
||||
$currentSearchFields['blank' + $count]['label'] = '';
|
||||
$currentSearchFields['blank' + $count]['input'] = '';
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$this->currentSearchFields = $currentSearchFields;
|
||||
|
||||
$this->configureSS->assign('strings', array('general' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_GENERAL'],
|
||||
'filters' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_FILTERS'],
|
||||
'myItems' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_MY_ITEMS_ONLY'],
|
||||
'displayRows' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_DISPLAY_ROWS'],
|
||||
'title' => $GLOBALS['mod_strings']['LBL_DASHLET_CONFIGURE_TITLE'],
|
||||
'save' => $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']));
|
||||
$this->configureSS->assign('id', $this->id);
|
||||
$this->configureSS->assign('showMyItemsOnly', $this->showMyItemsOnly);
|
||||
$this->configureSS->assign('myItemsOnly', $this->myItemsOnly);
|
||||
$this->configureSS->assign('searchFields', $this->currentSearchFields);
|
||||
// title
|
||||
$this->configureSS->assign('dashletTitle', $this->title);
|
||||
|
||||
// display rows
|
||||
$displayRowOptions = $GLOBALS['sugar_config']['dashlet_display_row_options'];
|
||||
$this->configureSS->assign('displayRowOptions', $displayRowOptions);
|
||||
$this->configureSS->assign('displayRowSelect', $this->displayRows);
|
||||
}
|
||||
/**
|
||||
* Displays the options for this Dashlet
|
||||
*
|
||||
* @return string HTML that shows options
|
||||
*/
|
||||
function displayOptions() {
|
||||
$this->processDisplayOptions();
|
||||
return parent::displayOptions() . $this->configureSS->fetch($this->configureTpl);
|
||||
}
|
||||
|
||||
function buildWhere() {
|
||||
global $current_user;
|
||||
|
||||
$returnArray = array();
|
||||
|
||||
if(!is_array($this->filters)) {
|
||||
// use defaults
|
||||
$this->filters = array();
|
||||
foreach($this->searchFields as $name => $params) {
|
||||
if(!empty($params['default']))
|
||||
$this->filters[$name] = $params['default'];
|
||||
}
|
||||
}
|
||||
foreach($this->filters as $name=>$params) {
|
||||
if(!empty($params)) {
|
||||
if($name == 'assigned_user_id' && $this->myItemsOnly) continue; // don't handle assigned user filter if filtering my items only
|
||||
$widgetDef = $this->seedBean->field_defs[$name];
|
||||
|
||||
$widgetClass = $this->layoutManager->getClassFromWidgetDef($widgetDef, true);
|
||||
$widgetDef['table'] = $this->seedBean->table_name;
|
||||
$widgetDef['table_alias'] = $this->seedBean->table_name;
|
||||
if(!empty($widgetDef['source']) && $widgetDef['source'] == 'custom_fields'){
|
||||
$widgetDef['table'] = $this->seedBean->table_name."_cstm";
|
||||
$widgetDef['table_alias'] = $widgetDef['table'];
|
||||
}
|
||||
switch($widgetDef['type']) {// handle different types
|
||||
case 'date':
|
||||
case 'datetime':
|
||||
case 'datetimecombo':
|
||||
if(is_array($params) && !empty($params)) {
|
||||
if(!empty($params['date']))
|
||||
$widgetDef['input_name0'] = $params['date'];
|
||||
$filter = 'queryFilter' . $params['type'];
|
||||
}
|
||||
else {
|
||||
$filter = 'queryFilter' . $params;
|
||||
}
|
||||
array_push($returnArray, $widgetClass->$filter($widgetDef, true));
|
||||
break;
|
||||
case 'assigned_user_name':
|
||||
// This type runs through the SugarWidgetFieldname class, and needs a little extra help to make it through
|
||||
if ( ! isset($widgetDef['column_key']) ) {
|
||||
$widgetDef['column_key'] = $name;
|
||||
}
|
||||
// No break here, we want to run through the default handler
|
||||
default:
|
||||
$widgetDef['input_name0'] = $params;
|
||||
if(is_array($params) && !empty($params)) { // handle array query
|
||||
array_push($returnArray, $widgetClass->queryFilterone_of($widgetDef, false));
|
||||
}
|
||||
else {
|
||||
array_push($returnArray, $widgetClass->queryFilterStarts_With($widgetDef, true));
|
||||
}
|
||||
$widgetDef['input_name0'] = $params;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->myItemsOnly) array_push($returnArray, $this->seedBean->table_name . '.' . "assigned_user_id = '" . $current_user->id . "'");
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
private function loadCustomMetadata(){
|
||||
$customMetadate = 'custom/modules/'.$this->seedBean->module_dir.'/metadata/dashletviewdefs.php';
|
||||
if ( file_exists ( $customMetadate )){
|
||||
require_once($customMetadate);
|
||||
$this->searchFields = $dashletData[$this->seedBean->module_dir.'Dashlet']['searchFields'];
|
||||
foreach($this->searchFields as $key =>$def){
|
||||
if($key == 'assigned_user_name'){
|
||||
$this->searchFields['assigned_user_id'] = $def;
|
||||
unset($this->searchFields['assigned_user_name'] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->columns = $dashletData[$this->seedBean->module_dir.'Dashlet']['columns'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does all dashlet processing, here's your chance to modify the rows being displayed!
|
||||
*/
|
||||
function process($lvsParams = array()) {
|
||||
$currentSearchFields = array();
|
||||
$configureView = true; // configure view or regular view
|
||||
$query = false;
|
||||
$whereArray = array();
|
||||
$lvsParams['massupdate'] = false;
|
||||
|
||||
$this->loadCustomMetadata();
|
||||
$this->addCustomFields();
|
||||
// apply filters
|
||||
if(isset($this->filters) || $this->myItemsOnly) {
|
||||
$whereArray = $this->buildWhere();
|
||||
}
|
||||
|
||||
$this->lvs->export = false;
|
||||
$this->lvs->multiSelect = false;
|
||||
// columns
|
||||
$displayColumns = array();
|
||||
if(!empty($this->displayColumns)) { // use user specified columns
|
||||
foreach($this->displayColumns as $name => $val) {
|
||||
$displayColumns[strtoupper($val)] = $this->columns[$val];
|
||||
$displayColumns[strtoupper($val)]['label'] = trim($displayColumns[strtoupper($val)]['label'], ':');// strip : at the end of headers
|
||||
}
|
||||
}
|
||||
else if (isset($this->columns)){
|
||||
// use the default
|
||||
foreach($this->columns as $name => $val) {
|
||||
if(!empty($val['default']) && $val['default']) {
|
||||
$displayColumns[strtoupper($name)] = $val;
|
||||
$displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->lvs->displayColumns = $displayColumns;
|
||||
|
||||
$this->lvs->lvd->setVariableName($this->seedBean->object_name, array());
|
||||
$lvdOrderBy = $this->lvs->lvd->getOrderBy(); // has this list been ordered, if not use default
|
||||
if(empty($lvdOrderBy['orderBy'])) {
|
||||
foreach($displayColumns as $colName => $colParams) {
|
||||
if(!empty($colParams['defaultOrderColumn'])) {
|
||||
$lvsParams['overrideOrder'] = true;
|
||||
$lvsParams['orderBy'] = $colName;
|
||||
$lvsParams['sortOrder'] = $colParams['defaultOrderColumn']['sortOrder'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!empty($this->displayTpl))
|
||||
{
|
||||
//MFH BUG #14296
|
||||
$where = '';
|
||||
if(!empty($whereArray)){
|
||||
$where = '(' . implode(') AND (', $whereArray) . ')';
|
||||
}
|
||||
$this->lvs->setup($this->seedBean, $this->displayTpl, $where , $lvsParams, 0, $this->displayRows/*, $filterFields*/);
|
||||
if(in_array('CREATED_BY', array_keys($displayColumns))) { // handle the created by field
|
||||
foreach($this->lvs->data['data'] as $row => $data) {
|
||||
$this->lvs->data['data'][$row]['CREATED_BY'] = get_assigned_user_name($data['CREATED_BY']);
|
||||
}
|
||||
}
|
||||
// assign a baseURL w/ the action set as DisplayDashlet
|
||||
foreach($this->lvs->data['pageData']['urls'] as $type => $url) {
|
||||
// awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet
|
||||
if($type == 'orderBy')
|
||||
$this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url);
|
||||
else
|
||||
$this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url) . '&sugar_body_only=1&id=' . $this->id;
|
||||
}
|
||||
|
||||
$this->lvs->ss->assign('dashletId', $this->id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the Dashlet, must call process() prior to calling this
|
||||
*
|
||||
* @return string HTML that displays Dashlet
|
||||
*/
|
||||
function display() {
|
||||
return parent::display() . $this->lvs->display(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the $_REQUEST and only save only the needed options
|
||||
* @param array $req the array to pull options from
|
||||
*
|
||||
* @return array options array
|
||||
*/
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
|
||||
$this->loadCustomMetadata();
|
||||
foreach($req as $name => $value) {
|
||||
if(!is_array($value)) $req[$name] = trim($value);
|
||||
}
|
||||
$options['filters'] = array();
|
||||
foreach($this->searchFields as $name=>$params) {
|
||||
$widgetDef = $this->seedBean->field_defs[$name];
|
||||
if($widgetDef['type'] == 'datetimecombo' || $widgetDef['type'] == 'datetime' || $widgetDef['type'] == 'date') { // special case datetime types
|
||||
$options['filters'][$widgetDef['name']] = array();
|
||||
if(!empty($req['type_' . $widgetDef['name']])) { // save the type of date filter
|
||||
$options['filters'][$widgetDef['name']]['type'] = $req['type_' . $widgetDef['name']];
|
||||
}
|
||||
if(!empty($req['date_' . $widgetDef['name']])) { // save the date
|
||||
$options['filters'][$widgetDef['name']]['date'] = $req['date_' . $widgetDef['name']];
|
||||
}
|
||||
}
|
||||
elseif(!empty($req[$widgetDef['name']])) {
|
||||
$options['filters'][$widgetDef['name']] = $req[$widgetDef['name']];
|
||||
}
|
||||
}
|
||||
if(!empty($req['dashletTitle'])) {
|
||||
$options['title'] = $req['dashletTitle'];
|
||||
}
|
||||
|
||||
if(!empty($req['myItemsOnly'])) {
|
||||
$options['myItemsOnly'] = $req['myItemsOnly'];
|
||||
}
|
||||
else {
|
||||
$options['myItemsOnly'] = false;
|
||||
}
|
||||
$options['displayRows'] = empty($req['displayRows']) ? '5' : $req['displayRows'];
|
||||
// displayColumns
|
||||
if(!empty($req['displayColumnsDef'])) {
|
||||
$options['displayColumns'] = explode('|', $req['displayColumnsDef']);
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function to add custom fields
|
||||
*
|
||||
*/
|
||||
function addCustomFields() {
|
||||
foreach($this->seedBean->field_defs as $fieldName => $def) {
|
||||
if(!empty($def['type']) && $def['type'] == 'html')
|
||||
continue;
|
||||
if(isset($def['vname'])) {
|
||||
$translated = translate($def['vname'], $this->seedBean->module_dir);
|
||||
if(is_array($translated)) $translated = $def['vname'];
|
||||
if(!empty($def['source']) && $def['source'] == 'custom_fields') {
|
||||
if(isset($this->columns[$fieldName]['default']) && $this->columns[$fieldName]['default']){
|
||||
$this->columns[$fieldName] = array('width' => '10',
|
||||
'label' => $translated,
|
||||
'default' => 1);
|
||||
}else{
|
||||
$this->columns[$fieldName] = array('width' => '10',
|
||||
'label' => $translated);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
296
include/Dashlets/DashletGenericChart.php
Executable file
296
include/Dashlets/DashletGenericChart.php
Executable file
@@ -0,0 +1,296 @@
|
||||
<?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/Dashlets/Dashlet.php');
|
||||
require_once('include/generic/LayoutManager.php');
|
||||
|
||||
abstract class DashletGenericChart extends Dashlet
|
||||
{
|
||||
/**
|
||||
* The title of the dashlet
|
||||
* @var string
|
||||
*/
|
||||
public $title;
|
||||
|
||||
/**
|
||||
* @see Dashlet::$isConfigurable
|
||||
*/
|
||||
public $isConfigurable = true;
|
||||
|
||||
/**
|
||||
* @see Dashlet::$isRefreshable
|
||||
*/
|
||||
public $isRefreshable = true;
|
||||
|
||||
/**
|
||||
* location of smarty template file for configuring
|
||||
* @var string
|
||||
*/
|
||||
protected $_configureTpl = 'include/Dashlets/DashletGenericChartConfigure.tpl';
|
||||
|
||||
/**
|
||||
* Bean file used in this Dashlet
|
||||
* @var object
|
||||
*/
|
||||
private $_seedBean;
|
||||
|
||||
/**
|
||||
* Module used in this Dashlet
|
||||
* @var string
|
||||
*/
|
||||
protected $_seedName;
|
||||
|
||||
/**
|
||||
* Array of fields and thier defintions that we are searching on
|
||||
* @var array
|
||||
*/
|
||||
protected $_searchFields;
|
||||
|
||||
/**
|
||||
* smarty object for the generic configuration template
|
||||
* @var object
|
||||
*/
|
||||
private $_configureSS;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(
|
||||
$id,
|
||||
array $options = null
|
||||
)
|
||||
{
|
||||
parent::Dashlet($id);
|
||||
|
||||
if ( isset($options) ) {
|
||||
foreach ( $options as $key => $value ) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// load searchfields
|
||||
$classname = get_class($this);
|
||||
if ( is_file("modules/Charts/Dashlets/$classname/$classname.data.php") ) {
|
||||
require("modules/Charts/Dashlets/$classname/$classname.data.php");
|
||||
$this->_searchFields = $dashletData[$classname]['searchFields'];
|
||||
}
|
||||
|
||||
// load language files
|
||||
$this->loadLanguage($classname, 'modules/Charts/Dashlets/');
|
||||
|
||||
if ( empty($options['title']) )
|
||||
$this->title = $this->dashletStrings['LBL_TITLE'];
|
||||
|
||||
$this->layoutManager = new LayoutManager();
|
||||
$this->layoutManager->setAttribute('context', 'Report');
|
||||
// fake a reporter object here just to pass along the db type used in many widgets.
|
||||
// this should be taken out when sugarwidgets change
|
||||
$temp = (object) array('db' => &$GLOBALS['db'], 'report_def_str' => '');
|
||||
$this->layoutManager->setAttributePtr('reporter', $temp);
|
||||
}
|
||||
|
||||
public function setRefreshIcon()
|
||||
{
|
||||
$additionalTitle = '';
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
|
||||
. $this->id . '\',\'predefined_chart\'); return false;"><img border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
|
||||
. SugarThemeRegistry::current()->getImageURL('dashlet-header-refresh.png').'"/></a>';
|
||||
return $additionalTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
public function displayScript()
|
||||
{
|
||||
global $sugar_config, $current_user, $current_language;
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
$chartStringsXML = $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $current_language .'.lang.xml';
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
|
||||
$ss->assign('chartStyleCSS', SugarThemeRegistry::current()->getCSSURL('chart.css'));
|
||||
$ss->assign('chartColorsXML', SugarThemeRegistry::current()->getImageURL('sugarColors.xml'));
|
||||
$ss->assign('chartStringsXML', $chartStringsXML);
|
||||
|
||||
$str = $ss->fetch('include/Dashlets/DashletGenericChartScript.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the smarty object for the config window. Designed to allow lazy loading the object
|
||||
* when it's needed.
|
||||
*/
|
||||
protected function getConfigureSmartyInstance()
|
||||
{
|
||||
if ( !($this->_configureSS instanceof Sugar_Smarty) ) {
|
||||
|
||||
$this->_configureSS = new Sugar_Smarty();
|
||||
}
|
||||
|
||||
return $this->_configureSS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the chart config options
|
||||
* Filter the $_REQUEST and only save only the needed options
|
||||
*
|
||||
* @param array $req
|
||||
* @return array
|
||||
*/
|
||||
public function saveOptions(
|
||||
$req
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
|
||||
$options = array();
|
||||
|
||||
foreach($req as $name => $value)
|
||||
if(!is_array($value)) $req[$name] = trim($value);
|
||||
|
||||
foreach($this->_searchFields as $name => $params) {
|
||||
$widgetDef = $params;
|
||||
if ( isset($this->getSeedBean()->field_defs[$name]) )
|
||||
$widgetDef = $this->getSeedBean()->field_defs[$name];
|
||||
if ( $widgetDef['type'] == 'date') // special case date types
|
||||
$options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
|
||||
elseif ( $widgetDef['type'] == 'time') // special case time types
|
||||
$options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat);
|
||||
elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types
|
||||
$options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
|
||||
elseif (!empty($req[$widgetDef['name']]))
|
||||
$options[$widgetDef['name']] = $req[$widgetDef['name']];
|
||||
}
|
||||
|
||||
if (!empty($req['dashletTitle']))
|
||||
$options['title'] = $req['dashletTitle'];
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles displaying the chart dashlet configuration popup window
|
||||
*
|
||||
* @return string HTML to return to the browser
|
||||
*/
|
||||
public function displayOptions()
|
||||
{
|
||||
$currentSearchFields = array();
|
||||
|
||||
if ( is_array($this->_searchFields) ) {
|
||||
foreach($this->_searchFields as $name=>$params) {
|
||||
if(!empty($name)) {
|
||||
$name = strtolower($name);
|
||||
$currentSearchFields[$name] = array();
|
||||
|
||||
$widgetDef = $params;
|
||||
if ( isset($this->getSeedBean()->field_defs[$name]) )
|
||||
$widgetDef = $this->getSeedBean()->field_defs[$name];
|
||||
|
||||
if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
|
||||
|
||||
if ( empty($widgetDef['input_name0']) )
|
||||
$widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
|
||||
$currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir);
|
||||
if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] )
|
||||
$currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
|
||||
$currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name));
|
||||
}
|
||||
else { // ability to create spacers in input fields
|
||||
$currentSearchFields['blank' + $count]['label'] = '';
|
||||
$currentSearchFields['blank' + $count]['input'] = '';
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->currentSearchFields = $currentSearchFields;
|
||||
$this->getConfigureSmartyInstance()->assign('title',translate('LBL_TITLE','Charts'));
|
||||
$this->getConfigureSmartyInstance()->assign('save',$GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']);
|
||||
$this->getConfigureSmartyInstance()->assign('id', $this->id);
|
||||
$this->getConfigureSmartyInstance()->assign('searchFields', $this->currentSearchFields);
|
||||
$this->getConfigureSmartyInstance()->assign('dashletTitle', $this->title);
|
||||
$this->getConfigureSmartyInstance()->assign('dashletType', 'predefined_chart');
|
||||
$this->getConfigureSmartyInstance()->assign('module', $_REQUEST['module']);
|
||||
|
||||
return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the DashletGenericChart::_seedBean object. Designed to allow lazy loading the object
|
||||
* when it's needed.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function getSeedBean()
|
||||
{
|
||||
if ( !($this->_seedBean instanceof $this->_seedName) )
|
||||
$this->_seedBean = loadBean($this->_seedName);
|
||||
|
||||
return $this->_seedBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the built query read to feed into SugarChart::getData()
|
||||
*
|
||||
* @return string SQL query
|
||||
*/
|
||||
protected function constructQuery()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array of group by parameters for SugarChart::$group_by
|
||||
*
|
||||
* @return string SQL query
|
||||
*/
|
||||
protected function constructGroupBy()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
?>
|
||||
82
include/Dashlets/DashletGenericChartConfigure.tpl
Executable file
82
include/Dashlets/DashletGenericChartConfigure.tpl
Executable file
@@ -0,0 +1,82 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="edit view">
|
||||
<tr>
|
||||
<td scope='row'>
|
||||
{$title}
|
||||
</td>
|
||||
<td colspan='3'>
|
||||
<input type='text' name='dashletTitle' value='{$dashletTitle}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
{foreach name=searchIteration from=$searchFields key=name item=params}
|
||||
<td scope='row' valign='top'>
|
||||
{$params.label}
|
||||
</td>
|
||||
<td valign='top' style='padding-bottom: 5px'>
|
||||
{$params.input}
|
||||
</td>
|
||||
{if ($smarty.foreach.searchIteration.iteration is even) and $smarty.foreach.searchIteration.iteration != $smarty.foreach.searchIteration.last}
|
||||
</tr><tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='4' align='right'>
|
||||
<input type='submit' class='button' value='{$save}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
44
include/Dashlets/DashletGenericChartScript.tpl
Executable file
44
include/Dashlets/DashletGenericChartScript.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
<script>
|
||||
SUGAR.mySugar.addToChartsArray('{$chartName}', '{$chartXMLFile}', '100%', '480', '{$chartStyleCSS}', '{$chartColorsXML}', '{$chartStringsXML}');
|
||||
</script>
|
||||
123
include/Dashlets/DashletGenericConfigure.tpl
Executable file
123
include/Dashlets/DashletGenericConfigure.tpl
Executable file
@@ -0,0 +1,123 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div>
|
||||
<form action='index.php' id='configure_{$id}' method='post' onSubmit='SUGAR.mySugar.setChooser(); return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' id='displayColumnsDef' name='displayColumnsDef' value=''>
|
||||
<input type='hidden' id='hideTabsDef' name='hideTabsDef' value=''>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='' />
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="edit view">
|
||||
<tr>
|
||||
<td scope='row'colspan='4' align='left'>
|
||||
<h2>{$strings.general}</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope='row'>
|
||||
{$strings.title}
|
||||
</td>
|
||||
<td colspan='3'>
|
||||
<input type='text' name='dashletTitle' value='{$dashletTitle}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope='row'>
|
||||
{$strings.displayRows}
|
||||
</td>
|
||||
<td colspan='3'>
|
||||
<select name='displayRows'>
|
||||
{html_options values=$displayRowOptions output=$displayRowOptions selected=$displayRowSelect}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='4' align='center'>
|
||||
<table border='0' cellpadding='0' cellspacing='0'>
|
||||
<tr><td>
|
||||
{$columnChooser}
|
||||
</td>
|
||||
</tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td scope='row'colspan='4' align='left'>
|
||||
<br>
|
||||
<h2>{$strings.filters}</h2>
|
||||
</td>
|
||||
</tr>
|
||||
{if $showMyItemsOnly}
|
||||
<tr>
|
||||
<td scope='row'>
|
||||
{$strings.myItems}
|
||||
</td>
|
||||
<td>
|
||||
<input type='checkbox' {if $myItemsOnly == 'true'}checked{/if} name='myItemsOnly' value='true'>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
{foreach name=searchIteration from=$searchFields key=name item=params}
|
||||
<td scope='row' valign='top'>
|
||||
{$params.label}
|
||||
</td>
|
||||
<td valign='top' style='padding-bottom: 5px'>
|
||||
{$params.input}
|
||||
</td>
|
||||
{if ($smarty.foreach.searchIteration.iteration is even) and $smarty.foreach.searchIteration.iteration != $smarty.foreach.searchIteration.last}
|
||||
</tr><tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='4' align='right'>
|
||||
<input type='submit' class='button' value='{$strings.save}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
203
include/Dashlets/DashletGenericDisplay.tpl
Executable file
203
include/Dashlets/DashletGenericDisplay.tpl
Executable file
@@ -0,0 +1,203 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<table cellpadding='0' cellspacing='0' width='100%' border='0' class='list view'>
|
||||
<tr class="pagination">
|
||||
<td colspan='{$colCount+1}' align='right'>
|
||||
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
|
||||
<tr>
|
||||
<td align='left'> </td>
|
||||
<td align='right' nowrap='nowrap'>
|
||||
{if $pageData.urls.startPage}
|
||||
<!--<a href='#' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.startPage}")' ><img src='{sugar_getimagepath file="start.png"}' alt='{$navStrings.start}' align='absmiddle' border='0' width='14' height='13'> {$navStrings.start}</a> -->
|
||||
<button title='{$navStrings.start}' class='button' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.startPage}")'>
|
||||
<img src='{sugar_getimagepath file='start.png'}' alt='{$navStrings.start}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
|
||||
{else}
|
||||
<!--<img src='{sugar_getimagepath file="start_off.png"}' alt='{$navStrings.start}' align='absmiddle' border='0'> {$navStrings.start} -->
|
||||
<button title='{$navStrings.start}' class='button' disabled>
|
||||
<img src='{sugar_getimagepath file='start_off.png'}' alt='{$navStrings.start}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
|
||||
{/if}
|
||||
{if $pageData.urls.prevPage}
|
||||
<!--<a href='#' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.prevPage}")' ><img src='{sugar_getimagepath file="previous.png"}' alt='{$navStrings.previous}' align='absmiddle' border='0' width='8' height='13'> {$navStrings.previous}</a> -->
|
||||
<button title='{$navStrings.previous}' class='button' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.prevPage}")'>
|
||||
<img src='{sugar_getimagepath file='previous.png'}' alt='{$navStrings.previous}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
|
||||
{else}
|
||||
<!--<img src='{sugar_getimagepath file="previous_off.png"}' alt='{$navStrings.previous}' align='absmiddle' border='0' width='8' height='13'> {$navStrings.previous} -->
|
||||
<button class='button' disabled title='{$navStrings.previous}'>
|
||||
<img src='{sugar_getimagepath file='previous_off.png'}' alt='{$navStrings.previous}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
{/if}
|
||||
<span class='pageNumbers'>({if $pageData.offsets.lastOffsetOnPage == 0}0{else}{$pageData.offsets.current+1}{/if} - {$pageData.offsets.lastOffsetOnPage} {$navStrings.of} {if $pageData.offsets.totalCounted}{$pageData.offsets.total}{else}{$pageData.offsets.total}{if $pageData.offsets.lastOffsetOnPage != $pageData.offsets.total}+{/if}{/if})</span>
|
||||
{if $pageData.urls.nextPage}
|
||||
<!-- <a href='#' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.nextPage}")' >{$navStrings.next} <img src='{sugar_getimagepath file="next.png"}' alt='{$navStrings.next}' align='absmiddle' border='0' width='8' height='13'></a> -->
|
||||
<button title='{$navStrings.next}' class='button' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.nextPage}")'>
|
||||
<img src='{sugar_getimagepath file='next.png'}' alt='{$navStrings.next}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
|
||||
{else}
|
||||
<!-- {$navStrings.next} <img src='{sugar_getimagepath file="next_off.png"}' alt='{$navStrings.next}' align='absmiddle' border='0' width='8' height='13'>-->
|
||||
<button class='button' title='{$navStrings.next}' disabled>
|
||||
<img src='{sugar_getimagepath file='next_off.png'}' alt='{$navStrings.next}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
|
||||
{/if}
|
||||
{if $pageData.urls.endPage && $pageData.offsets.total != $pageData.offsets.lastOffsetOnPage}
|
||||
<!--<a href='#' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.endPage}")' >{$navStrings.end} <img src='{sugar_getimagepath file="end.png"}' alt='{$navStrings.end}' align='absmiddle' border='0' width='14' height='13'></a></td>-->
|
||||
<button title='{$navStrings.end}' class='button' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.endPage}")'>
|
||||
<img src='{sugar_getimagepath file='end.png'}' alt='{$navStrings.end}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
|
||||
{elseif !$pageData.offsets.totalCounted || $pageData.offsets.total == $pageData.offsets.lastOffsetOnPage}
|
||||
<!-- {$navStrings.end} <img src='{sugar_getimagepath file="end_off.png"}' alt='{$navStrings.end}' align='absmiddle' border='0' width='14' height='13'>-->
|
||||
<button class='button' disabled title='{$navStrings.end}'>
|
||||
<img src='{sugar_getimagepath file='end_off.png'}' alt='{$navStrings.end}' align='absmiddle' border='0'>
|
||||
</button>
|
||||
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height='20'>
|
||||
{foreach from=$displayColumns key=colHeader item=params}
|
||||
<th scope='col' width='{$params.width}%' nowrap="nowrap">
|
||||
<div style='white-space: nowrap;'width='100%' align='{$params.align|default:'left'}'>
|
||||
{if $params.sortable|default:true}
|
||||
<a href='#' onclick='return SUGAR.mySugar.retrieveDashlet("{$dashletId}", "{$pageData.urls.orderBy}{$params.orderBy|default:$colHeader|lower}&sugar_body_only=1&id={$dashletId}")' class='listViewThLinkS1'>{sugar_translate label=$params.label module=$pageData.bean.moduleDir}</a>
|
||||
{if $params.orderBy|default:$colHeader|lower == $pageData.ordering.orderBy}
|
||||
{if $pageData.ordering.sortOrder == 'ASC'}
|
||||
{capture assign="imageName"}arrow_down.{$arrowExt}{/capture}
|
||||
<img border='0' src='{sugar_getimagepath file=$imageName}' width='{$arrowWidth}' height='{$arrowHeight}' align='absmiddle' alt='{$arrowAlt}'>
|
||||
{else}
|
||||
{capture assign="imageName"}arrow_up.{$arrowExt}{/capture}
|
||||
<img border='0' src='{sugar_getimagepath file=$imageName}' width='{$arrowWidth}' height='{$arrowHeight}' align='absmiddle' alt='{$arrowAlt}'>
|
||||
{/if}
|
||||
{else}
|
||||
{capture assign="imageName"}arrow.{$arrowExt}{/capture}
|
||||
<img border='0' src='{sugar_getimagepath file=$imageName}' width='{$arrowWidth}' height='{$arrowHeight}' align='absmiddle' alt='{$arrowAlt}'>
|
||||
{/if}
|
||||
{else}
|
||||
{sugar_translate label=$params.label module=$pageData.bean.moduleDir}
|
||||
{/if}
|
||||
</div>
|
||||
</th>
|
||||
{/foreach}
|
||||
{if !empty($quickViewLinks)}
|
||||
<th scope='col' nowrap="nowrap" width='1%'> </th>
|
||||
{/if}
|
||||
</tr>
|
||||
|
||||
{foreach name=rowIteration from=$data key=id item=rowData}
|
||||
{if $smarty.foreach.rowIteration.iteration is odd}
|
||||
{assign var='_rowColor' value=$rowColor[0]}
|
||||
{else}
|
||||
{assign var='_rowColor' value=$rowColor[1]}
|
||||
{/if}
|
||||
<tr height='20' class='{$_rowColor}S1'>
|
||||
{if $prerow}
|
||||
<td width='1%' nowrap='nowrap'>
|
||||
<input onclick='sListView.check_item(this, document.MassUpdate)' type='checkbox' class='checkbox' name='mass[]' value='{$rowData[$params.id]|default:$rowData.ID}'>
|
||||
</td>
|
||||
{/if}
|
||||
{counter start=0 name="colCounter" print=false assign="colCounter"}
|
||||
{foreach from=$displayColumns key=col item=params}
|
||||
<td scope='row' align='{$params.align|default:'left'}' valign=top class='{$_rowColor}S1' bgcolor='{$_bgColor}'><span sugar="sugar{$colCounter}b">
|
||||
{if $params.link && !$params.customCode}
|
||||
<{$pageData.tag.$id[$params.ACLTag]|default:$pageData.tag.$id.MAIN} href='index.php?action={$params.action|default:'DetailView'}&module={if $params.dynamic_module}{$rowData[$params.dynamic_module]}{else}{$params.module|default:$pageData.bean.moduleDir}{/if}&record={$rowData[$params.id]|default:$rowData.ID}&offset={$pageData.offsets.current+$smarty.foreach.rowIteration.iteration}&stamp={$pageData.stamp}'>{$rowData.$col}</{$pageData.tag.$id[$params.ACLTag]|default:$pageData.tag.$id.MAIN}>
|
||||
{elseif $params.customCode}
|
||||
{sugar_evalcolumn_old var=$params.customCode rowData=$rowData}
|
||||
{elseif $params.currency_format}
|
||||
{sugar_currency_format
|
||||
var=$rowData.$col
|
||||
round=$params.currency_format.round
|
||||
decimals=$params.currency_format.decimals
|
||||
symbol=$params.currency_format.symbol
|
||||
convert=$params.currency_format.convert
|
||||
currency_symbol=$params.currency_format.currency_symbol
|
||||
}
|
||||
{elseif $params.type == 'bool'}
|
||||
<input type='checkbox' disabled=disabled class='checkbox'
|
||||
{if !empty($rowData[$col])}
|
||||
checked=checked
|
||||
{/if}
|
||||
/>
|
||||
{elseif $params.type == 'multienum'}
|
||||
{if !empty($rowData.$col)}
|
||||
{counter name="oCount" assign="oCount" start=0}
|
||||
{multienum_to_array string=$rowData.$col assign="vals"}
|
||||
{foreach from=$vals item=item}
|
||||
{counter name="oCount"}
|
||||
{if !empty($item)}{sugar_translate label=$params.options select=$item}{if $oCount != count($vals)}, {/if}{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{else}
|
||||
{$rowData.$col}
|
||||
{/if}
|
||||
</span sugar='sugar{$colCounter}b'></td>
|
||||
{counter name="colCounter"}
|
||||
{/foreach}
|
||||
{if !empty($quickViewLinks)}
|
||||
<td width='1%' class='{$_rowColor}S1' bgcolor='{$_bgColor}' nowrap>
|
||||
{if $pageData.access.edit}
|
||||
<a title='{$editLinkString}' href='index.php?action=EditView&module={$params.module|default:$pageData.bean.moduleDir}&record={$rowData[$params.parent_id]|default:$rowData.ID}&offset={$pageData.offsets.current+$smarty.foreach.rowIteration.iteration}&stamp={$pageData.stamp}&return_module=Home&return_action=index'><img border="0" src="{sugar_getimagepath file="edit_inline.png"}"></a>
|
||||
{/if}
|
||||
{if $pageData.access.view}
|
||||
<a title='{$viewLinkString}' href='index.php?action=DetailView&module={$params.module|default:$pageData.bean.moduleDir}&record={$rowData[$params.parent_id]|default:$rowData.ID}&offset={$pageData.offsets.current+$smarty.foreach.rowIteration.iteration}&stamp={$pageData.stamp}&return_module=Home&return_action=index'><img border="0" src="{sugar_getimagepath file="view_inline.png"}"></a>
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr height='20' class='{$rowColor[0]}S1'>
|
||||
<td colspan="{$colCount}">
|
||||
<em>{$APP.LBL_NO_DATA}</em>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
Reference in New Issue
Block a user