init
This commit is contained in:
44
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.en_us.lang.php
Executable file
44
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.en_us.lang.php
Executable 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['ChartsDashlet'] = array('LBL_TITLE' => 'Charts',
|
||||
'LBL_DESCRIPTION' => 'A dashlet to display charts',
|
||||
'LBL_CONFIGURE_TITLE' => 'Title', );
|
||||
?>
|
||||
44
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.ge_ge.lang.php
Executable file
44
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.ge_ge.lang.php
Executable 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['ChartsDashlet'] = array('LBL_TITLE' => 'Diagramme',
|
||||
'LBL_DESCRIPTION' => 'Ein Dashlet um Diagramme anzuzeigen',
|
||||
'LBL_CONFIGURE_TITLE' => 'Titel', );
|
||||
?>
|
||||
47
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.meta.php
Executable file
47
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.meta.php
Executable 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['ChartsDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'category' => 'Charts',
|
||||
'hidden' => true,
|
||||
);
|
||||
?>
|
||||
187
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.php
Executable file
187
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.php
Executable file
@@ -0,0 +1,187 @@
|
||||
<?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/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
|
||||
class ChartsDashlet extends Dashlet {
|
||||
var $width = '400';
|
||||
var $height = '480';
|
||||
var $report_id;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @global string current language
|
||||
* @param guid $id id for the current dashlet (assigned from Home module)
|
||||
* @param report_id $report_id id of the saved report
|
||||
* @param array $def options saved for this dashlet
|
||||
*/
|
||||
function ChartsDashlet($id, $report_id, $def) {
|
||||
$this->report_id = $report_id;
|
||||
|
||||
$this->loadLanguage('ChartsDashlet'); // load the language strings here
|
||||
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->searchFields = array();
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = true; // dashlet has javascript attached to it
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the dashlet
|
||||
*
|
||||
* @return string html to display dashlet
|
||||
*/
|
||||
function display() {
|
||||
require_once("modules/Reports/Report.php");
|
||||
require_once("modules/Reports/SavedReport.php");
|
||||
|
||||
ajaxInit();
|
||||
|
||||
$chartReport = new SavedReport();
|
||||
$chartExists = $chartReport->retrieve($this->report_id, false);
|
||||
|
||||
if (!is_null($chartExists)){
|
||||
$this->title = $chartReport->name;
|
||||
|
||||
$reporter = new Report($chartReport->content);
|
||||
$reporter->is_saved_report = true;
|
||||
$reporter->saved_report_id = $chartReport->id;
|
||||
$reporter->run_chart_queries();
|
||||
|
||||
require_once("modules/Reports/templates/templates_chart.php");
|
||||
|
||||
ob_start();
|
||||
template_chart($reporter, true, true, $this->id);
|
||||
$str = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$xmlFile = get_cache_file_name($reporter);
|
||||
|
||||
$html = parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
$script = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
|
||||
$json = getJSONobj();
|
||||
|
||||
return parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
require_once("modules/Reports/Report.php");
|
||||
require_once("modules/Reports/SavedReport.php");
|
||||
|
||||
$chartReport = new SavedReport();
|
||||
$chartExists = $chartReport->retrieve($this->report_id, false);
|
||||
|
||||
if (!is_null($chartExists)){
|
||||
$this->title = $chartReport->name;
|
||||
|
||||
require_once("modules/Reports/templates/templates_chart.php");
|
||||
|
||||
$reporter = new Report($chartReport->content);
|
||||
$reporter->is_saved_report = true;
|
||||
$reporter->saved_report_id = $chartReport->id;
|
||||
$xmlFile = get_cache_file_name($reporter);
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
|
||||
$ss->assign('chartStyleCSS', chartStyle());
|
||||
$ss->assign('chartColorsXML', chartColors());
|
||||
$ss->assign('chartLangFile', $GLOBALS['sugar_config']['tmp_dir'].'chart_strings.' . $GLOBALS['current_language'] .'.lang.xml');
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the configuration form for the dashlet
|
||||
*
|
||||
* @return string html to display form
|
||||
*/
|
||||
function displayOptions() {
|
||||
}
|
||||
|
||||
/**
|
||||
* called to filter out $_REQUEST object when the user submits the configure dropdown
|
||||
*
|
||||
* @param array $req $_REQUEST
|
||||
* @return array filtered options to save
|
||||
*/
|
||||
function saveOptions($req) {
|
||||
}
|
||||
|
||||
function setConfigureIcon(){
|
||||
global $image_path;
|
||||
|
||||
if($this->isConfigurable)
|
||||
$additionalTitle = '<td nowrap width="1%"><div style="width: 100%;text-align:right"><a href="index.php?module=Reports&record=' . $this->report_id . '&action=ReportCriteriaResults&page=report" class="chartToolsLink">'
|
||||
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a> '
|
||||
. '';
|
||||
else
|
||||
$additionalTitle = '<td nowrap width="1%"><div style="width: 100%;text-align:right">';
|
||||
|
||||
return $additionalTitle;
|
||||
}
|
||||
|
||||
function setRefreshIcon(){
|
||||
global $image_path;
|
||||
|
||||
$additionalTitle = '';
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
|
||||
. $this->id . '\', \'chart\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
|
||||
. $image_path . 'refresh.gif"/></a> ';
|
||||
return $additionalTitle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
36
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.pl_pl.lang.php
Executable file
36
modules/Home/Dashlets/ChartsDashlet/ChartsDashlet.pl_pl.lang.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['ChartsDashlet'] = array('LBL_TITLE' => 'Wykresy',
|
||||
'LBL_DESCRIPTION' => 'Zakładka Wyświetlająca Wykresy',
|
||||
'LBL_CONFIGURE_TITLE' => 'Tytuł', );
|
||||
?>
|
||||
44
modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl
Executable file
44
modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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$
|
||||
|
||||
*}
|
||||
|
||||
<script>
|
||||
SUGAR.mySugar.addToChartsArray('{$chartName}', '{$chartXMLFile}', '100%', '480', '{$chartStyleCSS}', '{$chartColorsXML}', '{$chartLangFile}');
|
||||
</script>
|
||||
46
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.en_us.lang.php
Executable file
46
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.en_us.lang.php
Executable 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['InvadersDashlet'] = array('LBL_TITLE' => 'Invaders!',
|
||||
'LBL_DESCRIPTION' => 'A little way to pass the time',
|
||||
'LBL_DBLCLICK_HELP' => 'Use A and D to move, S to fire.',
|
||||
|
||||
);
|
||||
?>
|
||||
46
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.ge_ge.lang.php
Executable file
46
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.ge_ge.lang.php
Executable 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['InvadersDashlet'] = array('LBL_TITLE' => 'Invaders!',
|
||||
'LBL_DESCRIPTION' => 'Ein bisschen was zum Spielen',
|
||||
'LBL_DBLCLICK_HELP' => 'A und D um zu bewegen, S um zu feuern.',
|
||||
|
||||
);
|
||||
?>
|
||||
47
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.meta.php
Executable file
47
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.meta.php
Executable 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['InvadersDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'icon' => 'themes/default/images/icon_Invaders_32.gif',
|
||||
'category' => 'Tools',
|
||||
'hidden' => true);
|
||||
?>
|
||||
157
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.php
Executable file
157
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.php
Executable file
@@ -0,0 +1,157 @@
|
||||
<?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/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
|
||||
class InvadersDashlet extends Dashlet {
|
||||
var $savedText; // users's saved text
|
||||
var $height = '100'; // height of the pad
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @global string current language
|
||||
* @param guid $id id for the current dashlet (assigned from Home module)
|
||||
* @param array $def options saved for this dashlet
|
||||
*/
|
||||
function InvadersDashlet($id, $def) {
|
||||
$this->loadLanguage('InvadersDashlet'); // load the language strings here
|
||||
|
||||
if(!empty($def['height'])) // set a default height if none is set
|
||||
$this->height = $def['height'];
|
||||
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = false; // dashlet is configurable
|
||||
$this->hasScript = true; // dashlet has javascript attached to it
|
||||
|
||||
// if no custom title, use default
|
||||
if(empty($def['title'])) $this->title = $this->dashletStrings['LBL_TITLE'];
|
||||
else $this->title = $def['title'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the dashlet
|
||||
*
|
||||
* @return string html to display dashlet
|
||||
*/
|
||||
function display() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.tpl');
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $str . '<br />'; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/InvadersDashlet/InvadersDashletScript.tpl');
|
||||
return $str; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the configuration form for the dashlet
|
||||
*
|
||||
* @return string html to display form
|
||||
*/
|
||||
function displayOptions() {
|
||||
global $app_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
|
||||
$ss->assign('heightLbl', $this->dashletStrings['LBL_CONFIGURE_HEIGHT']);
|
||||
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/InvadersDashlet/InvadersOptions.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* called to filter out $_REQUEST object when the user submits the configure dropdown
|
||||
*
|
||||
* @param array $req $_REQUEST
|
||||
* @return array filtered options to save
|
||||
*/
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
$options['title'] = $_REQUEST['title'];
|
||||
if(is_numeric($_REQUEST['height'])) {
|
||||
if($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300) $options['height'] = $_REQUEST['height'];
|
||||
elseif($_REQUEST['height'] > 300) $options['height'] = '300';
|
||||
else $options['height'] = '100';
|
||||
}
|
||||
|
||||
// $options['savedText'] = br2nl($this->savedText);
|
||||
$options['savedText'] = $this->savedText;
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to save text on textarea blur. Accessed via Home/CallMethodDashlet.php
|
||||
* This is an example of how to to call a custom method via ajax
|
||||
*/
|
||||
function saveText() {
|
||||
if(isset($_REQUEST['savedText'])) {
|
||||
$optionsArray = $this->loadOptions();
|
||||
// _pp($_REQUEST['savedText']);
|
||||
$optionsArray['savedText'] = nl2br($_REQUEST['savedText']);
|
||||
$this->storeOptions($optionsArray);
|
||||
|
||||
}
|
||||
else {
|
||||
$optionsArray['savedText'] = '';
|
||||
}
|
||||
$json = getJSONobj();
|
||||
echo 'result = ' . $json->encode(array('id' => $_REQUEST['id'],
|
||||
'savedText' => $optionsArray['savedText']));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
38
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.pl_pl.lang.php
Executable file
38
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.pl_pl.lang.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['InvadersDashlet'] = array('LBL_TITLE' => 'Najeźdźcy!',
|
||||
'LBL_DESCRIPTION' => 'Ciekawy sposób spędzania czasu :)',
|
||||
'LBL_DBLCLICK_HELP' => 'Użyj A i D, do poruszania się i S aby strzelać.',
|
||||
|
||||
);
|
||||
?>
|
||||
80
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.tpl
Executable file
80
modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.tpl
Executable file
@@ -0,0 +1,80 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
*}
|
||||
<div align="center">
|
||||
<table cellpadding="0" cellspacing="0" class="playArea" style="overflow: hidden; background-color: black; background-image: url('modules/Home/Dashlets/InvadersDashlet/sprites/bg.png'); width: 400px; height:300px">
|
||||
<tr height="16"><td><img id="shot" style="position: relative; top:245px; display: none" src="modules/Home/Dashlets/InvadersDashlet/sprites/cube.png" width="16" height="16"/></td></tr>
|
||||
<tr height="32"><td><img id="player" style="position: relative; top:252px; left:134" src="modules/Home/Dashlets/InvadersDashlet/sprites/player.png" width="32" height="32"/></td></tr>
|
||||
<tr><td><div id="aliens" style="position: relative; left:0px; width:172px;">
|
||||
<table cellpadding="0" cellspacing="2"><tbody>
|
||||
<tr>
|
||||
<td id="a00" width="32" height="14"> </td>
|
||||
<td id="a10" width="32" height="14"> </td>
|
||||
<td id="a20" width="32" height="14"> </td>
|
||||
<td id="a30" width="32" height="14"> </td>
|
||||
<td id="a40" width="32" height="14"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="a01" width="32" height="14"> </td>
|
||||
<td id="a11" width="32" height="14"> </td>
|
||||
<td id="a21" width="32" height="14"> </td>
|
||||
<td id="a31" width="32" height="14"> </td>
|
||||
<td id="a41" width="32" height="14"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="a02" width="32" height="14"> </td>
|
||||
<td id="a12" width="32" height="14"> </td>
|
||||
<td id="a22" width="32" height="14"> </td>
|
||||
<td id="a32" width="32" height="14"> </td>
|
||||
<td id="a42" width="32" height="14"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="a03" width="32" height="14"> </td>
|
||||
<td id="a13" width="32" height="14"> </td>
|
||||
<td id="a23" width="32" height="14"> </td>
|
||||
<td id="a33" width="32" height="14"> </td>
|
||||
<td id="a43" width="32" height="14"> </td>
|
||||
</tr>
|
||||
</tbody></table></div>
|
||||
</td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div align="center" id="startScreen" style="position: relative; top: -125;" onclick="InvadersGame.reset()">
|
||||
<a href="javascript:void(0);" class="otherTabLink"><h1 style="color: #FFF; " id="messageText">Click Here to Start!</h1></a>
|
||||
</div>
|
||||
261
modules/Home/Dashlets/InvadersDashlet/InvadersDashletScript.tpl
Executable file
261
modules/Home/Dashlets/InvadersDashlet/InvadersDashletScript.tpl
Executable file
@@ -0,0 +1,261 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{literal}<script>
|
||||
if(typeof InvadersGame == 'undefined') {
|
||||
InvadersGame = function() {
|
||||
var playerX, move, timer, rate, shotX, shotY, started, shotFired, alienX, alienY, aMove;
|
||||
var rightRowsCleared, leftRowsCleared, bottomRow;
|
||||
return {
|
||||
init: function() {
|
||||
//alert("initilized");
|
||||
InvadersGame.rate = 30;
|
||||
document.onkeydown = InvadersGame.keyDown;
|
||||
document.onkeyup = InvadersGame.keyUp;
|
||||
clearTimeout(InvadersGame.timer);
|
||||
InvadersGame.timer = setTimeout("InvadersGame.update()",InvadersGame.rate);
|
||||
InvadersGame.started = false;
|
||||
InvadersGame.shotFired = false;
|
||||
InvadersGame.level = 1;
|
||||
},
|
||||
moveLeft: function(frameTime) {
|
||||
InvadersGame.playerX = InvadersGame.playerX + (5 * frameTime);
|
||||
},
|
||||
moveRight: function(frameTime) {
|
||||
InvadersGame.playerX = InvadersGame.playerX - (5 * frameTime);
|
||||
},
|
||||
checkLoss: function() {
|
||||
if (InvadersGame.alienY + (InvadersGame.bottomRow * 16) >= 110) {
|
||||
InvadersGame.init();
|
||||
//InvadersGame.alienY += 32;
|
||||
var startScreen = document.getElementById("startScreen");
|
||||
startScreen.style.display = "block";
|
||||
var messageText = document.getElementById("messageText");
|
||||
messageText.innerHTML = "Game Over";
|
||||
}
|
||||
},
|
||||
keyDown: function(keyEvents) {
|
||||
var key = (window.event) ? event.keyCode : keyEvents.keyCode;
|
||||
if (InvadersGame.started) {
|
||||
if (key == 65){ //'a' key
|
||||
InvadersGame.move = -1;
|
||||
}
|
||||
if (key == 68){ //'d' key
|
||||
InvadersGame.move = 1;
|
||||
}
|
||||
if (key == 83){ //'s' key
|
||||
InvadersGame.shoot();
|
||||
}
|
||||
if (key == 82){ //'s' key
|
||||
InvadersGame.reset();
|
||||
}
|
||||
}
|
||||
},
|
||||
keyUp: function(keyEvents) {
|
||||
var key = (window.event) ? event.keyCode : keyEvents.keyCode;
|
||||
if (key == 65 || key == 68){
|
||||
InvadersGame.move = 0;
|
||||
}
|
||||
},
|
||||
reset: function() {
|
||||
InvadersGame.started = true;
|
||||
InvadersGame.lastFrame = new Date().getTime();
|
||||
var startScreen = document.getElementById("startScreen");
|
||||
startScreen.style.display = "none";
|
||||
var aliensTable = document.getElementById("aliens");
|
||||
var aliens = aliensTable.getElementsByTagName("td");
|
||||
var shot = document.getElementById("shot");
|
||||
shot.style.display = "none";
|
||||
var i=0;
|
||||
for(i=0; i < aliens.length; i++) {
|
||||
aliens[i].style.backgroundImage = "url('modules/Home/Dashlets/InvadersDashlet/sprites/alien.png')"
|
||||
}
|
||||
InvadersGame.playerX = 134;
|
||||
InvadersGame.move = 0;
|
||||
InvadersGame.aMove = (3 + InvadersGame.level) / 4;
|
||||
InvadersGame.alienX = 0;
|
||||
InvadersGame.alienY = -140;
|
||||
InvadersGame.shoty = 250;
|
||||
InvadersGame.shotFired = false;
|
||||
InvadersGame.rightRowsCleared = 0;
|
||||
InvadersGame.leftRowsCleared = 0;
|
||||
InvadersGame.bottomRow = 3;
|
||||
aliensTable.style.left = InvadersGame.alienX;
|
||||
aliensTable.style.top = InvadersGame.alienY;
|
||||
clearTimeout(InvadersGame.timer);
|
||||
InvadersGame.timer = setTimeout("InvadersGame.update()",InvadersGame.rate);
|
||||
},
|
||||
shoot: function() {
|
||||
if (!InvadersGame.shotFired) {
|
||||
InvadersGame.shotX = InvadersGame.playerX;
|
||||
InvadersGame.shotY = 250;
|
||||
InvadersGame.shotFired = true;
|
||||
var shot = document.getElementById("shot");
|
||||
shot.style.left = InvadersGame.playerX + 8;
|
||||
shot.style.top = 250;
|
||||
shot.style.display = "inline";
|
||||
}
|
||||
},
|
||||
update: function() {
|
||||
var time = new Date().getTime();
|
||||
var frameTime = (time - InvadersGame.lastFrame) / InvadersGame.rate;
|
||||
if (frameTime == 0) frameTime = 1;
|
||||
InvadersGame.lastFrame = time;
|
||||
if (InvadersGame.started) {
|
||||
if (InvadersGame.move < 0 && InvadersGame.playerX > 0) {
|
||||
InvadersGame.moveRight(frameTime);
|
||||
}
|
||||
if (InvadersGame.move > 0 && InvadersGame.playerX < 368) {
|
||||
InvadersGame.moveLeft(frameTime);
|
||||
}
|
||||
InvadersGame.alienX += InvadersGame.aMove * frameTime;
|
||||
if (InvadersGame.aMove > 0 && InvadersGame.alienX > (225 + InvadersGame.rightRowsCleared)) {
|
||||
InvadersGame.aMove = -(3 + InvadersGame.level) / (4);
|
||||
InvadersGame.alienY += 16;
|
||||
InvadersGame.checkLoss();
|
||||
}
|
||||
else if (InvadersGame.alienX < (0 - InvadersGame.leftRowsCleared)) {
|
||||
InvadersGame.aMove = (3 + InvadersGame.level) / (4);
|
||||
InvadersGame.alienY += 16;
|
||||
InvadersGame.checkLoss();
|
||||
}
|
||||
|
||||
var player = document.getElementById("player");
|
||||
var shot = document.getElementById("shot");
|
||||
var aliens = document.getElementById("aliens");
|
||||
|
||||
if (InvadersGame.shotY < 8){
|
||||
InvadersGame.shotY = 235;
|
||||
InvadersGame.shotFired = false;
|
||||
shot.style.display = "none";
|
||||
}
|
||||
if (InvadersGame.shotFired) {
|
||||
InvadersGame.shotY -= 5;
|
||||
shot.style.top = InvadersGame.shotY;
|
||||
}
|
||||
player.style.left = InvadersGame.playerX;
|
||||
aliens.style.left = InvadersGame.alienX;
|
||||
aliens.style.top = InvadersGame.alienY;
|
||||
if(InvadersGame.shotFired) {
|
||||
InvadersGame.checkCollide(shot, aliens);
|
||||
}
|
||||
}
|
||||
InvadersGame.timer = setTimeout("InvadersGame.update()",InvadersGame.rate);
|
||||
},
|
||||
nextLevel: function() {
|
||||
InvadersGame.started = false;
|
||||
var startScreen = document.getElementById("startScreen");
|
||||
startScreen.style.display = "block";
|
||||
InvadersGame.level++;
|
||||
var messageText = document.getElementById("messageText");
|
||||
messageText.innerHTML = "Level " + InvadersGame.level;
|
||||
clearTimeout(InvadersGame.timer);
|
||||
InvadersGame.timer = setTimeout("InvadersGame.reset()",5000);
|
||||
},
|
||||
checkCollide: function(shot, aliens) {
|
||||
var sx = InvadersGame.shotX + 8;
|
||||
var sy = InvadersGame.shotY;
|
||||
var ax = InvadersGame.alienX;
|
||||
var ay = InvadersGame.alienY + 140;
|
||||
var cx = Math.floor((sx - ax) / 34);
|
||||
var cy = Math.floor((sy - ay) / 16);
|
||||
if (cx > -1 && cx < 5 && cy > -1 && cy < 4) {
|
||||
var dAlien = document.getElementById("a" + cx + cy);
|
||||
if (!(dAlien.style.backgroundImage == "none")) {
|
||||
//Collision occured
|
||||
dAlien.style.backgroundImage = "none";
|
||||
InvadersGame.shotFired = false;
|
||||
shot.style.display = "none";
|
||||
var aliens = document.getElementById("aliens").getElementsByTagName("td");
|
||||
var i = 0;
|
||||
var col = 0;
|
||||
var row = 0;
|
||||
var count = new Array(5);
|
||||
var rows = new Array(5);
|
||||
for (i = 0; i < count.length; i++) {
|
||||
count[i] = 0;
|
||||
rows[i] = 0;
|
||||
}
|
||||
for (i = 0; i < aliens.length; i++) {
|
||||
col = i % 5;
|
||||
row = Math.floor(i / 5);
|
||||
if (aliens[i].style.backgroundImage != "none") {
|
||||
count[col]++;
|
||||
rows[row]++;
|
||||
}
|
||||
}
|
||||
if (count[0] == 0) {
|
||||
if (count[1] == 0) {
|
||||
if (count[2] == 0) {
|
||||
if (count[3] == 0) {
|
||||
if (count[4] == 0) { InvadersGame.nextLevel();}
|
||||
else {InvadersGame.leftRowsCleared = 32 * 4;}
|
||||
} else {InvadersGame.leftRowsCleared = 32 * 3;}
|
||||
} else {InvadersGame.leftRowsCleared = 32 * 2;}
|
||||
} else {InvadersGame.leftRowsCleared = 32;}
|
||||
} else {InvadersGame.leftRowsCleared = 0;}
|
||||
|
||||
if (count[4] == 0) {
|
||||
if (count[3] == 0) {
|
||||
if (count[2] == 0) {
|
||||
if (count[1] == 0) {
|
||||
if (count[0] == 0) {InvadersGame.rightRowsCleared = 32 * 5;
|
||||
} else {InvadersGame.rightRowsCleared = 32 * 4;}
|
||||
} else {InvadersGame.rightRowsCleared = 32 * 3; }
|
||||
} else {InvadersGame.rightRowsCleared = 32 * 2;}
|
||||
} else { InvadersGame.rightRowsCleared = 32;}
|
||||
} else {InvadersGame.rightRowsCleared = 0;}
|
||||
|
||||
for (i = 0; i < 4 ; i++) {
|
||||
if (rows[i] > 0) {
|
||||
InvadersGame.bottomRow = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}();
|
||||
}
|
||||
InvadersGame.init();
|
||||
|
||||
</script>{/literal}
|
||||
70
modules/Home/Dashlets/InvadersDashlet/InvadersOptions.tpl
Executable file
70
modules/Home/Dashlets/InvadersDashlet/InvadersOptions.tpl
Executable file
@@ -0,0 +1,70 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 500px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.sugarHome.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='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$titleLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$heightLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="height" size='3' value='{$height}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLbl}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
64
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.en_us.lang.php
Executable file
64
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.en_us.lang.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$defaultText = "";
|
||||
|
||||
$dashletStrings['JotPadDashlet'] = array('LBL_TITLE' => 'JotPad',
|
||||
'LBL_DESCRIPTION' => 'A dashlet to keep your notes',
|
||||
'LBL_SAVING' => 'Saving JotPad ...',
|
||||
'LBL_SAVED' => 'Saved',
|
||||
'LBL_CONFIGURE_TITLE' => 'Title',
|
||||
'LBL_CONFIGURE_HEIGHT' => 'Height (1 - 300)',
|
||||
'LBL_DBLCLICK_HELP' => 'Double click below to Edit.',
|
||||
'LBL_DEFAULT_TEXT' => $defaultText,
|
||||
);
|
||||
?>
|
||||
87
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.ge_ge.lang.php
Executable file
87
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.ge_ge.lang.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 - 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$defaultText =
|
||||
<<<EOQ
|
||||
<b>Wilkommen bei Sugar 5.2!</b><br /><br />
|
||||
|
||||
Klicken Sie auf <b>Mein Konto</b> um Ihre persönlichen Einstellungen zu verändern.<br>
|
||||
Klicken Sie auf das <b>Fragezeichen</b> Icon um die Hilfeseiten für jedes Modul aufzurufen (tlw. Englisch).<br><br>
|
||||
|
||||
Bei Fragen bitte info@iscongroup.net oder +43 720 504177 bzw. +49 1801 995500 6042</b>.<br />
|
||||
EOQ
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['JotPadDashlet'] = array('LBL_TITLE' => 'JotPad',
|
||||
'LBL_DESCRIPTION' => 'Ein Dashlet für Ihre Notizen',
|
||||
'LBL_SAVING' => 'Speichere JotPad ...',
|
||||
'LBL_SAVED' => 'Gespeichert.',
|
||||
'LBL_CONFIGURE_TITLE' => 'Titel',
|
||||
'LBL_CONFIGURE_HEIGHT' => 'Höhe (1 - 300)',
|
||||
'LBL_DBLCLICK_HELP' => 'Doppelklicken Sie unten um zu bearbeiten.',
|
||||
'LBL_DEFAULT_TEXT' => $defaultText,
|
||||
);
|
||||
?>
|
||||
47
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.meta.php
Executable file
47
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.meta.php
Executable 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['JotPadDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'icon' => 'themes/default/images/icon_JotPad_32.gif',
|
||||
'category' => 'Tools',
|
||||
'hidden' => true);
|
||||
?>
|
||||
176
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.php
Executable file
176
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.php
Executable file
@@ -0,0 +1,176 @@
|
||||
<?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/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
|
||||
class JotPadDashlet extends Dashlet {
|
||||
var $savedText; // users's saved text
|
||||
var $height = '200'; // height of the pad
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @global string current language
|
||||
* @param guid $id id for the current dashlet (assigned from Home module)
|
||||
* @param array $def options saved for this dashlet
|
||||
*/
|
||||
function JotPadDashlet($id, $def) {
|
||||
$this->loadLanguage('JotPadDashlet'); // load the language strings here
|
||||
|
||||
if(!empty($def['savedText'])) // load default text is none is defined
|
||||
$this->savedText = $def['savedText'];
|
||||
else
|
||||
$this->savedText = $this->dashletStrings['LBL_DEFAULT_TEXT'];
|
||||
|
||||
if(!empty($def['height'])) // set a default height if none is set
|
||||
$this->height = $def['height'];
|
||||
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = true; // dashlet has javascript attached to it
|
||||
|
||||
// if no custom title, use default
|
||||
if(empty($def['title'])) $this->title = $this->dashletStrings['LBL_TITLE'];
|
||||
else $this->title = $def['title'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the dashlet
|
||||
*
|
||||
* @return string html to display dashlet
|
||||
*/
|
||||
function display() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$xss = clean_xss($this->savedText, false);
|
||||
if(!empty($xss)) {
|
||||
$this->savedText = str_replace($xss, "", $this->savedText);
|
||||
}
|
||||
$ss->assign('savedText', $this->savedText);
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.tpl');
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $str . '<br />'; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/JotPadDashlet/JotPadDashletScript.tpl');
|
||||
return $str; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the configuration form for the dashlet
|
||||
*
|
||||
* @return string html to display form
|
||||
*/
|
||||
function displayOptions() {
|
||||
global $app_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
|
||||
$ss->assign('heightLbl', $this->dashletStrings['LBL_CONFIGURE_HEIGHT']);
|
||||
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/JotPadDashlet/JotPadDashletOptions.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* called to filter out $_REQUEST object when the user submits the configure dropdown
|
||||
*
|
||||
* @param array $req $_REQUEST
|
||||
* @return array filtered options to save
|
||||
*/
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
$options['title'] = $_REQUEST['title'];
|
||||
if(is_numeric($_REQUEST['height'])) {
|
||||
if($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300) $options['height'] = $_REQUEST['height'];
|
||||
elseif($_REQUEST['height'] > 300) $options['height'] = '300';
|
||||
else $options['height'] = '100';
|
||||
}
|
||||
|
||||
// $options['savedText'] = br2nl($this->savedText);
|
||||
$options['savedText'] = $this->savedText;
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to save text on textarea blur. Accessed via Home/CallMethodDashlet.php
|
||||
* This is an example of how to to call a custom method via ajax
|
||||
*/
|
||||
function saveText() {
|
||||
$json = getJSONobj();
|
||||
if(isset($_REQUEST['savedText'])) {
|
||||
$optionsArray = $this->loadOptions();
|
||||
// _pp($_REQUEST['savedText']);
|
||||
$optionsArray['savedText']=$json->decode(html_entity_decode($_REQUEST['savedText']));
|
||||
$optionsArray['savedText']=nl2br($optionsArray['savedText']['jsonObject']);
|
||||
$xss = clean_xss($optionsArray['savedText'], false);
|
||||
if(!empty($xss)) {
|
||||
$optionsArray['savedText'] = str_replace($xss, "", $optionsArray['savedText']);
|
||||
}
|
||||
$this->storeOptions($optionsArray);
|
||||
|
||||
}
|
||||
else {
|
||||
$optionsArray['savedText'] = '';
|
||||
}
|
||||
echo 'result = ' . $json->encode(array('id' => $_REQUEST['id'],
|
||||
'savedText' => $optionsArray['savedText']));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
14
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.pl_pl.lang.php
Executable file
14
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.pl_pl.lang.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$dashletStrings['JotPadDashlet'] = array('LBL_TITLE' => 'Pomocnik Edycji Widoku',
|
||||
'LBL_DESCRIPTION' => 'Pasek Twoich Notatek',
|
||||
'LBL_SAVING' => 'Zapisuję Twój Widok ...',
|
||||
'LBL_SAVED' => 'Zapisano',
|
||||
'LBL_CONFIGURE_TITLE' => 'Tytuł',
|
||||
'LBL_CONFIGURE_HEIGHT' => 'Wysokość (1 - 300)',
|
||||
'LBL_DBLCLICK_HELP' => 'Kliknij dwa razy poniżej, aby edytować.',
|
||||
'LBL_DEFAULT_TEXT' => "Witaj w SugarCRM!\n\nMożesz dowolnie zmienić wygląd Twojej Strony Głównej, aby pasowała do Twoich Potrzeb.\n\n" .
|
||||
"* Dodawaj nowe Belki, klikając na \"Dodaj Belkę\" w lewym górnym rogu ekranu.\n" .
|
||||
"* Zmieniaj każdą z Belek, klikając na Ikonce Konfiguracji w prawym górnym rogu każdej z Belek\n" .
|
||||
"* Usuń Belkę klikając na znaku X");
|
||||
?>
|
||||
44
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.tpl
Executable file
44
modules/Home/Dashlets/JotPadDashlet/JotPadDashlet.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div id='jotpad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: {$height}px; border: 1px #ddd solid'>{$savedText}</div>
|
||||
<textarea id='jotpad_textarea_{$id}' rows="5" onblur='JotPad.blur(this, "{$id}")' style='display: none; width: 100%; height: {$height}px; overflow: auto'></textarea>
|
||||
70
modules/Home/Dashlets/JotPadDashlet/JotPadDashletOptions.tpl
Executable file
70
modules/Home/Dashlets/JotPadDashlet/JotPadDashletOptions.tpl
Executable file
@@ -0,0 +1,70 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 500px'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$titleLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$heightLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="height" size='3' value='{$height}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLbl}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
88
modules/Home/Dashlets/JotPadDashlet/JotPadDashletScript.tpl
Executable file
88
modules/Home/Dashlets/JotPadDashlet/JotPadDashletScript.tpl
Executable file
@@ -0,0 +1,88 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{literal}<script>
|
||||
if(typeof JotPad == 'undefined') { // since the dashlet can be included multiple times a page, don't redefine these functions
|
||||
JotPad = function() {
|
||||
return {
|
||||
/**
|
||||
* Called when the textarea is blurred
|
||||
*/
|
||||
blur: function(ta, id) {
|
||||
ajaxStatus.showStatus('{/literal}{$saving}{literal}'); // show that AJAX call is happening
|
||||
// what data to post to the dashlet
|
||||
var va=JSON.stringify(ta.value);
|
||||
postData = 'to_pdf=1&module=Home&action=CallMethodDashlet&method=saveText&id=' + id + '&savedText=' + va;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
|
||||
{success: JotPad.saved, failure: JotPad.saved}, postData);
|
||||
},
|
||||
/**
|
||||
* Called when the textarea is double clicked on
|
||||
*/
|
||||
edit: function(divObj, id) {
|
||||
ta = document.getElementById('jotpad_textarea_' + id);
|
||||
if(isIE) ta.value = divObj.innerHTML.replace(/<br>/gi, "\n");
|
||||
else ta.value = divObj.innerHTML.replace(/<br>/gi, '');
|
||||
ta.value = ta.value.replace(/&/, "&");
|
||||
divObj.style.display = 'none';
|
||||
ta.style.display = '';
|
||||
ta.focus();
|
||||
},
|
||||
/**
|
||||
* handle the response of the saveText method
|
||||
*/
|
||||
saved: function(data) {
|
||||
eval(data.responseText);
|
||||
ajaxStatus.showStatus('{/literal}{$saved}{literal}');
|
||||
if(typeof result != 'undefined') {
|
||||
ta = document.getElementById('jotpad_textarea_' + result['id']);
|
||||
theDiv = document.getElementById('jotpad_' + result['id']);
|
||||
theDiv.innerHTML = result['savedText'];
|
||||
}
|
||||
ta.style.display = 'none';
|
||||
theDiv.style.display = '';
|
||||
window.setTimeout('ajaxStatus.hideStatus()', 2000);
|
||||
}
|
||||
};
|
||||
}();
|
||||
}
|
||||
</script>{/literal}
|
||||
@@ -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 - 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".
|
||||
*/
|
||||
|
||||
$dashletStrings['MyEcmCalendarsDashlets'] = array('LBL_TITLE' => 'Calendar',
|
||||
'LBL_DESCRIPTION' => 'A Calendar Dashlet',
|
||||
'LBL_SAVING' => 'Saving Calendar ...',
|
||||
'LBL_SAVED' => 'Saved',
|
||||
'LBL_CONFIGURE_TITLE' => 'Title',
|
||||
'LBL_CONFIGURE_STATUS' => 'Default status',
|
||||
'LBL_CONFIGURE_USER' => 'Activity user',
|
||||
'LBL_CONFIGURE_TYPE' => 'Activity type',
|
||||
'LBL_DBLCLICK_HELP' => 'Double click below to Edit.',
|
||||
'LBL_DEFAULT_TEXT' => '',
|
||||
);
|
||||
?>
|
||||
47
modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.meta.php
Executable file
47
modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.meta.php
Executable 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 - 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['MyEcmCalendarsDashlets'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'icon' => 'themes/default/images/EcmCalendars.gif',
|
||||
'category' => 'Tools',
|
||||
'hidden' => true);
|
||||
?>
|
||||
237
modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.php
Executable file
237
modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.php
Executable file
@@ -0,0 +1,237 @@
|
||||
<?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 - 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/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
|
||||
class MyEcmCalendarsDashlets extends Dashlet {
|
||||
|
||||
var $height = '200';
|
||||
var $act_status;
|
||||
var $act_user;
|
||||
var $act_type;
|
||||
|
||||
function MyEcmCalendarsDashlets($id, $def) {
|
||||
$this->loadLanguage('MyEcmCalendarsDashlets'); // load the language strings here
|
||||
|
||||
if(!empty($def['savedText'])) // load default text is none is defined
|
||||
$this->savedText = $def['savedText'];
|
||||
else
|
||||
$this->savedText = $this->dashletStrings['LBL_DEFAULT_TEXT'];
|
||||
|
||||
if(!empty($def['height'])) // set a default height if none is set
|
||||
$this->height = $def['height'];
|
||||
|
||||
$this->act_status = $def['act_status'];
|
||||
$this->act_user = $def['act_user'];
|
||||
$this->act_type = $def['act_type'];
|
||||
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = true; // dashlet has javascript attached to it
|
||||
|
||||
// if no custom title, use default
|
||||
if(empty($def['title'])) $this->title = 'Mój Kalendarz';
|
||||
else $this->title = $def['title'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the dashlet
|
||||
*
|
||||
* @return string html to display dashlet
|
||||
*/
|
||||
function display() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('savedText', $this->savedText);
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.tpl');
|
||||
require_once("modules/EcmCalendars/Calendar.php");
|
||||
require_once("modules/EcmCalendars/language/pl_pl.lang.php");
|
||||
$cal=new Calendar();
|
||||
if($_REQUEST['date'])
|
||||
{
|
||||
$exp=explode("-",$_REQUEST['date']);
|
||||
$cal->year=$exp[0];
|
||||
$cal->month=$exp[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cal->year=date("Y");
|
||||
$cal->month=date("m");
|
||||
}
|
||||
$cal->act_status=$this->act_status;
|
||||
$cal->act_user=$this->act_user;
|
||||
$cal->act_type=$this->act_type;
|
||||
if(!$this->act_type)$cal->act_type="All";
|
||||
$_SESSION['calendar_dashlet_id']=$this->id;
|
||||
$str='
|
||||
<link href="modules/EcmCalendars/style.css" rel="stylesheet" type="text/css">
|
||||
<script src="modules/EcmCalendars/helper.js" language="javascript"></script>
|
||||
<script src="modules/EcmCalendars/Calendar.js" language="javascript"></script>
|
||||
<div id="calendar_dashlet">'.$cal->showTableDashlet($cal->month,$cal->year).'</div>
|
||||
';
|
||||
return parent::display("") . $str . '<br />'; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashletsScript.tpl');
|
||||
return $str; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the configuration form for the dashlet
|
||||
*
|
||||
* @return string html to display form
|
||||
*/
|
||||
function displayOptions() {
|
||||
global $app_strings,$GLOBALS;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
|
||||
$arr=array("All","Planned","Held","Not Held");
|
||||
$as='';
|
||||
global $app_list_strings;
|
||||
$as.='<option value="All"';
|
||||
$as.='>Wszystkie</option>';
|
||||
foreach ($app_list_strings['activity_status_dom'] as $k=>$v) {
|
||||
$as.='<option value="'.$k.'"';
|
||||
if($this->act_status==$k)$as.=" selected";
|
||||
$as.='>'.$v.'</option>';
|
||||
}
|
||||
$ss->assign('act_status_options', $as);
|
||||
|
||||
$arr=array("All","Calls","Meetings","Tasks");
|
||||
$at='';
|
||||
$at.='<option value="All"';
|
||||
if($this->act_type=="All")$at.=" selected";
|
||||
$at.='>Wszystkie</option><option value="Calls"';
|
||||
if($this->act_type=="Calls")$at.=" selected";
|
||||
$at.='>Rozmowy</option><option value="Meetings"';
|
||||
if($this->act_type=="Meetings")$at.=" selected";
|
||||
$at.='>Spotkania</option><option value="Tasks"';
|
||||
if($this->act_type=="Tasks")$at.=" selected";
|
||||
$at.='>Zadania</option></select>';
|
||||
$ss->assign('act_type_options', $at);
|
||||
|
||||
$ua='<option value="All"';
|
||||
if($this->act_user=='All')$ua.=' selected';
|
||||
$ua.='>Wszyscy</option>';
|
||||
$w=mysql_query("select user_name,id from users where deleted='0' order by user_name asc");
|
||||
while($r=mysql_fetch_array($w))
|
||||
{
|
||||
$ua.='<option value="'.$r['id'].'"';
|
||||
if($r['id']==$this->act_user)$ua.=' selected';
|
||||
$ua.='>'.$r['user_name'].'</option>';
|
||||
}
|
||||
$ss->assign('act_user_options', $ua);
|
||||
|
||||
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
|
||||
$ss->assign('statusLbl', $this->dashletStrings['LBL_CONFIGURE_STATUS']);
|
||||
$ss->assign('userLbl', $this->dashletStrings['LBL_CONFIGURE_USER']);
|
||||
$ss->assign('typeLbl', $this->dashletStrings['LBL_CONFIGURE_TYPE']);
|
||||
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashletsOptions.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* called to filter out $_REQUEST object when the user submits the configure dropdown
|
||||
*
|
||||
* @param array $req $_REQUEST
|
||||
* @return array filtered options to save
|
||||
*/
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
$options['title'] = $_REQUEST['title'];
|
||||
$options['act_status'] = $_REQUEST['act_status'];
|
||||
$options['act_user'] = $_REQUEST['act_user'];
|
||||
$options['act_type'] = $_REQUEST['act_type'];
|
||||
|
||||
if(is_numeric($_REQUEST['height'])) {
|
||||
if($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300) $options['height'] = $_REQUEST['height'];
|
||||
elseif($_REQUEST['height'] > 300) $options['height'] = '300';
|
||||
else $options['height'] = '100';
|
||||
}
|
||||
|
||||
// $options['savedText'] = br2nl($this->savedText);
|
||||
$options['savedText'] = $this->savedText;
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to save text on textarea blur. Accessed via Home/CallMethodDashlet.php
|
||||
* This is an example of how to to call a custom method via ajax
|
||||
*/
|
||||
function saveText() {
|
||||
$json = getJSONobj();
|
||||
if(isset($_REQUEST['savedText'])) {
|
||||
$optionsArray = $this->loadOptions();
|
||||
// _pp($_REQUEST['savedText']);
|
||||
$optionsArray['savedText']=$json->decode(html_entity_decode($_REQUEST['savedText']));
|
||||
$optionsArray['savedText']=nl2br($optionsArray['savedText']['jsonObject']);
|
||||
$this->storeOptions($optionsArray);
|
||||
|
||||
}
|
||||
else {
|
||||
$optionsArray['savedText'] = '';
|
||||
}
|
||||
echo 'result = ' . $json->encode(array('id' => $_REQUEST['id'],
|
||||
'savedText' => $optionsArray['savedText']));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
44
modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.tpl
Executable file
44
modules/Home/Dashlets/MyEcmCalendarsDashlets/MyEcmCalendarsDashlets.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div id='jotpad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: {$height}px; border: 1px #ddd solid'>{$savedText}lkjhlkjhlkjhlkjh</div>
|
||||
<textarea id='jotpad_textarea_{$id}' rows="5" onblur='JotPad.blur(this, "{$id}")' style='display: none; width: 100%; height: {$height}px; overflow: auto'></textarea>
|
||||
@@ -0,0 +1,82 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 500px'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Tytuł</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Status</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name='act_status'>{$act_status_options}</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Użytkownik</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name='act_user'>{$act_user_options}</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Działania</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name='act_type'>{$act_type_options}</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLbl}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,88 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{literal}<script>
|
||||
if(typeof JotPad == 'undefined') { // since the dashlet can be included multiple times a page, don't redefine these functions
|
||||
JotPad = function() {
|
||||
return {
|
||||
/**
|
||||
* Called when the textarea is blurred
|
||||
*/
|
||||
blur: function(ta, id) {
|
||||
ajaxStatus.showStatus('{/literal}{$saving}{literal}'); // show that AJAX call is happening
|
||||
// what data to post to the dashlet
|
||||
var va=JSON.stringify(ta.value);
|
||||
postData = 'to_pdf=1&module=Home&action=CallMethodDashlet&method=saveText&id=' + id + '&savedText=' + va;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
|
||||
{success: JotPad.saved, failure: JotPad.saved}, postData);
|
||||
},
|
||||
/**
|
||||
* Called when the textarea is double clicked on
|
||||
*/
|
||||
edit: function(divObj, id) {
|
||||
ta = document.getElementById('jotpad_textarea_' + id);
|
||||
if(isIE) ta.value = divObj.innerHTML.replace(/<br>/gi, "\n");
|
||||
else ta.value = divObj.innerHTML.replace(/<br>/gi, '');
|
||||
ta.value = ta.value.replace(/&/, "&");
|
||||
divObj.style.display = 'none';
|
||||
ta.style.display = '';
|
||||
ta.focus();
|
||||
},
|
||||
/**
|
||||
* handle the response of the saveText method
|
||||
*/
|
||||
saved: function(data) {
|
||||
eval(data.responseText);
|
||||
ajaxStatus.showStatus('{/literal}{$saved}{literal}');
|
||||
if(typeof result != 'undefined') {
|
||||
ta = document.getElementById('jotpad_textarea_' + result['id']);
|
||||
theDiv = document.getElementById('jotpad_' + result['id']);
|
||||
theDiv.innerHTML = result['savedText'];
|
||||
}
|
||||
ta.style.display = 'none';
|
||||
theDiv.style.display = '';
|
||||
window.setTimeout('ajaxStatus.hideStatus()', 2000);
|
||||
}
|
||||
};
|
||||
}();
|
||||
}
|
||||
</script>{/literal}
|
||||
81
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlOptions.tpl
Executable file
81
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlOptions.tpl
Executable file
@@ -0,0 +1,81 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 100%'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$titleLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Date</td>
|
||||
<td class="dataField" valign="top">
|
||||
<input onblur="parseDate(this, '%d.%m.%Y');" class="text" name="date" size="12" maxlength="10" id="date" value="{$date}">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="" id="date_trigger" align="absmiddle">
|
||||
<script type="text/javascript">
|
||||
{literal}Calendar.setup ({inputField : "date", ifFormat : "%d.%m.%Y", showsTime : false, button : "date_trigger", singleClick : true, step : 1});{/literal}
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$userLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name='user[]' size="6" multiple="multiple">{$user_options}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLbl}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
81
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashleOptions.tpl
Executable file
81
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashleOptions.tpl
Executable file
@@ -0,0 +1,81 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 100%'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$titleLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Date</td>
|
||||
<td class="dataField" valign="top">
|
||||
<input onblur="parseDate(this, '%d.%m.%Y');" class="text" name="date" size="12" maxlength="10" id="date" value="{$date}">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="" id="date_trigger" align="absmiddle">
|
||||
<script type="text/javascript">
|
||||
{literal}Calendar.setup ({inputField : "date", ifFormat : "{/literal}{$format}{literal}", showsTime : false, button : "date_trigger", singleClick : true, step : 1});{/literal}
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$userLbl}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name='user[]' size="6" multiple="multiple">{$user_options}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLbl}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -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 - 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".
|
||||
*/
|
||||
|
||||
$dashletStrings['MyEcmCallsMoreDashlets'] = array('LBL_TITLE' => 'Calls summary',
|
||||
'LBL_DESCRIPTION' => 'A user calls summary dashlet',
|
||||
'LBL_SAVING' => 'Saving calls summary ...',
|
||||
'LBL_SAVED' => 'Saved',
|
||||
'LBL_CONFIGURE_TITLE' => 'Title',
|
||||
'LBL_CONFIGURE_STATUS' => 'Default status',
|
||||
'LBL_CONFIGURE_USER' => 'User',
|
||||
'LBL_CONFIGURE_TYPE' => 'Type',
|
||||
'LBL_DBLCLICK_HELP' => 'Double click below to Edit.',
|
||||
'LBL_DEFAULT_TEXT' => '',
|
||||
);
|
||||
?>
|
||||
46
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlets.meta.php
Executable file
46
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlets.meta.php
Executable 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 - 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['MyEcmCallsMoreDashlets'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'icon' => 'themes/default/images/EcmCallsMore.gif',
|
||||
'category' => 'Tools');
|
||||
?>
|
||||
458
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlets.php
Executable file
458
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlets.php
Executable file
@@ -0,0 +1,458 @@
|
||||
<?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 - 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/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
|
||||
class MyEcmCallsMoreDashlets extends Dashlet {
|
||||
|
||||
var $height = '200';
|
||||
var $user=array();
|
||||
|
||||
function MyEcmCallsMoreDashlets($id, $def) {
|
||||
$this->loadLanguage('MyEcmCallsMoreDashlets');
|
||||
|
||||
if(!empty($def['height']))
|
||||
$this->height = $def['height'];
|
||||
|
||||
$this->user = $def['user'];
|
||||
if($def['date'])$this->date = $GLOBALS['timedate']->to_display_date($def['date']);
|
||||
else $this->date=$GLOBALS['timedate']->to_display_date(date("Y-m-d"));
|
||||
if(count($this->user)==0){
|
||||
$w=$GLOBALS['db']->query("select id from users where deleted='0' and status='Active' and phone_work!=''");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$this->user[]=$r['id'];
|
||||
}
|
||||
}
|
||||
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = true; // dashlet has javascript attached to it
|
||||
|
||||
// if no custom title, use default
|
||||
if(empty($def['title'])) $this->title = $this->dashletStrings['LBL_TITLE'];
|
||||
else $this->title = $def['title'];
|
||||
}
|
||||
|
||||
function display() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('savedText', $this->savedText);
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
|
||||
$str='';
|
||||
|
||||
//echo $this->date;
|
||||
$exp=explode("-",$GLOBALS['timedate']->to_db_date($this->date));
|
||||
//echo $GLOBALS['timedate']->to_db_date($this->date)."mm";
|
||||
$dm=$exp[1];
|
||||
$dd=$exp[2];
|
||||
$dy=$exp[0];
|
||||
|
||||
$trd=array(
|
||||
6=>0,
|
||||
0=>1,
|
||||
1=>2,
|
||||
2=>3,
|
||||
3=>4,
|
||||
4=>5,
|
||||
5=>6,
|
||||
);
|
||||
|
||||
//echo "<br>".$dy." ".$dm." ".$dd;
|
||||
|
||||
$no_actual_day=date("w",mktime(0,0,0,$dm,$dd,$dy));
|
||||
//echo $no_actual_day;
|
||||
$date_first=date("Y-m-d",mktime(0,0,0,$dm,$dd,$dy)-($no_actual_day)*(3600*24)+3600*24);
|
||||
//echo $date_first;
|
||||
$expl=explode("-",$date_first);
|
||||
$ds=array(0,1,2,3,4);
|
||||
|
||||
$m=0;
|
||||
foreach($ds as $dss){
|
||||
$days[$m]=date("Y-m-d",mktime(0,0,0,$expl[1],$expl[2],$expl[0])+$m*3600*24);
|
||||
$m++;
|
||||
}
|
||||
//print_r($days);
|
||||
/*
|
||||
$days[$no_actual_day]=$GLOBALS['timedate']->to_db_date($this->date);
|
||||
//echo $this->date;die();
|
||||
if($no_actual_day>0){
|
||||
for($i=0;$i<$no_actual_day;$i++){
|
||||
$days[$i]=date("Y-m-d",mktime(0,0,0,$dm,$dd,$dy)-($i+1)*(3600*24));
|
||||
}
|
||||
}
|
||||
for($i=$no_actual_day+1;$i<=6;$i++){
|
||||
$days[$i]=date("Y-m-d",mktime(0,0,0,$dm,$dd,$dy)+($i-$no_actual_day)*(3600*24));
|
||||
}*/
|
||||
//$this->user=array("178770a9-cd31-9f5e-6ee4-4acb40f6381c","dbf183f4-70da-2e17-1745-4acb40d0294b");
|
||||
if(count($this->user)>0){
|
||||
foreach($this->user as $u){
|
||||
foreach($days as $ddd){
|
||||
$w=$GLOBALS['db']->query("select * from ecmcallsphones where bean_id='".$u."'");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
|
||||
/*$p[$r['bean_id'][$ddd]]['busy']=mysql_num_rows($GLOBALS['db']->query("select id from cdr where disposition='BUSY' and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
|
||||
$ww=$GLOBALS['db']->query("select duration from cdr where disposition='BUSY' and src='".$r['phone']."' and (calldate like '".$ddd."%')");
|
||||
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$p[$r['bean_id']][$ddd]['busy_duration']+=$rr['duration'];
|
||||
}*/
|
||||
$p[$r['bean_id']][$ddd]['answered_up_60']=mysql_num_rows($GLOBALS['db']->query("select id from cdr where disposition like 'ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
|
||||
$ww=$GLOBALS['db']->query("select duration,dst from cdr where disposition='ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and (calldate like '".$ddd."%')");
|
||||
$temp=array();
|
||||
$dttt=0;
|
||||
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$p[$r['bean_id']][$ddd]['answered_up_60_duration']+=$rr['duration'];
|
||||
$temp[$rr['dst']]+=$rr['duration'];
|
||||
}
|
||||
$p[$r['bean_id']][$ddd]['answered_up_60_distinct']=count($temp);
|
||||
foreach($temp as $tte)$dttt+=$tte;
|
||||
$p[$r['bean_id']][$ddd]['answered_up_60_distinct_duration']=$dttt;
|
||||
|
||||
$temp_cnt=0;
|
||||
$dur_tt=0;
|
||||
if(count($temp)>0){
|
||||
foreach($temp as $temp_key=>$temp_value){
|
||||
$www=$GLOBALS['db']->query("select dst,duration from cdr where disposition='ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate like '".$ddd."%'");
|
||||
if(mysql_num_rows($GLOBALS['db']->query("select dst,duration from cdr where disposition='ANSWERED' and deleted='0' and duration>60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate<'".$ddd."'"))==0){
|
||||
$temp_cnt++;
|
||||
}
|
||||
while($rrr=$GLOBALS['db']->fetchByAssoc($www))$dur_tt+=$rrr['duration'];
|
||||
}
|
||||
}
|
||||
$p[$r['bean_id']][$ddd]['answered_up_60_new']=$temp_cnt;
|
||||
$p[$r['bean_id']][$ddd]['answered_up_60_new_duration']=$dur_tt;
|
||||
|
||||
$p[$r['bean_id']][$ddd]['failed']=mysql_num_rows($GLOBALS['db']->query("select id from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
|
||||
$ww=$GLOBALS['db']->query("select duration,dst from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and (calldate like '".$ddd."%')");
|
||||
$temp=array();
|
||||
$dttt=0;
|
||||
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$p[$r['bean_id']][$ddd]['failed_duration']+=$rr['duration'];
|
||||
$temp[$rr['dst']]+=$rr['duration'];
|
||||
}
|
||||
$p[$r['bean_id']][$ddd]['failed_distinct']=count($temp);
|
||||
foreach($temp as $tte)$dttt+=$tte;
|
||||
$p[$r['bean_id']][$ddd]['failed_distinct_duration']=$dttt;
|
||||
|
||||
$temp_cnt=0;
|
||||
$dur_tt=0;
|
||||
if(count($temp)>0){
|
||||
foreach($temp as $temp_key=>$temp_value){
|
||||
$www=$GLOBALS['db']->query("select dst,duration from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate like '".$ddd."%'");
|
||||
if(mysql_num_rows($GLOBALS['db']->query("select dst,duration from cdr where disposition like 'ANSWERED' and deleted='0' and duration<=60 and src='".$r['phone']."' and dst='".$temp_key."' and calldate<'".$ddd."'"))==0){
|
||||
$temp_cnt++;
|
||||
}
|
||||
while($rrr=$GLOBALS['db']->fetchByAssoc($www))$dur_tt+=$rrr['duration'];
|
||||
}
|
||||
}
|
||||
$p[$r['bean_id']][$ddd]['failed_new']=$temp_cnt;
|
||||
$p[$r['bean_id']][$ddd]['failed_new_duration']=$dur_tt;
|
||||
/*echo '<pre>';
|
||||
print_r($p[$r['bean_id']]);
|
||||
echo '</pre>';
|
||||
$p[$r['bean_id']][$ddd]['failed']=mysql_num_rows($GLOBALS['db']->query("select id from cdr where disposition='FAILED' and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
|
||||
$ww=$GLOBALS['db']->query("select duration from cdr where disposition='FAILED' and src='".$r['phone']."' and (calldate like '".$ddd."%')");
|
||||
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$p[$r['bean_id']][$ddd]['failed_duration']+=$rr['duration'];
|
||||
}
|
||||
$p[$r['bean_id']][$ddd]['no_answer']=mysql_num_rows($GLOBALS['db']->query("select id from cdr where disposition='NO ANSWER' and src='".$r['phone']."' and (calldate like '".$ddd."%')"));
|
||||
$ww=$GLOBALS['db']->query("select duration from cdr where disposition='NO ANSWER' and src='".$r['phone']."' and (calldate like '".$ddd."%')");
|
||||
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$p[$r['bean_id']][$ddd]['no_answer_duration']+=$rr['duration'];
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$days=$this->multisort($days,array(array('key'=>0,'sort'=>'asc')));
|
||||
//echo '<pre>';
|
||||
//print_r($p);
|
||||
//echo '</pre>';
|
||||
$str.='<div style="border: 1px solid #cccccc;min-width:500px;max-width:700px;overflow:auto">';
|
||||
$str.='<table cellspacing="0" cellpadding="0" border="0" width="100%">';
|
||||
$str.='<tr class="listViewThLinkS1" align="center" valign="top">';
|
||||
$str.='<td> </td>';
|
||||
for($i=0;$i<count($days);$i++){
|
||||
$str.='<td colspan="3" style="border: 1px solid #cccccc"><b>'.$GLOBALS['timedate']->to_display_date($days[$i]).'</b></td>';
|
||||
}
|
||||
$str.='<td colspan="3" style="border: 1px solid #cccccc"><b>Summary</b></td>';
|
||||
$str.'</tr>';
|
||||
$str.='<tr class="listViewThLinkS1" align="center" valign="top">';
|
||||
$str.='<td class="listViewThS1"> </td>';
|
||||
for($i=0;$i<=count($days);$i++){
|
||||
$str.='<td colspan="2" align="center" style="text-align: center;" class="listViewThS1"><img src="modules/Home/Dashlets/MyEcmCallsMoreDashlets/blue.png" border="0" /></td>';
|
||||
//$str.='<td class="listViewThS1">>60 (h:m)</td>';
|
||||
$str.='<td class="listViewThS1"><img src="modules/Home/Dashlets/MyEcmCallsMoreDashlets/red.png" border="0" /></td>';
|
||||
}
|
||||
$str.='</tr>';
|
||||
$type_arr=array("answered_up_60","failed");
|
||||
$type_arr_distinct=array("answered_up_60_distinct","failed_distinct");
|
||||
if(count($p)>0){
|
||||
foreach($p as $k=>$v){
|
||||
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select first_name,last_name,phone_work from users where id='".$k."'"));
|
||||
if($k){
|
||||
$str.='<tr align="center" valign="top">';
|
||||
$str.='<td style="width:60px;padding:2px;border-bottom: 1px solid #cccccc;">'.$r['first_name'].' '.$r['last_name'].' ('.$r['phone_work'].')</td>';
|
||||
foreach($v as $kk=>$vv){
|
||||
foreach($type_arr as $ta){
|
||||
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
|
||||
else $sty="";
|
||||
if($vv[$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;">'.$vv[$ta].'<br><span alt="distinct" title="distinct">'.$vv[$ta.'_distinct'].'</span><br><span alt="new" title="new">'.$vv[$ta.'_new'].'</span></td>';
|
||||
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;">0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></td>';
|
||||
if($ta!="failed"){
|
||||
if($vv[$ta.'_duration']){
|
||||
$m=floor($vv[$ta.'_duration']/60);
|
||||
$h=floor($vv[$ta.'_duration']/3600);
|
||||
$m=$m-60*$h;
|
||||
$m2=floor($vv[$ta.'_distinct_duration']/60);
|
||||
$h2=floor($vv[$ta.'_distinct_duration']/3600);
|
||||
$m2=$m2-60*$h2;
|
||||
$m3=floor($vv[$ta.'_new_duration']/60);
|
||||
$h3=floor($vv[$ta.'_new_duration']/3600);
|
||||
$m3=$m3-60*$h3;
|
||||
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;">'.$h.'h '.$m.'m</td>';
|
||||
}
|
||||
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;">0h 0m</td>';
|
||||
}
|
||||
$all[$k][$ta]+=$vv[$ta];
|
||||
$all[$k][$ta."_distinct"]+=$vv[$ta."_distinct"];
|
||||
$all[$k][$ta."_new"]+=$vv[$ta."_new"];
|
||||
if($ta!="failed")$all[$k][$ta.'_duration']+=$vv[$ta.'_duration'];
|
||||
if($ta!="failed")$all[$k][$ta.'_distinct_duration']+=$vv[$ta.'_distinct_duration'];
|
||||
if($ta!="failed")$all[$k][$ta.'_new_duration']+=$vv[$ta.'_new_duration'];
|
||||
$alla[$kk][$ta]+=$vv[$ta];
|
||||
$alla[$kk][$ta."_distinct"]+=$vv[$ta."_distinct"];
|
||||
$alla[$kk][$ta."_new"]+=$vv[$ta."_new"];
|
||||
if($ta!="failed")$alla[$kk][$ta.'_duration']+=$vv[$ta.'_duration'];
|
||||
if($ta!="failed")$alla[$kk][$ta.'_distinct_duration']+=$vv[$ta.'_distinct_duration'];
|
||||
if($ta!="failed")$alla[$kk][$ta.'_new_duration']+=$vv[$ta.'_new_duration'];
|
||||
$allaa[$ta]+=$vv[$ta];
|
||||
$allaa[$ta."_distinct"]+=$vv[$ta."_distinct"];
|
||||
$allaa[$ta."_new"]+=$vv[$ta."_new"];
|
||||
if($ta!="failed")$allaa[$ta.'_duration']+=$vv[$ta.'_duration'];
|
||||
if($ta!="failed")$allaa[$ta.'_distinct_duration']+=$vv[$ta.'_distinct_duration'];
|
||||
if($ta!="failed")$allaa[$ta.'_new_duration']+=$vv[$ta.'_new_duration'];
|
||||
}
|
||||
}
|
||||
foreach($type_arr as $ta){
|
||||
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
|
||||
else $sty="";
|
||||
if($all[$k][$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$all[$k][$ta].'<br><span alt="distinct" title="distinct">'.$all[$k][$ta."_distinct"].'</span><br><span alt="new" title="new">'.$all[$k][$ta."_new"].'</span></b></td>';
|
||||
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></b></td>';
|
||||
if($ta!="failed"){
|
||||
if($all[$k][$ta.'_duration']){
|
||||
$m=floor($all[$k][$ta.'_duration']/60);
|
||||
$h=floor($all[$k][$ta.'_duration']/3600);
|
||||
$m=$m-60*$h;
|
||||
$m2=floor($all[$k][$ta.'_distinct_duration']/60);
|
||||
$h2=floor($all[$k][$ta.'_distinct_duration']/3600);
|
||||
$m2=$m2-60*$h2;
|
||||
$m3=floor($all[$k][$ta.'_new_duration']/60);
|
||||
$h3=floor($all[$k][$ta.'_new_duration']/3600);
|
||||
$m3=$m3-60*$h3;
|
||||
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$h.'h '.$m.'m</b></td>';
|
||||
}
|
||||
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>0h 0m</b></td>';
|
||||
}
|
||||
}
|
||||
$str.='</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$str.='<tr align="center" valign="top"><td><b>Summary</b></td>';
|
||||
if(count($alla)>0){
|
||||
foreach($alla as $al){
|
||||
foreach($type_arr as $ta){
|
||||
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
|
||||
else $sty="";
|
||||
if($al[$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$al[$ta].'<br><span alt="distinct" title="distinct">'.$al[$ta."_distinct"].'</span><br><span alt="new" title="new">'.$al[$ta."_new"].'</span></b></td>';
|
||||
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></b></td>';
|
||||
if($ta=="failed")continue;
|
||||
if($al[$ta.'_duration']){
|
||||
$m=floor($al[$ta.'_duration']/60);
|
||||
$h=floor($al[$ta.'_duration']/3600);
|
||||
$m=$m-60*$h;
|
||||
$m2=floor($al[$ta.'_distinct_duration']/60);
|
||||
$h2=floor($al[$ta.'_distinct_duration']/3600);
|
||||
$m2=$m2-60*$h2;
|
||||
$m3=floor($al[$ta.'_new_duration']/60);
|
||||
$h3=floor($al[$ta.'_new_duration']/3600);
|
||||
$m3=$m3-60*$h3;
|
||||
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$h.'h '.$m.'m</b></td>';
|
||||
}
|
||||
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>0h 0m</b></td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($type_arr as $ta){
|
||||
if($ta=="answered_up_60")$sty="border-left: 1px solid #cccccc";
|
||||
else $sty="";
|
||||
if($allaa[$ta])$str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$allaa[$ta].'<br><span alt="distinct" title="distinct">'.$allaa[$ta."_distinct"].'</span><br><span alt="new" title="new">'.$allaa[$ta."_new"].'</span></b></td>';
|
||||
else $str.='<td style="'.$sty.';padding:2px;border-bottom: 1px solid #cccccc;"><b>0<br><span alt="distinct" title="distinct">0</span><br><span alt="new" title="new">0</span></b></td>';
|
||||
if($ta=="failed")continue;
|
||||
if($allaa[$ta.'_duration']){
|
||||
$m=floor($allaa[$ta.'_duration']/60);
|
||||
$h=floor($allaa[$ta.'_duration']/3600);
|
||||
$m=$m-60*$h;
|
||||
$m2=floor($allaa[$ta.'_distinct_duration']/60);
|
||||
$h2=floor($allaa[$ta.'_distinct_duration']/3600);
|
||||
$m2=$m2-60*$h2;
|
||||
$m3=floor($allaa[$ta.'_new_duration']/60);
|
||||
$h3=floor($allaa[$ta.'_new_duration']/3600);
|
||||
$m3=$m3-60*$h3;
|
||||
$str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>'.$h.'h '.$m.'m</b></td>';
|
||||
}
|
||||
else $str.='<td style="padding:2px;border-bottom: 1px solid #cccccc;"><b>0h 0m</b></td>';
|
||||
}
|
||||
$str.='</tr>';
|
||||
$str.='</table>';
|
||||
$str.='</div>';
|
||||
return parent::display("") . $str . '<br />'; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
|
||||
function multisort($data,$keys)
|
||||
{
|
||||
if(count($data)>0)
|
||||
{
|
||||
foreach($data as $key => $row)
|
||||
{
|
||||
foreach($keys as $k)
|
||||
{
|
||||
$cols[$k['key']][$key] = $row[$k['key']];
|
||||
}
|
||||
}
|
||||
|
||||
$idkeys=@array_keys($data);
|
||||
$i=0;
|
||||
foreach($keys as $k)
|
||||
{
|
||||
if($i>0)$sort.=',';
|
||||
$sort.='$cols['.$k['key'].']';
|
||||
if($k['sort'])$sort.=',SORT_'.strtoupper($k['sort']);
|
||||
if($k['type'])$sort.=',SORT_'.strtoupper($k['type']);
|
||||
$i++;
|
||||
}
|
||||
$sort.=',$idkeys';
|
||||
$sort='@array_multisort('.$sort.');';
|
||||
eval($sort);
|
||||
foreach($idkeys as $idkey)
|
||||
{
|
||||
$result[$idkey]=$data[$idkey];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
function displayScript() {
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
$str = $ss->fetch('modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashletsScript.tpl');
|
||||
return $str; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the configuration form for the dashlet
|
||||
*
|
||||
* @return string html to display form
|
||||
*/
|
||||
function displayOptions() {
|
||||
global $app_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
|
||||
$ua='<option value="All"';
|
||||
if($this->user[0]=='All' || $this->user[0]=='')$ua.=' selected';
|
||||
$ua.='>All</option>';
|
||||
$w=$GLOBALS['db']->query("select first_name,last_name,id from users where deleted='0' and status='Active' and phone_work!='' order by user_name asc");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w))
|
||||
{
|
||||
$ua.='<option value="'.$r['id'].'"';
|
||||
if(is_array($this->user)){
|
||||
if(in_array($r['id'],$this->user)){
|
||||
$ua.=' selected';
|
||||
}
|
||||
}
|
||||
$ua.='>'.$r['first_name'].' '.$r['last_name'].'</option>';
|
||||
}
|
||||
$ss->assign('user_options', $ua);
|
||||
$ss->assign('date', $this->date);
|
||||
|
||||
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
|
||||
$ss->assign('statusLbl', $this->dashletStrings['LBL_CONFIGURE_STATUS']);
|
||||
$ss->assign('userLbl', $this->dashletStrings['LBL_CONFIGURE_USER']);
|
||||
$ss->assign('typeLbl', $this->dashletStrings['LBL_CONFIGURE_TYPE']);
|
||||
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('height', $this->height);
|
||||
$arr=array("d","m","Y","y");
|
||||
$arrp=array("%d","%m","%Y","%y");
|
||||
$ss->assign('format', str_replace($arr,$arrp,$GLOBALS['timedate']->get_date_format()));
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashleOptions.tpl');
|
||||
}
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
$options['title'] = $_REQUEST['title'];
|
||||
$options['user'] = $_REQUEST['user'];
|
||||
$exp=explode("-",$GLOBALS['timedate']->to_db_date($_REQUEST['date']));
|
||||
$options['date'] = date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])+3600*24);
|
||||
|
||||
if(is_numeric($_REQUEST['height'])) {
|
||||
if($_REQUEST['height'] > 0 && $_REQUEST['height'] <= 300) $options['height'] = $_REQUEST['height'];
|
||||
elseif($_REQUEST['height'] > 300) $options['height'] = '300';
|
||||
else $options['height'] = '100';
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
44
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlets.tpl
Executable file
44
modules/Home/Dashlets/MyEcmCallsMoreDashlets/MyEcmCallsMoreDashlets.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div id='jotpad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: {$height}px; border: 1px #ddd solid'>{$savedText}lkjhlkjhlkjhlkjh</div>
|
||||
<textarea id='jotpad_textarea_{$id}' rows="5" onblur='JotPad.blur(this, "{$id}")' style='display: none; width: 100%; height: {$height}px; overflow: auto'></textarea>
|
||||
@@ -0,0 +1,88 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{literal}<script>
|
||||
if(typeof JotPad == 'undefined') { // since the dashlet can be included multiple times a page, don't redefine these functions
|
||||
JotPad = function() {
|
||||
return {
|
||||
/**
|
||||
* Called when the textarea is blurred
|
||||
*/
|
||||
blur: function(ta, id) {
|
||||
ajaxStatus.showStatus('{/literal}{$saving}{literal}'); // show that AJAX call is happening
|
||||
// what data to post to the dashlet
|
||||
var va=JSON.stringify(ta.value);
|
||||
postData = 'to_pdf=1&module=Home&action=CallMethodDashlet&method=saveText&id=' + id + '&savedText=' + va;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
|
||||
{success: JotPad.saved, failure: JotPad.saved}, postData);
|
||||
},
|
||||
/**
|
||||
* Called when the textarea is double clicked on
|
||||
*/
|
||||
edit: function(divObj, id) {
|
||||
ta = document.getElementById('jotpad_textarea_' + id);
|
||||
if(isIE) ta.value = divObj.innerHTML.replace(/<br>/gi, "\n");
|
||||
else ta.value = divObj.innerHTML.replace(/<br>/gi, '');
|
||||
ta.value = ta.value.replace(/&/, "&");
|
||||
divObj.style.display = 'none';
|
||||
ta.style.display = '';
|
||||
ta.focus();
|
||||
},
|
||||
/**
|
||||
* handle the response of the saveText method
|
||||
*/
|
||||
saved: function(data) {
|
||||
eval(data.responseText);
|
||||
ajaxStatus.showStatus('{/literal}{$saved}{literal}');
|
||||
if(typeof result != 'undefined') {
|
||||
ta = document.getElementById('jotpad_textarea_' + result['id']);
|
||||
theDiv = document.getElementById('jotpad_' + result['id']);
|
||||
theDiv.innerHTML = result['savedText'];
|
||||
}
|
||||
ta.style.display = 'none';
|
||||
theDiv.style.display = '';
|
||||
window.setTimeout('ajaxStatus.hideStatus()', 2000);
|
||||
}
|
||||
};
|
||||
}();
|
||||
}
|
||||
</script>{/literal}
|
||||
128
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashletOptions.tpl
Executable file
128
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashletOptions.tpl
Executable file
@@ -0,0 +1,128 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 100%'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Title</td>
|
||||
<td colspan="4" valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' value='{$title}'> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Period</td>
|
||||
<td valign='top' class='dataField'>{$date}</td>
|
||||
<td valign='top' class='dataField'> </td>
|
||||
<td valign='top' class='dataField'> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%" valign='top' nowrap class='dataLabel'> </td>
|
||||
<td width="20%" valign='top' class='dataField'>Show</td>
|
||||
<td width="20%" valign='top' class='dataField'>Title</td>
|
||||
<td width="20%" valign='top' class='dataField'>Order</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Sales</td>
|
||||
<td valign='top' class='dataField'>{$sales}</td>
|
||||
<td valign='top' class='dataField'>{$sales_title}</td>
|
||||
<td valign='top' class='dataField'>{$sales_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Sales in year</td>
|
||||
<td valign='top' class='dataField'>{$sales_year}</td>
|
||||
<td valign='top' class='dataField'>{$sales_year_title}</td>
|
||||
<td valign='top' class='dataField'>{$sales_year_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Order fulfillment</td>
|
||||
<td valign='top' class='dataField'>{$percent}</td>
|
||||
<td valign='top' class='dataField'>{$percent_title}</td>
|
||||
<td valign='top' class='dataField'>{$percent_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Quotes</td>
|
||||
<td valign='top' class='dataField'>{$quotes}</td>
|
||||
<td valign='top' class='dataField'>{$quotes_title}</td>
|
||||
<td valign='top' class='dataField'>{$quotes_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Orders</td>
|
||||
<td valign='top' class='dataField'>{$orders}</td>
|
||||
<td valign='top' class='dataField'>{$orders_title}</td>
|
||||
<td valign='top' class='dataField'>{$orders_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Stocks</td>
|
||||
<td valign='top' class='dataField'>{$stocks}</td>
|
||||
<td valign='top' class='dataField'>{$stocks_title}</td>
|
||||
<td valign='top' class='dataField'>{$stocks_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Products</td>
|
||||
<td valign='top' class='dataField'>{$products}</td>
|
||||
<td valign='top' class='dataField'>{$products_title}</td>
|
||||
<td valign='top' class='dataField'>{$products_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>New products</td>
|
||||
<td valign='top' class='dataField'>{$new_products}</td>
|
||||
<td valign='top' class='dataField'>{$new_products_title}</td>
|
||||
<td valign='top' class='dataField'>{$new_products_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>Payments</td>
|
||||
<td valign='top' class='dataField'>{$payments}</td>
|
||||
<td valign='top' class='dataField'>{$payments_title}</td>
|
||||
<td valign='top' class='dataField'>{$payments_no}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="5">
|
||||
<input type='submit' class='button' value='{$saveLbl}'> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
46
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.en_us.lang.php
Executable file
46
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.en_us.lang.php
Executable 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 - 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".
|
||||
*/
|
||||
|
||||
$dashletStrings['MyEcmReportDashlets'] = array('LBL_TITLE' => 'Reports summary',
|
||||
'LBL_DESCRIPTION' => 'A reports summary dashlet',
|
||||
'LBL_SAVING' => 'Saving calls summary ...',
|
||||
'LBL_SAVED' => 'Saved',
|
||||
'LBL_CONFIGURE_TITLE' => 'Title',
|
||||
'LBL_CONFIGURE_SAVE' => 'Save',
|
||||
'LBL_DEFAULT_TEXT' => '',
|
||||
);
|
||||
?>
|
||||
47
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.meta.php
Executable file
47
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.meta.php
Executable 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 - 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['MyEcmReportDashlets'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'icon' => 'themes/default/images/EcmReport.gif',
|
||||
'category' => 'Tools',
|
||||
'hidden' => true);
|
||||
?>
|
||||
1039
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.php
Executable file
1039
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.php
Executable file
File diff suppressed because it is too large
Load Diff
44
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.tpl
Executable file
44
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashlets.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div id='jotpad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: {$height}px; border: 1px #ddd solid'>{$savedText}lkjhlkjhlkjhlkjh</div>
|
||||
<textarea id='jotpad_textarea_{$id}' rows="5" onblur='JotPad.blur(this, "{$id}")' style='display: none; width: 100%; height: {$height}px; overflow: auto'></textarea>
|
||||
88
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashletsScript.tpl
Executable file
88
modules/Home/Dashlets/MyEcmReportDashlets/MyEcmReportDashletsScript.tpl
Executable file
@@ -0,0 +1,88 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
{literal}<script>
|
||||
if(typeof JotPad == 'undefined') { // since the dashlet can be included multiple times a page, don't redefine these functions
|
||||
JotPad = function() {
|
||||
return {
|
||||
/**
|
||||
* Called when the textarea is blurred
|
||||
*/
|
||||
blur: function(ta, id) {
|
||||
ajaxStatus.showStatus('{/literal}{$saving}{literal}'); // show that AJAX call is happening
|
||||
// what data to post to the dashlet
|
||||
var va=JSON.stringify(ta.value);
|
||||
postData = 'to_pdf=1&module=Home&action=CallMethodDashlet&method=saveText&id=' + id + '&savedText=' + va;
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('POST','index.php',
|
||||
{success: JotPad.saved, failure: JotPad.saved}, postData);
|
||||
},
|
||||
/**
|
||||
* Called when the textarea is double clicked on
|
||||
*/
|
||||
edit: function(divObj, id) {
|
||||
ta = document.getElementById('jotpad_textarea_' + id);
|
||||
if(isIE) ta.value = divObj.innerHTML.replace(/<br>/gi, "\n");
|
||||
else ta.value = divObj.innerHTML.replace(/<br>/gi, '');
|
||||
ta.value = ta.value.replace(/&/, "&");
|
||||
divObj.style.display = 'none';
|
||||
ta.style.display = '';
|
||||
ta.focus();
|
||||
},
|
||||
/**
|
||||
* handle the response of the saveText method
|
||||
*/
|
||||
saved: function(data) {
|
||||
eval(data.responseText);
|
||||
ajaxStatus.showStatus('{/literal}{$saved}{literal}');
|
||||
if(typeof result != 'undefined') {
|
||||
ta = document.getElementById('jotpad_textarea_' + result['id']);
|
||||
theDiv = document.getElementById('jotpad_' + result['id']);
|
||||
theDiv.innerHTML = result['savedText'];
|
||||
}
|
||||
ta.style.display = 'none';
|
||||
theDiv.style.display = '';
|
||||
window.setTimeout('ajaxStatus.hideStatus()', 2000);
|
||||
}
|
||||
};
|
||||
}();
|
||||
}
|
||||
</script>{/literal}
|
||||
154
modules/Home/Dashlets/MyEcmReportDashlets/salesChart.php
Executable file
154
modules/Home/Dashlets/MyEcmReportDashlets/salesChart.php
Executable file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
$startTime = microtime(true);
|
||||
|
||||
require_once('/var/www/html/e5crm/include/entryPoint.php');
|
||||
ob_start();
|
||||
require_once("/var/www/html/e5crm/config.php");
|
||||
require_once('/var/www/html/e5crm/include/MVC/SugarApplication.php');
|
||||
$mm = new MysqlManager();
|
||||
$mm->connect();
|
||||
/*$app = new SugarApplication();
|
||||
$app->startSession();
|
||||
$app->execute();
|
||||
*/
|
||||
include_once( '/var/www/html/e5crm/include/ECM/open_flash_chart/ofc-library/open-flash-chart.php' );
|
||||
include_once("/var/www/html/e5crm/modules/EcmReports/cache.php");
|
||||
include_once("/var/www/html/e5crm/modules/EcmReports/class.sales.php");
|
||||
|
||||
|
||||
$mmm=(int)date("m")-1;
|
||||
if($mmm==0)$mmm=12;
|
||||
|
||||
$year_month=$_SESSION['EcmReports_Dashlet_sales'];
|
||||
$e=explode("-",$_SESSION['EcmReports_Dashlet_sales']);
|
||||
$year=$e[0];
|
||||
$month=$e[1];
|
||||
|
||||
$s=new Sales();
|
||||
$s->date_from=$year."-".$month."-01";
|
||||
$s->date_to=$year."-".$month."-31";
|
||||
$sdata=$s->getSalesByCategory();
|
||||
|
||||
$pred=new Sales();
|
||||
$pred->date_from=$year."-01-01";
|
||||
$pred->date_to=$year."-12-31";
|
||||
$pred=$pred->getSalesByCategory();
|
||||
|
||||
function repl($t){
|
||||
$a1=array("ą","ś","ę","ż","ź","ć","ń","ó","ł","Ą","Ś","Ę","Ż","Ź","Ć","Ń","Ó","Ł");
|
||||
$a2=array("a","s","e","z","z","c","n","o","l","A","S","E","Z","Z","C","N","O","L");
|
||||
return str_replace($a1,$a2,$t);
|
||||
}
|
||||
function salesPercent($category_id,$date){
|
||||
$w=$GLOBALS['db']->query("select value_wz as swz,value_sale as ssale from ecmproductcategories_realisation where product_category_id='".$category_id."' and date='".$date."'");
|
||||
$r=$GLOBALS['db']->fetchByAssoc($w);
|
||||
return @100*$r['swz']/$r['ssale'];
|
||||
}
|
||||
|
||||
$year_month=$_SESSION['EcmReports_Dashlet_sales'];
|
||||
$e=explode("-",$_SESSION['EcmReports_Dashlet_sales']);
|
||||
$year=$e[0];
|
||||
$month=$e[1];
|
||||
|
||||
$s=sum($year_month,"","","","");
|
||||
$sy=sum($year,"","","","");
|
||||
|
||||
$w=$GLOBALS['db']->query("select id,name from ecmproductcategories where deleted='0' and name!='' order by name asc");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$ss=$sdata[$month][$r['id']];
|
||||
$pp=$pred[$month][$r['id']];
|
||||
|
||||
$v_s=$ss['sales'];
|
||||
if($v_s>$temp)$temp=$v_s;
|
||||
$sum_s+=$v_s;
|
||||
|
||||
$v_p=$ss['purchase'];
|
||||
if($v_p>$temp)$temp=$v_p;
|
||||
$sum_p+=$v_p;
|
||||
|
||||
$v_l=$pp['sales']/$mmm;
|
||||
if($v_l>$temp)$temp=$v_l;
|
||||
$sum_l+=$v_l;
|
||||
|
||||
$v_r=salesPercent($r['id'],$year_month);
|
||||
|
||||
$arr_s[]=array(
|
||||
"name"=>repl($r['name']),
|
||||
"value"=>$v_s,
|
||||
);
|
||||
$arr_p[]=array(
|
||||
"value"=>$v_p,
|
||||
);
|
||||
$arr_l[]=array(
|
||||
"value"=>$v_l,
|
||||
);
|
||||
$arr_r[]=array(
|
||||
"value"=>$v_r,
|
||||
);
|
||||
}
|
||||
//$arr_s=multisort($arr_s,array(array('key'=>'value','sort'=>'desc')));
|
||||
for($i=0;$i<count($arr_s);$i++){
|
||||
$data_1[]=$arr_l[$i]['value'];
|
||||
$data_2[]=$arr_s[$i]['value'];
|
||||
$data_3[]=$arr_p[$i]['value'];
|
||||
$data_4[]=$arr_r[$i]['value'];
|
||||
$cats[]=$arr_s[$i]['name'];
|
||||
}
|
||||
|
||||
$g = new graph();
|
||||
|
||||
//$g->title( 'Sales: '.$year_month, '{font-size:20px; color: #000000; margin: 5px; background-color: #ffffff; padding:5px; padding-left: 20px; padding-right: 20px;}' );
|
||||
|
||||
$g->bg_colour = '#ffffff';
|
||||
|
||||
$d1 = new bar( 75, '#999999' );
|
||||
$d2 = new bar( 75, '#D54C78' );
|
||||
$d3 = new bar( 75, '#3334AD' );
|
||||
$d1->key( 'Forecast', 10 );
|
||||
$d2->key( 'Sales', 10 );
|
||||
$d3->key( 'Margin', 10 );
|
||||
for($i=0;$i<count($data_1);$i++){
|
||||
$d1->add_data_tip($data_1[$i],"Margin: ".round($data_3[$i],2)."\nSales: ".round($data_2[$i],2)."\nForecast: ".round($data_1[$i],2)."\nFullfillment: ".round($data_4[$i],2)."%");
|
||||
$d2->add_data_tip($data_2[$i],"Margin: ".round($data_3[$i],2)."\nSales: ".round($data_2[$i],2)."\nForecast: ".round($data_1[$i],2)."\nFullfillment: ".round($data_4[$i],2)."%");
|
||||
$d3->add_data_tip($data_3[$i],"Margin: ".round($data_3[$i],2)."\nSales: ".round($data_2[$i],2)."\nForecast: ".round($data_1[$i],2)."\nFullfillment: ".round($data_4[$i],2)."%");
|
||||
}
|
||||
$g->data_sets[]=$d1;
|
||||
$g->data_sets[]=$d2;
|
||||
$g->data_sets[]=$d3;
|
||||
|
||||
$g->set_tool_tip( '#x_label#<br>#tip#<br>' );
|
||||
|
||||
//$g->set_data($data_1);
|
||||
//$g->bar( 75, '#D54C78', '', 10 );
|
||||
//$g->set_data($data_2);
|
||||
//$g->bar( 75, '#3334AD', '', 10 );
|
||||
|
||||
//$g->attach_to_y_right_axis(2);
|
||||
|
||||
$g->x_axis_colour( '#909090', '#ADB5C7' );
|
||||
$g->y_axis_colour( '#909090', '#ADB5C7' );
|
||||
$g->y_right_axis_colour( '#909090' );
|
||||
|
||||
$g->set_x_labels( $cats );
|
||||
$g->set_x_label_style( 10, '#000000', 2 );
|
||||
|
||||
$g->set_y_max( $temp );
|
||||
$g->set_y_right_max( $temp);
|
||||
|
||||
$g->y_label_steps( 20 );
|
||||
//$g->y_right_label_steps( 5 );
|
||||
|
||||
$g->set_y_legend( '', 12, '#736AFF' );
|
||||
$g->set_y_right_legend( 'Free Ram (MB)' ,12 , '#164166' );
|
||||
|
||||
echo $g->render();
|
||||
|
||||
$exit_on_cleanup = true;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sugar_cleanup($exit_on_cleanup);
|
||||
?>
|
||||
106
modules/Home/Dashlets/MyEcmReportDashlets/salesYearChart.php
Executable file
106
modules/Home/Dashlets/MyEcmReportDashlets/salesYearChart.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
session_start();
|
||||
//error_reporting(0);
|
||||
include_once( '/var/www/html/e5crm/config.php');
|
||||
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||||
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||||
mysql_query("set names utf8");
|
||||
include_once( '/var/www/html/e5crm/include/ECM/open_flash_chart/ofc-library/open-flash-chart.php' );
|
||||
include_once("/var/www/html/e5crm/modules/EcmReports/cache.php");
|
||||
function repl($t){
|
||||
$a1=array("ą","ś","ę","ż","ź","ć","ń","ó","ł","Ą","Ś","Ę","Ż","Ź","Ć","Ń","Ó","Ł");
|
||||
$a2=array("a","s","e","z","z","c","n","o","l","A","S","E","Z","Z","C","N","O","L");
|
||||
return str_replace($a1,$a2,$t);
|
||||
}
|
||||
function getSalesYear($year){
|
||||
for($i=1;$i<=12;$i++){
|
||||
if($i<10)$n="0".$i;
|
||||
else $n=$i;
|
||||
$r=mysql_fetch_array(mysql_query("select if(e.currency_value>0 and e.currency_value is not null,sum(i.quantity*i.price*e.currency_value),sum(i.quantity*i.price)) as s,sum(i.quantity*i.purchase_price) as p from ecminvoiceouts as e inner join ecminvoiceoutitems as i on e.id=i.ecminvoiceout_id inner join ecmproducts as p on p.id=i.ecmproduct_id inner join ecmstockdocouts as w on w.id=e.wz_id inner join ecmproductcategories as pc on pc.id=p.product_category_id where e.register_date like '".$year."-".$n."%' and e.type!='correct' and e.status='accepted' and i.deleted='0' and e.deleted='0'"));
|
||||
$arr[$i]=$r;
|
||||
|
||||
$w=mysql_query("select i.price,i.quantity,i.ecminvoiceoutitem_id,e.currency_value from ecminvoiceouts as e inner join ecminvoiceoutitems as i on e.id=i.ecminvoiceout_id inner join ecmproducts as p on p.id=i.ecmproduct_id inner join ecmproductcategories as pc on pc.id=p.product_category_id where e.register_date like '".$year."-".$n."%' and e.type='correct' and e.status='accepted' and i.deleted='0' and e.deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
if(!$r['currency_value'])$r['currency_value']=1;
|
||||
$arr[$i]['s']+=$r['currency_value']*$r['price']*$r['quantity'];
|
||||
$rr=mysql_fetch_array(mysql_query("select price,quantity,purchase_price from ecminvoiceoutitems where id='".$r['ecminvoiceoutitem_id']."'"));
|
||||
$arr[$i]['s']-=$rr['price']*$rr['quantity'];
|
||||
$arr[$i]['p']+=$rr['purchase_price']*$r['quantity'];
|
||||
$arr[$i]['p']-=$rr['purchase_price']*$rr['quantity'];
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;;
|
||||
}
|
||||
|
||||
$year_month=$_SESSION['EcmReports_Dashlet_sales_year'];
|
||||
$e=explode("-",$_SESSION['EcmReports_Dashlet_sales_year']);
|
||||
$year=$e[0];
|
||||
$month=$e[1];
|
||||
|
||||
$months=array("January","February","March","April","May","June","July","August","September","October","November","Dezember");
|
||||
|
||||
for($i=1;$i<=12;$i++){
|
||||
$s=getSalesYear($year);
|
||||
if($temp<$s[$i]['s'])$temp=$s[$i]['s'];
|
||||
$arr_s[]=array(
|
||||
"name"=>repl($months[$i-1]),
|
||||
"value"=>$s[$i]['s'],
|
||||
);
|
||||
$arr_p[]=array(
|
||||
"name"=>repl($months[$i-1]),
|
||||
"value"=>$s[$i]['p'],
|
||||
);
|
||||
}
|
||||
for($i=0;$i<count($arr_s);$i++){
|
||||
$data_1[]=$arr_s[$i]['value'];
|
||||
$data_2[]=$arr_s[$i]['value']-$arr_p[$i]['value'];
|
||||
$cats[]=$arr_s[$i]['name']." ".$year;
|
||||
}
|
||||
|
||||
$g = new graph();
|
||||
|
||||
//$g->title( 'Sales: '.$year_month, '{font-size:20px; color: #000000; margin: 5px; background-color: #ffffff; padding:5px; padding-left: 20px; padding-right: 20px;}' );
|
||||
|
||||
$g->bg_colour = '#ffffff';
|
||||
//$g->bg_colour = '#000000';
|
||||
|
||||
$d1 = new bar( 75, '#D54C78' );
|
||||
$d2 = new bar( 75, '#3334AD' );
|
||||
$d1->key( 'Sales', 10 );
|
||||
$d2->key( 'PLN Margin', 10 );
|
||||
for($i=0;$i<count($data_1);$i++){
|
||||
$d1->add_data_tip($data_1[$i],"Sales: ".round($data_1[$i],2)."\nPLN Margin: ".round($data_2[$i],2)."\nMargin: ".@round(100*($data_2[$i])/$data_1[$i],2)."%");
|
||||
$d2->add_data_tip($data_2[$i],"Sales: ".round($data_1[$i],2)."\nPLN Margin: ".round($data_2[$i],2)."\nMargin: ".@round(100*($data_2[$i])/$data_1[$i],2)."%");
|
||||
}
|
||||
$g->data_sets[]=$d1;
|
||||
$g->data_sets[]=$d2;
|
||||
|
||||
$g->set_tool_tip( '#x_label#<br>#tip#<br>' );
|
||||
|
||||
//$g->set_data($data_1);
|
||||
//$g->bar( 75, '#D54C78', '', 10 );
|
||||
//$g->set_data($data_2);
|
||||
//$g->bar( 75, '#3334AD', '', 10 );
|
||||
|
||||
//$g->attach_to_y_right_axis(2);
|
||||
|
||||
$g->x_axis_colour( '#909090', '#ADB5C7' );
|
||||
$g->y_axis_colour( '#909090', '#ADB5C7' );
|
||||
$g->y_right_axis_colour( '#909090' );
|
||||
|
||||
$g->set_x_labels( $cats );
|
||||
$g->set_x_label_style( 10, '#000000', 2 );
|
||||
|
||||
$g->set_y_max( $temp );
|
||||
$g->set_y_right_max( $temp);
|
||||
|
||||
$g->y_label_steps( 20 );
|
||||
//$g->y_right_label_steps( 5 );
|
||||
|
||||
$g->set_y_legend( '', 12, '#736AFF' );
|
||||
$g->set_y_right_legend( '' ,12 , '#164166' );
|
||||
|
||||
echo $g->render();
|
||||
mysql_close($sql);
|
||||
?>
|
||||
106
modules/Home/Dashlets/MyEcmReportDashlets/stocksChart.php
Executable file
106
modules/Home/Dashlets/MyEcmReportDashlets/stocksChart.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once( '/var/www/html/e5crm/config.php');
|
||||
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||||
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||||
mysql_query("set names utf8");
|
||||
include_once( '/var/www/html/e5crm/include/ECM/open_flash_chart/ofc-library/open-flash-chart.php' );
|
||||
//include_once('/var/www/html/e5crm/modules/EcmCharts/chartHelper.php');
|
||||
include_once("/var/www/html/e5crm/modules/EcmReports/cache.php");
|
||||
function repl($t){
|
||||
$a1=array("ą","ś","ę","ż","ź","ć","ń","ó","ł","Ą","Ś","Ę","Ż","Ź","Ć","Ń","Ó","Ł");
|
||||
$a2=array("a","s","e","z","z","c","n","o","l","A","S","E","Z","Z","C","N","O","L");
|
||||
return str_replace($a1,$a2,$t);
|
||||
}
|
||||
|
||||
function getStock($category_id){
|
||||
$ww=mysql_query("select sum(h.value) as sum from ecmproducts_history_states as h inner join ecmproducts as p on p.id=h.ecmproduct_id where p.product_category_id='".$category_id."' and p.deleted='0' and h.ecmstock_id='c7afd71a-4c3a-bde4-138d-4acaee1644e4' and p.product_active='1'");
|
||||
$rr=mysql_fetch_array($ww);
|
||||
|
||||
$i=mysql_num_rows(mysql_query("select distinct date from ecmproducts_history_states"));
|
||||
$v=$rr['sum'];
|
||||
|
||||
return $v/$i;
|
||||
}
|
||||
if((int)date("m")==1){
|
||||
$mmm=12;
|
||||
$year=date("Y")-1;
|
||||
}
|
||||
else{
|
||||
$mmm=(int)date("m")-1;
|
||||
$year=date("Y");
|
||||
}
|
||||
$s=sum($year,"","","","");
|
||||
|
||||
//$w=mysql_query("select id,name from ecmproductcategories where deleted='0' and name!=''");
|
||||
//while($r=mysql_fetch_array($w)){
|
||||
//$ss=getSum($s,$year,"",$r['id']);
|
||||
//@$rot[$r['id']]=12*($ss['total_purchase']/$mmm)/getStock($r['id']);
|
||||
//if($tempr<$rot[$r['id']])$tempr=$rot[$r['id']];
|
||||
//}
|
||||
//echo '<pre>';
|
||||
//print_r($rot);
|
||||
//echo '</pre>';m
|
||||
$w=mysql_query("select p.id,p.product_category_id from ecmproducts as p inner join ecmproductcategories as c on c.id=p.product_category_id where p.deleted='0' order by c.name asc");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$qty=0;
|
||||
$ww=mysql_query("select quantity,price from ecmstockstates where deleted='0' and product_id='".$r['id']."'");
|
||||
while($rrr=mysql_fetch_array($ww)){
|
||||
$qty+=$rrr['quantity']*$rrr['price'];
|
||||
}
|
||||
$cats[$r['product_category_id']]+=$qty;
|
||||
if($cats[$r['product_category_id']]>$temp)$temp=$cats[$r['product_category_id']];
|
||||
}
|
||||
//$arr_s=multisort($arr_s,array(array('key'=>'value','sort'=>'desc')));
|
||||
$i=0;
|
||||
foreach($cats as $k=>$v){
|
||||
$r=mysql_fetch_array(mysql_query("select name from ecmproductcategories where id='".$k."' and deleted='0'"));
|
||||
if($r['name']){
|
||||
$data_1[$i]=$v;
|
||||
if($v)$data_2[$i]=$rot[$k];
|
||||
else $data_2[$i]=0;
|
||||
$cn[$i]=repl($r['name']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$g = new graph();
|
||||
|
||||
//$g->title( 'Stocks', '{font-size:20px; color: #000000; margin: 5px; background-color: #ffffff; padding:5px; padding-left: 20px; padding-right: 20px;}' );
|
||||
|
||||
$g->bg_colour = '#ffffff';
|
||||
|
||||
$d1 = new bar( 75, '#D54C78' );
|
||||
$d2 = new bar( 75, '#3334AD' );
|
||||
$d1->key( 'Inventory valueee', 10 );
|
||||
$d2->key( 'Rotation', 10 );
|
||||
for($i=0;$i<count($data_1);$i++){
|
||||
$d1->add_data_tip($data_1[$i],"Value: ".$data_1[$i]."\nRotation: ".round($data_2[$i],2));
|
||||
//$d2->add_data_tip($data_2[$i],"Value: ".$data_1[$i]."\nRotation: ".round($data_2[$i],2));
|
||||
}
|
||||
$g->data_sets[]=$d1;
|
||||
//$g->data_sets[]=$d2;
|
||||
|
||||
$g->set_tool_tip( '#x_label#<br>#tip#<br>' );
|
||||
|
||||
$g->attach_to_y_right_axis(2);
|
||||
|
||||
$g->x_axis_colour( '#909090', '#ADB5C7' );
|
||||
$g->y_axis_colour( '#909090', '#ADB5C7' );
|
||||
$g->y_right_axis_colour( '#909090' );
|
||||
|
||||
$g->set_x_labels( $cn );
|
||||
$g->set_x_label_style( 10, '#000000', 2 );
|
||||
|
||||
$g->set_y_max( $temp );
|
||||
$g->set_y_right_max( $tempr);
|
||||
|
||||
$g->y_label_steps( 20 );
|
||||
//$g->y_right_label_steps( 5 );
|
||||
|
||||
$g->set_y_legend( 'Inventory value', 12, '#D54C78' );
|
||||
$g->set_y_right_legend( 'Rotation' ,12 , '#3334AD' );
|
||||
|
||||
echo $g->render();
|
||||
mysql_close($sql);
|
||||
?>
|
||||
35
modules/Home/Dashlets/MyEcmReportDashlets/updateHistoryStates.php
Executable file
35
modules/Home/Dashlets/MyEcmReportDashlets/updateHistoryStates.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once( '/var/www/html/e5crm/vserver/e5crm.more7.com/www/config.php');
|
||||
include_once( '/var/www/html/e5crm/vserver/e5crm.more7.com/www/guid.php');
|
||||
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||||
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||||
mysql_query("set names utf8");
|
||||
//mysql_query("truncate table ecmproducts_history_states");
|
||||
$date="2010-08-02";
|
||||
$www=mysql_query("select id,name from ecmstocks where deleted='0' and no='1'");
|
||||
while($rrr=mysql_fetch_array($www)){
|
||||
$stock_id=$rrr['id'];
|
||||
$ww=mysql_query("select id,code from ecmproducts where deleted='0' and code!='' order by code");
|
||||
while($rr=mysql_fetch_array($ww)){
|
||||
$v=0;
|
||||
$product_id=$rr['id'];
|
||||
$w=mysql_query("select type,quantity,price from ecmstockoperations where stock_id='".$stock_id."' and product_id='".$product_id."' and deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
if($r['type']==0)$v+=$r['price']*$r['quantity'];
|
||||
else $v-=$r['price']*$r['quantity'];
|
||||
}
|
||||
if($v<0)$v=0;
|
||||
$set="date='".$date."',ecmproduct_id='".$product_id."',ecmstock_id='".$stock_id."',value='".$v."'";
|
||||
if(mysql_num_rows(mysql_query("select id from ecmproducts_history_states where ecmstock_id='".$stock_id."' and ecmproduct_id='".$product_id."' and date='".$date."'"))==0){
|
||||
mysql_query("insert into ecmproducts_history_states set id='".create_guid()."',".$set);
|
||||
}
|
||||
else{
|
||||
mysql_query("update ecmproducts_history_states set value='".$v."' where ecmstock_id='".$stock_id."' and ecmproduct_id='".$product_id."' and date='".$date."'");
|
||||
}
|
||||
echo $rr['code']." ".$v."\n";
|
||||
|
||||
}
|
||||
}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
86
modules/Home/Dashlets/MyEcmReportDashlets/updateRealisation.php
Executable file
86
modules/Home/Dashlets/MyEcmReportDashlets/updateRealisation.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once( '/var/www/html/e5crm/config.php');
|
||||
include_once( '/var/www/html/e5crm/guid.php');
|
||||
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||||
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||||
mysql_query("set names utf8");
|
||||
//mysql_query("truncate table ecmproductcategories_realisation");
|
||||
$mdate=date("Y-m");
|
||||
|
||||
//$w=mysql_query("select * from ecmsales where delivery_date like '".$mdate."%' and deleted='0' and status='s30' and type='sales_order'");
|
||||
$w=mysql_query("select e.* from ecmsales as e inner join ecmstockdocouts as w on w.so_id=e.id inner join ecminvoiceouts as inv on inv.wz_id=w.id where e.deleted='0' and inv.register_date like '".$mdate."%' and e.type='sales_order' and e.status!='s10'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$rsale=mysql_fetch_array(mysql_query("select sum(quantity*price) as qty from ecmsaleitems where ecmsale_id='".$r['id']."'"));
|
||||
$rwz=mysql_fetch_array(mysql_query("select id from ecmstockdocouts where so_id='".$r['id']."'"));
|
||||
$rwzi=mysql_fetch_array(mysql_query("select sum(quantity*selling_price) as qty from ecmstockdocoutitems where ecmstockdocout_id='".$rwz['id']."'"));
|
||||
$ecmstockdocout_id=$rwz['id'];
|
||||
if(mysql_num_rows(mysql_query("select id from ecminvoiceouts where wz_id='".$ecmstockdocout_id."' and deleted='0'"))==0)continue;
|
||||
if($ecmstockdocout_id){
|
||||
$sum_wz_qty+=$rwzi['qty'];
|
||||
$sum_sale_qty+=$rsale['qty'];
|
||||
}
|
||||
$qty_diff=$rwzi['qty']-$rsale['qty'];
|
||||
$diff_minus=$diff_plus=0;
|
||||
$rst=$rsale['qty'];
|
||||
$rwt=$rwzi['qty'];
|
||||
|
||||
if($ecmstockdocout_id){
|
||||
$wsale=mysql_query("select quantity,price,code,ecmproduct_id from ecmsaleitems where deleted='0' and ecmsale_id='".$r['id']."' order by code");
|
||||
while($rsale=mysql_fetch_array($wsale)){
|
||||
$qty=0;
|
||||
$wwz=mysql_query("select quantity,selling_price from ecmstockdocoutitems where deleted='0' and ecmproduct_id='".$rsale['ecmproduct_id']."' and ecmstockdocout_id='".$ecmstockdocout_id."'");
|
||||
while($rwz=mysql_fetch_array($wwz)){
|
||||
$qty+=$rwz['quantity']*$rwz['selling_price'];
|
||||
}
|
||||
|
||||
if($rsale['quantity']*$rsale['price']>$qty)$diff_minus+=$qty-$rsale['quantity']*$rsale['price'];
|
||||
if($rsale['quantity']*$rsale['price']<$qty)$diff_plus+=$qty-$rsale['quantity']*$rsale['price'];
|
||||
|
||||
$sum[$rsale['ecmproduct_id']]['wz']+=$qty;
|
||||
$sum[$rsale['ecmproduct_id']]['sale']+=$rsale['quantity']*$rsale['price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$percent=number_format((100*$sum_wz_qty/$sum_sale_qty),2,",",".")."%";
|
||||
|
||||
$rst=0;
|
||||
$rwt=0;
|
||||
$diff_plus=$diff_minus=0;
|
||||
$ww=mysql_query("select id,product_category_id from ecmproducts where deleted='0' order by code asc");
|
||||
while($rr=mysql_fetch_array($ww)){
|
||||
$k=$rr['id'];
|
||||
if(!$sum[$k])continue;
|
||||
$rst+=$sum[$k]['sale'];
|
||||
$rwt+=$sum[$k]['wz'];
|
||||
$cst[$rr['product_category_id']]+=$sum[$k]['sale'];
|
||||
$cwt[$rr['product_category_id']]+=$sum[$k]['wz'];
|
||||
if($sum[$k]['sale']>$sum[$k]['wz'])$diff_minus+=$sum[$k]['wz']-$sum[$k]['sale'];
|
||||
if($sum[$k]['sale']<$sum[$k]['wz'])$diff_plus+=$sum[$k]['wz']-$sum[$k]['sale'];
|
||||
}
|
||||
|
||||
$ww=mysql_query("select id,name from ecmproductcategories where deleted='0' order by name asc");
|
||||
while($rr=mysql_fetch_array($ww)){
|
||||
$k=$rr['id'];
|
||||
if($cwt[$k]<$cst[$k])$color="red";
|
||||
elseif($cwt[$k]>$cst[$k])$color="green";
|
||||
else $color="black";
|
||||
$set="date='".$mdate."',product_category_id='".$rr['id']."',value_sale='".$cst[$k]."',value_wz='".$cwt[$k]."'";
|
||||
if(mysql_num_rows(mysql_query("select id from ecmproductcategories_realisation where product_category_id='".$rr['id']."' and date like '".$mdate."%'"))==0){
|
||||
mysql_query("insert into ecmproductcategories_realisation set id='".create_guid()."',".$set);
|
||||
}
|
||||
else mysql_query("update ecmproductcategories_realisation set ".$set." where product_category_id='".$rr['id']."' and date like '".$mdate."%'");
|
||||
echo $rr['name']."\n";
|
||||
}
|
||||
$set="date='".$mdate."',product_category_id='diff_minus',value_sale='".$diff_minus."'";
|
||||
if(mysql_num_rows(mysql_query("select id from ecmproductcategories_realisation where product_category_id='diff_minus' and date like '".$mdate."%'"))==0){
|
||||
mysql_query("insert into ecmproductcategories_realisation set id='".create_guid()."',".$set);
|
||||
}
|
||||
else mysql_query("update ecmproductcategories_realisation set ".$set." where product_category_id='diff_minus' and date like '".$mdate."%'");
|
||||
$set="date='".$mdate."',product_category_id='diff_plus',value_sale='".$diff_plus."'";
|
||||
if(mysql_num_rows(mysql_query("select id from ecmproductcategories_realisation where product_category_id='diff_plus' and date like '".$mdate."%'"))==0){
|
||||
mysql_query("insert into ecmproductcategories_realisation set id='".create_guid()."',".$set);
|
||||
}
|
||||
else mysql_query("update ecmproductcategories_realisation set ".$set." where product_category_id='diff_plus' and date like '".$mdate."%'");
|
||||
mysql_close($sql);
|
||||
?>
|
||||
53
modules/Home/Dashlets/RSSDashlet/RSSDashlet.en_us.lang.php
Executable file
53
modules/Home/Dashlets/RSSDashlet/RSSDashlet.en_us.lang.php
Executable 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-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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['RSSDashlet'] = array('LBL_TITLE' => 'News Feed',
|
||||
'LBL_DESCRIPTION' => 'News Feed',
|
||||
'LBL_SAVING' => 'Parsing ...',
|
||||
'LBL_SAVED' => 'Complete',
|
||||
'LBL_AUTO_SCROLL' => 'Auto Scroll',
|
||||
'LBL_SCROLL_SPEED' => 'Scroll Speed (%)',
|
||||
'LBL_CONFIGURE_TITLE' => 'Title',
|
||||
'LBL_CONFIGURE_HEIGHT' => 'Height (1 - 300)',
|
||||
'LBL_CONFIGURE_RSSURL' => 'RSS Url',
|
||||
'LBL_DBLCLICK_HELP' => '',
|
||||
'ERR_LOADING_FEED' => 'Failed loading RSS Feed',
|
||||
);
|
||||
?>
|
||||
46
modules/Home/Dashlets/RSSDashlet/RSSDashlet.meta.php
Executable file
46
modules/Home/Dashlets/RSSDashlet/RSSDashlet.meta.php
Executable 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".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['RSSDashlet'] = array('title' => 'LBL_TITLE', // array index in language pack
|
||||
'description' => 'LBL_DESCRIPTION', // array index in language pack
|
||||
'category' => 'Web',
|
||||
'hidden' => true);
|
||||
?>
|
||||
175
modules/Home/Dashlets/RSSDashlet/RSSDashlet.php
Executable file
175
modules/Home/Dashlets/RSSDashlet/RSSDashlet.php
Executable file
@@ -0,0 +1,175 @@
|
||||
<?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/Sugar_Smarty.php');
|
||||
|
||||
class RSSDashlet extends Dashlet
|
||||
{
|
||||
protected $url = 'http://www.sugarcrm.com/crm/aggregator/rss/1';
|
||||
protected $height = '200'; // height of the pad
|
||||
protected $images_dir = 'modules/Home/Dashlets/RSSDashlet/images';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @global string current language
|
||||
* @param guid $id id for the current dashlet (assigned from Home module)
|
||||
* @param array $def options saved for this dashlet
|
||||
*/
|
||||
public function __construct($id, $def)
|
||||
{
|
||||
$this->loadLanguage('RSSDashlet', 'modules/Home/Dashlets/'); // load the language strings here
|
||||
|
||||
if(!empty($def['height'])) // set a default height if none is set
|
||||
$this->height = $def['height'];
|
||||
|
||||
if(!empty($def['url']))
|
||||
$this->url = $def['url'];
|
||||
|
||||
if(!empty($def['title']))
|
||||
$this->title = $def['title'];
|
||||
else
|
||||
$this->title = $this->dashletStrings['LBL_TITLE'];
|
||||
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = false; // dashlet has javascript attached to it
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the dashlet
|
||||
*
|
||||
* @return string html to display dashlet
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('saving', $this->dashletStrings['LBL_SAVING']);
|
||||
$ss->assign('saved', $this->dashletStrings['LBL_SAVED']);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('rss_output', $this->getRSSOutput($this->url));
|
||||
$str = $ss->fetch('modules/Home/Dashlets/RSSDashlet/RSSDashlet.tpl');
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $str; // return parent::display for title and such
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the configuration form for the dashlet
|
||||
*
|
||||
* @return string html to display form
|
||||
*/
|
||||
public function displayOptions() {
|
||||
global $app_strings, $sugar_version, $sugar_config;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('titleLbl', $this->dashletStrings['LBL_CONFIGURE_TITLE']);
|
||||
$ss->assign('heightLbl', $this->dashletStrings['LBL_CONFIGURE_HEIGHT']);
|
||||
$ss->assign('rssUrlLbl', $this->dashletStrings['LBL_CONFIGURE_RSSURL']);
|
||||
$ss->assign('saveLbl', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('url', $this->url);
|
||||
$ss->assign('id', $this->id);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Home/Dashlets/RSSDashlet/RSSDashletOptions.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* called to filter out $_REQUEST object when the user submits the configure dropdown
|
||||
*
|
||||
* @param array $req $_REQUEST
|
||||
* @return array filtered options to save
|
||||
*/
|
||||
public function saveOptions(
|
||||
array $req
|
||||
)
|
||||
{
|
||||
$options = array();
|
||||
$options['title'] = $req['title'];
|
||||
$options['url'] = $req['url'];
|
||||
$options['height'] = $req['height'];
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function getRSSOutput(
|
||||
$url
|
||||
)
|
||||
{
|
||||
// suppress XML errors
|
||||
libxml_use_internal_errors(true);
|
||||
$rssdoc = simplexml_load_file($url);
|
||||
// return back the error message if the loading wasn't successful
|
||||
if (!$rssdoc)
|
||||
return $this->dashletStrings['ERR_LOADING_FEED'];
|
||||
|
||||
$output = "<table class='edit view'>";
|
||||
if ( isset($rssdoc->channel) ) {
|
||||
foreach ( $rssdoc->channel as $channel ) {
|
||||
if ( isset($channel->item ) ) {
|
||||
foreach ( $channel->item as $item ) {
|
||||
$output .= <<<EOHTML
|
||||
<tr>
|
||||
<td>
|
||||
<h3><a href="{$item->link}" target="_child">{$item->title}</a></h3>
|
||||
{$item->description}
|
||||
</td>
|
||||
</tr>
|
||||
EOHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ( $rssdoc->entry as $entry ) {
|
||||
$output .= <<<EOHTML
|
||||
<tr>
|
||||
<td>
|
||||
<h3><a href="{$entry->link}" target="_child">{$entry->title}</a></h3>
|
||||
{$entry->summary}
|
||||
</td>
|
||||
</tr>
|
||||
EOHTML;
|
||||
}
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
43
modules/Home/Dashlets/RSSDashlet/RSSDashlet.tpl
Executable file
43
modules/Home/Dashlets/RSSDashlet/RSSDashlet.tpl
Executable file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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 id='rss_{$id}' style='overflow: auto; width: 100%; height: {$height}px; border: 1px #ddd solid'>
|
||||
{$rss_output}
|
||||
</div>
|
||||
76
modules/Home/Dashlets/RSSDashlet/RSSDashletOptions.tpl
Executable file
76
modules/Home/Dashlets/RSSDashlet/RSSDashletOptions.tpl
Executable file
@@ -0,0 +1,76 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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 style='width: 500px'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="edit view" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap scope='row'>{$titleLbl}</td>
|
||||
<td valign='top'>
|
||||
<input class="text" name="title" size='20' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap scope='row'>{$rssUrlLbl}</td>
|
||||
<td valign='top'>
|
||||
<input class="text" name="url" size='20' value='{$url}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap scope='row'>{$heightLbl}</td>
|
||||
<td valign='top'>
|
||||
<input class="text" name="height" size='3' value='{$height}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLbl}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
45
modules/Home/Dashlets/SugarNewsDashlet/SugarNewsDashlet.meta.php
Executable file
45
modules/Home/Dashlets/SugarNewsDashlet/SugarNewsDashlet.meta.php
Executable 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-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".
|
||||
********************************************************************************/
|
||||
|
||||
global $app_strings;
|
||||
|
||||
$dashletMeta['SugarNewsDashlet'] = array('module' => 'Home',
|
||||
'title' => translate('LBL_DASHLET_SUGAR_NEWS', 'Home'),
|
||||
'description' => 'A customizeable portal page',
|
||||
'icon' => 'themes/default/images/icon_SugarNews_32.gif',
|
||||
'category' => 'Tools',
|
||||
'hidden' => true);
|
||||
110
modules/Home/Dashlets/SugarNewsDashlet/SugarNewsDashlet.php
Executable file
110
modules/Home/Dashlets/SugarNewsDashlet/SugarNewsDashlet.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?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');
|
||||
|
||||
|
||||
class SugarNewsDashlet extends Dashlet {
|
||||
var $displayTpl = 'modules/Home/Dashlets/SugarNewsDashlet/display.tpl';
|
||||
var $configureTpl = 'modules/Home/Dashlets/SugarNewsDashlet/configure.tpl';
|
||||
var $defaultURL = 'http://apps.sugarcrm.com/dashlet/sugarcrm-news-dashlet.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
|
||||
var $url;
|
||||
|
||||
function SugarNewsDashlet($id, $options = null) {
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
|
||||
if(empty($options['title'])) {
|
||||
$this->title = translate('LBL_DASHLET_SUGAR_NEWS', 'Home');
|
||||
} else {
|
||||
$this->title = $options['title'];
|
||||
}
|
||||
if(empty($options['url'])) {
|
||||
$this->url = $this->defaultURL;
|
||||
} else {
|
||||
$this->url = $options['url'];
|
||||
}
|
||||
|
||||
if(empty($options['height']) || (int)$options['height'] < 1 ) {
|
||||
$this->height = 315;
|
||||
} else {
|
||||
$this->height = (int)$options['height'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $app_strings;
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('titleLBL', translate('LBL_DASHLET_OPT_TITLE', 'Home'));
|
||||
$ss->assign('urlLBL', translate('LBL_DASHLET_OPT_URL', 'Home'));
|
||||
$ss->assign('heightLBL', translate('LBL_DASHLET_OPT_HEIGHT', 'Home'));
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('url', $this->url);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('saveLBL', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
|
||||
return $ss->fetch('modules/Home/Dashlets/SugarNewsDashlet/configure.tpl');
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
|
||||
if ( isset($req['title']) ) {
|
||||
$options['title'] = $req['title'];
|
||||
}
|
||||
if ( isset($req['url']) ) {
|
||||
$options['url'] = $req['url'];
|
||||
}
|
||||
if ( isset($req['height']) ) {
|
||||
$options['height'] = (int)$req['height'];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function display(){
|
||||
$sugar_edition = 'COM';
|
||||
|
||||
$out_url = str_replace(
|
||||
array('@@LANG@@','@@VER@@','@@EDITION@@'),
|
||||
array($GLOBALS['current_language'],$GLOBALS['sugar_config']['sugar_version'],$sugar_edition),
|
||||
$this->url);
|
||||
return parent::display() . "<iframe class='teamNoticeBox' src='".$out_url."' height='".$this->height."px'></iframe>";
|
||||
}
|
||||
}
|
||||
73
modules/Home/Dashlets/SugarNewsDashlet/configure.tpl
Executable file
73
modules/Home/Dashlets/SugarNewsDashlet/configure.tpl
Executable file
@@ -0,0 +1,73 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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 style='width:100%'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$titleLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' maxlength='80' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$urlLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="url" size='20' maxlength='255' value='{$url}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$heightLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="height" size='20' maxlength='80' value='{$height}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLBL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
73
modules/Home/Dashlets/iFrameDashlet/configure.tpl
Executable file
73
modules/Home/Dashlets/iFrameDashlet/configure.tpl
Executable file
@@ -0,0 +1,73 @@
|
||||
{*
|
||||
|
||||
/*********************************************************************************
|
||||
* 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 style='width:100%'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$titleLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="title" size='20' maxlength='80' value='{$title}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$urlLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="url" size='20' maxlength='255' value='{$url}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$heightLBL}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input class="text" name="height" size='20' maxlength='80' value='{$height}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' class='button' value='{$saveLBL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
45
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.meta.php
Executable file
45
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.meta.php
Executable 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-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".
|
||||
********************************************************************************/
|
||||
|
||||
global $app_strings;
|
||||
|
||||
$dashletMeta['iFrameDashlet'] = array('module' => 'Home',
|
||||
'title' => translate('LBL_DASHLET_TITLE', 'Home'),
|
||||
'description' => 'A customizeable portal page',
|
||||
'icon' => 'themes/default/images/icon_iFrames_32.gif',
|
||||
'category' => 'Web',
|
||||
'hidden' => true);
|
||||
124
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.php
Executable file
124
modules/Home/Dashlets/iFrameDashlet/iFrameDashlet.php
Executable file
@@ -0,0 +1,124 @@
|
||||
<?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');
|
||||
|
||||
|
||||
class iFrameDashlet extends Dashlet {
|
||||
var $displayTpl = 'modules/Home/Dashlets/iFrameDashlet/display.tpl';
|
||||
var $configureTpl = 'modules/Home/Dashlets/iFrameDashlet/configure.tpl';
|
||||
var $defaultURL = 'http://apps.sugarcrm.com/dashlet/sugarcrm-news-dashlet.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
|
||||
var $url;
|
||||
protected $allowed_schemes = array("http", "https");
|
||||
|
||||
function iFrameDashlet($id, $options = null) {
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
|
||||
if(empty($options['title'])) {
|
||||
$this->title = translate('LBL_DASHLET_TITLE', 'Home');
|
||||
$this->title = translate('LBL_DASHLET_DISCOVER_SUGAR_PRO', 'Home');
|
||||
} else {
|
||||
$this->title = $options['title'];
|
||||
}
|
||||
if(empty($options['url'])) {
|
||||
$this->url = $this->defaultURL;
|
||||
$this->url = 'http://apps.sugarcrm.com/dashlet/go-pro.html?lang=@@LANG@@&edition=@@EDITION@@&ver=@@VER@@';
|
||||
} else {
|
||||
$this->url = $options['url'];
|
||||
}
|
||||
|
||||
$this->checkURL();
|
||||
|
||||
if(empty($options['height']) || (int)$options['height'] < 1 ) {
|
||||
$this->height = 315;
|
||||
} else {
|
||||
$this->height = (int)$options['height'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function checkURL()
|
||||
{
|
||||
$scheme = parse_url($this->url, PHP_URL_SCHEME);
|
||||
if(!in_array($scheme, $this->allowed_schemes)) {
|
||||
$this->url = 'about:blank';
|
||||
}
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $app_strings;
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('titleLBL', translate('LBL_DASHLET_OPT_TITLE', 'Home'));
|
||||
$ss->assign('urlLBL', translate('LBL_DASHLET_OPT_URL', 'Home'));
|
||||
$ss->assign('heightLBL', translate('LBL_DASHLET_OPT_HEIGHT', 'Home'));
|
||||
$ss->assign('title', $this->title);
|
||||
$ss->assign('url', $this->url);
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('height', $this->height);
|
||||
$ss->assign('saveLBL', $app_strings['LBL_SAVE_BUTTON_LABEL']);
|
||||
|
||||
return $ss->fetch('modules/Home/Dashlets/iFrameDashlet/configure.tpl');
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
|
||||
if ( isset($req['title']) ) {
|
||||
$options['title'] = $req['title'];
|
||||
}
|
||||
if ( isset($req['url']) ) {
|
||||
$options['url'] = $req['url'];
|
||||
}
|
||||
if ( isset($req['height']) ) {
|
||||
$options['height'] = (int)$req['height'];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function display(){
|
||||
|
||||
$sugar_edition = 'COM';
|
||||
|
||||
$out_url = str_replace(
|
||||
array('@@LANG@@','@@VER@@','@@EDITION@@'),
|
||||
array($GLOBALS['current_language'],$GLOBALS['sugar_config']['sugar_version'],$sugar_edition),
|
||||
$this->url);
|
||||
return parent::display() . "<iframe class='teamNoticeBox' src='".$out_url."' height='".$this->height."px'></iframe>";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user