Code

< 40 %
40-60 %
> 60 %
1
<?php
2
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
/*********************************************************************************
4
 * SugarCRM Community Edition is a customer relationship management program developed by
5
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6
7
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
8
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
9
 *
10
 * This program is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU Affero General Public License version 3 as published by the
12
 * Free Software Foundation with the addition of the following permission added
13
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
14
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
15
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
16
 *
17
 * This program is distributed in the hope that it will be useful, but WITHOUT
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
20
 * details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License along with
23
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
24
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25
 * 02110-1301 USA.
26
 *
27
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
28
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
29
 *
30
 * The interactive user interfaces in modified source and object code versions
31
 * of this program must display Appropriate Legal Notices, as required under
32
 * Section 5 of the GNU Affero General Public License version 3.
33
 *
34
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
35
 * these Appropriate Legal Notices must retain the display of the "Powered by
36
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
37
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
38
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39
 ********************************************************************************/
40
41
 //Request object must have these property values:
42
 //		Module: module name, this module should have a file called TreeData.php
43
 //		Function: name of the function to be called in TreeData.php, the function will be called statically.
44
 //		PARAM prefixed properties: array of these property/values will be passed to the function as parameter.
45
46
$ret=array();
47
$params1=array();
48
$nodes=array();
49
50
$GLOBALS['log']->debug("TreeData:session started");
51
$current_language = $GLOBALS['current_language'];
52
53
//process request parameters. consider following parameters.
54
//function, and all parameters prefixed with PARAM.
55
//PARAMT_ are tree level parameters.
56
//PARAMN_ are node level parameters.
57
//module  name and function name parameters are the only ones consumed
58
//by this file..
59
foreach ($_REQUEST as $key=>$value) {
60
61
	switch ($key) {
62
	
63
		case "function":
64
		case "call_back_function":
65
			$func_name=$value;
66
			$params1['TREE']['function']=$value;
67
			break;
68
			
69
		default:
70
			$pssplit=explode('_',$key);
71
			if ($pssplit[0] =='PARAMT') {
72
				unset($pssplit[0]);
73
				$params1['TREE'][implode('_',$pssplit)]=$value;				
74
			} else {
75
				if ($pssplit[0] =='PARAMN') {
76
					$depth=$pssplit[count($pssplit)-1];
77
					//parmeter is surrounded  by PARAMN_ and depth info.
78
					unset($pssplit[count($pssplit)-1]);unset($pssplit[0]);	
79
					$params1['NODES'][$depth][implode('_',$pssplit)]=$value;
80
				} else {
81
					if ($key=='module') {
82
						if (!isset($params1['TREE']['module'])) {
83
							$params1['TREE'][$key]=$value;	
84
						}
85
					} else { 	
86
						$params1['REQUEST'][$key]=$value;
87
					}					
88
				}
89
			}
90
	}	
91
}	
92
$modulename=$params1['TREE']['module']; ///module is a required parameter for the tree.
93
require('include/modules.php');
94
if (!empty($modulename) && !empty($func_name) && isset($beanList[$modulename]) ) {
95
    require_once('modules/'.$modulename.'/TreeData.php');
96
    $TreeDataFunctions = array(
97
        'ProductTemplates' => array('get_node_data'=>'','get_categories_and_products'=>''),
98
        'ProductCategories' => array('get_node_data'=>'','get_product_categories'=>''),
99
        'KBTags' => array(
100
            'get_node_data'=>'',
101
            'get_tags_nodes'=>'',
102
            'get_tags_nodes_cached'=>'',
103
            'childNodes'=>'',
104
            'get_searched_tags_nodes'=>'',
105
            'find_peers'=>'',
106
            'getRootNode'=>'',
107
            'getParentNode'=>'',
108
            'get_tags_modal_nodes'=>'',
109
            'get_admin_browse_articles'=>'',
110
            'tagged_documents_count'=>'',
111
            'tag_count'=>'',
112
            'get_browse_documents'=>'',
113
            'get_tag_nodes_for_browsing'=>'',
114
            'create_browse_node'=>'',
115
            'untagged_documents_count'=>'',
116
            'check_tag_child_tags_for_articles'=>'',
117
            'childTagsHaveArticles'=>'',
118
            ),
119
        'KBDocuments' => array(
120
            'get_node_data'=>'',
121
            'get_category_nodes'=>'',
122
            'get_documents'=>'',
123
            ),
124
        'Forecasts' => array(
125
            'get_node_data'=>'',
126
            'get_worksheet'=>'',
127
            'commit_forecast'=>'',
128
            'save_worksheet'=>'',
129
            'list_nav'=>'',
130
            'reset_worksheet'=>'',
131
            'get_chart'=>'',
132
            ),
133
        'Documents' => array(
134
            'get_node_data'=>'',
135
            'get_category_nodes'=>'',
136
            'get_documents'=>'',
137
            ),
138
        );
139
        
140
	if (isset($TreeDataFunctions[$modulename][$func_name])) {
141
		$ret=call_user_func($func_name,$params1);
142
    }
143
}
144
145
if (!empty($ret)) {
146
	echo $ret;
147
}
148
149
?>
150