2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
38 * Created on Jul 18, 2007
40 * To change the template for this generated file go to
41 * Window - Preferences - PHPeclipse - PHP - Code Templates
43 function get_body(&$ss, $vardef){
46 if (isset ($vardef['type']) && $vardef['type'] == 'multienum')
49 $selected_options = "";
50 if ($multi && !empty($vardef['default'])) {
51 $selected_options = unencodeMultienum( $vardef['default']);
52 } else if (isset($vardef['default'])){
53 $selected_options = $vardef['default'];
56 $edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
58 if(!empty($_REQUEST['type']) && $_REQUEST['type'] == 'radioenum'){
59 $edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_RADIO_FIELDS'];
62 $package_strings = array();
63 if(!empty($_REQUEST['view_package'])){
64 $view_package = $_REQUEST['view_package'];
65 if($view_package != 'studio') {
66 require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
67 $mb = new ModuleBuilder();
68 $module =& $mb->getPackageModule($view_package, $_REQUEST['view_module']);
69 $lang = $GLOBALS['current_language'];
70 //require_once($package->getPackageDir()."/include/language/$lang.lang.php");
71 $module->mblanguage->generateAppStrings(false);
72 $package_strings = $module->mblanguage->appListStrings[$lang.'.lang.php'];
76 global $app_list_strings;
77 $my_list_strings = $app_list_strings;
78 $my_list_strings = array_merge($my_list_strings, $package_strings);
79 foreach($my_list_strings as $key=>$value){
80 if(!is_array($value)){
81 unset($my_list_strings[$key]);
84 $dropdowns = array_keys($my_list_strings);
86 $default_dropdowns = array();
87 if(!empty($vardef['options']) && !empty($my_list_strings[$vardef['options']])){
88 $default_dropdowns = $my_list_strings[$vardef['options']];
90 //since we do not have a default value then we should assign the first one.
92 $default_dropdowns = $my_list_strings[$key];
95 $selected_dropdown = '';
96 if(!empty($vardef['options'])){
97 $selected_dropdown = $vardef['options'];
101 if(!empty($_REQUEST['refresh_dropdown']))
104 $ss->assign('dropdowns', $dropdowns);
105 $ss->assign('default_dropdowns', $default_dropdowns);
106 $ss->assign('selected_dropdown', $selected_dropdown);
107 $ss->assign('show', $show);
108 $ss->assign('selected_options', $selected_options);
109 $ss->assign('multi', isset($multi) ? $multi: false);
110 $ss->assign('radio', isset($radio) ? $radio: false);
111 $ss->assign('dropdown_name',(!empty($vardef['options']) ? $vardef['options'] : ''));
113 require_once('include/JSON.php');
114 $json = new JSON(JSON_LOOSE_TYPE);
115 $ss->assign('app_list_strings', "''");
116 return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/enum.tpl');