Uploading...
";
config.domElement.innerHTML = html;
this.submit = function() {
var cb = {
upload: function(evt) {
if (config.callbacks && config.callbacks.oncomplete) {
config.callbacks.oncomplete();
}
that.dispose();
}
};
config.domElement.firstChild.action = FIRSTCLASS.lang.ensureSlashUrl(config.baseUrl) + FIRSTCLASS.opCodes.Attach;
FIRSTCLASS.util.net.doAsyncPost({ form: config.domElement.firstChild, upload: true, callbacks: cb });
YAHOO.util.Dom.addClass(config.domElement.firstChild, "fcHidden");
YAHOO.util.Dom.removeClass(config.domElement.lastChild, "fcHidden");
};
this.cancel = function() {
that.dispose();
};
/* YAHOO.util.Event.addListener(config.domElement.firstChild, 'submit', onsubmit);*/
this.dispose = function() {
YAHOO.util.Event.purgeElement(config.domElement, true);
};
this.setChangeHandler = function(handler) {
YAHOO.util.Event.on('fcWidgetUpload_input', 'change', function(ev) {
YAHOO.util.Event.stopEvent(ev);
handler();
YAHOO.util.Event.purgeElement('fcWidgetUpload_input');
return true;
});
};
},
setupForGlow: function(btnElement, darkBkgrnd) {
var hoverBtn = darkBkgrnd ? "dark" : "white";
YAHOO.util.Event.purgeElement(btnElement, true);
YAHOO.util.Dom.setStyle(btnElement, 'cursor', 'pointer');
YAHOO.util.Event.addListener(btnElement, "mouseover", function() {
this.firstChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonON' + hoverBtn + '_left.png';
YAHOO.util.Dom.setStyle(this.firstChild.nextSibling, 'background-image', 'url(' + FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonON' + hoverBtn + '_mid.png)');
this.lastChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonON' + hoverBtn + '_right.png';
});
YAHOO.util.Event.addListener(btnElement, "mouseout", function() {
this.firstChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonOUTLINE_left.png';
YAHOO.util.Dom.setStyle(this.firstChild.nextSibling, 'background-image', '');
this.lastChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonOUTLINE_right.png';
});
},
flashButton: function(btnElement) {
var that = this;
if (this._shine & 1) {
btnElement.firstChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonOUTLINE_left.png';
YAHOO.util.Dom.setStyle(btnElement.firstChild.nextSibling, 'background-image', '');
btnElement.lastChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonOUTLINE_right.png';
} else {
btnElement.firstChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonONdark_left.png';
YAHOO.util.Dom.setStyle(btnElement.firstChild.nextSibling, 'background-image', 'url(' + FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonONdark_mid.png)');
btnElement.lastChild.firstChild.src = FIRSTCLASS.session.templatebase + '/' + FIRSTCLASS.session.fcbase + '/images/ButtonONdark_right.png';
}
if (this._shine < 3) {
++this._shine;
setTimeout(function() { that.flashButton(btnElement); }, 750);
}
},
setSubscribeBtn: function(subscribeTD, btnElement, isMyBuddy) {
var that = this;
if (isMyBuddy) {
FIRSTCLASS.ui.Dom.setInnerHTML(btnElement, FIRSTCLASS.locale.profile.stopFollow);
YAHOO.util.Event.removeListener(subscribeTD, 'click');
YAHOO.util.Dom.setStyle(subscribeTD, 'cursor', 'default');
YAHOO.util.Event.removeListener(subscribeTD, "mouseover");
} else {
FIRSTCLASS.ui.Dom.setInnerHTML(btnElement, FIRSTCLASS.locale.profile.follow);
}
if (subscribeTD !== null) {
that._shine = 0;
setTimeout(function() { that.flashButton(subscribeTD); }, 750);
}
},
setupSubscribing: function() {
var that = this;
var subscribe = document.getElementById('fcMiniProfileSubscribe');
if (subscribe !== null) {
var btnTextElem = FIRSTCLASS.ui.Dom.getChildByClassName('fcProfileEditBtns', subscribe);
that.setupForGlow(subscribe, true);
that.setSubscribeBtn(null, btnTextElem, FIRSTCLASS.util.BuddyList.isBuddy(FIRSTCLASS.ui.MiniProfile.lastUID));
YAHOO.util.Event.addListener(subscribe, 'click', function() {
var handleSuccess = function(o) {
var wasActivate = FIRSTCLASS.util.BuddyList._dataSource.isActive();
if (!wasActivate) {
FIRSTCLASS.util.BuddyList._dataSource.activate();
}
setTimeout(function() {
FIRSTCLASS.util.BuddyList._dataSource.fetchRows();
if (!wasActivate) {
setTimeout(function() {
FIRSTCLASS.util.BuddyList._dataSource.deactivate();
}, 3000);
}
}, 4000);
that.setSubscribeBtn(subscribe, btnTextElem, true);
};
var handleFailure = function(o) {
if (btnTextElem !== null) {
FIRSTCLASS.ui.Dom.setInnerHTML(btnTextElem, FIRSTCLASS.locale.profile.failed);
}
};
var callback = {
success: handleSuccess,
failure: handleFailure
};
if (FIRSTCLASS.ui.MiniProfile.lastUID) {
if (FIRSTCLASS.util.BuddyList.isBuddy(FIRSTCLASS.ui.MiniProfile.lastUID)) {
FIRSTCLASS.util.BuddyList.deleteBuddy(FIRSTCLASS.ui.MiniProfile.lastUID);
that.setSubscribeBtn(subscribe, btnTextElem, false);
} else {
FIRSTCLASS.util.BuddyList.addBuddy(null, FIRSTCLASS.ui.MiniProfile.lastUID, callback);
}
} else {
alert("FIRSTCLASS.ui.MiniProfile.lastUID is UNDEFINED");
}
});
}
},
setupChatButton: function(row) {
var that = this;
var dochat = document.getElementById('fcMiniProfileDoChat');
if (dochat != null) {
that.setupForGlow(dochat, true);
YAHOO.util.Event.addListener(dochat, 'click', function() {
FIRSTCLASS.apps.Global.chat.openChat(row.uid, row.name);
FIRSTCLASS.ui.MiniProfile.hideBoxNow();
});
}
return dochat;
},
showMiniProfile: function(domElement, user, callbacks, showoncomplete, showFollowBtn, neverHover, showtoolbar) {
var that = this;
var handleProfileError = function(response) {
FIRSTCLASS.ui.MiniProfile.hideBoxNow();
if (callbacks && callbacks.profileFail) {
callbacks.profileFail(user.name);
}
return;
}
var handleProfile = function(response) {
if ((user.uid <= 0) || (CIDOfUser != user.uid)) {
// alert("CID <=0 --- Please let DEV know about this");
return;
}
if ((YAHOO.env.ua.ie) && ((response.responseText.indexOf("ERR404") >= 0) || (response.responseText.indexOf("ERR403") >= 0))) {
handleProfileError(response);
return;
}
var tempContainer = document.createElement("div");
tempContainer.innerHTML = response.responseText;
domElement.innerHTML = FIRSTCLASS.ui.Dom.getChildByIdName('popUp', tempContainer).innerHTML;
var ministatMsg = FIRSTCLASS.ui.Dom.getChildByIdName('statusMsg', domElement);
FIRSTCLASS.ui.Dom.setInnerHTML(FIRSTCLASS.lang.mlesc(ministatMsg, FIRSTCLASS.util.expandHashTags(ministatMsg.innerHTML.parseURLS(23, 30))));
var timeDiv = FIRSTCLASS.ui.Dom.getChildByIdName('lastmsgtime', domElement);
if (timeDiv) {
var statTime = parseInt(timeDiv.innerHTML, 10);
if (!isNaN(statTime) && (statTime !== 0)) {
timeDiv.innerHTML = "(" + FIRSTCLASS.util.Date.getFriendlyDateTimeString(FIRSTCLASS.lang.fcTimeToDate(statTime)) + ")";
}
}
var applyParams = function(el, neverHover) {
if (neverHover) {
if (el.getAttribute) {
el.setAttribute('fcid', '');
el.setAttribute('fcevents', '');
el.setAttribute('fcattrs', '');
el.setAttribute('nohover', 'true');
el.setAttribute('uid', '');
}
}
else {
if (el.getAttribute && (el.getAttribute('fcid') == null)) {
el.setAttribute('fcid', 'user');
el.setAttribute('fcevents', 'mouseout,mouseover,mousemove');
// el.setAttribute('fcattrs', row.name);
el.setAttribute('nohover', 'true');
el.setAttribute('uid', user.uid);
}
}
};
var walkNodes = function(el, func, neverHover) {
func(el, neverHover);
if (el.childNodes) {
var i;
for (i = 0; i < el.childNodes.length; i++) {
walkNodes(el.childNodes[i], func, neverHover);
}
}
};
walkNodes(domElement.firstChild, applyParams, neverHover);
if (callbacks && callbacks.loaded) {
callbacks.loaded();
}
YAHOO.util.Dom.setStyle(domElement, 'height', (domElement.firstChild.clientHeight + 5) + 'px');
if (FIRSTCLASS.ui.MiniProfile.overlayBox && domElement.parentNode.parentNode.id == FIRSTCLASS.ui.MiniProfile.overlayBox.id) {
YAHOO.util.Dom.setStyle(FIRSTCLASS.ui.MiniProfile.overlayBox, 'height', (domElement.firstChild.clientHeight + 5) + 'px');
YAHOO.util.Dom.setStyle(FIRSTCLASS.ui.MiniProfile.overlayBox.firstChild, 'height', (domElement.firstChild.clientHeight + 5) + 'px');
}
if (showoncomplete) {
FIRSTCLASS.ui.MiniProfile.showBoxNow();
}
};
CIDOfUser = user.uid;
var theURL = FIRSTCLASS.util.User.getProfileUrlByCid(CIDOfUser) + "FCXResume?Templates=Popup";
if (typeof showtoolbar == "undefined" || showtoolbar) {
theURL += "&ShowToolbar=1";
}
if (FIRSTCLASS.util.BuddyList.isBuddy(CIDOfUser)) {
theURL += "&IsBuddy=1";
}
if (user && user.name) {
theURL += "&username=" + user.name;
}
if (CIDOfUser == FIRSTCLASS.session.user.cid) {
theURL += "&" + FIRSTCLASS.util.User.LatestImageTimestamp;
}
var callback = {
success: handleProfile,
failure: handleProfileError
};
var request = FIRSTCLASS.util.net.doAsyncGet({ action: theURL, callbacks: callback });
}
},
/**
* set the current document's title in the browser window and fcNavBar
*
* @method setDocumentTitle
* @param {string} newTitle (required) the new title string
* @static
*/
setDocumentTitle: function(newTitle) {
var titleElement = $("fcNavTitle");
if (titleElement) {
FIRSTCLASS.ui.navBar.setTitle(newTitle);
FIRSTCLASS.ui._docTitle = newTitle;
var svTitle = (FIRSTCLASS.session.serverName) ? (": " + FIRSTCLASS.session.serverName) : "";
document.title = newTitle + svTitle;
}
},
setPageRSSFeed: function(obj) {
/*
var rssfeed = $('RSSFeedElement');
if (rssfeed) {
rssfeed.parentNode.removeChild(rssfeed);
}
rssfeed = document.createElement("link");
var parent = document.getElementsByTagName("head").item(0);
rssfeed.id = 'RSSFeedElement';
rssfeed.href = obj.href;
rssfeed.atitle = obj.title;
rssfeed.type = "application/rss+xml";
rssfeed.rel = "alternate";
parent.appendChild(rssfeed);
*/
},
clearPageRSSFeed: function() {
var rssfeed = $('RSSFeedElement');
if (rssfeed) {
rssfeed.parentNode.removeChild(rssfeed);
}
},
Dom: {
updateViewportBounds: function() {
if (!this._viewportBounds) {
FIRSTCLASS.ui.Dom.onViewportTimeout();
} else {
if (this.viewportTimeout) {
window.clearTimeout(this.viewportTimeout);
}
this.viewportTimeout = FIRSTCLASS.setTimeout(FIRSTCLASS.ui.Dom.onViewportTimeout, 50);
}
},
onViewportTimeout: function() {
FIRSTCLASS.ui.Dom._viewportBounds = {
//wd:YAHOO.util.Dom.getViewportWidth(),
wd: YAHOO.util.Dom.getViewportWidth(),
ht: YAHOO.util.Dom.getViewportHeight()
};
if (FIRSTCLASS.session.getActiveApplication() && FIRSTCLASS.session.getActiveApplication().resizeEvent) {
FIRSTCLASS.session.getActiveApplication().resizeEvent();
}
if (FIRSTCLASS.apps.Global) {
FIRSTCLASS.apps.Global.resizeEvent();
}
FIRSTCLASS.ui.Dom._viewportTimeout = false;
}, /*
updateViewportBounds: function (wd, ht) {
if (!wd) {
wd = document.width;
}
if (!ht) {
ht = YAHOO.util.Dom.getViewportHeight();
}
this._viewportBounds = {
//wd:YAHOO.util.Dom.getViewportWidth(),
wd: wd,
ht: ht
};
},*/
getViewportBounds: function() {
if (!this._viewportBounds) {
this.updateViewportBounds();
}
return this._viewportBounds;
},
getViewportHeight: function() {
if (!this._viewportBounds) {
this.updateViewportBounds();
}
return this._viewportBounds.ht;
},
getViewportWidth: function() {
if (!this._viewportBounds) {
this.updateViewportBounds();
}
return this._viewportBounds.wd;
},
clearElementChildren: function(element) {
var newContainer = document.createElement("div");
while (element.firstChild) {
var child = element.firstChild;
FIRSTCLASS.ui.Dom.reparentNode(child, newContainer);
}
return newContainer;
},
setInnerHTML: function(element, html) {
try {
element.innerHTML = html;
} catch (e) {
var tmp = document.createElement("div");
tmp.innerHTML = html;
FIRSTCLASS.ui.Dom.replaceChildrenWithChildren(element, tmp);
}
},
replaceChildrenWithChildren: function(element, from) {
var newcontainer = FIRSTCLASS.ui.Dom.clearElementChildren(element);
while (from.firstChild) {
var child = from.firstChild;
FIRSTCLASS.ui.Dom.reparentNode(child, element);
}
return newcontainer;
},
replaceContentsWithElement: function(element, newcontents) {
var newContainer = FIRSTCLASS.ui.Dom.clearElementChildren(element);
element.appendChild(newcontents);
return newContainer;
},
replaceContents: function(element, replace) {
FIRSTCLASS.ui.Dom.clearElementChildren(element);
while (replace.firstChild) {
FIRSTCLASS.ui.Dom.reparentNode(replace.firstChild, element);
}
},
reparentNode: function(element, newparent) {
var parent = element.parentNode;
if (parent) {
parent.removeChild(element);
}
newparent.appendChild(element);
return parent;
},
getChildByFCID: function(fcid, node) {
var firstChild = YAHOO.util.Dom.getFirstChild(node),
child,
cfcid = "",
tmpchild;
child = firstChild;
while (child) {
cfcid = child.getAttribute('fcid');
if (cfcid && cfcid == fcid) {
return child;
}
child = YAHOO.util.Dom.getNextSibling(child);
}
child = firstChild;
while (child) {
tmpchild = FIRSTCLASS.ui.Dom.getChildByFCID(fcid, child);
if (tmpchild) {
return tmpchild;
}
child = YAHOO.util.Dom.getNextSibling(child);
}
return null;
},
getChildrenByClassName: function(classname, node) {
var children = [];
var firstChild = YAHOO.util.Dom.getFirstChild(node),
child,
tmpchild;
child = firstChild;
while (child) {
if (YAHOO.util.Dom.hasClass(child, classname)) {
children.push(child);
}
child = YAHOO.util.Dom.getNextSibling(child);
}
child = firstChild;
while (child) {
tmpchildren = FIRSTCLASS.ui.Dom.getChildrenByClassName(classname, child);
if (tmpchildren) {
var i;
for (i in tmpchildren) {
children.push(tmpchildren[i]);
}
}
child = YAHOO.util.Dom.getNextSibling(child);
}
if (children.length > 0) {
return children;
}
return null;
},
getChildByClassName: function(classname, node, depth) {
var firstChild = YAHOO.util.Dom.getFirstChild(node),
child,
tmpchild;
child = firstChild;
while (child) {
if (YAHOO.util.Dom.hasClass(child, classname)) {
return child;
}
child = YAHOO.util.Dom.getNextSibling(child);
}
child = firstChild;
while (child) {
tmpchild = FIRSTCLASS.ui.Dom.getChildByClassName(classname, child);
if (tmpchild) {
return tmpchild;
}
child = YAHOO.util.Dom.getNextSibling(child);
}
return null;
},
getChildByTagName: function(tagname, node, depth) {
var firstChild = YAHOO.util.Dom.getFirstChild(node),
child,
tmpchild;
child = firstChild;
while (child) {
if (child.tagName && child.tagName.toUpperCase() == tagname.toUpperCase()) {
return child;
}
child = YAHOO.util.Dom.getNextSibling(child);
}
child = firstChild;
while (child) {
tmpchild = FIRSTCLASS.ui.Dom.getChildByTagName(tagname, child);
if (tmpchild) {
return tmpchild;
}
child = YAHOO.util.Dom.getNextSibling(child);
}
return null;
},
getChildByIdName: function(idname, node) {
var firstChild = YAHOO.util.Dom.getFirstChild(node), //.childNodes[0];
child,
tmpchild;
child = firstChild;
while (child) {
if ((typeof child.id !== "undefined") && (child.id == idname)) {
return child;
}
//child = child.nextSibling;//
child = YAHOO.util.Dom.getNextSibling(child);
}
child = firstChild;
while (child) {
tmpchild = FIRSTCLASS.ui.Dom.getChildByIdName(idname, child);
if (tmpchild) {
return tmpchild;
}
//child = child.nextSibling;//
child = YAHOO.util.Dom.getNextSibling(child);
}
return null;
},
getCurrTimestamp: function() {
var d = new Date();
return "time=" + d.getFullYear() + FIRSTCLASS.ui.Dom.zeroPad(d.getMonth(), 2) + FIRSTCLASS.ui.Dom.zeroPad(d.getDate(), 2) + FIRSTCLASS.ui.Dom.zeroPad(d.getHours(), 2) + FIRSTCLASS.ui.Dom.zeroPad(d.getMinutes(), 2) + FIRSTCLASS.ui.Dom.zeroPad(d.getSeconds(), 2);
},
zeroPad: function(num, count) {
var numZeropad = num + '';
while (numZeropad.length < count) { numZeropad = "0" + numZeropad; }
return numZeropad;
}
},
hover: {
apply: function(el, hclass) {
YAHOO.util.Dom.addClass(el, hclass);
},
remove: function(el, hclass) {
YAHOO.util.Dom.removeClass(el, hclass);
}
},
hoverBar: {
make: function(bar, hover, control, timeout) {
timeout = timeout || 1000;
YAHOO.util.Event.addListener(hover, "mouseover", function() {
bar.mouseOver = true;
if (!hover.timeout) {
hover.timeout = FIRSTCLASS.setTimeout(function() {
if (bar.mouseOver) {
if (control.elementWithHoverBar != hover) {
FIRSTCLASS.ui.hoverBar.hide(control);
}
YAHOO.util.Dom.removeClass(bar, "fcHoverHidden");
control.elementWithHoverBar = hover;
}
}, timeout);
}
});
YAHOO.util.Event.addListener(hover, "mouseout", function(evt) {
bar.mouseOver = false;
if (!YAHOO.util.Dom.isAncestor(hover.parentNode, evt.relatedTarget) && hover != evt.relatedTarget) {
hover.removeHoverBar();
}
if (!YAHOO.util.Dom.isAncestor(hover, evt.relatedTarget)) {
if (hover.timeout) {
window.clearTimeout(hover.timeout);
hover.timeout = false;
}
}
});
hover.removeHoverBar = function() {
YAHOO.util.Dom.addClass(bar, "fcHoverHidden");
};
hover.removeHoverBar();
},
hide: function(control) {
if (control.elementWithHoverBar && control.elementWithHoverBar.removeHoverBar) {
control.elementWithHoverBar.removeHoverBar();
control.elementWithHoverBar = false;
}
}
},
initializeSearchBox: function(id) {
var input = $(id);
YAHOO.util.Event.addListener(input, "keydown", function(evt) {
YAHOO.util.Event.stopPropagation(evt);
});
YAHOO.util.Event.addListener(input, "keyup", function(evt) {
if (evt.keyCode == 13) {
FIRSTCLASS.search({ key: input.value });
// top.location.hash="#__Search/?Srch=" + escape(input.value);
} else if (evt.keyCode == 27) {
input.typing = false;
YAHOO.util.Dom.removeClass(input, "focussed");
input.value = FIRSTCLASS.locale.desktop.search;
input.blur();
} else if (FIRSTCLASS.session.ui.experimental && typeof FIRSTCLASS.session.getActiveApplication().quickFilter != "undefined") {
FIRSTCLASS.session.getActiveApplication().quickFilter(input.value);
}
YAHOO.util.Event.stopPropagation(evt);
});
YAHOO.util.Event.addListener(input, "blur", function(evt) {
if (input.value == "") {
input.value = FIRSTCLASS.locale.desktop.search;
}
YAHOO.util.Dom.removeClass(input, "focussed");
});
YAHOO.util.Event.addListener(input, "focus", function(evt) {
if (input.value == FIRSTCLASS.locale.desktop.search) {
input.value = "";
} else {
input.select();
}
YAHOO.util.Dom.addClass(input, "focussed");
});
},
initializeQuickSendBox: function(id) {
var input = $(id);
var buildQuickSendUrl = function(str) {
var postData = "BODY=" + FIRSTCLASS.lang.uesc(str) + "&Subject=" + FIRSTCLASS.lang.uesc(str) + "&BODYTYPE=PLAIN&CharSet=UTF-8&Send=1&KeepNames=1";
return postData;
};
input.typing = false;
YAHOO.util.Event.addListener(input, "keydown", function(evt) {
YAHOO.util.Event.stopPropagation(evt);
});
YAHOO.util.Event.addListener(input, "keyup", function(evt) {
if (evt.keyCode == 13) {
if (input.value == "") {
return;
}
// enter
//FIRSTCLASS.search({key:input.value});
var postData = buildQuickSendUrl(input.value);
var url = FIRSTCLASS.session.getActiveObject() + "__Send";
input.value = "Sending...";
input.disabled = true;
input.typing = false;
input.blur();
YAHOO.util.Dom.removeClass(input, "focussed");
FIRSTCLASS.util.net.doAsyncPost({ action: url, postData: postData, callbacks: {
success: function(o) {
input.value = "Send Succeeded";
input.disabled = false;
},
failure: function(o) {
input.value = "Send Failed";
input.disabled = false;
}
}
});
} else if (evt.keyCode == 27) {
input.typing = false;
YAHOO.util.Dom.removeClass(input, "focussed");
input.value = "Send";
input.blur();
} else {
input.typing = true;
}
YAHOO.util.Event.stopPropagation(evt);
});
YAHOO.util.Event.addListener(input, "blur", function(evt) {
if ((!input.typing || input.value == "") && input.value != "Send Succeeded" && input.value != "Sending...") {
input.value = "Send";
}
YAHOO.util.Dom.removeClass(input, "focussed");
});
YAHOO.util.Event.addListener(input, "focus", function(evt) {
if (!input.typing) {
input.value = "";
}
YAHOO.util.Dom.addClass(input, "focussed");
});
},
tags: {
defines: {
separator: String.fromCharCode(0x02),
countdelimiter: String.fromCharCode(0x03),
// separator: ',', //String.fromCharCode(0x02),
// countdelimiter: '.', //String.fromCharCode(0x03),
legacy: {
separator: ',',
countdelimiter: '.'
}
},
arrayToServerTags: function(arrayofstrings) {
return arrayofstrings.join(FIRSTCLASS.ui.tags.defines.separator) + FIRSTCLASS.ui.tags.defines.separator;
}
},
parseServerTags: function(stags, defaultkeys) {
var cloud = [], i, tags, legacymode, tag, ts, thetag, item;
if (stags != "") {
legacymode = false;
tags = stags.split(FIRSTCLASS.ui.tags.defines.separator);
if (stags.indexOf(FIRSTCLASS.ui.tags.defines.separator) < 0) {
// new mode tags are always terminated with a separator
legacymode = true;
tags = stags.split(FIRSTCLASS.ui.tags.defines.legacy.separator);
}
for (i in tags) {
tag = tags[i];
ts = tag.split(FIRSTCLASS.ui.tags.defines.countdelimiter);
if (legacymode) {
ts = tag.split(FIRSTCLASS.ui.tags.defines.legacy.countdelimiter);
}
if (ts.length >= 1) {
thetag = ts[0];
if (thetag.indexOf(""" >= 0)) {
thetag = thetag.replace(/"/g, "");
}
ts[0] = thetag;
}
item = { "tag": ts[0], "weight": 1 };
if (ts.length == 2) {
item = { "tag": ts[0], "weight": parseInt(ts[1], 10) };
}
for (i in defaultkeys) {
item[i] = defaultkeys[i];
}
if (item.tag) {
cloud.push(item);
}
}
}
if (cloud.length > 0 && !cloud[cloud.length - 1].tag) {
cloud = cloud.splice(0, cloud.length - 1);
}
return cloud;
},
generateCloud: function(atagsa, makefunctiontext) {
var calculateTagWeights = function(atags) {
var min = -1,
max = -1,
avg = 0,
i, n,
range;
for (i in atags) {
if (min == -1) {
min = atags[i].weight;
}
if (min > atags[i].weight) {
min = atags[i].weight;
}
if (max < atags[i].weight) {
max = atags[i].weight;
}
avg += atags[i].weight;
}
range = (max - min) / 6;
for (i in atags) {
n = atags[i].weight;
if (n == min) {
atags[i].fw = 0;
} else if (n > min && n < min + range) {
atags[i].fw = 1;
} else if (n >= min + range && n < min + 2 * range) {
atags[i].fw = 2;
} else if (n >= min + 2 * range && n < min + 3 * range) {
atags[i].fw = 3;
} else if (n >= min + 3 * range && n < min + 4 * range) {
atags[i].fw = 4;
} else if (n >= min + 4 * range && n <= max) {
atags[i].fw = 5;
}
}
};
var defaultfunctiontext = function(tag) {
return "FIRSTCLASS.search({key:\""
+ tag
+ "\"});";
};
var generateTag = function(cfg, mode) {
var html = [
"');
bottomText.innerHTML = html.join("");//"');
bottomText.innerHTML = html.join("");//"