Click here to Skip to main content
15,884,176 members
Articles / Desktop Programming / Win32

Pipe template classes

Rate me:
Please Sign up or sign in to vote.
4.69/5 (9 votes)
2 Nov 2010MPL12 min read 146.2K   1.9K   33  
A template classes library to support pipe development with minimum programmer effort.
// Copyright (c) 2008, The Code Project. All rights reserved.
/// <reference path="../../JS/jquery-1.3.2-vsdoc2.js" />

function bookmarkMe(objId, objTypeId) {
    var idPrefix = "bm_";
	var bmkLink = GetBmkLink(idPrefix, objId.toString(), objTypeId.toString());
	var bmkStatusMsg = GetBmkStatusMsg(idPrefix, objId.toString(), objTypeId.toString());

	if (LoadWaitMessage(bmkLink, bmkStatusMsg))
	    $(bmkStatusMsg).load("/Script/Bookmarks/Ajax/Add.aspx?obtid=" + objTypeId + "&obid=" + objId + "&action=addbookmark");
	return false;
}

function watchMe(objId, objTypeId) {
    var idPrefix = "bmw_";
    var bmkLink = GetBmkLink(idPrefix, objId.toString(), objTypeId.toString());
    var bmkStatusMsg = GetBmkStatusMsg(idPrefix, objId.toString(), objTypeId.toString());
    
	if (LoadWaitMessage(bmkLink, bmkStatusMsg))
	    $(bmkStatusMsg).load("/Script/Bookmarks/Ajax/Add.aspx?obtid=" + objTypeId + "&obid=" + objId + "&action=addwatch");
	return false;
}

function GetBmkLink(idPrefix, objectId, objectTypeId) {
    return $("a[name=" + idPrefix + objectId + "_" + objectTypeId + "]");
}
function GetBmkStatusMsg(idPrefix, objectId, objectTypeId) {
	return document.getElementsByName(idPrefix + objectId + "_" + objectTypeId)[0];
}

function LoadWaitMessage(bmkLink, bmkStatusMsg)
{
	if (!bmkLink || !bmkStatusMsg) return false;

	$(bmkLink).css("display", "none");
    $(bmkStatusMsg).html(" please wait... ");
    $(bmkStatusMsg).css("display", "");
        
	return true;
}

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 Mozilla Public License 1.1 (MPL 1.1)


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

Comments and Discussions