public function testinsert_popup_footer() { //execute the method and test if it returns html ob_start(); insert_popup_footer(); $renderedContent = ob_get_contents(); ob_end_clean(); $this->assertGreaterThan(0, strlen($renderedContent)); }
function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $current_language; global $current_module_strings; if (!is_file(sugar_cached('jsLanguage/WorkFlow/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('WorkFlow', $GLOBALS['current_language']); } $javascript_language_files = getVersionedScript("cache/jsLanguage/WorkFlow/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $current_module_strings = return_module_language($current_language, 'WorkFlowAlertShells'); $ListView = new ListView(); $header_text = ''; if (isset($_REQUEST['workflow_id'])) { $workflow = BeanFactory::getBean('WorkFlow', $_REQUEST['workflow_id']); //TODO GET ALL ALERTS HERE //$focus_alerts_list = $workflow->get_linked_beans('wf_alerts','WorkFlowAlertShell'); $alerts = BeanFactory::getBean('WorkFlowAlertShells'); $current_module_strings = return_module_language($current_language, $alerts->module_dir); insert_popup_header($theme); $ListView->initNewXTemplate('modules/WorkFlowAlertShells/Popup_picker.html', $current_module_strings); $ListView->xTemplateAssign("WORKFLOW_ID", $workflow->id); $ListView->xTemplateAssign("JAVASCRIPT_LANGUAGE_FILES", $javascript_language_files); $ListView->xTemplateAssign("RETURN_URL", "&return_module=" . $currentModule . "&return_action=DetailView&return_id={$workflow->id}"); $ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_EDIT'])); $ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_REMOVE'])); $ListView->setHeaderTitle($current_module_strings['LBL_MODULE_NAME_COMBO'] . $header_text); //$ListView->setHeaderText($button); //$ListView->setQuery("workflow_alertshells.alert_type = 'Email'","","", "ALERT"); $list = $alerts->get_list("", "workflow_alertshells.alert_type = 'Email'"); $display_list = $this->cullFromList($list['list'], $workflow->base_module, $workflow->type); $ListView->processListViewTwo($display_list, "main", "ALERT"); insert_popup_footer(); } }
$subpanel = $_REQUEST['subpanel']; $record = $_REQUEST['record']; $module = $_REQUEST['module']; $collection = array(); if (isset($_REQUEST['collection_basic']) && $_REQUEST['collection_basic'][0] != 'null') { $_REQUEST['collection_basic'] = explode(',', $_REQUEST['collection_basic'][0]); $collection = $_REQUEST['collection_basic']; } if (empty($_REQUEST['inline'])) { insert_popup_header($theme); } //require_once('include/SubPanel/SubPanelDefinitions.php'); //require_once($beanFiles[$beanList[$_REQUEST['module']]]); //$focus=new $beanList[$_REQUEST['module']]; //$focus->retrieve($record); include 'custom/include/SubPanel/SubPanel.php'; $layout_def_key = ''; if (!empty($_REQUEST['layout_def_key'])) { $layout_def_key = $_REQUEST['layout_def_key']; } $subpanel_object = new CustomSubPanel($module, $record, $subpanel, null, $layout_def_key, $collection); $subpanel_object->setTemplateFile('custom/include/SubPanel/SubPanelDynamic.html'); echo empty($_REQUEST['inline']) ? $subpanel_object->get_buttons() : ''; $subpanel_object->display(); $jsAlerts = new jsAlerts(); if (!isset($_SESSION['isMobile'])) { echo $jsAlerts->getScript(); } if (empty($_REQUEST['inline'])) { insert_popup_footer($theme); }
/** * */ function process_page() { global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/ACLRoles/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('MODULE_NAME', $currentModule); $form->assign('NAME', $name); $form->assign('request_data', $request_data); ob_start(); insert_popup_header(); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new ACLRole(); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_ROLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', 'name', 'ROLE'); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', 'ROLE'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; global $app_list_strings; global $sugar_config; $b_from_documents = false; if (isset($_REQUEST['caller']) && $_REQUEST['caller'] == 'Documents') { $b_from_documents = true; } //initalize template $form = new XTemplate('modules/Documents/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); //tree header. $doctree = new Tree('doctree'); $doctree->set_param('module', 'Documents'); if ($b_from_documents) { $doctree->set_param('caller', 'Documents'); $href_string = "javascript:populate_parent_search('doctree')"; } else { $href_string = "javascript:populate_search('doctree')"; } $nodes = get_category_nodes($href_string); foreach ($nodes as $node) { $doctree->add_node($node); } $form->assign("TREEHEADER", $doctree->generate_header()); $form->assign("TREEINSTANCE", $doctree->generate_nodes_array()); $site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n"; $form->assign("SITEURL", $site_data); $form->parse('main.SearchHeader.TreeView'); $treehtml = $form->text('main.SearchHeader.TreeView'); $form->reset('main.SearchHeader.TreeView'); //end tree if (isset($_REQUEST['caller']) && $_REQUEST['caller'] == 'Documents') { ///process treeview and return. return insert_popup_header($theme) . $treehtml . insert_popup_footer(); } ////////////////////////process full search form and list view.////////////////////////////// $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $document_name = empty($_REQUEST['document_name']) ? '' : $_REQUEST['document_name']; $category_id = empty($_REQUEST['category_id']) ? '' : $_REQUEST['category_id']; $subcategory_id = empty($_REQUEST['subcategory_id']) ? '' : $_REQUEST['subcategory_id']; $template_type = empty($_REQUEST['template_type']) ? '' : $_REQUEST['template_type']; $is_template = empty($_REQUEST['is_template']) ? '' : $_REQUEST['is_template']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form->assign('NAME', $name); $form->assign('DOCUMENT_NAME', $document_name); $form->assign('request_data', $request_data); $form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_category_dom'], $category_id)); $form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_subcategory_dom'], $subcategory_id)); $form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template)); $form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['document_template_type_dom'], $template_type)); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); //add tree view to output_html. $output_html .= $treehtml; // create the listview $seed_bean = new Document(); $ListView = new ListView(); $ListView->show_select_menu = false; $ListView->show_delete_button = false; $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', 'document_name', 'DOCUMENT'); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', 'DOCUMENT'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $audit; global $current_language; $audit_list = Audit::get_audit_list(); $xtpl = new XTemplate('modules/Audit/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; $mod_strings = return_module_language($current_language, $focus->module_dir); $printImageURL = SugarThemeRegistry::current()->getImageURL('print.gif'); $titleExtra = <<<EOHTML <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'> <!--not_in_theme!--><img src="{$printImageURL}" alt="{$GLOBALS['app_strings']['LNK_PRINT']}"></a> <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'> {$GLOBALS['app_strings']['LNK_PRINT']} </a> EOHTML; $params = array(); $params[] = translate('LBL_MODULE_NAME', $focus->module_dir); $params[] = $focus->get_summary_text(); $params[] = translate('LBL_CHANGE_LOG', 'Audit'); echo str_replace('</div>', "<span class='utils'>{$titleExtra}</span></div>", getClassicModuleTitle($focus->module_dir, $params, false)); $oddRow = true; $audited_fields = $focus->getAuditEnabledFieldDefinitions(); asort($audited_fields); $fields = ''; $field_count = count($audited_fields); $start_tag = "<table><tr><td >"; $end_tag = "</td></tr></table>"; if ($field_count > 0) { $index = 0; foreach ($audited_fields as $key => $value) { $index++; $vname = ''; if (isset($value['vname'])) { $vname = $value['vname']; } else { if (isset($value['label'])) { $vname = $value['label']; } } $fields .= str_replace(':', '', translate($vname, $focus->module_dir)); if ($index < $field_count) { $fields .= ", "; } } echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $fields . $end_tag; } else { echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $end_tag; } foreach ($audit_list as $audit) { if (empty($audit['before_value_string']) && empty($audit['after_value_string'])) { $before_value = $audit['before_value_text']; $after_value = $audit['after_value_text']; } else { $before_value = $audit['before_value_string']; $after_value = $audit['after_value_string']; } // Let's run the audit data through the sugar field system if (isset($audit['data_type'])) { require_once 'include/SugarFields/SugarFieldHandler.php'; $vardef = array('name' => 'audit_field', 'type' => $audit['data_type']); $field = SugarFieldHandler::getSugarField($audit['data_type']); $before_value = $field->getChangeLogSmarty(array($vardef['name'] => $before_value), $vardef, array(), $vardef['name']); $after_value = $field->getChangeLogSmarty(array($vardef['name'] => $after_value), $vardef, array(), $vardef['name']); } $activity_fields = array('ID' => $audit['id'], 'NAME' => $audit['field_name'], 'BEFORE_VALUE' => $before_value, 'AFTER_VALUE' => $after_value, 'CREATED_BY' => $audit['created_by'], 'DATE_CREATED' => $audit['date_created']); $xtpl->assign("ACTIVITY", $activity_fields); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("audit.row"); // Put the rows in. } //end foreach $xtpl->parse("audit"); $xtpl->out("audit"); insert_popup_footer(); }
/** * */ function process_page() { global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $timedate; $history_list = array(); if (!empty($_REQUEST['record'])) { $result = $focus->retrieve($_REQUEST['record']); if ($result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } } $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note'); //Setup the arrays to store the linked records. foreach ($activitiesRels as $relMod => $beanName) { $varname = "focus_" . $relMod . "_list"; ${$varname} = array(); } foreach ($focus->get_linked_fields() as $field => $def) { if ($focus->load_relationship($field)) { $relTable = $focus->{$field}->getRelatedTableName(); if (in_array($relTable, array_keys($activitiesRels))) { $varname = "focus_" . $relTable . "_list"; ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable])); } } } foreach ($focus_tasks_list as $task) { $sort_date_time = ''; if (empty($task->date_due) || $task->date_due == '0000-00-00') { $date_due = ''; } else { $date_due = $task->date_due; } if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") { $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => strtotime($task->fetched_row['date_due'] . ' GMT')); } else { $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']); } } // end Tasks foreach ($focus_meetings_list as $meeting) { if (empty($meeting->contact_id) && empty($meeting->contact_name)) { $meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact'); if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) { $meeting->contact_id = $meeting_contacts[0]->id; $meeting->contact_name = $meeting_contacts[0]->name; } } if ($meeting->status != "Planned") { $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($meeting->fetched_row['date_start'] . ' GMT')); } else { $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Meetings foreach ($focus_calls_list as $call) { if (empty($call->contact_id) && empty($call->contact_name)) { $call_contacts = $call->get_linked_beans('contacts', 'Contact'); if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) { $call->contact_id = $call_contacts[0]->id; $call->contact_name = $call_contacts[0]->name; } } if ($call->status != "Planned") { $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($call->fetched_row['date_start'] . ' GMT')); } else { $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Calls foreach ($focus_emails_list as $email) { if (empty($email->contact_id) && empty($email->contact_name)) { $email_contacts = $email->get_linked_beans('contacts', 'Contact'); if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) { $email->contact_id = $email_contacts[0]->id; $email->contact_name = $email_contacts[0]->name; } } $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT')); } //end Emails // Bug 46439 'No email archived when clicking on View Summary' (All condition) if (method_exists($focus, 'get_unlinked_email_query')) { $queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true')); $query = $queryArray['select']; $query .= $queryArray['from']; if (!empty($queryArray['join_tables'])) { foreach ($queryArray['join_tables'] as $join_table) { if ($join_table != '') { $query .= ', ' . $join_table . ' '; } } } $query .= $queryArray['join']; $query .= $queryArray['where']; $emails = new Email(); $focus_unlinked_emails_list = $emails->process_list_query($query, 0); $focus_unlinked_emails_list = $focus_unlinked_emails_list['list']; foreach ($focus_unlinked_emails_list as $email) { $email->retrieve($email->id); $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT')); } } //end Unlinked Emails foreach ($focus_notes_list as $note) { $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT')); if (!empty($note->filename)) { $count = count($history_list); $count--; $history_list[$count]['filename'] = $note->filename; $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id); } } // end Notes $xtpl = new XTemplate('modules/Activities/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header(); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; echo getClassicModuleTitle($focus->module_dir, array(translate('LBL_MODULE_NAME', $focus->module_dir), $focus->name), false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; if (count($history_list) > 0) { $history_list = array_csort($history_list, 'sort_value', SORT_DESC); } foreach ($history_list as $activity) { $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']]; } switch ($activity['type']) { case 'Call': $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } if (isset($activity['location'])) { $activity_fields['LOCATION'] = $activity['location']; } if (isset($activity['filename'])) { $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>"; } if (isset($activity['parent_type'])) { $activity_fields['PARENT_MODULE'] = $activity['parent_type']; } $xtpl->assign("ACTIVITY", $activity_fields); $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"')); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; if (!empty($activity_fields['DESCRIPTION'])) { $xtpl->parse("history.row.description"); } $xtpl->parse("history.row"); // Put the rows in. } $xtpl->parse("history"); $xtpl->out("history"); insert_popup_footer(); }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $image_path; global $audit; global $current_language; global $sugar_version; $theme_path = "themes/" . $theme . "/"; $image_path = 'themes/' . $theme . '/images/'; if (floatval(substr($sugar_version, 0, 3)) < 6.0) { require_once $theme_path . 'layout_utils.php'; } else { require_once 'include/utils/layout_utils.php'; } $audit_list = Audit::get_audit_list(); $xtpl = new XTemplate('modules/Audit/Popup_picker.html'); $xtpl->assign('THEME', $theme); $xtpl->assign('MOD', return_module_language($current_language, 'Audit')); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; $focus_mod_strings = return_module_language($current_language, $focus->module_dir); echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . $image_path . "print.gif' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; $audited_fields = $focus->getAuditEnabledFieldDefinitions(); asort($audited_fields); $fields = ''; $field_count = count($audited_fields); $start_tag = "<table><tr><td class=\"listViewPaginationLinkS1\">"; $end_tag = "</td></tr></table>"; if ($field_count > 0) { $index = 0; foreach ($audited_fields as $key => $value) { $index++; $vname = ''; if (isset($value['vname'])) { $vname = $value['vname']; } else { if (isset($value['label'])) { $vname = $value['label']; } } $fields .= str_replace(':', '', translate($vname, $focus->module_dir)); if ($index < $field_count) { $fields .= ", "; } } echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $fields . $end_tag; } else { echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $end_tag; } foreach ($audit_list as $audit) { if (isset($audit['before_value_string']) || isset($audit['after_value_string'])) { $before_value = $audit['before_value_string']; $after_value = $audit['after_value_string']; } else { // show textblocks correctly formatted. // TODO: be careful of security implications $before_value = from_html($audit['before_value_text']); $after_value = from_html($audit['after_value_text']); } $activity_fields = array('ID' => $audit['id'], 'NAME' => $audit['field_name'], 'BEFORE_VALUE' => $before_value, 'AFTER_VALUE' => $after_value, 'CREATED_BY' => $audit['created_by'], 'DATE_CREATED' => $audit['date_created']); $xtpl->assign("ACTIVITY", $activity_fields); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("audit.row"); // Put the rows in. } //end foreach $xtpl->parse("audit"); $xtpl->out("audit"); insert_popup_footer(); }
$form->assign('DOCUMENT_REVISION_ID', $document_revision_id); //$form->assign('request_data', $request_data); $form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_category_dom'], $category_id)); $form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_subcategory_dom'], $subcategory_id)); $form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template)); $form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['document_template_type_dom'], $template_type)); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($current_mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = BeanFactory::getBean('Documents'); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->setHeaderTitle($current_mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', 'document_name', 'DOCUMENT'); $ListView->setModStrings($current_mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', 'DOCUMENT'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); echo $output_html;
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='button' name='button' id='selectButton' class='button' onclick=\"send_back_selected('SavedReports',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' id='clearButton' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' id='selectButton' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Reports/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('request_data', $request_data); if (!empty($_REQUEST['module_name'])) { $form->assign('FILTER_MODULE_NAME', $_REQUEST['module_name']); } $form->assign('NAME', $name); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = BeanFactory::getBean('Reports'); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; // Bug 50020 // If the popup mode is SINGLE, don't show select dropdown or delete button $mode = empty($_REQUEST['mode']) ? '' : strtoupper($_REQUEST['mode']); if ($mode == "SINGLE") { $ListView->show_select_menu = false; $ListView->show_delete_button = false; } $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; //FOR MULTI-SELECT if ($multi_select) { $ListView->xTemplate->assign("TAG_TYPE", "SPAN"); } else { $ListView->xTemplate->assign("TAG_TYPE", "A"); } //FOR MULTI-SELECT //$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); //FOR MULTI-SELECT //$ListView->setHeaderText($button); //FOR MULTI-SELECT $ListView->setQuery($where, '', 'name', 'SAVEDREPORT'); $ListView->setModStrings($mod_strings); ob_start(); $output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //FOR MULTI-SELECT $ListView->processListView($seed_bean, 'main', 'SAVEDREPORT'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $audit; global $current_language; $audit_list = Audit::get_audit_list(); $xtpl = new XTemplate('modules/Audit/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; $focus_mod_strings = return_module_language($current_language, $focus->module_dir); echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; $audited_fields = $focus->getAuditEnabledFieldDefinitions(); asort($audited_fields); $fields = ''; $field_count = count($audited_fields); $start_tag = "<table><tr><td >"; $end_tag = "</td></tr></table>"; if ($field_count > 0) { $index = 0; foreach ($audited_fields as $key => $value) { $index++; $vname = ''; if (isset($value['vname'])) { $vname = $value['vname']; } else { if (isset($value['label'])) { $vname = $value['label']; } } $fields .= str_replace(':', '', translate($vname, $focus->module_dir)); if ($index < $field_count) { $fields .= ", "; } } echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $fields . $end_tag; } else { echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $end_tag; } foreach ($audit_list as $audit) { if (empty($audit['before_value_string']) && empty($audit['after_value_string'])) { $before_value = $audit['before_value_text']; $after_value = $audit['after_value_text']; } else { $before_value = $audit['before_value_string']; $after_value = $audit['after_value_string']; } $activity_fields = array('ID' => $audit['id'], 'NAME' => $audit['field_name'], 'BEFORE_VALUE' => $before_value, 'AFTER_VALUE' => $after_value, 'CREATED_BY' => $audit['created_by'], 'DATE_CREATED' => $audit['date_created']); $xtpl->assign("ACTIVITY", $activity_fields); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("audit.row"); // Put the rows in. } //end foreach $xtpl->parse("audit"); $xtpl->out("audit"); insert_popup_footer(); }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $image_path; $theme_path = "themes/" . $theme . "/"; $image_path = 'themes/' . $theme . '/images/'; require_once $theme_path . 'layout_utils.php'; $history_list = array(); if (!empty($_REQUEST['record'])) { $result = $focus->retrieve($_REQUEST['record']); if ($result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } } if ($focus->object_name == "ProjectTask" || $focus->object_name == "Project") { $focus_tasks_list = array(); } else { $focus_tasks_list = $focus->get_linked_beans('tasks', 'Task'); } $focus_meetings_list = $focus->get_linked_beans('meetings', 'Meeting'); $focus_calls_list = $focus->get_linked_beans('calls', 'Call'); $focus_emails_list = $focus->get_linked_beans('emails', 'Email'); $focus_notes_list = $focus->get_linked_beans('notes', 'Note'); foreach ($focus_tasks_list as $task) { if ($task->date_due == '0000-00-00') { $date_due = ''; } else { $date_due = $task->date_due; } if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") { $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:'); } else { $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:'); } } // end Tasks foreach ($focus_meetings_list as $meeting) { if ($meeting->status != "Planned") { $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:'); } else { $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:'); } } // end Meetings foreach ($focus_calls_list as $call) { if ($call->status != "Planned") { $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:'); } else { $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:'); } } // end Calls foreach ($focus_emails_list as $email) { $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => 'Sent:'); } //end Emails foreach ($focus_notes_list as $note) { $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => 'Modified:'); if (!empty($note->filename)) { $count = count($history_list); $count--; $history_list[$count]['filename'] = $note->filename; $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id); } } // end Notes $xtpl = new XTemplate('modules/Activities/Popup_picker.html'); $xtpl->assign('THEME', $theme); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; echo get_module_title($focus->module_dir, $focus->module_dir . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . $image_path . "print.gif' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; if (count($history_list) > 0) { $history_list = array_csort($history_list, 'date_modified', SORT_DESC); } foreach ($history_list as $activity) { $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']]; } switch ($activity['type']) { case 'Call': $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } if (isset($activity['location'])) { $activity_fields['LOCATION'] = $activity['location']; } if (isset($activity['filename'])) { $activity_fields['ATTACHMENT'] = "<a href='" . $activity['fileurl'] . "' target='_blank'>" . get_image($image_path . "attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>"; } if (isset($activity['parent_type'])) { $activity_fields['PARENT_MODULE'] = $activity['parent_type']; } $xtpl->assign("ACTIVITY", $activity_fields); $xtpl->assign("ACTIVITY_MODULE_PNG", get_image($image_path . $activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"')); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("history.row"); // Put the rows in. } $xtpl->parse("history"); $xtpl->out("history"); insert_popup_footer(); }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $image_path; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = ''; $form = new XTemplate('modules/ACLRoles/ListView.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('NAME', $name); $form->assign('request_data', $request_data); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); $output_html .= get_form_footer(); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new ACLRole(); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_ROLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', 'name', 'ROLE'); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', 'ROLE'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_footer(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $timedate; $history_list = array(); if (!empty($_REQUEST['record'])) { $result = $focus->retrieve($_REQUEST['record']); if ($result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } } $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note'); //Setup the arrays to store the linked records. foreach ($activitiesRels as $relMod => $beanName) { $varname = "focus_" . $relMod . "_list"; ${$varname} = array(); } foreach ($focus->get_linked_fields() as $field => $def) { if ($focus->load_relationship($field)) { $relTable = $focus->{$field}->getRelatedTableName(); if (in_array($relTable, array_keys($activitiesRels))) { $varname = "focus_" . $relTable . "_list"; ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable])); } } } foreach ($focus_tasks_list as $task) { $sort_date_time = ''; if ($task->date_due == '0000-00-00') { $date_due = ''; } else { $date_due = $task->date_due; } if (!empty($task->date_due) and !empty($task->time_due)) { $sort_date_time = $timedate->to_db_date_time($task->date_due, $task->time_due); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") { $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => $sort_date_time); } else { $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']); } } // end Tasks foreach ($focus_meetings_list as $meeting) { if ($meeting->status != "Planned") { $sort_date_time = ''; if (!empty($meeting->date_start) and !empty($meeting->time_start)) { $sort_date_time = $timedate->to_db_date_time($meeting->date_start, $meeting->time_start); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time); } else { $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Meetings foreach ($focus_calls_list as $call) { if ($call->status != "Planned") { $sort_date_time = ''; if (!empty($call->date_start) and !empty($call->time_start)) { $sort_date_time = $timedate->to_db_date_time($call->date_start, $call->time_start); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } elseif (!empty($call->date_start) && empty($call->time_start)) { //jc - Bug#19862 //for some reason the calls module does not populate the time_start variable in //this case, so the date_start attribute contains the information we need //to determine where in the history this call belongs. //using swap_formats to get from the format '03/31/2008 09:45pm' to the format //'2008-03-31 09:45:00' $sort_date_time = $timedate->swap_formats($call->date_start, $timedate->get_date_time_format(), $timedate->get_db_date_time_format()); } $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time); } else { $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Calls foreach ($focus_emails_list as $email) { $sort_date_time = ''; if (!empty($email->date_start) and !empty($email->time_start)) { $sort_date_time = $timedate->to_db_date_time($email->date_start, $email->time_start); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $sort_date_time); } //end Emails foreach ($focus_notes_list as $note) { if (!empty($note->date_modified)) { $sort_date_time = $timedate->swap_formats($note->date_modified, $timedate->get_date_time_format(), $timedate->get_db_date_time_format()); } $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => $sort_date_time); if (!empty($note->filename)) { $count = count($history_list); $count--; $history_list[$count]['filename'] = $note->filename; $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id); } } // end Notes $xtpl = new XTemplate('modules/Activities/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header(); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; if (count($history_list) > 0) { $history_list = array_csort($history_list, 'sort_value', SORT_DESC); } foreach ($history_list as $activity) { $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']]; } switch ($activity['type']) { case 'Call': $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } if (isset($activity['location'])) { $activity_fields['LOCATION'] = $activity['location']; } if (isset($activity['filename'])) { $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>"; } if (isset($activity['parent_type'])) { $activity_fields['PARENT_MODULE'] = $activity['parent_type']; } $xtpl->assign("ACTIVITY", $activity_fields); $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"')); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("history.row"); // Put the rows in. } $xtpl->parse("history"); $xtpl->out("history"); insert_popup_footer(); }
function process_page_for_merge() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name']; $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name']; $account_name = empty($_REQUEST['account_name']) ? '' : $_REQUEST['account_name']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Contacts',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Contacts/MailMergePicker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('FIRST_NAME', $first_name); $form->assign('LAST_NAME', $last_name); $form->assign('ACCOUNT_NAME', $account_name); $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $form->assign('request_data', $request_data); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new Contact(); $ListView = new ListView(); $ListView->display_header_and_footer = false; $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; if ($multi_select) { $ListView->xTemplate->assign("TAG_TYPE", "SPAN"); } else { $ListView->xTemplate->assign("TAG_TYPE", "A"); } $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setQuery($where, '', 'contacts.last_name, contacts.first_name', 'CONTACT'); $ListView->setModStrings($mod_strings); ob_start(); $output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //BEGIN ATHENA CUSTOMIZATION - rsmith $query = $_REQUEST['select'] . ' WHERE ' . $_REQUEST['where'] . "'" . $_REQUEST['id'] . "'"; //$response = $seed_bean->process_list_query($_REQUEST['select'], 0, -1, -1, $_REQUEST['where']."'".$_REQUEST['id']."'"); $result = $seed_bean->db->query($query, true, "Error retrieving {$seed_bean->object_name} list: "); $list = array(); while (($row = $seed_bean->db->fetchByAssoc($result)) != null) { $seed_bean = new Contact(); foreach ($seed_bean->field_defs as $field => $value) { if (isset($row[$field])) { $seed_bean->{$field} = $row[$field]; } else { if (isset($row[$seed_bean->table_name . '.' . $field])) { $seed_bean->{$field} = $row[$seed_bean->table_name . '.' . $field]; } else { $seed_bean->{$field} = ""; } } } $seed_bean->fill_in_additional_list_fields(); $list[] = $seed_bean; } $ListView->processListViewTwo($list, 'main', 'CONTACT'); //END ATHENA CUSTOMIZATION - rsmith $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $status = empty($_REQUEST['status']) ? '' : $_REQUEST['status']; $campaign_type = empty($_REQUEST['campaign_type']) ? '' : $_REQUEST['campaign_type']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Prospects',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Campaigns/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('request_data', $request_data); $form->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['campaign_type_dom'], "")); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new Campaign(); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; //FOR MULTI-SELECT $ListView->xTemplate->assign("TAG_TYPE", "A"); //FOR MULTI-SELECT $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); //FOR MULTI-SELECT $ListView->setHeaderText($button); //FOR MULTI-SELECT $ListView->setQuery($where, '', 'name', 'CAMPAIGN'); $ListView->setModStrings($mod_strings); ob_start(); //$output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //FOR MULTI-SELECT $ListView->processListView($seed_bean, 'main', 'CAMPAIGN'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $app_list_strings, $sugar_version, $sugar_config; $output_html = "<script type=\"text/javascript\" src=\"" . getJSPath('include/javascript/sugar_3.js') . "\"></script>"; $where = ''; if (empty($_REQUEST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'])) { $_POST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'] = ''; } if (empty($_REQUEST['saved_associated_data'])) { $_POST['saved_associated_data'] = ''; } $where = $this->_get_where_clause(); // CREATE STUFF if ($this->_create) { $formBase = new $this->_popupMeta['create']['formBaseClass'](); if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') { $formBase->handleSave('', false, true); } $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE']; $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY']; $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL']; // TODO: cleanup the construction of $addform $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0]; $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1]; $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2]; $getFormMethod = empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod']; $formbody = $formBase->{$getFormMethod}($prefix, $mod, $formBody); $addform = '<table><tr><td nowrap="nowrap" valign="top">' . str_replace('<br>', '</td><td nowrap="nowrap" valign="top"> ', $formbody) . '</td></tr></table>' . '<input type="hidden" name="action" value="Popup" />'; $formSave = <<<EOQ \t\t\t<input type="hidden" name="create" value="true"> \t\t\t<input type="hidden" name="popup" value="true"> \t\t\t<input type="hidden" name="to_pdf" value="true"> \t\t\t<input type="hidden" name="return_module" value="{$currentModule}"> \t\t\t<input type="hidden" name="return_action" value="Popup"> \t\t\t<input type="submit" name="button" class="button" title="{$lbl_save_button_title}" value=" {$lbl_save_button_label} " /> \t\t\t<input type="button" name="button" class="button" title="{$app_strings['LBL_CANCEL_BUTTON_TITLE']}" accesskey="{$app_strings['LBL_CANCEL_BUTTON_KEY']}" value="{$app_strings['LBL_CANCEL_BUTTON_LABEL']}" onclick="toggleDisplay('addform');" /> EOQ; // if metadata contains custom inputs for the quickcreate if (!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) { foreach ($this->_popupMeta['customInput'] as $key => $value) { $formSave .= '<input type="hidden" name="' . $key . '" value="' . $value . '">\\n'; } } $createButtonTranslation = translate($this->_popupMeta['create']['createButton']); $createButton = <<<EOQ \t\t\t<input type="button" id="showAdd" name="showAdd" class="button" value="{$createButtonTranslation}" onclick="toggleDisplay('addform');" /> EOQ; $addformheader = get_form_header($createButtonTranslation, $formSave, false); } // END CREATE STUFF // search request inputs $searchInputs = array(); foreach ($this->_popupMeta['searchInputs'] as $input) { $searchInputs[$input] = empty($_REQUEST[$input]) ? '' : $_REQUEST[$input]; } $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) && empty($this->_hide_clear_button) ? false : true; $button = '<script>eval("var request_data = " + window.document.forms[\'popup_query_form\'].request_data.value);</script>'; if (isset($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $button .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='hidden' name='mode' value='MultiSelect'>"; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; if (isset($this->_popupMeta['templateForm'])) { $form = new XTemplate($this->_popupMeta['templateForm']); } else { $form = new XTemplate('modules/' . $currentModule . '/Popup_picker.html'); } $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('request_data', $request_data); // CREATE STUFF if ($this->_create) { $form->assign('CREATEBUTTON', $createButton); $form->assign('ADDFORMHEADER', $addformheader); $form->assign('ADDFORM', $addform); } // CREATE STUFF if (isset($this->_popupMeta['className'])) { $seed_bean = new $this->_popupMeta['className'](); } else { $seed_bean = new $this->_popupMeta['moduleMain'](); } // assign search inputs to xtemplates foreach (array_keys($searchInputs) as $key) { if (!empty($_REQUEST[$key]) && (isset($seed_bean->field_name_map[$key]['type']) && $seed_bean->field_name_map[$key]['type'] == 'bool')) { $form->assign(strtoupper($key), ' checked '); } else { $form->assign(strtoupper($key), $searchInputs[$key]); } } if ($this->_create) { $form->assign('CREATE', 'true'); } else { $form->assign('CREATE', 'false'); } // fill any doms if (isset($this->_popupMeta['selectDoms'])) { foreach ($this->_popupMeta['selectDoms'] as $key => $value) { $form->assign($key, get_select_options_with_id($app_list_strings[$value['dom']], $value['searchInput'])); } } $form->assign('MULTI_SELECT', !empty($_REQUEST['mode']) ? strtoupper($_REQUEST['mode']) : ''); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); $ListView = new ListView(); $ListView->show_select_menu = false; $ListView->show_delete_button = false; $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; $ListView->xTemplate->assign('TAG_TYPE', 'A'); if (isset($this->_popupMeta['listTitle'])) { $ListView->setHeaderTitle($this->_popupMeta['listTitle']); } else { $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); } $ListView->setHeaderText($button); $ListView->setQuery($where, '', $this->_popupMeta['orderBy'], $this->_popupMeta['varName']); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', $this->_popupMeta['varName']); $output_html .= ob_get_contents(); ob_end_clean(); $json = getJSONobj(); // decode then encode to escape "'s $output_html .= "</form>\n\t\t<script type=\"text/javascript\">\n\t\tfunction save_checks(offset) {\n\t\t\tchecked_ids = Array();\n\t\t\tfor (i = 0; i < document.MassUpdate.elements.length; i++){\n\t\t\t\tif(document.MassUpdate.elements[i].name == 'mass[]' && document.MassUpdate.elements[i].checked) {\n\t\t\t\t\ttemp_string = '';\n\t\t\t\t\ttemp_string += '\"' + document.MassUpdate.elements[i].value + '\": {';\n\t\t\t\t\tfor(the_key in associated_javascript_data[document.MassUpdate.elements[i].value]) {\n\t\t\t\t\t\ttemp_string += '\"' + the_key + '\":\"' + associated_javascript_data[document.MassUpdate.elements[i].value][the_key] + '\",'; \n\t\t\t\t\t}\n\t\t\t\t\ttemp_string = temp_string.substring(0,temp_string.length - 1);\n\t\t\t\t\ttemp_string += '}';\n\t\t\t\t\tchecked_ids.push(temp_string);\n\t\t\t\t}\t\t\t\t \n\t\t\t}\n\t\t\tdocument.MassUpdate.saved_associated_data.value = escape('{' + checked_ids.join(',') + '}');\n\n\t\t\tdocument.MassUpdate.action.value = \"Popup\";\n\t\t\tdocument.MassUpdate.{$currentModule}" . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset.value = offset; document.MassUpdate.submit(); } // reassigned the saved data from the saved checks if(typeof(document.MassUpdate) != \'undefined\' && document.MassUpdate.saved_associated_data.value != \'\') { temp_array = ' . (!empty($_REQUEST['saved_associated_data']) ? $json->encode($json->decode(urldecode($_REQUEST['saved_associated_data']))) : '\'\'') . '; for(the_key in temp_array) { associated_javascript_data[the_key] = temp_array[the_key]; } } // save checks across pages for multiselects if(typeof(document.MassUpdate) != "undefined") { checked_items = Array(); inputs_array = document.MassUpdate.elements; for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].style.display == "none") { checked_items.push(inputs_array[wp].value); } } for(i in checked_items) { for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].value == checked_items[i]) { inputs_array[wp].checked = true; } } } } </script>'; $output_html .= insert_popup_footer(); return $output_html; }
$filter1_expression_text = $display_array['lhs_field'] . " " . $display_array['operator'] . " " . $display_array['rhs_value']; } else { $filter1_expression_text = $mod_strings['LBL_SPECIFIC_FIELD_LNK']; } //end if base_id is there } else { $filter1_expression_text = $mod_strings['LBL_SPECIFIC_FIELD_LNK']; } $form->assign("TRIGGER_EXP_ID", $filter1_object->id); $form->assign("TRIGGER_RHS_VALUE", $filter1_object->rhs_value); $form->assign("TRIGGER_TEXT", $filter1_expression_text); $form->assign("TRIGGER_OPERATOR", $filter1_object->operator); $form->assign("TRIGGER_EXP_TYPE", $filter1_object->exp_type); $form->assign("TRIGGER_LHS_MODULE", $target_module); $form->assign("TRIGGER_LHS_FIELD", $filter1_object->lhs_field); /////////////////END Filter1 Object///////////////////////////////// /////////////////End Items ////////////////////// //close window and refresh parent if needed if (!empty($_REQUEST['special_action']) && $_REQUEST['special_action'] == "refresh") { $special_javascript = "window.opener.document.DetailView.action.value = 'DetailView'; \n"; $special_javascript .= "window.opener.document.DetailView.submit(); \n"; $special_javascript .= "window.close();"; $form->assign("SPECIAL_JAVASCRIPT", $special_javascript); } $form->parse("main"); $form->out("main"); ?> <?php insert_popup_footer();
/** * */ function process_page_for_address() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $image_path = 'themes/' . $theme . '/images/'; $formBase = new ContactFormBase(); if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') { $formBase->handleSave('', false, true); } $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name']; $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name']; $account_name = empty($_REQUEST['account_name']) ? '' : $_REQUEST['account_name']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE']; $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY']; $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL']; // TODO: cleanup the construction of $addform $formbody = $formBase->getFormBody('', '', 'EmailEditView'); $addform = '<table><tr><td nowrap="nowrap" valign="top">' . str_replace('<br>', '</td><td nowrap="nowrap" valign="top"> ', $formbody) . '</td></tr></table>' . '<input type="hidden" name="action" value="Popup" />'; $formSave = <<<EOQ \t\t<input type="submit" name="button" class="button" title="{$lbl_save_button_title}" accesskey="{$lbl_save_button_key}" value=" {$lbl_save_button_label} " /> \t\t<input type="button" name="button" class="button" title="{$app_strings['LBL_CANCEL_BUTTON_TITLE']}" accesskey="{$app_strings['LBL_CANCEL_BUTTON_KEY']}" value="{$app_strings['LBL_CANCEL_BUTTON_LABEL']}" onclick="toggleDisplay('addform');" /> EOQ; $createContact = <<<EOQ \t\t<input type="button" name="showAdd" class="button" value="{$mod_strings['LNK_NEW_CONTACT']}" onclick="toggleDisplay('addform');" /> EOQ; $addformheader = get_form_header($mod_strings['LNK_NEW_CONTACT'], $formSave, false); $button = "<form action='index.php' method='post' name='form' id='form'>\n"; if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Contacts/Address_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); //$form->assign('CREATECONTACT', $createContact); $form->assign('ADDFORMHEADER', $addformheader); $form->assign('ADDFORM', $addform); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('FIRST_NAME', $first_name); $form->assign('LAST_NAME', $last_name); $form->assign('ACCOUNT_NAME', $account_name); $form->assign('request_data', $request_data); // fill in for mass update $button = "<input type='hidden' name='module' value='Contacts'><input type='hidden' id='form_action' name='action' value='index'><input type='hidden' name='massupdate' value='true'><input type='hidden' name='delete' value='false'><input type='hidden' name='mass' value='Array'><input type='hidden' name='Update' value='Update'>"; if (isset($_REQUEST['mass']) && is_array($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $button .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } $button .= "<input type='hidden' name='saved_associated_data' value=''>"; $button .= "<input type='hidden' name='query' value='true'>"; $button .= "<input type='hidden' name='close_window' value='true'>"; $button .= "<input type='hidden' name='html' value='change_address'>"; $button .= "<input type='hidden' name='account_name' value='{$account_name}'>"; $button .= "<span style='display: none'><textarea name='primary_address_street'>" . str_replace("<br>", "\n", $_REQUEST["primary_address_street"]) . "</textarea></span>"; $button .= "<input type='hidden' name='primary_address_city' value='" . $_REQUEST["primary_address_city"] . "'>"; $button .= "<input type='hidden' name='primary_address_state' value='" . $_REQUEST["primary_address_state"] . "'>"; $button .= "<input type='hidden' name='primary_address_postalcode' value='" . $_REQUEST["primary_address_postalcode"] . "'>"; $button .= "<input type='hidden' name='primary_address_country' value='" . $_REQUEST["primary_address_country"] . "'>"; $button .= "<input type='hidden' name='Contacts_CONTACT_offset' value=''>"; $button .= "<input title='" . $mod_strings['LBL_COPY_ADDRESS_CHECKED'] . "' class='button' LANGUAGE=javascript type='submit' name='button' value=' " . $mod_strings['LBL_COPY_ADDRESS_CHECKED'] . " '>\n"; $button .= "<input title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " '>\n"; ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); //$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); //$form->parse('main.SearchHeader'); //$output_html .= $form->text('main.SearchHeader'); $output_html .= get_form_footer(); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new Contact(); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', '', 'CONTACT'); $ListView->setModStrings($mod_strings); // Added $ListView->process_for_popups = true; ob_start(); $ListView->processListViewMulti($seed_bean, 'main', 'CONTACT'); $output_html .= ob_get_contents(); ob_end_clean(); // The following is a regular expression filter that will convert the nested <a>...</a> tags // for the Next and Previous button links. The regular expression has 7 placeholder fields // Given sample HTML as follows /* ------------------------------------- <a href="/maint_4_5_0/index.php?module=Contacts&action=Popup&query=true&account_name=360 Vacations 723351&html=change_address&primary_address_street=111 Silicon Valley Road&primary_address_city=Ohio&primary_address_state=CA&primary_address_postalcode=53430&primary_address_country=USA&mode=undefined&create=undefined&metadata=undefined&Contacts_CONTACT_offset=20" onclick="javascript:return sListView.save_checks(20, \'Contacts_CONTACT_offset\')" class="listViewPaginationLinkS1">Next <img src=\'themes/GoldenGate/images/next.gif\' width=\'8\' height=\'11\' alt=\'Next\' border=\'0\' align=\'absmiddle\'></a> <a href="/maint_4_5_0/index.php?module=Contacts&action=Popup&query=true&account_name=360 Vacations 723351&html=change_address&primary_address_street=111 Silicon Valley Road&primary_address_city=Ohio&primary_address_state=CA&primary_address_postalcode=53430&primary_address_country=USA&mode=undefined&create=undefined&metadata=undefined&Contacts_CONTACT_offset=-100" onclick="javascript:return sListView.save_checks(980, \'Contacts_CONTACT_offset\')" class="listViewPaginationLinkS1">End <img src=\'themes/GoldenGate/images/end.gif\' width=\'13\' height=\'11\' alt=\'End\' border=\'0\' align=\'absmiddle\'> </a> -------------------------------------- The resulting preg_replace call should create Array of matches: [1] => Array ( [0] => 20 ) [2] => Array ( [0] => Next ) [3] => Array ( [0] => <img src='themes/GoldenGate/images/next.gif' width='8' height='11' alt='Next' border='0' align='absmiddle'> ) [4] => Array ( [0] => ) [5] => Array ( [0] => 980 ) [6] => Array ( [0] => End ) [7] => Array ( [0] => <img src='themes/GoldenGate/images/end.gif' width='13' height='11' alt='End' border='0' align='absmiddle'> ) */ $exp = '/<a.*?checks\\((\\d+),.*?>(.*?)(<img.*>).*<\\/a>(.*?)<a.*?checks\\((\\d+),.*?>(.*?)(<img.*>).*<\\/a>/Ui'; $change = '<a class="listViewPaginationLinkS1" onclick="javascript:save_checks(${1}, \'Contacts_CONTACT_offset\');" href="#"> ${2}${3}</a>${4}<a class="listViewPaginationLinkS1" onclick="javascript:save_checks(${5}, \'Contacts_CONTACT_offset\');" href="#">${6}${7}</a>'; $output_html = preg_replace(array($exp), array($change), $output_html); $output_html .= '<script> checked_items = Array(); inputs_array = document.MassUpdate.elements; for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].style.display == "none") { checked_items.push(inputs_array[wp].value); } } for(i in checked_items) { for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].value == checked_items[i]) { inputs_array[wp].checked = true; } } } </script>'; $output_html .= get_form_footer(); $output_html .= insert_popup_footer(); return $output_html; }