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

50
include/templates/Template.php Executable file
View File

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

View File

@@ -0,0 +1,281 @@
<?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/templates/Template.php");
class TemplateDragDropChooser extends Template {
var $args;
function TemplateDragDropChooser() {
}
/*
* This function creates the html and uses the args parameter to call the class file
* ideally, you would want to call the displayScriptTags() function,
* followed by the displayDefinitionScript();
* and lastly call the display function
*/
function display(){
/* valid entries for expected arguments array are as follow:
* args['left_header'] = value of left table header
* args['mid_header'] = value of middle table header
* args['right_header'] = value of right table header
* args['left_data'] = array to use in left data.
* args['mid_data'] = array to use in middle data.
* args['right_data'] =array to use in right data.
* args['title'] = title (if any) to be used.
* args['classname'] = name to be used as class. This helps when defining multiple templates on one screen.
* args['left_div_name'] = Name to be used for left div (should be unique)
* args['mid_div_name'] = Name to be used for middle div (should be unique)
* args['right_div_name'] = Name to be used for right div (should be unique)
* args['gridcount'] = Number of grids to show. Acceptable Values are 'one','two' and 'three'
* The string is converted to numeric values, so you could also set these directly
* The values are Zero Based, so to display one column, set to '0'
* To display two columns set to '1', to display three columns set to '2'.
* $this->args['return_array']= if this is set to true, then 'display()' function returns html and javascript
* in array format. This will allow granular control of html so that you can
* seperate the tables and customize the grid
*/
//convert values for gridcount in case they are in string form
if($this->args['gridcount'] == 'one'){
$this->args['gridcount'] = 0;
}elseif($this->args['gridcount'] == 'two'){
$this->args['gridcount'] = 1;
}elseif(
$this->args['gridcount'] == 'three'){$this->args['gridcount'] = 2;
}
if(!isset($this->args['classname']) || empty($this->args['classname'])){
$this->args['classname'] = 'DragDropGrid';
}
$json = getJSONobj();
//use Json to encode the arrays of data, for passing to javascript.
//we will always display at least one column, so set left column
$this->args['left_data'][] = array(' ', ' ');
$data0_enc = $json->encode($this->args['left_data']);
$left_div_name = $this->args['left_div_name'];
//if count is set to 1, then we are displaying two columns, set the 2 column variables
if($this->args['gridcount']==1){
$this->args['right_data'][] = array(' ', ' ');
$data1_enc = $json->encode($this->args['right_data']);
$right_div_name = $this->args['right_div_name'];
}
//if count is set to 2, then we are displaying three columns, set the 3 column variables
if($this->args['gridcount']==2){
$this->args['mid_data'][] = array(' ', ' ');
$data1_enc = $json->encode($this->args['mid_data']);
$mid_div_name = $this->args['mid_div_name'];
$this->args['right_data'][] = array(' ', ' ');
$data2_enc = $json->encode($this->args['right_data']);
$right_div_name = $this->args['right_div_name'];
}
$html_str_arr = array();
//create the table, with the divs that will get populated. Populate both the string and array version
$html_str = "<div id='" . $this->args['classname'] . "'><table align='left' width='180px' border='1' cellspacing='0' cellpadding='0'>";
$html_str_arr['begin'] = $html_str;
$html_str .= "<tr><td width='180px' class='tabDetailViewDF'><div id='$left_div_name' class='ygrid-mso' style='width:180px;height:270px;overflow:hidden;'> </div></td>";
$html_str_arr['left'] = "<tr><td width='180px' class='tabDetailViewDF'><div id='$left_div_name' class='ygrid-mso' style='width:180px;height:270px;overflow:hidden;'> </div></td>";
//set the middle column only if we are displaying 3 columns
if($this->args['gridcount']==2){
$html_str .= "<td width='180px' class='tabDetailViewDF'><div id='$mid_div_name' class='ygrid-mso' style='width:180px;height:270px;overflow:hidden;'> </div></td>";
$html_str_arr['middle'] = "<td width='180px' class='tabDetailViewDF'><div id='$mid_div_name' class='ygrid-mso' style='width:180px;height:270px;overflow:hidden;'> </div></td>";
}
//set the right column if we are not in 1 column only mode
if($this->args['gridcount']>0){
$html_str .= "<td width='180px' class='tabDetailViewDF'><div id='$right_div_name' class='ygrid-mso' style='width:180px;height:270px;overflow:hidden;'> </div></td>";
$html_str_arr['right'] = "<td width='180px' class='tabDetailViewDF'><div id='$right_div_name' class='ygrid-mso' style='width:180px;height:270px;overflow:hidden;'> </div></td>";
}
$html_str .= "</tr></table></div>";
$html_str_arr['end'] = "</tr></table></div>";
//create the needed javascript to set the values and invoke listener
$j_str = "<script> ";
$j_str .= $this->args['classname'] . ".rows0 = {$data0_enc};\n";
$j_str .= $this->args['classname'] . ".hdr0 = '{$this->args['left_header']}';\n";
if($this->args['gridcount']==1){
$j_str .= $this->args['classname'] . ".rows1 = {$data1_enc};\n";
$j_str .= $this->args['classname'] . ".hdr1 = '{$this->args['right_header']}';\n";
}
if($this->args['gridcount']==2){
$j_str .= $this->args['classname'] . ".rows1 = {$data1_enc}; \n";
$j_str .= $this->args['classname'] . ".rows2 = {$data2_enc}; \n";
$j_str .= $this->args['classname'] . ".hdr1 = '{$this->args['mid_header']}'; \n";
$j_str .= $this->args['classname'] . ".hdr2 = '{$this->args['right_header']}'; \n";
}
$divs_str = "'".$left_div_name ."'";
if($this->args['gridcount']==2){$divs_str .= ", '".$mid_div_name."'";}
if($this->args['gridcount']>0) {$divs_str .= ", '".$right_div_name."'";}
$j_str .= $this->args['classname'] . ".divs = [$divs_str]; ";
$j_str .= "YAHOO.util.Event.on(window, 'load', " . $this->args['classname'] . ".init); ";
$j_str .= "</script> ";
//return display string
$str = $j_str . ' ' . $html_str;
$html_str_arr['script'] = $j_str;
if(isset($this->args['return_array']) && $this->args['return_array']){
return $html_str_arr;
}else{
return $str;
}
}
/*
* This script is the javascript class definition for the template drag drop object. This
* makes use of the args['classname'] parameter to name the class and to prefix variables with. This is done
* dynamically so that multiple template dragdrop objects can be defined on the same page if needed
* without having the variables mix up as you drag rows around.
*/
function displayDefinitionScript() {
//create some defaults in case arguments are missing
//convert values for gridcount in case they are in string form
if(!isset($this->args['gridcount']) || empty($this->args['gridcount']) || $this->args['gridcount'] == 'one'){
$this->args['gridcount'] = 0;
}elseif($this->args['gridcount'] == 'two'){
$this->args['gridcount'] = 1;
}elseif(
$this->args['gridcount'] == 'three'){$this->args['gridcount'] = 2;
}
//default class name
if(!isset($this->args['classname']) || empty($this->args['classname'])){
$this->args['classname'] = 'DragDropGrid';
}
//default columns to one if the value is set to anything other than the expected 0,1 or 2
if(($this->args['gridcount'] != 0) && ($this->args['gridcount'] != 1) && ($this->args['gridcount'] != 2)){
$this->args['gridcount'] = 0;
}
//default div names
if(!isset($this->args['left_div_name']) || empty($this->args['left_div_name'])){
$this->args['left_div_name'] = 'left';
}
if(!isset($this->args['mid_div_name']) || empty($this->args['mid_div_name'])){
$this->args['mid_div_name'] = 'mid';
}
if(!isset($this->args['right_div_name']) || empty($this->args['right_div_name'])){
$this->args['right_div_name'] = 'right';
}
//create javascript that defines the javascript class for this instance
//start by defining the variables that the grids will be referenced by
$j_str = "
<script>
var container = new YAHOO.util.Element('grid_Div').addClass('yui-skin-sam');
var " . $this->args['classname'] . "_grid2, " . $this->args['classname'] . "_grid1, " . $this->args['classname'] . "_grid0;
var " . $this->args['classname'] . "_sugar_grid2, " . $this->args['classname'] . "_sugar_grid1, " . $this->args['classname'] . "_sugar_grid0;
/*
* This invokes the grid objects
*/
" . $this->args['classname'] . " = {" ;
$j_str .= "
rows0 : [],
rows1 : [],
rows2 : [],
hdr0 : [],
hdr1 : [],
hdr2 : [],
divs : [],
formatter : function(elCell, oRecord, oColumn, oData) {
if (oRecord.getData()[0] == ' ' ) {
return;
}
elCell.innerHTML = '<span id=\"' + oRecord.getData()[1] + '_row\">' + oRecord.getData()[0] + '</span>';
},
init : function(){
";
$count = 0;
while($count<$this->args['gridcount']+1){
$j_str .= "
{$this->args['classname']}_grid{$count}source = new YAHOO.util.LocalDataSource({$this->args['classname']}.rows$count);
{$this->args['classname']}_grid{$count}cols = [
{key:'label', label:{$this->args['classname']}.hdr$count, formatter: {$this->args['classname']}.formatter}
];
{$this->args['classname']}_grid$count = new YAHOO.SUGAR.DragDropTable(
{$this->args['classname']}.divs[$count], {$this->args['classname']}_grid{$count}cols, {$this->args['classname']}_grid{$count}source,
{
trackMouseOver: false,
height: '250px'
}
);";
$j_str .= "
{$this->args['classname']}_sugar_grid$count = {$this->args['classname']}_grid$count;";
$count = $count+1;
}
$j_str.="
}
};
</script>
";
//all done, return final script
return $j_str;
}
/*
* this function returns the src style sheet and script tags that need to be included
* for the template chooser to work
*/
function displayScriptTags() {
global $sugar_version, $sugar_config;
$j_str = "
<link rel='stylesheet' type='text/css' href='include/javascript/yui/build/datatable/assets/skins/sam/datatable.css'/>
<script type='text/javascript' src='include/javascript/sugar_grp_yui_widgets.js'></script>";
return $j_str;
}
}
?>

