/**
* Class Description
* @namespace FIRSTCLASS.apps
* @module OrgProfile
* @requires
* @optional
* @title Organization Profile
*/
/**
* Constructor definition
* @class OrgProfile
* @constructor
* @param {Object} config (required) the configuration object
* @param {string|HTMLElement} config.div (required) the div to load into
* @param {string} config.baseUrl (required) the container base url
*/
FIRSTCLASS.apps.orgProfile = function(config) {
/**
* Private member variables
*
* Private variables are identified by the convention of naming them with a leading underscore.
* i.e. this._privateVariable
*/
this._subApps = [
{label:"Overview",app:"fcOverview",loaded:true },
{label:"Blog",app:"fcBlog",loaded:false}
];
this._dataSource = null;
this._title = "OrgProfile";
this._listView = null;
this._uploadImageStep = 0;
this._convertStep = 0;
this._initalpadding = 0;
this._createProfile = false;
this._inEditMode = false;
this._profileDialog = null;
this._parentDiv = config.parentDiv;
this._config = config;
if (typeof config.params.uid == "string") {
if (config.params.uid.indexOf("CID") === 0) {
this._config.params.cid = config.params.uid;
} else {
this._config.params.cid = "CID" + config.params.uid;
}
} else {
this._config.params.cid = "CID" + config.params.uid;
}
this._baseURL = config.baseUrl;
this._domElement = (typeof(this._config.div) == "string") ? document.getElementById(this._config.divId) : this._config.div;
this._topLevelMenu = document.getElementById('topLevelMenu');
this._getProfileOverview(true);
};
FIRSTCLASS.apps.orgProfile.prototype.configure = function() {
FIRSTCLASS.ui.leftSideBar.hide();
FIRSTCLASS.ui.rightSideBar.hide();
this._config.onready();
var that = this;
var tmp = [];
if ((typeof this._config.params.name == 'undefined') || (this._config.params.name == 'undefined')) {
this._config.params.name = "";
}
tmp.push("
| ");
tmp.push ("");
tmp.push (" | ");
tmp.push(" | ");
tmp.push(" | ");
tmp.push("" + this._topLevelMenu.innerHTML + " | ");
tmp.push(" ");
tmp.push("
" + FIRSTCLASS.locale.profile.groupDetail + " | ");
tmp.push("
" + FIRSTCLASS.locale.profile.userName + " | " + FIRSTCLASS.locale.profile.userPos + " | " + FIRSTCLASS.locale.profile.phone + " | | ");
tmp.push(" | ");
tmp.push(" |
");
FIRSTCLASS.ui.navBar.clearContentPane();
this._domElement.innerHTML = tmp.join("");
FIRSTCLASS.ui.initializeSearchBox('fcSearchInputBlog');
this._resumeDomElement = document.getElementById("fcProfileOverview");
var mainTable = document.getElementById("fcMain");
YAHOO.util.Dom.addClass(mainTable, "fcAppScrollingContent");
YAHOO.util.Dom.setStyle(mainTable, "overflow", "auto");
var url = this._config.baseUrl;
FIRSTCLASS.session.addHistoryEntry({
"uri": url,
"app": this,
activate: function()
{
that.activate();
}
});
};
FIRSTCLASS.apps.orgProfile.prototype.handleEvent = function(evt, fcevent) {
var rv = false;
var app;
for (var i in this._subApps) {
app = this._subApps[i];
if (app.instance && app.instance != this && app.instance._listView) {
rv = app.instance._listView.handleEvent(evt, fcevent);
if (rv) {
break;
}
}
}
return rv;
};
FIRSTCLASS.apps.orgProfile.prototype.isSafeToNavigate = function() {
return true;
};
FIRSTCLASS.apps.orgProfile.prototype.overrideSafeToNavigate = function() {
};
FIRSTCLASS.apps.orgProfile.prototype._updateProfileOverview = function ()
{
var that = this;
var handleSuccess = function(o) {
if(typeof o.responseText !== 'undefined') {
var domElem;
var OldProfileData = FIRSTCLASS.ui.Dom.getChildByIdName('fcProfileUserData',that._resumeDomElement);
var newDiv = document.createElement('div');
newDiv.innerHTML = o.responseText;
var newProfileData = FIRSTCLASS.ui.Dom.getChildByIdName('fcProfileUserData',newDiv);
OldProfileData.innerHTML = newProfileData.innerHTML;
that._setupProfileLinks(that._resumeDomElement);
domElem = document.getElementById("fcProfileResume");
that.createSearchLinks(domElem);
that._getGroupHierarchy();
}
};
var handleFailure = function(o){
alert(FIRSTCLASS.locale.profile.noRetrieve);
};
var callback = {
success:handleSuccess,
failure: handleFailure
};
var theURL = FIRSTCLASS.session.domain + FIRSTCLASS.session.baseURL + "__Open-User/" + this._config.params.cid + "/__Resume/?FormID=97";
FIRSTCLASS.util.net.asyncRequest('GET', theURL+"?Close=0", callback);
};
FIRSTCLASS.apps.orgProfile.prototype._getGroupDetails = function (pgNumber)
{
this.addedGroupDetails = true;
var that = this;
var handleSuccess = function(o) {
if(o.responseText !== 'undefined') {
var obj = FIRSTCLASS.lang.JSON.parse(o.responseText);
obj.records.sort(function(a,b)
{
var c = a;
var d = b;
if (typeof c.rankorpgnum != 'number') {
c.rankorpgnum = 0;
}
if (typeof d.rankorpgnum != 'number') {
d.rankorpgnum = 0;
}
return c.rankorpgnum - d.rankorpgnum;
}
);
var index;
var aRow;
var theHTML = ""; // = "