echo get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], "", false); if (isset($_REQUEST['num'])) { $last_search['NUM'] = $_REQUEST['num']; } if (isset($_REQUEST['name'])) { $last_search['NAME'] = $_REQUEST['name']; } if (isset($_REQUEST['category'])) { $last_search['CATEGORY'] = $_REQUEST['category']; } if (isset($last_search)) { $form->assign("LAST_SEARCH", $last_search); } $form->parse("main.SearchHeader"); $form->out("main.SearchHeader"); echo get_form_footer(); $form->parse("main.SearchHeaderEnd"); $form->out("main.SearchHeaderEnd"); // Reset the sections that are already in the page so that they do not print again later. $form->reset("main.SearchHeader"); $form->reset("main.SearchHeaderEnd"); // Stick the form header out there. $ListView = new ListView(); $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, "", "num, name", "MATERIAL"); $ListView->setModStrings($mod_strings); $ListView->process_for_popups = true; $ListView->processListView($seed_object, "main", "MATERIAL"); insert_popup_footer();
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $image_path = 'themes/' . $theme . '/images/'; $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/Products/Popup_picker.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); 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 printing again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new Products(); $ListView = new ListView(); $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, '', 'name', 'PRODUCTS'); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', 'PRODUCTS'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_footer(); $output_html .= insert_popup_footer(); return $output_html; }
$noteForm = new NoteFormBase(); $postform = "<div id='accountnotelink'><p><a href='javascript:toggleDisplay(\"accountnote\");'>{$mod_strings['LNK_NEW_NOTE']}</a></p></div>"; $postform .= '<div id="accountnote" style="display:none">' . $noteForm->getFormBody('AccountNotes', 'Notes', 'BusinessCard', 85) . '</div>'; $xtpl->assign('POSTFORM', $postform); $xtpl->parse("main.headlessform"); //OPPORTUNITTY $xtpl->assign('FORMHEADER', get_form_header($mod_strings['LNK_NEW_OPPORTUNITY'], '', '')); require_once 'modules/Opportunities/OpportunityFormBase.php'; $oppForm = new OpportunityFormBase(); $xtpl->assign('CLASS', 'evenListRow'); $xtpl->assign('FORMBODY', "<slot class='dataLabel'><input class='checkbox' type='checkbox' name='newopportunity' onclick='toggleDisplay(\"newoppdiv\");'> " . $mod_strings['LNK_NEW_OPPORTUNITY'] . "</slot><div id='newoppdiv' style='display:none'>" . $oppForm->getWideFormBody('Opportunities', 'Opportunities', 'BusinessCard', '', false)); $xtpl->assign('FORMFOOTER', get_form_footer()); require_once 'modules/Notes/NoteFormBase.php'; $noteForm = new NoteFormBase(); $postform = "<div id='oppnotelink'><a href='javascript:toggleDisplay(\"oppnote\");'>{$mod_strings['LNK_NEW_NOTE']}</a></div>"; $postform .= '<div id="oppnote" style="display:none">' . $noteForm->getFormBody('OpportunityNotes', 'Notes', 'BusinessCard', 85) . '</div><br>'; $xtpl->assign('POSTFORM', $postform); $xtpl->parse("main.headlessform"); //Appointment $xtpl->assign('FORMHEADER', $mod_strings['LNK_NEW_APPOINTMENT']); require_once 'modules/Calls/CallFormBase.php'; $callForm = new CallFormBase(); $xtpl->assign('FORMBODY', "<slot class='dataLabel'><input class='checkbox' type='checkbox' name='newappointment' onclick='toggleDisplay(\"newappointmentdiv\");'> " . $mod_strings['LNK_NEW_APPOINTMENT'] . "</slot<div id='newappointmentdiv' style='display:none'>" . $callForm->getWideFormBody('Appointments', 'Calls', 85)); $xtpl->assign('FORMFOOTER', get_form_footer()); $xtpl->assign('POSTFORM', ''); $xtpl->parse("main.headlessform"); $xtpl->parse("main.save"); $xtpl->parse("main.endform"); $xtpl->parse("main"); $xtpl->out("main"); }
$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'); $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 Document(); $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 .= get_form_footer(); $output_html .= insert_popup_footer(); echo $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; $image_path = 'themes/' . $theme . '/images/'; $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()); $sugar_config['site_url'] = preg_replace('/^http(s)?\\:\\/\\/[^\\/]+/', "http\$1://" . $_SERVER['HTTP_HOST'], $sugar_config['site_url']); if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') { $sugar_config['site_url'] = preg_replace('/^http\\:/', 'https:', $sugar_config['site_url']); } $site_data = "<script> var site_url= {\"site_url\":\"" . $sugar_config['site_url'] . "\"};</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'] . "' 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->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'); $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'); //add tree view to output_html. $output_html .= $treehtml; // create the listview $seed_bean = new Document(); $ListView = new ListView(); $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 .= get_form_footer(); $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=\"include/javascript/sugar_3.js?s=" . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . "\"></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(); $image_path = 'themes/' . $theme . '/images/'; // 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}" accesskey="{$lbl_save_button_key}" 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'; } } //Edit: Peter Peshev if (isset($_REQUEST['custom_var']) && $_REQUEST['custom_var'] == "paper_rate") { $onclick_function = "add_paper_rate_check();"; } elseif (isset($_REQUEST['return_side']) && $_REQUEST['return_side'] == "paper_rate") { $onclick_function = "add_paper_rate_check();"; } else { $onclick_function = "toggleDisplay('addform');"; } $createButton = <<<EOQ \t\t\t\t<input type="button" name="showAdd" class="button" value="{$this->_popupMeta['create']['createButton']}" onclick="{$onclick_function}" /> EOQ; $addformheader = get_form_header($this->_popupMeta['create']['createButton'], $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']) ? 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; if ($currentModule == "Operations") { $button .= "<input type='hidden' name='mode' value='MultiSelect'>"; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected_operations('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } elseif ($currentModule == "Rateplate") { $button .= "<input type='hidden' name='mode' value='MultiSelect'>"; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected_plates('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } elseif ($currentModule == "Ratefilm") { $button .= "<input type='hidden' name='mode' value='MultiSelect'>"; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected_plates('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } elseif ($currentModule == "Ink") { $button .= "<input type='hidden' name='mode' value='MultiSelect'>"; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected_inks('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } else { $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'] . "' 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"; 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); if (isset($_REQUEST['custom_var'])) { $custom_var = $_REQUEST['custom_var']; } if (isset($_REQUEST['return_side'])) { $custom_var = $_REQUEST['return_side']; } if (isset($custom_var) && !is_null($custom_var) && !empty($custom_var)) { $form->assign('return_side', $custom_var); } // 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'); $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'); $ListView = new ListView(); $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); //$where = 'type="Книговезане"'; $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 .= get_form_footer(); $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(); $image_path = 'themes/' . $theme . '/images/'; $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name']; $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_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' 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/CampaignLog/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); 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 CampaignLog(); $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 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, '', 'campaign_name', 'CAMPAIGNLOG'); $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', 'CAMPAIGNLOG'); $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 $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_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; }
/** * @return void * @param unknown $seed * @param unknown $xTemplateSection * @param unknown $html_varName * @desc PUBLIC FUNCTION Handles List Views using seeds that extend SugarBean $XTemplateSection is the section in the XTemplate file that should be parsed usually main $html_VarName is the variable name used in the XTemplateFile e.g. TASK $seed is a seed there are two types of seeds one is a subclass of SugarBean, the other is a list usually created from a sugar bean using get_list if no XTemplate is set it will create a new XTemplate * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. * All Rights Reserved.. * Contributor(s): ______________________________________.. */ function processListViewTwo($seed, $xTemplateSection, $html_varName) { if (!isset($this->xTemplate)) { $this->createXTemplate(); } $isSugarBean = is_subclass_of($seed, "SugarBean"); $list = null; if ($isSugarBean) { $list = $this->processSugarBean($xTemplateSection, $html_varName, $seed); } else { $list = $seed; } if ($this->is_dynamic) { $this->processHeaderDynamic($xTemplateSection, $html_varName); $this->processListRows($list, $xTemplateSection, $html_varName); } else { $this->processSortArrows($html_varName); if ($isSugarBean) { $seed->parse_additional_headers($this->xTemplate, $xTemplateSection); } $this->xTemplateAssign('CHECKALL', "<img src='include/images/blank.gif' width=\"1\" height=\"1\" al=\"\">"); // Process the order by before processing the pro_nav. The pro_nav requires the order by values to be set $this->processOrderBy($html_varName); $this->processListRows($list, $xTemplateSection, $html_varName); } if ($this->display_header_and_footer) { $this->getAdditionalHeader(); if (!empty($this->header_title)) { echo get_form_header($this->header_title, $this->header_text, false); } } $this->xTemplate->out($xTemplateSection); if ($this->display_header_and_footer) { echo get_form_footer(); } if ($isSugarBean) { //echo "</td></tr>\n</table>\n"; if (isset($_SESSION['validation'])) { print base64_decode('PGEgaHJlZj0naHR0cDovL3d3dy5zdWdhcmNybS5jb20nPlBPV0VSRUQmbmJzcDtCWSZuYnNwO1NVR0FSQ1JNPC9hPg=='); } } }