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.
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.
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
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
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.
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.
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 ********************************************************************************/
43 require_once("include/upload_file.php");
45 require_once('include/utils/db_utils.php');
46 require_once('modules/Audit/Audit.php');
48 global $beanList, $beanFiles, $currentModule, $focus, $action, $app_strings, $app_list_strings, $current_language, $timedate, $mod_strings;
49 //we don't want the parent module's string file, but rather the string file specifc to this subpanel
53 $bean = $beanList[$_REQUEST['module_name']];
54 require_once($beanFiles[$bean]);
64 function Popup_Picker()
72 function process_page()
78 global $app_list_strings;
79 global $currentModule;
84 global $current_language;
86 $audit_list = Audit::get_audit_list();
87 $xtpl=new XTemplate ('modules/Audit/Popup_picker.html');
89 $xtpl->assign('MOD', $mod_strings);
90 $xtpl->assign('APP', $app_strings);
91 insert_popup_header($theme);
94 echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
95 $mod_strings = return_module_language($current_language, $focus->module_dir);
97 $printImageURL = SugarThemeRegistry::current()->getImageURL('print.gif');
98 $titleExtra = <<<EOHTML
99 <a href="javascript:void window.open('index.php?{$GLOBALS['request_string']}','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')" class='utilsLink'>
100 <img src="{$printImageURL}" alt="{$GLOBALS['app_strings']['LNK_PRINT']}"></a>
101 <a href="javascript:void window.open('index.php?{$GLOBALS['request_string']}','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')" class='utilsLink'>
102 {$GLOBALS['app_strings']['LNK_PRINT']}
107 $params[] = translate('LBL_MODULE_NAME', $focus->module_dir);
108 $params[] = $focus->get_summary_text();
109 $params[] = translate('LBL_CHANGE_LOG', 'Audit');
110 echo str_replace('</div>',"<span class='utils'>$titleExtra</span></div>",getClassicModuleTitle($focus->module_dir, $params, false));
113 $audited_fields = $focus->getAuditEnabledFieldDefinitions();
114 asort($audited_fields);
116 $field_count = count($audited_fields);
117 $start_tag = "<table><tr><td >";
118 $end_tag = "</td></tr></table>";
123 foreach($audited_fields as $key=>$value)
127 if(isset($value['vname']))
128 $vname = $value['vname'];
129 else if(isset($value['label']))
130 $vname = $value['label'];
131 $fields .= str_replace(':', '', translate($vname, $focus->module_dir));
133 if($index < $field_count)
139 echo $start_tag.translate('LBL_AUDITED_FIELDS', 'Audit').$fields.$end_tag;
143 echo $start_tag.translate('LBL_AUDITED_FIELDS', 'Audit').$end_tag;
146 foreach($audit_list as $audit)
148 if(empty($audit['before_value_string']) && empty($audit['after_value_string']))
150 $before_value = $audit['before_value_text'];
151 $after_value = $audit['after_value_text'];
154 $before_value = $audit['before_value_string'];
155 $after_value = $audit['after_value_string'];
158 // Let's run the audit data through the sugar field system
159 if(isset($audit['data_type'])){
160 require_once('include/SugarFields/SugarFieldHandler.php');
161 $vardef = array('name'=>'audit_field','type'=>$audit['data_type']);
162 $field = SugarFieldHandler::getSugarField($audit['data_type']);
163 $before_value = $field->getChangeLogSmarty(array($vardef['name']=>$before_value), $vardef, array(), $vardef['name']);
164 $after_value = $field->getChangeLogSmarty(array($vardef['name']=>$after_value), $vardef, array(), $vardef['name']);
167 $activity_fields = array(
168 'ID' => $audit['id'],
169 'NAME' => $audit['field_name'],
170 'BEFORE_VALUE' => $before_value,
171 'AFTER_VALUE' => $after_value,
172 'CREATED_BY' => $audit['created_by'],
173 'DATE_CREATED' => $audit['date_created'],
176 $xtpl->assign("ACTIVITY", $activity_fields);
180 //todo move to themes
181 $xtpl->assign("ROW_COLOR", 'oddListRow');
182 $xtpl->assign("BG_COLOR", $odd_bg);
186 //todo move to themes
187 $xtpl->assign("ROW_COLOR", 'evenListRow');
188 $xtpl->assign("BG_COLOR", $even_bg);
192 $xtpl->parse("audit.row");
196 $xtpl->parse("audit");
198 insert_popup_footer();
200 } // end of class Popup_Picker