View File

@@ -0,0 +1,174 @@
<?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".
********************************************************************************/
$js_loaded = false;
require_once("include/templates/Template.php");
class TemplateGroupChooser extends Template {
var $args;
var $js_loaded = false;
var $display_hide_tabs = true;
var $display_third_tabs = false;
function TemplateGroupChooser() {
}
function display() {
global $mod_strings, $js_loaded;
$left_size = (empty($this->args['left_size']) ? '10' : $this->args['left_size']);
$right_size = (empty($this->args['right_size']) ? '10' : $this->args['right_size']);
$third_size = (empty($this->args['third_size']) ? '10' : $this->args['third_size']);
$max_left = (empty($this->args['max_left']) ? '' : $this->args['max_left']);
$alt_tip = (empty($this->args['alt_tip']) ? '' : $this->args['alt_tip']);
$str = '';
if($js_loaded == false) {
// $this->template_groups_chooser_js();
$js_loaded = true;
}
if(!isset($this->args['display'])) {
$table_style = "";
}
else {
$table_style = "display: ".$this->args['display'];
}
$str .= "<div id=\"{$this->args['id']}\" style=\"{$table_style}\">";
if(!empty($this->args['title'])) $str .= "<h4>{$this->args['title']}</h4>";
$str .= <<<EOQ
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>&nbsp;</td>
<td scope="row" id="chooser_{$this->args['left_name']}_text" align="center"><nobr>{$this->args['left_label']}</nobr></td>
EOQ;
if($this->display_hide_tabs == true) {
$str .= <<<EOQ
<td>&nbsp;</td>
<td scope="row" id="chooser_{$this->args['right_name']}" align="center"><nobr>{$this->args['right_label']}</nobr></td>
EOQ;
}
if($this->display_third_tabs == true) {
$str .= <<<EOQ
<td>&nbsp;</td>
<td>&nbsp;</td>
<td scope="row" id="chooser_{$this->args['third_name']}" align="center"><nobr>{$this->args['third_label']}</nobr></td>
EOQ;
}
$str .= '<td>&nbsp;</td></tr><tr><td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
if(!isset($this->args['disable'])) {
$str .= "<a onclick=\"return SUGAR.tabChooser.up('{$this->args['left_name']}','{$this->args['left_name']}','{$this->args['right_name']}');\">" . SugarThemeRegistry::current()->getImage('uparrow_big','border="0" style="margin-bottom: 1px;" alt="'.$alt_tip.'"') . "</a><br>
<a onclick=\"return SUGAR.tabChooser.down('{$this->args['left_name']}','{$this->args['left_name']}','{$this->args['right_name']}');\">" . SugarThemeRegistry::current()->getImage('downarrow_big','border="0" style="margin-top: 1px;" alt="'.$alt_tip.'"') . "</a>";
}
$str .= <<<EOQ
</td>
<td align="center">
<table border="0" cellspacing=0 cellpadding="0" align="center">
<tr>
<td id="{$this->args['left_name']}_td" align="center">
<select id="{$this->args['left_name']}" name="{$this->args['left_name']}[]" size=
EOQ;
$str .= '"' . (empty($this->args['left_size']) ? '10' : $this->args['left_size']) . '" multiple="multiple" ' . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">';
foreach($this->args['values_array'][0] as $key=>$value) {
$str .= "<option value='{$key}'>{$value}</option>";
}
$str .= "</select></td>
</tr>
</table>
</td>";
if ($this->display_hide_tabs == true) {
$str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
if(!isset($this->args['disable'])) {
$str .= "<a onclick=\"return SUGAR.tabChooser.right_to_left('{$this->args['left_name']}','{$this->args['right_name']}', '{$left_size}', '{$right_size}', '{$max_left}');\">" . SugarThemeRegistry::current()->getImage('leftarrow_big','border="0" style="margin-right: 1px;" alt="'.$alt_tip.'"') . "</a><a onclick=\"return SUGAR.tabChooser.left_to_right('{$this->args['left_name']}','{$this->args['right_name']}', '{$left_size}', '{$right_size}');\">" . SugarThemeRegistry::current()->getImage('rightarrow_big','border="0" style="margin-left: 1px;" alt="'.$alt_tip.'"') . "</a>";
}
$str .= "</td>
<td id=\"{$this->args['right_name']}_td\" align=\"center\">
<select id=\"{$this->args['right_name']}\" name=\"{$this->args['right_name']}[]\" size=\"" . (empty($this->args['right_size']) ? '10' : $this->args['right_size']) . "\" multiple=\"multiple\" " . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">';
foreach($this->args['values_array'][1] as $key=>$value) {
$str .= "<option value=\"{$key}\">{$value}</option>";
}
$str .= "</select></td><td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">"
. "<script>var object_refs = new Object();object_refs['{$this->args['right_name']}'] = document.getElementById('{$this->args['right_name']}');</script>";
}
if ($this->display_third_tabs == true) {
$str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
if(!isset($this->args['disable'])) {
$str .= "<a onclick=\"return SUGAR.tabChooser.right_to_left('{$this->args['right_name']}','{$this->args['third_name']}', '{$right_size}', '{$third_size}');\">" . SugarThemeRegistry::current()->getImage('leftarrow_big','border="0" style="margin-right: 1px;" alt="'.$alt_tip.'"') . "</a><a onclick=\"return SUGAR.tabChooser.left_to_right('{$this->args['right_name']}','{$this->args['third_name']}', '{$right_size}', '{$third_size}');\">" . SugarThemeRegistry::current()->getImage('rightarrow_big','border="0" style="margin-left: 1px;" alt="'.$alt_tip.'"') . "</a>";
}
$str .= "</td>
<td id=\"{$this->args['third_name']}_td\" align=\"center\">
<select id=\"{$this->args['third_name']}\" name=\"{$this->args['third_name']}[]\" size=\"" . (empty($this->args['third_size']) ? '10' : $this->args['third_size']) . "\" multiple=\"multiple\" " . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">';
foreach($this->args['values_array'][2] as $key=>$value) {
$str .= "<option value=\"{$key}\">{$value}</option>";
}
$str .= "</select>
<script>
object_refs['{$this->args['third_name']}'] = document.getElementById('{$this->args['third_name']}');
</script>
<td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">
</td>";
}
$str .= "<script>
object_refs['{$this->args['left_name']}'] = document.getElementById('{$this->args['left_name']}');
</script></tr>
</table>";
return $str;
}
/*
* All Moved to sugar_3.js in class tabChooser;
* Please follow style that Dashlet configuration is done.
*/
function template_groups_chooser_js() {
//return '<script>var object_refs = new Object();</script>';
}
}
?>