Click here to Skip to main content
15,885,546 members
Articles / Web Development / ASP.NET

SharePoint Page Navigation Web Part

Rate me:
Please Sign up or sign in to vote.
4.56/5 (4 votes)
25 Mar 2009CPOL6 min read 126.9K   540   19  
Web Part for users to drop on their pages for navigation across the site collection.

var QB_DlgUrl = "/_layouts/QueryBuilder.aspx";
var QB_DlgDimension = "resizable:yes;dialogWidth:800px;dialogHeight:650px;status:no;location:no;menubar:no;help:no";
var QB_WarningFailedOperation_TEXT = "Do you wish to continue?";
var QB_NullSelectionText_TEXT = "Please select a target or click cancel";
var QB_IdSeparator = ",";

function QB_LaunchQueryBuilderDialog(siteUrl, list, view, query, isView, isQuery, isUserInput, callback) {
    if (view == null)
        view = "";
    if (query == null)
        query = "";
    if (isView == null)
        isView = false;
    if (isQuery == null)
        isQuery = false;
    if (isUserInput == null)
        isUserInput = false;

    var dialogUrl = QB_TrimLastSlash(siteUrl) + QB_DlgUrl + "?list=" + list + "&view=" + view + "&query=" + query;

    dialogUrl += "&isview=";
    if (isView)
        dialogUrl += "true";
    else
        dialogUrl += "false";

    dialogUrl += "&isquery=";
    if (isQuery)
        dialogUrl += "true";
    else
        dialogUrl += "false";
        
    dialogUrl += "&userinput=";
    if (isUserInput)
        dialogUrl += "true";
    else
        dialogUrl += "false";
        
    commonShowModalDialog(dialogUrl, QB_DlgDimension, callback, null);
}

function QB_TrimLastSlash(siteUrl) {
    return (siteUrl.charAt(siteUrl.length - 1) == "/") ? siteUrl.substring(0, (siteUrl.length - 1)) : siteUrl;
}

function QB_HandleOkReturnValues(strDlgReturnValue, strDlgReturnErr) {
    if (strDlgReturnValue[0].indexOf("Error:") >= 0) {
        alert(strDlgReturnValue[0].slice(7));
    }
    else {
        if (strDlgReturnErr.indexOf("Error:") >= 0) {
            var promptUser = strDlgReturnErr.slice(7) + "." + QB_NullSelectionText_TEXT;
            if (confirm(promptUser) == 0)
                return false;
        }
        setModalDialogReturnValue(window, strDlgReturnValue);
        window.top.close();
    }
    return false;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions