Ejemplo n.º 1
0
 function getAppMetaJSON($scheduler = false)
 {
     global $json, $sugar_config;
     $str = "\nvar " . $this->global_registry_var_name . " = new Object();\n";
     $str .= "\n" . $this->global_registry_var_name . ".config = {\"site_url\":\"" . getJavascriptSiteURL() . "\"};\n";
     $str .= $this->global_registry_var_name . ".meta = new Object();\n";
     $str .= $this->global_registry_var_name . ".meta.modules = new Object();\n";
     /*
     $modules_arr = array('Meetings','Calls');
     $meta_modules = array();
     
     global $beanFiles,$beanList;
     //header('Content-type: text/xml');
     foreach($modules_arr as $module) {
     	require_once($beanFiles[$beanList[$module]]);
     	$focus = new $beanList[$module];
     	$meta_modules[$module] = array();
     	$meta_modules[$module]['field_defs'] = $focus->field_defs;
     }
     
     $str .= $this->global_registry_var_name.".meta.modules.Meetings = ". $json->encode($meta_modules['Meetings'])."\n";
     $str .= $this->global_registry_var_name.".meta.modules.Calls = ". $json->encode($meta_modules['Calls'])."\n";
     */
     return $str;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
    /**
     * @see SugarView::display()
     */
    public function display()
    {
        global $mod_strings;
        $ss = new Sugar_Smarty();
        $ss->assign("MOD", $GLOBALS['mod_strings']);
        $ss->assign("INSTRUCTION", "<h1>{$mod_strings['LNK_BROWSER']}</h1>");
        //tree header.
        $doctree = new Tree('doctree');
        $doctree->tree_style = 'include/ytree/TreeView/css/default/tree.css';
        $doctree->set_param('module', 'xeBayCategories');
        $nodes = get_node_data(array('TREE' => array('depth' => 0)), true);
        // $nodes = get_category_nodes($href_string);
        // $nodes = $this->get_test_nodes($href_string);
        foreach ($nodes as $node) {
            $doctree->add_node($node);
        }
        $ss->assign("TREEHEADER", $doctree->generate_header());
        $ss->assign("TREEINSTANCE", $doctree->generate_nodes_array());
        $site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n";
        $ss->assign("SITEURL", $site_data);
        $javascript = <<<EOQ
EOQ;
        $ss->assign("JAVASCRIPT", $javascript);
        echo $ss->fetch("modules/xeBayCategories/tpls/browser.tpl");
    }
Ejemplo n.º 4
0
    function process_page()
    {
        global $mod_strings, $app_strings, $currentModule, $seed_object, $sugar_version, $sugar_config;
        $focus = BeanFactory::getBean('ProductCategories');
        if (!isset($_REQUEST['html'])) {
            $xtpl = new XTemplate('modules/ProductCategories/Popup_picker.html');
            $GLOBALS['log']->debug("using file modules/ProductCategories/Popup_picker1.html");
        } else {
            $_REQUEST['html'] = preg_replace("/[^a-zA-Z0-9_]/", "", $_REQUEST['html']);
            $GLOBALS['log']->debug("_REQUEST['html'] is " . $_REQUEST['html']);
            $xtpl = new XTemplate('modules/ProductCategories/' . $_REQUEST['html'] . '.html');
            $GLOBALS['log']->debug("using file modules/ProductCategories/" . $_REQUEST['html'] . '.html');
        }
        insert_popup_header();
        //tree header.
        $prodcattree = new Tree('productcategories');
        $prodcattree->set_param('module', 'ProductCategories');
        $parents = array();
        if (!empty($_REQUEST['parent_category_id'])) {
            $parents = $this->find_parents($_REQUEST['parent_category_id']);
        }
        $nodes = get_product_categories(null, $parents);
        foreach ($nodes as $node) {
            $prodcattree->add_node($node);
        }
        $xtpl->assign("TREEHEADER", $prodcattree->generate_header());
        $xtpl->assign("TREEINSTANCE", $prodcattree->generate_nodes_array());
        $xtpl->assign("MODULE_NAME", $currentModule);
        global $sugar_config;
        $site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n";
        $xtpl->assign("SITEURL", $site_data);
        if (!empty($_REQUEST['form']) && $_REQUEST['form'] == 'EditView') {
            $the_javascript = "<script type='text/javascript' language='JavaScript'>\n";
            $the_javascript .= "function set_return(treeid) { \n";
            $the_javascript .= "    node=YAHOO.namespace(treeid).selectednode;";
            $the_javascript .= "    window.opener.document.EditView.parent_id.value = node.data.id;\n";
            $the_javascript .= "    window.opener.document.EditView.parent_name.value = node.label;\n";
            $the_javascript .= "     window.close();\n";
            $the_javascript .= "}\n";
            $the_javascript .= "</script>\n";
            $clear_button = "<input title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"window.opener.document.EditView.parent_id.value = '';window.opener.document.EditView.parent_name.value = ''; window.close()\" type='submit' name='button' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  '>\n";
            $cancel_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";
        }
        if (empty($_REQUEST['form']) || $_REQUEST['form'] == 'EditView' && $_REQUEST['tree'] == 'ProdCat') {
            $seed_object->show_products = FALSE;
            $the_javascript = <<<END
            <script type='text/javascript' language='JavaScript'>
                var field_id = null;
                var field_name = null;

                function set_return(treeid) {

                    if(typeof treeid != 'undefined') {
                        node=YAHOO.namespace(treeid).selectednode;
                    } else {
                        node = {'data': {'id': ''}, 'label': ''};
                    }

                    if (typeof window.opener.document.forms.search_form != 'undefined' || window.opener.document.forms.popup_query_form != 'undefined') { // Search
                        var form = (typeof window.opener.document.forms.search_form != 'undefined') ? window.opener.document.forms.search_form : window.opener.document.forms.popup_query_form;
                        var searchType = (typeof form.searchFormTab != 'undefined' && form.searchFormTab.value == 'basic_search') ? 'basic' : 'advanced';

                        field_id = form['category_id_'   + searchType];
                        field_name = form['category_name_'   + searchType];
                    } else if(typeof window.opener.document.ReportsWizardForm != 'undefined') { // reports
                        field_id = window.opener.document.ReportsWizardForm['ProductCategories:name:id:1'];
                        field_name = window.opener.document.ReportsWizardForm['ProductCategories:name:name:1'];
                    } else if(typeof window.opener.document.EditView != 'undefined') {
                        field_id = window.opener.document.EditView.category_id;
                        field_name = window.opener.document.EditView.category_name;
                    }

                    if(field_id != null && field_name != null) {
                        field_id.value = node.data.id;
                        field_name.value = node.label;
                    }

                    window.close();
                }
            </script>
END;
            $clear_button = "<input title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"set_return()\" type='submit' name='button' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  '>\n";
            $cancel_button = "<input title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  '>\n";
        }
        $xtpl->assign("SET_RETURN_JS", $the_javascript);
        $xtpl->assign("CLEAR_BUTTON", $clear_button);
        $xtpl->assign("CANCEL_BUTTON", $cancel_button);
        $xtpl->parse('main');
        $xtpl->out('main');
    }