]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/InboundEmail/EditGroupFolder.php
Release 6.4.0
[Github/sugarcrm.git] / modules / InboundEmail / EditGroupFolder.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 $_REQUEST['edit']='true';
39
40 require_once('include/SugarFolders/SugarFolders.php');
41
42 // GLOBALS
43 global $mod_strings;
44 global $app_strings;
45 global $app_list_strings;
46 global $current_user;
47 global $sugar_config;
48
49 $ie = new InboundEmail();
50 $focus = new SugarFolder();
51 $javascript = new Javascript();
52 /* Start standard EditView setup logic */
53
54 if(isset($_REQUEST['record'])) {
55         $GLOBALS['log']->debug("In EditGroupFolder view, about to retrieve record: ".$_REQUEST['record']);
56         $result = $focus->retrieve($_REQUEST['record']);
57     if($result == null)
58     {
59         sugar_die($app_strings['ERROR_NO_RECORD']);
60     }
61 }
62
63 $GLOBALS['log']->info("SugarFolder Edit View");
64 /* End standard EditView setup logic */
65
66 // TEMPLATE ASSIGNMENTS
67 $smarty = new Sugar_Smarty();
68 // standard assigns
69 $smarty->assign('mod_strings', $mod_strings);
70 $smarty->assign('app_strings', $app_strings);
71 $smarty->assign('theme', $theme);
72 $smarty->assign('sugar_version', $sugar_version);
73 $smarty->assign('GRIDLINE', $gridline);
74 $smarty->assign('MODULE', 'InboundEmail');
75 $smarty->assign('RETURN_MODULE', 'InboundEmail');
76 $smarty->assign('RETURN_ID', $focus->id);
77 $smarty->assign('RETURN_ACTION', "");
78 $smarty->assign('ID', $focus->id);
79 // module specific
80
81 $ret = $focus->getFoldersForSettings($current_user);
82 $groupFolders = Array();
83 $groupFoldersOrig = array();
84 foreach($ret['groupFolders'] as $key => $value) {
85         if(!empty($focus->id)) {
86                 if ($value['id'] == $focus->id) {
87                         continue;
88                 }
89         } // if
90         $groupFolders[$value['id']] = $value['name'];
91         $groupFoldersOrig[] = $value['origName'];
92 } // foreach
93 $groupFolderName = "";
94 $addToGroupFolder = "";
95 $createGroupFolderStyle = "display:''";
96 $editGroupFolderStyle = "display:''";
97 if(!empty($focus->id)) {
98         $groupFolderName =      $focus->name;
99 }
100 if(!empty($focus->id)) {
101         $addToGroupFolder = $focus->parent_folder;
102 }
103 if(!empty($focus->id)) {
104         $createGroupFolderStyle = "display:none;";
105 } else {
106         $editGroupFolderStyle = "display:none;";
107 } // else
108 $smarty->assign('createGroupFolderStyle', $createGroupFolderStyle);
109 $smarty->assign('editGroupFolderStyle', $editGroupFolderStyle);
110
111 $smarty->assign('groupFolderName', $groupFolderName);
112 $json = getJSONobj();
113 $smarty->assign('group_folder_array', $json->encode($groupFoldersOrig));
114 $smarty->assign('group_folder_options', get_select_options_with_id($groupFolders, $addToGroupFolder));
115
116
117 $smarty->assign('CSS',SugarThemeRegistry::current()->getCSS());
118
119
120 $smarty->assign('languageStrings', getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js",  $GLOBALS['sugar_config']['js_lang_version']));
121 echo $smarty->fetch("modules/Emails/templates/_createGroupFolder.tpl");
122 ?>