");
}
} else {
this._resizeBlog();
}
}
};
FIRSTCLASS.apps.Blog.prototype.createRow = function(row) {
var that = this;
var myRowElement = null;
var myRowContents = document.createElement("div");
YAHOO.util.Dom.generateId(myRowContents);
var table = this._myFeed.createRow(row);
myRowContents.appendChild(table);
myRowContents.yId = myRowContents.id;
// if (row.status.unread) { YAHOO.util.Dom.addClass(myRowContents, "unread"); }
YAHOO.util.Dom.addClass(myRowContents, "fcBlogItem");
if (row.lformid == 21008 || row.icon.id == 9626) {
YAHOO.util.Event.addListener(myRowContents, 'click', function(evt) { that._myFeed.onSelectionChange(evt,this); } );
} else if (row.typedef.objtype == FIRSTCLASS.objTypes.confitem) {
// YAHOO.util.Dom.setStyle(myRowContents,"padding-left","60px");
YAHOO.util.Dom.setStyle(myRowContents,"padding-top","15px");
YAHOO.util.Dom.setStyle(myRowContents,"padding-left","40px");
YAHOO.util.Event.addListener(myRowContents, 'click', function(evt) { that._myFeed.onSelectionChange(evt,this); } );
}
myRowElement = FIRSTCLASS.apps.Blog.prototype._rowSubElement.cloneNode(true);
myRowElement.firstChild.id = ((row.typedef.objtype == FIRSTCLASS.objTypes.odocument) ? "blog[" : "comment[") + row.uri + "]";
var child = myRowElement.childNodes[0].childNodes[0].childNodes[0].childNodes[1];
child.appendChild(myRowContents);
myRowElement.row = myRowContents.row;
myRowElement.table = table;
if (row.status.unread) {
YAHOO.util.Dom.addClass(myRowElement,"unread");
} else {
YAHOO.util.Dom.addClass(myRowElement,"read");
}
this.updateRow(row,myRowElement,null);
return myRowElement;
};
FIRSTCLASS.apps.Blog.prototype.updateRow = function(row, element, oldRow) {
if (typeof oldRow == "undefined")
oldRow = null;
if (this._myFeed) {
if (typeof element.table == "undefined") {
this._myFeed.updateRow(row,element,oldRow);
} else {
this._myFeed.updateRow(row,element.table,oldRow);
}
if (row.status.unread) {
var circle;
if (row.typedef.objtype == FIRSTCLASS.objTypes.odocument) {
circle = FIRSTCLASS.ui.Dom.getChildByClassName("fclvrowpicunreadblog",element);
} else {
circle = FIRSTCLASS.ui.Dom.getChildByClassName("fclvrowpicunreadblogcomment",element);
}
this._unreadItem[row.uri] = circle;
}
}
};
FIRSTCLASS.apps.Blog.prototype.generateUniqueId = function(row) {
return row.messageid; // + "C";
};
// sort thread items in reverse chrono
FIRSTCLASS.apps.Blog.prototype.rowSort = function(row1, row2) {
var result = true;
if (row1 && row2) {
result = row1.parsedDate <= row2.parsedDate;
}
return result;
};
FIRSTCLASS.apps.Blog.prototype.activate = function () {
this._listView.activate();
this._dataSource.activate();
};
FIRSTCLASS.apps.Blog.prototype.deactivate = function() {
this._listView.deactivate();
this._dataSource.deactivate();
};
FIRSTCLASS.apps.Blog.prototype.rowFilter = function(row) {
if (row.status.deleted || ((row.typedef.objtype == FIRSTCLASS.objTypes.formdoc || row.typedef.objtype == FIRSTCLASS.objTypes.odocument) && (row.col8010 == "FCXResume"))) {
return false;
}
return (row.typedef.objtype == FIRSTCLASS.objTypes.odocument) || (row.typedef.objtype == FIRSTCLASS.objTypes.confitem);
};
FIRSTCLASS.apps.Blog.prototype.newPage = function() {
if (this._editor === null) {
var createText = document.getElementById('fcProfileCreateFirstBlog');
YAHOO.util.Dom.setStyle(createText,'display','none');
this._dataSource.deactivate();
var editCfg = {
row: null,
domElement: this._blogEntryElem,
blogEntry: this,
currentEdit: null
};
this._editor = new FIRSTCLASS.apps.Blog.editor(editCfg);
}
};
FIRSTCLASS.apps.Blog.prototype.editPage = function(theRow,blogElement,editElement) {
if (this._editor === null) {
var editCfg = {
row: theRow,
domElement: editElement,
blogEntry: this,
currentEdit: blogElement
};
this._editor = new FIRSTCLASS.apps.Blog.editor(editCfg);
}
};
FIRSTCLASS.apps.Blog.editor = function(config) {
this._domElement = config.domElement;
this._dsRow = config.row || null;
this._dataSource = config.blogEntry._dataSource;
this._currentEditElem = config.currentEdit;
this._itemURL = null;
this._theBlog = config.blogEntry;
// fire up the editor
var msgCfg = {
callback: this,
element: config.domElement,
objType: FIRSTCLASS.objTypes.odocument,
body: "HTML",
formID: 20500,
formElId: "fcDocForm",
bodyType: "HTML",
quoteText: null,
sendTo: null,
initHeight: "300px",
tbType: "blog",
maxImage: 480
};
if (this._dsRow) { // edit an existing one
this._itemURL = config.blogEntry._dataSource.getItemUrl(this._dsRow);
msgCfg.baseURL = this._itemURL;
msgCfg.op = FIRSTCLASS.opCodes.FormEdit;
msgCfg.params = "Close=-1";
msgCfg.row = this._dsRow;
} else { // create a new one
msgCfg.baseURL = FIRSTCLASS.lang.ensureSlashUrl(FIRSTCLASS.session.baseURL) + '__Open-Item/SharedDocuments/'; // config.blogEntry._dataSource.getContainerUrl();
msgCfg.op = FIRSTCLASS.opCodes.FormNew;
msgCfg.inMemory = false;
msgCfg.params = "InitialText=";
}
this._editor = new FIRSTCLASS.util.Message(msgCfg);
};
FIRSTCLASS.apps.Blog.editor.prototype.onDisplay = function() {
var docName = document.getElementById('blogSubject');
if (docName) {
docName.focus();
docName.select();
}
var container = document.getElementById('BODY_container');
if (container !== null) {
YAHOO.util.Dom.setStyle(container, 'width', '98%');
}
};
FIRSTCLASS.apps.Blog.editor.prototype.onLoaded = function(isEditable) {
if (!isEditable) { // got back read only form
if (this._editor !== null) {
this._editor.destroy();
this._editor = null;
}
this._theBlog._editor = null;
this._currentEditElem.removeChild(this._domElement);
this._currentEditElem = null;
alert(FIRSTCLASS.locale.blog.notEditable);
return;
}
};
FIRSTCLASS.apps.Blog.editor.prototype.onCancel = function() {
var tbcontainer = null;
if (this._editor !== null) {
this._editor.destroy();
this._editor = null;
}
this._theBlog._editor = null;
if (this._currentEditElem !== null) {
var itemURL;
var questionMark = this._itemURL.indexOf('?',0);
if (questionMark > 0) {
itemURL = FIRSTCLASS.lang.ensureSlashUrl(this._itemURL.substr(0,questionMark));
} else {
itemURL = FIRSTCLASS.lang.ensureSlashUrl(this._itemURL);
}
FIRSTCLASS.util.net.asyncRequest('POST',itemURL+"__FormSave?Close=1", null);
this._currentEditElem.removeChild(this._domElement);
tbcontainer = FIRSTCLASS.ui.Dom.getChildByClassName("fclvrowtoolbar",this._currentEditElem);
if (tbcontainer) {
YAHOO.util.Dom.removeClass(tbcontainer, "fcHidden");
}
this._currentEditElem = null;
} else {
this._dataSource.activate();
this._domElement.innerHTML = "";
}
tbcontainer = FIRSTCLASS.ui.Dom.getChildByClassName("fclvrowtoolbar",this._theBlog._selectedElement);
if (tbcontainer) {
YAHOO.util.Dom.removeClass(tbcontainer, "fcHidden");
}
};
FIRSTCLASS.apps.Blog.editor.prototype.onSave = function() {
if (this._editor !== null) {
this._editor.destroy();
this._editor = null;
}
if (this._currentEditElem !== null) {
this._currentEditElem.removeChild(this._domElement);
YAHOO.util.Dom.setStyle(this._currentEditElem.firstChild,'display','');
this._dataSource.fetchItem(this._dsRow);
var tbcontainer = FIRSTCLASS.ui.Dom.getChildByClassName("fclvrowtoolbar",this._currentEditElem);
if (tbcontainer) {
YAHOO.util.Dom.removeClass(tbcontainer, "fcHidden");
}
this._currentEditElem = null;
} else {
this._dataSource.activate();
this._dataSource.fetchNewRows();
this._domElement.innerHTML = "";
}
this._theBlog._editor = null;
};
FIRSTCLASS.apps.Blog.editor.prototype.onFail = function(obj) {
if (this._editor !== null) {
this._editor.destroy();
this._editor = null;
}
var del = this._domElement;
if (this._currentEditElem !== null) {
del = this._currentEditElem;
this._currentEditElem = null;
}
del.innerHTML = "
";
if (obj && obj.error) {
FIRSTCLASS.ui.navBar.updateShoutBox(FIRSTCLASS.locale.errors.getErrorString(obj.error));
}
this._theBlog._editor = null;
};
YAHOO.register("fcBlog", FIRSTCLASS.apps.Blog, {version: "0.0.1", build: "1"});