Exemplo n.º 1
0
 /**
  *
  */
 function process_page()
 {
     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'];
     $user_name = empty($_REQUEST['user_name']) ? '' : $_REQUEST['user_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'] . "'  />\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/Employees/Popup_picker.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('USER_NAME', $user_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');
     // 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('Employees');
     $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, '', 'user_name', 'EMPLOYEE');
     $ListView->setModStrings($mod_strings);
     ob_start();
     $ListView->processListView($seed_bean, 'main', 'EMPLOYEE');
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= insert_popup_footer();
     return $output_html;
 }
Exemplo n.º 2
0
/**
 * Parses a sitemap entry
 * @param  XTemplate $t      CoTemplate object
 * @param  int       &$items Total items count
 * @param  array     $item   Item to be rendered
 */
function sitemap_parse($t, &$items, $item)
{
    global $cfg;
    $perpage = (int) $cfg['plugin']['sitemap']['perpage'];
    if ($items > 0 && $items % $perpage == 0) {
        // Save previous page
        $d = $items / $perpage - 1;
        $t->parse();
        sitemap_save($t->text(), $d);
        // Start another
        $t->reset();
    }
    // Parse another row
    $t->assign(array('SITEMAP_ROW_URL' => strpos($item['url'], '://') === false ? COT_ABSOLUTE_URL . $item['url'] : $item['url'], 'SITEMAP_ROW_DATE' => sitemap_date($item['date']), 'SITEMAP_ROW_FREQ' => sitemap_freq($item['freq']), 'SITEMAP_ROW_PRIO' => sitemap_prio($item['prio'])));
    $t->parse('MAIN.SITEMAP_ROW');
    $items++;
}
Exemplo n.º 3
0
$form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
$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();
Exemplo n.º 4
0
 /**
  *
  */
 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;
 }
Exemplo n.º 5
0
    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();
} else {
    require_once 'include/Popups/Popup_picker.php';
    $popup = new Popup_Picker();
    echo $popup->process_page();
Exemplo n.º 6
0
 /**
  *
  */
 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;
 }
Exemplo n.º 7
0
    /**
     *
     */
    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">&nbsp;', $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;
    }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
 /**
  *
  */
 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;
 }
Exemplo n.º 10
0
if ($_REQUEST['form'] == 'Edit') {
    $form->assign('READONLY', 'readonly="readonly"');
}
if (isset($_REQUEST['name'])) {
    $form->assign("NAME", $_REQUEST['name']);
}
$form->assign('DROPDOWN_SELECT', $_REQUEST['dropdown_select']);
$key = isset($_REQUEST['key']) ? $_REQUEST['key'] : '';
$value = isset($_REQUEST['value']) ? $_REQUEST['value'] : '';
$form->assign('KEY', $key);
$form->assign('VALUE', $value);
$array_index = isset($_REQUEST['array_index']) ? $_REQUEST['array_index'] : '';
$form->assign('INDEX', $array_index);
$form->assign('LANGUAGE_SELECT', $_REQUEST['language_select']);
$form->assign('SUBMIT_BUTTON_LABEL', $app_strings['LBL_SAVE_BUTTON_LABEL']);
$form->assign('SUBMIT_BUTTON_TITLE', $app_strings['LBL_SAVE_BUTTON_TITLE']);
$form->assign('SUBMIT_BUTTON_KEY', $app_strings['LBL_SAVE_BUTTON_KEY']);
$form->assign('CANCEL_BUTTON_LABEL', $app_strings['LBL_CANCEL_BUTTON_LABEL']);
$form->assign('CANCEL_BUTTON_TITLE', $app_strings['LBL_CANCEL_BUTTON_TITLE']);
$form->assign('CANCEL_BUTTON_KEY', $app_strings['LBL_CANCEL_BUTTON_KEY']);
///////////////////////////////////////
// Start the output
///////////////////////////////////////
insert_popup_header($theme);
echo get_form_header($mod_strings['LBL_DROPDOWN'], "", false);
$form->parse("main");
$form->out("main");
// Reset the sections that are already in the page so that they do not print again later.
$form->reset("main");
echo get_form_footer();
insert_popup_footer();
Exemplo n.º 11
0
 /**
  *
  */
 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">&nbsp;', $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("&lt;br&gt;", "\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&nbsp;
                <img src=\'themes/GoldenGate/images/next.gif\' width=\'8\' height=\'11\' alt=\'Next\'  border=\'0\' align=\'absmiddle\'></a>
                &nbsp;&nbsp;
                <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&nbsp;
                <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&nbsp;
        	        )
        	
        	    [3] => Array
        	        (
        	            [0] => <img src='themes/GoldenGate/images/next.gif' width='8' height='11' alt='Next'  border='0' align='absmiddle'>
        	        )
        	
        	    [4] => Array
        	        (
        	            [0] => &nbsp;&nbsp;
        	        )
        	
        	    [5] => Array
        	        (
        	            [0] => 980
        	        )
        	
        	    [6] => Array
        	        (
        	            [0] => End&nbsp;
        	        )
        	
        	    [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;
    }
Exemplo n.º 13
0
///////////////////////////////////////
// Start the output
///////////////////////////////////////
if ($style == 'popup') {
    insert_popup_header($theme);
    $xtpl->parse("popup");
    $xtpl->out("popup");
    $xtpl->parse("body.topsave");
    $xtpl->parse("body.cancel");
} else {
    $xtpl->parse("embeded");
    $xtpl->out("embeded");
    if (!empty($record_id)) {
        $xtpl->parse("body.cancel");
        $xtpl->parse("body.topsave");
    } else {
        $xtpl->parse("body.botsave");
    }
}
$xtpl->parse("body");
$xtpl->out("body");
// Reset the sections that are already in the page so that they do not print again later.
$xtpl->reset("main");
if ($style == 'popup') {
    insert_popup_footer();
}
$javascript = new javascript();
$javascript->setFormName('popup_form');
$javascript->setSugarBean($focus);
$javascript->addAllFields('');
echo $javascript->getScript();