]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Emails/PopupDocuments.php
Release 6.5.0
[Github/sugarcrm.git] / modules / Emails / PopupDocuments.php
1 <?php
2 //_pp($_REQUEST);
3 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
4 /*********************************************************************************
5  * SugarCRM Community Edition is a customer relationship management program developed by
6  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
7  * 
8  * This program is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU Affero General Public License version 3 as published by the
10  * Free Software Foundation with the addition of the following permission added
11  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
12  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
13  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14  * 
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
18  * details.
19  * 
20  * You should have received a copy of the GNU Affero General Public License along with
21  * this program; if not, see http://www.gnu.org/licenses or write to the Free
22  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23  * 02110-1301 USA.
24  * 
25  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
26  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27  * 
28  * The interactive user interfaces in modified source and object code versions
29  * of this program must display Appropriate Legal Notices, as required under
30  * Section 5 of the GNU Affero General Public License version 3.
31  * 
32  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
33  * these Appropriate Legal Notices must retain the display of the "Powered by
34  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
35  * technical reasons, the Appropriate Legal Notices must display the words
36  * "Powered by SugarCRM".
37  ********************************************************************************/
38
39 /*********************************************************************************
40
41  * Description:  TODO: To be written.
42  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
43  * All Rights Reserved.
44  * Contributor(s): ______________________________________..
45  ********************************************************************************/
46 require_once('modules/Documents/Popup_picker.php');
47 $popup = new Popup_Picker();
48
49 global $theme;
50 global $current_mod_strings;
51 global $app_strings;
52 global $currentModule;
53 global $sugar_version, $sugar_config;
54 global $app_list_strings;
55
56 $current_mod_strings = return_module_language($current_language, 'Documents');
57 $output_html = '';
58 $where = '';
59
60 $where = $popup->_get_where_clause();
61
62 // We can't attach remote documents to emails because we can't necessarialy fetch a copy of them to include.
63 if ( ! empty($where) ) {
64     $where .= ' AND ';
65 }
66 $where .= "documents.doc_type IN ( '', 'Sugar')";
67
68 $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
69 $document_name = empty($_REQUEST['document_name']) ? '' : $_REQUEST['document_name'];
70 $category_id = empty($_REQUEST['category_id']) ? '' : $_REQUEST['category_id'];
71 $subcategory_id = empty($_REQUEST['subcategory_id']) ? '' : $_REQUEST['subcategory_id'];
72 $template_type = empty($_REQUEST['template_type']) ? '' : $_REQUEST['template_type'];
73 $is_template = empty($_REQUEST['is_template']) ? '' : $_REQUEST['is_template'];
74 $document_revision_id = empty($_REQUEST['document_revision_id']) ? '' : $_REQUEST['document_revision_id'];
75
76 //$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
77
78 $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
79 $button  = "<form action='index.php' method='post' name='form' id='form'>\n";
80 if(!$hide_clear_button)
81 {
82         $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
83                 .$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
84                 .$app_strings['LBL_CLEAR_BUTTON_LABEL']."  ' />\n";
85 }
86 $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
87         .$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
88         .$app_strings['LBL_CANCEL_BUTTON_KEY']."' value='  "
89         .$app_strings['LBL_CANCEL_BUTTON_LABEL']."  ' />\n";
90 $button .= "</form>\n";
91
92 $form = new XTemplate('modules/Emails/PopupDocuments.html');
93 $form->assign('MOD', $current_mod_strings);
94 $form->assign('APP', $app_strings);
95 $form->assign('THEME', $theme);
96 $form->assign('MODULE_NAME', $currentModule);
97 $form->assign('NAME', $name);
98 $form->assign('DOCUMENT_NAME', $document_name);
99 $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
100 $form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
101
102 //$form->assign('request_data', $request_data);
103 $form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_category_dom'], $category_id));
104 $form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_subcategory_dom'], $subcategory_id));
105 $form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template));
106 $form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['document_template_type_dom'], $template_type));
107
108
109
110 ob_start();
111 insert_popup_header($theme);
112 $output_html .= ob_get_contents();
113 ob_end_clean();
114
115 $output_html .= get_form_header($current_mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
116
117 $form->parse('main.SearchHeader');
118 $output_html .= $form->text('main.SearchHeader');
119
120 // Reset the sections that are already in the page so that they do not print again later.
121 $form->reset('main.SearchHeader');
122
123 // create the listview
124 $seed_bean = new Document();
125 $ListView = new ListView();
126 $ListView->show_export_button = false;
127 $ListView->process_for_popups = true;
128 $ListView->setXTemplate($form);
129 $ListView->setHeaderTitle($current_mod_strings['LBL_LIST_FORM_TITLE']);
130 $ListView->setHeaderText($button);
131 $ListView->setQuery($where, '', 'document_name', 'DOCUMENT');
132 $ListView->setModStrings($current_mod_strings);
133
134 ob_start();
135 $ListView->processListView($seed_bean, 'main', 'DOCUMENT');
136 $output_html .= ob_get_contents();
137 ob_end_clean();
138                 
139 $output_html .= insert_popup_footer();
140
141
142 echo $output_html;
143
144
145
146
147
148
149
150
151
152
153 ?>