]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Studio/DropDowns/EditView.php
Release 6.4.0
[Github/sugarcrm.git] / modules / Studio / DropDowns / EditView.php
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-2011 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38
39
40
41 global $app_list_strings, $app_strings, $mod_strings;
42
43 require_once('modules/Studio/DropDowns/DropDownHelper.php');
44 require_once('modules/Studio/parsers/StudioParser.php');
45 $dh = new DropDownHelper();
46 $dh->getDropDownModules();
47 $smarty = new Sugar_Smarty();
48 $smarty->assign('MOD', $GLOBALS['mod_strings']);
49 $title=getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_RENAME_TABS']), false);
50 $smarty->assign('title', $title);
51 $selected_lang = (!empty($_REQUEST['dropdown_lang'])?$_REQUEST['dropdown_lang']:$_SESSION['authenticated_user_language']);
52 if(empty($selected_lang)){
53
54     $selected_lang = $GLOBALS['sugar_config']['default_language'];
55 }
56 if($selected_lang == $GLOBALS['current_language']){
57         $my_list_strings = $GLOBALS['app_list_strings'];
58 }else{
59         $my_list_strings = return_app_list_strings_language($selected_lang);
60 }
61 foreach($my_list_strings as $key=>$value){
62         if(!is_array($value)){
63                 unset($my_list_strings[$key]);
64         }
65 }
66 $modules = array_keys($dh->modules);
67 $dropdown_modules = array(''=>$GLOBALS['mod_strings']['LBL_DD_ALL']);
68 foreach($modules as $module){
69     $dropdown_modules[$module] = (!empty($app_list_strings['moduleList'][$module]))?$app_list_strings['moduleList'][$module]: $module;
70 }
71 $smarty->assign('dropdown_modules',$dropdown_modules);
72 if(!empty($_REQUEST['dropdown_module']) &&  !empty($dropdown_modules[$_REQUEST['dropdown_module']]) ){
73
74     $smarty->assign('dropdown_module',$_REQUEST['dropdown_module']);
75     $dropdowns = (!empty($dh->modules[$_REQUEST['dropdown_module']]))?$dh->modules[$_REQUEST['dropdown_module']]: array();
76     foreach($dropdowns as $ok=>$dk){
77         if(!isset($my_list_strings[$dk]) || !is_array($my_list_strings[$dk])){
78             unset($dropdowns[$ok]);
79
80         }
81
82     }
83
84
85 }else{
86      if(!empty($_REQUEST['dropdown_module'])){
87         $smarty->assign('error', 'Module does not have any known dropdowns');
88     }
89     $dropdowns = array_keys($my_list_strings);
90 }
91 asort($dropdowns);
92 if(!empty($_REQUEST['newDropdown'])){
93     $smarty->assign('newDropDown',true);
94 }else{
95 $keys = array_keys($dropdowns);
96 $first_string = $dropdowns[$keys[0]];
97 $smarty->assign('dropdowns',$dropdowns);
98 if(empty($_REQUEST['dropdown_name']) || !in_array($_REQUEST['dropdown_name'], $dropdowns)){
99     $_REQUEST['dropdown_name'] = $first_string;
100 }
101 $selected_dropdown = $my_list_strings[$_REQUEST['dropdown_name']];
102
103 foreach($selected_dropdown as $key=>$value){
104    if($selected_lang != $_SESSION['authenticated_user_language'] && !empty($app_list_strings[$_REQUEST['dropdown_name']]) && isset($app_list_strings[$_REQUEST['dropdown_name']][$key])){
105         $selected_dropdown[$key]=array('lang'=>$value, 'user_lang'=> '['.$app_list_strings[$_REQUEST['dropdown_name']][$key] . ']');
106    }else{
107        $selected_dropdown[$key]=array('lang'=>$value);
108    }
109 }
110
111 $selected_dropdown = $dh->filterDropDown($_REQUEST['dropdown_name'], $selected_dropdown);
112
113 $smarty->assign('dropdown', $selected_dropdown);
114 $smarty->assign('dropdown_name',$_REQUEST['dropdown_name']);
115
116 }
117
118 $smarty->assign('dropdown_languages', get_languages());
119 if(strcmp($_REQUEST['dropdown_name'], 'moduleList') == 0){
120         $smarty->assign('disable_remove', true);
121         $smarty->assign('disable_add', true);
122         $smarty->assign('use_push', 1);
123 }else{
124         $smarty->assign('use_push', 0);
125 }
126
127 $imageSave = SugarThemeRegistry::current()->getImage( 'studio_save', '',null,null,'.gif',$mod_strings['LBL_SAVE']);
128 $imageUndo = SugarThemeRegistry::current()->getImage('studio_undo', '',null,null,'.gif',$mod_strings['LBL_UNDO']);
129 $imageRedo = SugarThemeRegistry::current()->getImage('studio_redo', '',null,null,'.gif',$mod_strings['LBL_REDO']);
130 $buttons = array();
131 $buttons[] = array('text'=>$mod_strings['LBL_BTN_UNDO'],'actionScript'=>"onclick='jstransaction.undo()'" );
132 $buttons[] = array('text'=>$mod_strings['LBL_BTN_REDO'],'actionScript'=>"onclick='jstransaction.redo()'" );
133 $buttons[] = array('text'=>$mod_strings['LBL_BTN_SAVE'],'actionScript'=>"onclick='if(check_form(\"editdropdown\")){document.editdropdown.submit();}'");
134 $buttonTxt = StudioParser::buildImageButtons($buttons);
135 $smarty->assign('buttons', $buttonTxt);
136 $smarty->assign('dropdown_lang', $selected_lang);
137
138 $editImage = SugarThemeRegistry::current()->getImage( 'edit_inline', '',null,null,'.gif',$mod_strings['LBL_INLINE']);
139 $smarty->assign('editImage',$editImage);
140 $deleteImage = SugarThemeRegistry::current()->getImage( 'delete_inline', '',null,null,'.gif',$mod_strings['LBL_DELETE']);
141 $smarty->assign('deleteImage',$deleteImage);
142 $smarty->display("modules/Studio/DropDowns/EditView.tpl");
143 ?>