コード例 #1
0
ファイル: TreeData.php プロジェクト: jglaine/sugar761-ent
function get_node_data($params, $get_array = false)
{
    $ret = array();
    $click_level = $params['TREE']['depth'];
    if (isset($params['TREE']['caller']) and $params['TREE']['caller'] == 'Tags') {
        $href = false;
    }
    if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'browse') {
        $clickdepth = $params['TREE']['depth'];
        $nodes = get_tag_nodes_for_browsing($params['NODES'][$clickdepth]['id']);
    } else {
        if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'admin') {
            $clickdepth = $params['TREE']['depth'];
            $nodes = get_tags_nodes(false, true, $params['NODES'][$clickdepth]['id']);
        } else {
            if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'modal') {
                $clickdepth = $params['TREE']['depth'];
                $nodes = get_tags_nodes(false, false, $params['NODES'][$clickdepth]['id']);
                //$nodes=get_tags_nodes_cached(false);
            } else {
                if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'modalMoveDocs') {
                    $clickdepth = $params['TREE']['depth'];
                    $nodes = get_tags_modal_nodes($params['NODES'][$clickdepth]['id'], false);
                } else {
                    if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'applyTags') {
                        $clickdepth = $params['TREE']['depth'];
                        $nodes = get_tags_modal_nodes($params['NODES'][$clickdepth]['id'], true);
                    }
                }
            }
        }
    }
    foreach ($nodes as $node) {
        $ret['nodes'][] = $node->get_definition();
    }
    $json = new JSON(JSON_LOOSE_TYPE);
    $str = $json->encode($ret);
    return $str;
}
コード例 #2
0
        $nodes = get_tags_nodes(false, true, null);
        $root_node = new Node('All_Tags', $mod_strings['LBL_TAGS_ROOT_LABEL']);
        foreach ($nodes as $node) {
            $root_node->add_node($node);
        }
        $href_string = "javascript:handler:SUGAR.kb.adminClick()";
        if ($root_node) {
            $root_node->set_property("href", $href_string);
        }
        $root_node->expanded = true;
        $tagstree->add_node($root_node);
    } else {
        $tagstree->set_param('moduleview', 'modal');
        //$nodes = get_tags_nodes_cached(null);
        //$nodes=get_tags_nodes(false,null);
        $nodes = get_tags_nodes(false, false, null);
        $root_node = new Node('All_Tags', $mod_strings['LBL_TAGS_ROOT_LABEL']);
        foreach ($nodes as $node) {
            $root_node->add_node($node);
        }
        $href_string = "javascript:handler:SUGAR.kb.modalClose('tagstree')";
        if ($root_node) {
            $root_node->set_property("href", $href_string);
        }
        $root_node->expanded = true;
        $tagstree->add_node($root_node);
    }
    //$tagstree->add_node($root_node);
    $response = $tagstree->generate_nodes_array();
} else {
    $response = 1;
コード例 #3
0
ファイル: SearchHome.php プロジェクト: jglaine/sugar761-ent
function return_advanced_tab($focus, $json, $json_config)
{
    global $theme, $image_path, $app_list_strings, $mod_strings, $app_strings;
    $ss_adv = new Sugar_Smarty();
    $ss_adv->assign("MOD", $mod_strings);
    $ss_adv->assign("APP", $app_strings);
    //assign back values from last search, if it exists.
    //do not set any values if value has been set
    if (isset($_POST['clear_loaded'])) {
        $_POST['searchText'] = '';
        foreach ($_POST as $_key => $_val) {
            $ss_adv->assign($_key, '');
        }
    } else {
        foreach ($_POST as $_key => $_val) {
            $ss_adv->assign($_key, $_val);
        }
    }
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'FTSFormAdvanced', 'field_to_name_array' => array('id' => 'kbdoc_approver_id', 'name' => 'kbdoc_approver_name'));
    $ss_adv->assign('encoded_approver_popup_request_data', $json->encode($popup_request_data));
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'FTSFormAdvanced', 'field_to_name_array' => array('id' => 'kbarticle_author_id', 'name' => 'kbarticle_author_name'));
    $ss_adv->assign('encoded_author_popup_request_data', $json->encode($popup_request_data));
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'FTSFormAdvanced', 'field_to_name_array' => array('id' => 'tag_id', 'tag_name' => 'tag_name'));
    $ss_adv->assign('encoded_tags_popup_request_data', $json->encode($popup_request_data));
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'FTSFormAdvanced', 'field_to_name_array' => array('id' => 'team_id', 'name' => 'team_name'));
    $json = getJSONobj();
    $ss_adv->assign('encoded_team_popup_request_data', $json->encode($popup_request_data));
    $ss_adv->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
    $ss_adv->assign("ID", $focus->id);
    $ss_adv->assign("DOCUMENT_NAME", $focus->kbdocument_name);
    $ss_adv->assign("DESCRIPTION", $focus->description);
    $ss_adv->assign("ACTIVE_DATE", $focus->active_date);
    $ss_adv->assign("EXP_DATE", $focus->exp_date);
    $status_option = "<option value='' selected>" . $app_strings['LBL_NONE'] . "</option> ";
    if (isset($_POST['status_id'])) {
        $status_option .= get_select_options_with_id($app_list_strings['kbdocument_status_dom'], $_POST['status_id']);
        $ss_adv->assign("STATUS_OPTIONS", $status_option);
    } else {
        $status_option .= get_select_options_with_id($app_list_strings['kbdocument_status_dom'], '');
        $ss_adv->assign("STATUS_OPTIONS", $status_option);
    }
    if (isset($_POST['saved_search_select']) && !empty($_POST['saved_search_select'])) {
        $ss_adv->assign("SAVED_SEARCH_OPTIONS", getSavedSearchOptions($focus, $_POST['saved_search_select']));
        $savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . getSavedSearchOptions($focus, $_POST['saved_search_select'], true)));
    } else {
        $ss_adv->assign("SAVED_SEARCH_OPTIONS", getSavedSearchOptions($focus));
        $savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . getSavedSearchOptions($focus, '', true)));
    }
    $str = "<script>\n    YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, {$savedSearchSelects});\n    </script>";
    echo $str;
    if (isset($_POST['canned_search'])) {
        $ss_adv->assign("CANNED_SEARCH_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_canned_search'], $_POST['canned_search']));
    } else {
        $ss_adv->assign("CANNED_SEARCH_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_canned_search'], ''));
    }
    $a1_style = '';
    $x1_style = '';
    $a2_style = 'none';
    $x2_style = 'none';
    //set the expiration date filter if it exists.  Also set the style properties
    //that will determine whether to show or hide the supporting text boxes
    if (isset($_POST['active_date_filter'])) {
        $ss_adv->assign("ACTIVE_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], $_POST['active_date_filter']));
        if ($_POST['active_date_filter'] == 'on' || $_POST['active_date_filter'] == 'before' || $_POST['active_date_filter'] == 'after') {
            $a1_style = '';
        } else {
            $a1_style = 'none';
        }
        if ($_POST['active_date_filter'] == 'between_dates') {
            $a2_style = '';
        }
    } else {
        $ss_adv->assign("ACTIVE_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], ''));
    }
    //set the expiration date filter if it exists.  Also set the style properties
    //that will determine whether to show or hide the supporting text boxes
    if (isset($_POST['exp_date_filter'])) {
        $ss_adv->assign("EXP_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], $_POST['exp_date_filter']));
        if ($_POST['exp_date_filter'] == 'on' || $_POST['exp_date_filter'] == 'before' || $_POST['exp_date_filter'] == 'after') {
            $x1_style = '';
        } else {
            $x1_style = 'none';
        }
        if ($_POST['exp_date_filter'] == 'between_dates') {
            $x2_style = '';
        }
    } else {
        $ss_adv->assign("EXP_DATE_FILTER_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_date_filter_options'], ''));
    }
    //set the style sheet properties for date filters
    $ss_adv->assign("A_DATE1_STYLE", $a1_style);
    $ss_adv->assign("X_DATE1_STYLE", $x1_style);
    $ss_adv->assign("A_DATE2_STYLE", $a2_style);
    $ss_adv->assign("X_DATE2_STYLE", $x2_style);
    $attach_name_style = 'none';
    $attach_mime_style = 'none';
    if (isset($_POST['attachments'])) {
        $ss_adv->assign("ATTACHMENT_SELECT_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_attachment_option_dom'], $_POST['attachments']));
        if ($_POST['attachments'] == 'mime') {
            $attach_mime_style = ' ';
        } else {
            if ($_POST['attachments'] == 'name') {
                $attach_name_style = ' ';
            }
        }
    } else {
        $ss_adv->assign("ATTACHMENT_SELECT_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_attachment_option_dom'], ''));
    }
    $ss_adv->assign("ATTACHMENT_NAME_STYLE", $attach_name_style);
    $ss_adv->assign("ATTACHMENT_MIME_STYLE", $attach_mime_style);
    if (!empty($focus->kbdoc_approver_id)) {
        $user = BeanFactory::getBean('Users', $focus->kbdoc_approver_id);
        $ss_adv->assign("KBDOC_APPROVER_NAME", $user->name);
        $ss_adv->assign("KBDOC_APPROVER_ID", $focus->kbdoc_approver_id);
    }
    global $timedate;
    $ss_adv->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
    $ss_adv->assign("USER_DATE_FORMAT", $timedate->get_user_date_format());
    $ss_adv->assign('JSON_CONFIG_JAVASCRIPT', $json_config->get_static_json_server());
    if (isset($_POST['frequency'])) {
        $ss_adv->assign("FRQ_VIEW_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_viewing_frequency_dom'], $_POST['frequency']));
    } else {
        $ss_adv->assign("FRQ_VIEW_OPTIONS", get_select_options_with_id($app_list_strings['kbdocument_viewing_frequency_dom'], ''));
    }
    if (isset($_POST['is_external_article'])) {
        if ($_POST['is_external_article']) {
            $ss_adv->assign('is_external_id', '1');
            $ss_adv->assign('is_external_checked', 'checked');
        } else {
            $ss_adv->assign('is_external_id', '0');
            $ss_adv->assign('is_external_checked', '');
        }
    }
    //create tree for tag selection modal
    $tag = BeanFactory::getBean('KBTags');
    $ss_adv->assign("TAG_NAME", $tag->tag_name);
    //tree header.
    $tagstree = new Tree('tagstree');
    $tagstree->set_param('module', 'KBTags');
    $tagstree->set_param('moduleview', 'modal');
    $nodes = get_tags_nodes(false, false, null);
    $root_node = new Node('All_Tags', $mod_strings['LBL_TAGS_ROOT_LABEL']);
    foreach ($nodes as $node) {
        $root_node->add_node($node);
    }
    $href_string = "javascript:handler:modalClose('tagstree')";
    if ($root_node) {
        $root_node->set_property("href", $href_string);
    }
    $root_node->expanded = true;
    $tagstree->add_node($root_node);
    $ss_adv->assign("TREEINSTANCE", $tagstree->generate_nodes_array());
    return $ss_adv->fetch("modules/KBDocuments/tpls/advancedTab.tpl");
}