]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Releases/index.php
Release 6.5.0
[Github/sugarcrm.git] / modules / Releases / index.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-2012 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  * Description:
41  ********************************************************************************/
42
43
44 $header_text = '';
45 global $mod_strings;
46 global $app_list_strings;
47 global $app_strings;
48 global $current_user;
49
50 if((!is_admin($GLOBALS['current_user']) && (!is_admin_for_module($GLOBALS['current_user'],'Bugs')))) 
51 {
52    sugar_die("Unauthorized access to administration.");
53 }
54
55 $focus = new Release();
56 echo getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_TITLE']), true); 
57 $is_edit = false;
58 if(!empty($_REQUEST['record'])) {
59     $result = $focus->retrieve($_REQUEST['record']);
60     if($result == null)
61     {
62         sugar_die($app_strings['ERROR_NO_RECORD']);
63     }
64         $is_edit=true;
65 }
66 if(isset($_REQUEST['edit']) && $_REQUEST['edit']=='true') {
67         $is_edit=true;
68         //Only allow admins to enter this screen
69         if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Bugs')) {
70                 $GLOBALS['log']->error("Non-admin user ($current_user->user_name) attempted to enter the Releases edit screen");
71                 session_destroy();
72                 include('modules/Users/Logout.php');
73         }
74 }
75
76 $GLOBALS['log']->info("Release list view");
77 global $theme;
78
79 $button  = "<form border='0' action='index.php' method='post' name='form'>\n";
80 $button .= "<input type='hidden' name='module' value='Releases'>\n";
81 $button .= "<input type='hidden' name='action' value='EditView'>\n";
82 $button .= "<input type='hidden' name='edit' value='true'>\n";
83 $button .= "<input type='hidden' name='return_module' value='".$currentModule."'>\n";
84 $button .= "<input type='hidden' name='return_action' value='".$action."'>\n";
85 $button .= "<input title='".$app_strings['LBL_NEW_BUTTON_TITLE']."' accessyKey='".$app_strings['LBL_NEW_BUTTON_KEY']."' class='button' type='submit' name='New' value='  ".$app_strings['LBL_NEW_BUTTON_LABEL']."  '>\n";
86 $button .= "</form>\n";
87
88 $ListView = new ListView();
89 if((is_admin($current_user)|| is_admin_for_module($GLOBALS['current_user'],'Bugs')) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){     
90                 $header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&from_action=ListView&from_module=".$_REQUEST['module'] ."'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'"
91 ,null,null,'.gif',$mod_strings['LBL_EDITLAYOUT'])."</a>";
92 }
93 $ListView->initNewXTemplate( 'modules/Releases/ListView.html',$mod_strings);
94 $ListView->xTemplateAssign("DELETE_INLINE_PNG",  SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LNK_DELETE']));
95 $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE'] . $header_text);
96 $ListView->setHeaderText($button);
97 $ListView->show_export_button = false;
98 $ListView->show_mass_update = false;
99 $ListView->show_delete_button = false;
100 $ListView->show_select_menu = false;
101 $ListView->setQuery("", "", "list_order", "RELEASE");
102 $ListView->processListView($focus, "main", "RELEASE");
103
104 if ($is_edit) {
105
106                 $edit_button ="<form name='EditView' method='POST' action='index.php'>\n";
107                 $edit_button .="<input type='hidden' name='module' value='Releases'>\n";
108                 $edit_button .="<input type='hidden' name='record' value='$focus->id'>\n";
109                 $edit_button .="<input type='hidden' name='action'>\n";
110                 $edit_button .="<input type='hidden' name='edit'>\n";
111                 $edit_button .="<input type='hidden' name='isDuplicate'>\n";                    
112                 $edit_button .="<input type='hidden' name='return_module' value='Releases'>\n";
113                 $edit_button .="<input type='hidden' name='return_action' value='index'>\n";
114                 $edit_button .="<input type='hidden' name='return_id' value=''>\n";
115                 $edit_button .='<input title="'.$app_strings['LBL_SAVE_BUTTON_TITLE'].'" accessKey="'.$app_strings['LBL_SAVE_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'Save\'; return check_form(\'EditView\');" type="submit" name="button" value="  '.$app_strings['LBL_SAVE_BUTTON_LABEL'].'  " >';
116                 $edit_button .=' <input title="'.$app_strings['LBL_SAVE_NEW_BUTTON_TITLE'].'" class="button" onclick="this.form.action.value=\'Save\'; this.form.isDuplicate.value=\'true\'; this.form.edit.value=\'true\'; this.form.return_action.value=\'EditView\'; return check_form(\'EditView\')" type="submit" name="button" value="  '.$app_strings['LBL_SAVE_NEW_BUTTON_LABEL'].'  " >';
117                 if((is_admin($current_user) || is_admin_for_module($GLOBALS['current_user'],'Bugs')) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){    
118                 $header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&edit=true&from_action=EditView&from_module=".$_REQUEST['module'] ."'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDITLAYOUT'])."</a>";
119                 }
120                 echo get_form_header($mod_strings['LBL_RELEASE']." ".$focus->name . '&nbsp;' . $header_text,$edit_button , false);
121
122
123         $GLOBALS['log']->info("Releases edit view");
124         $xtpl=new XTemplate ('modules/Releases/EditView.html');
125         $xtpl->assign("MOD", $mod_strings);
126         $xtpl->assign("APP", $app_strings);
127
128         if (isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
129         if (isset($_REQUEST['return_action'])) $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
130         if (isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
131         $xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
132         $xtpl->assign("JAVASCRIPT", get_set_focus_js());
133         $xtpl->assign("ID", $focus->id);
134         $xtpl->assign('NAME', $focus->name);
135         $xtpl->assign('STATUS', $focus->status);
136
137
138         if (empty($focus->list_order)) $xtpl->assign('LIST_ORDER', count($focus->get_releases(FALSE, 'All'))+1);
139         else $xtpl->assign('LIST_ORDER', $focus->list_order);
140         $xtpl->assign('STATUS_OPTIONS', get_select_options_with_id($app_list_strings['release_status_dom'], $focus->status));
141
142 // adding custom fields:
143
144 require_once('modules/DynamicFields/templates/Files/EditView.php');
145
146
147         $xtpl->parse("main");
148         $xtpl->out("main");
149         
150 $javascript = new javascript();
151 $javascript->setFormName('EditView');
152 $javascript->setSugarBean($focus);
153 $javascript->addAllFields('');
154 echo $javascript->getScript();
155 }
156 ?>