function memoSelectsLayer(ds,cs,ct,ci,srcID,accGrp) {
assertNotNull(ds,"ds(destSite)");
if( isEmpty(cs) ) cs = siteID();
if( isEmpty(ct) ) ct = contentType();
if( isEmpty(ci) ) ci = contentID();
//alert('1 : ' + cntID());
this._super = this.superClass;
this.superClass = this;
this.ds = ds;
this.cs = cs;
this.ct = ct;
this.ci = ci;
this.useTheme = false;
this.backgroundWhite = false;
this.updateLayout = function(ct,ci) {
this.searchMemo(ct,ci);
this.refresh();
}
this.getHTML = function() {
return this.getLayout();
}
this.doApply = function() {
var ids = [];
var chks = document.getElementsByName("mmCHKS");
for(var i=0;i < chks.length;i++) {
if( chks[i].checked )
ids[ids.length] = chks[i].value;
}
if( ids.length==0 ) {
showMsgBox('alert',"Please select memo.");
return;
}
try { this.onApply( ids.join(","),this.cs ); }
catch(e) {}
this.close();
}
this.goLayerSearch = function() {
var val = elm('searchLayer').value;
var srchOption = elm('srchSel').value;
if (val == '' || val == 'Enter your search terms.') {
showMsgBox('alert','Enter your search terms.');
return;
}
/*
var index = memoHandler.getIndex();
var ax = ajaxPost(index.toURL());
var pm = index.params()
.set('search',val)
.bounds("cntList",'0', '9')
.dest("/jsp/ajax/ajaxMemoSelects.jsp")
.getRefTargets('',val);
ax.send( pm ); eval( ax.responseText );
*/
if( isEmpty(ct) ) ct = "001";
if( isEmpty(ci) ) ci = "00000";
var ax = ajaxPost(memoHandler.toURL() );
var pm = memoHandler.params()
.dest("/jsp/ajax/ajaxMemoSelects.jsp")
.bounds("cntList",0,9)
.getRefTargets(cs,srcID,accGrp, srchOption , val);
ax.send( pm ); eval( ax.responseText );
this.refresh();
}
this.search = function(st,ed) {
var val = elm('searchLayer').value;
var srchOption = elm('srchSel').value;
var fname, fvalue;
if (val == 'Enter your search terms.') {
val = '';
fname = '';
fvalue = '';
}
var ax = ajaxPost(memoHandler.toURL() );
var pm = memoHandler.params()
.dest("/jsp/ajax/ajaxMemoSelects.jsp")
.set('fname',fname)
.set('fvalue',fvalue)
.set('paging','true')
.bounds("cntList",st,ed)
.getRefTargets(cs,srcID,accGrp, srchOption , val);
/*
var pm = memoHandler.params()
.dest("/jsp/ajax/ajaxMemoSelects.jsp")
.bounds("cntList",st,ed)
.set('fname',fname)
.set('fvalue',fvalue)
.set('paging','true')
.searchActives(this.cs, this.ci, true, null, 'READ_ACC', 'all');
//.searchActives(this.cs,this.ci,true);
*/
ax.send( pm ); eval( ax.responseText );
this.refresh();
}
this.searchMemo = function(ct,ci) {
/*
if( isEmpty(ct) ) ct = "001";
if( isEmpty(ci) ) ci = "00000";
var ax = ajaxPost(memoHandler.toURL() );
var pm = memoHandler.params()
.dest("/jsp/ajax/ajaxMemoSelects.jsp")
.bounds("cntList",0,9)
.searchActives(cs, ci, true, null, 'READ_ACC', 'all');
//.searchActives(cs,ci,true);
ax.send( pm ); eval( ax.responseText );
*/
//getRefTargets(srcSite, srcID, accessGroup)
if( isEmpty(ct) ) ct = "001";
if( isEmpty(ci) ) ci = "00000";
var ax = ajaxPost(memoHandler.toURL() );
var pm = memoHandler.params()
.dest("/jsp/ajax/ajaxMemoSelects.jsp")
.bounds("cntList",0,9)
.getRefTargets(cs,srcID,accGrp,'');
ax.send( pm ); eval( ax.responseText );
}
this.getTitleText = function() {
return "Link Memos To";
}
this.initItems = function() {
this.searchMemo(ct,ci);
return this;
}
this.add();
this.attachEvents();
this.initItems();
}
memoSelectsLayer.prototype = new jpLayer;
function MessageManager(mgsType, msg) {
this.useTheme = false;
//this.enableOuterClose = false;
this.msgType = msgType;
this.msgStr = msg;
this.bodyAlign = "center";
this.alertBox = "
.close();\">\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t| | \r\n\t\t\t\t;\">\r\n\t\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t
\r\n\t
";
this.confirmBox = ".close();\">\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t| | \r\n\t\t\t\t;\">\r\n\t\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t
\r\n\t
";
this.getHTML = function() {
return this.msgProc();
}
this.msgProc = function (){
switch( this.msgType ) {
case "confirm": this.responseText = this.confirmBox; break;
default: this.responseText = this.alertBox; break;
}
// sectionHandler.params();
// sectionHandler.dest("/jsp/ajax/ajaxMessgeBox.jsp");
// sectionHandler.set("msgs", msg);
// sectionHandler.set("mgsType", mgsType);
// var ax = ajaxRequest();
// ax.open( "POST",sectionHandler.toURL(),false );
// setPost(ax);
// ax.send( sectionHandler.view(null,null,contentID()) );
return this.applyThis( this.responseText );
}
}
MessageManager.prototype = new jpLayer;
/* commonPopup Box */
function CommonPopup() {
this.useTheme = false;
this.enableOuterClose = false;
this.backgroundWhite = false;
this.btnClose = false;
this.opacity = 30;
this.divStyle = '';
this.getHTML = function() {
return this.getMessageBox();
}
this.getMessageBox = function() {
sectionHandler.params()
.set("bodyAlign", this.bodyAlign)
.set("bodyContent", this.content)
.set("btnClose", this.btnClose)
.set("parameter", this.parameter)
.set("divStyle", this.divStyle)
.dest("/jsp/ajax/ajaxPopupBox.jsp");
var ax = ajaxPost(sectionHandler.toURL());
//ax.open( "POST",sectionHandler.toURL(),false );
//setPost(ax);
ax.send(sectionHandler.view(null,null,contentID()));
if (this.afterOption)
this.addAfter( function() { elm('' + this.objID + '').focus(); },[] );
return this.applyThis( ax.responseText );
}
/* page Display content */
this.setContent = function(content, bodyAlign) {
this.content = content;
this.bodyAlign = bodyAlign;
return this;
}
this.setFocus = function(bln, objID) {
this.afterOption = bln;
this.objID = objID;
return this;
}
this.setEnableOuterClose = function(enableOuterClose) {
this.enableOuterClose = enableOuterClose;
return this;
}
this.setOpacity = function(opacity) {
this.opacity = opacity;
return this;
}
this.setBtnClose = function(btnClose) {
this.btnClose = btnClose;
return this;
}
this.setParameter = function(parameter) {
this.parameter = parameter;
return this;
}
this.setDivStyle = function(divStyle) {
this.divStyle = divStyle;
return this;
}
}
CommonPopup.prototype = new jpLayer;
/* commonMsg Box (alert, confirm) */
function CommonMsg() {
this.useTheme = false;
this.tfn = null;
this.ffn = null;
this.bodyAlign = "center";
if (this.enableOuterClose)
this.enableOuterClose = true;
else
this.enableOuterClose = false;
//this.enableOuterClose = false;
this.backgroundWhite = false;
this.alertBox = ".close();\">\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t| | \r\n\t\t\t\t;\">\r\n\t\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t
\r\n\t
";
this.confirmBox = ".close();\">\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t| | \r\n\t\t\t\t;\">\r\n\t\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t\t | \r\n\t\t\t
\r\n\t\t
\r\n\t
";
this.getHTML = function() {
return this.getMessageBox();
}
this.getMessageBox = function() {
switch( this.msgType ) {
case "confirm": this.responseText = this.confirmBox; break;
default: this.responseText = this.alertBox; break;
}
// sectionHandler.params();
// sectionHandler.dest("/jsp/ajax/ajaxMessageBox.jsp");
// sectionHandler.set("msgType", this.msgType);
// sectionHandler.set("msgStr", this.msgStr);
// sectionHandler.set("command", this.command);
// sectionHandler.set("bodyAlign", this.bodyAlign);
// var ax = ajaxRequest();
// ax.open( "POST",sectionHandler.toURL(),false );
// setPost(ax);
// ax.send(sectionHandler.view(null,null,contentID()));
//alert(this.msgType.value);
if (this.msgType)
this.addAfter( function() { document.getElementById('btnOK').focus(); },[] );
return this.applyThis( this.responseText );
}
this.setMsg = function(msgType, msgStr) {
this.msgType = msgType;
this.msgStr = this.applyThis(msgStr);
return this;
}
this.setCommand = function(command) {
this.command = command;
return this;
}
this.setTrue = function(tfn) {
this.tfn = tfn;
return this;
}
this.setFalse = function(ffn) {
this.ffn = ffn;
return this;
}
this.setAlign = function(align) {
if( align )
this.bodyAlign = align;
return this;
}
this.setEnableOuterClose = function(enableOuterClose) {
this.enableOuterClose = enableOuterClose;
return this;
}
this.onOK = function() {
this.close();
try { eval( this.command ); } catch(e) { }
try { this.tfn(); } catch(e) { }
this.tfn = null;
}
this.onYes = function() {
this.close();
try { eval( this.command ); } catch(e) { }
try { this.tfn(); } catch(e) { }
this.tfn = null;
}
this.onNo = function() {
this.close();
try { this.ffn(); } catch(e) { }
this.ffn = null;
}
}
CommonMsg.prototype = new jpLayer;
/* showMsgBox */
function showMsgBox(msgType, msgStr, bodyAlign, command, enableOuterClose, tfn, ffn) {
var msgBox = document.getElementById('commonMsgBox');
if (msgBox == null ) {
var obj = new CommonMsg();
obj.add().attachEvents()
.setMsg(msgType, msgStr)
.setAlign(bodyAlign)
.setCommand(command)
.setTrue( tfn )
.setFalse( ffn )
.setEnableOuterClose(enableOuterClose)
.render();
return obj;
}
}
function userInfoLayer() {
this.useTheme = false;
//this.enableOuterClose = false;
this.backgroundWhite = false;
this.getHTML = function() {
if( !this.getLayout ) this.getProfile();
return this.getLayout();
}
this.getTitleText = function() {
return "User information";
}
this.applySet = function() {
}
this.getProfile = function() {
var qry = userHandler.params(true)
.context('/',this.userID)
.dest("/jsp/ajax/ajaxUserInfo.jsp")
.view(this.userID);
var ax = ajaxGet( qry,false );
ax.send( null ); eval( ax.responseText );
}
this.updateLayout = function() {
this.getProfile();
this.refresh();
}
this.setID = function(userID) {
this.userID = userID;
return this;
}
this.accessFriend = function(sender, receiver) {
if( !(sender == receiver)){
var post = memberHandler.params().dest("/jsp/truth.jsp").requestMember(sender, receiver);
var ax = getXmlHttpRequest();
var ax = ajaxPost( memberHandler.toURL(),false );
ax.send( post); eval( ax.responseText );
//alert(ax.responseText);
}
}
this.requestMember = function( comment ) {
if( !(this.sender == this.receiver)){
if (comment == '' || comment == 'Enter the request message.') {
showMsgBox('alert','Enter the request message.');
return;
}
var message = [''].join("");
var post = memberHandler.params()
.dest("/jsp/truth.jsp")
.requestMember(this.sender, this.receiver, message);
var ax = getXmlHttpRequest();
var ax = ajaxPost( memberHandler.toURL(),false );
ax.send( post); eval( ax.responseText );
var a = true;
if (eval( ax.responseText )) {
this.close();
this.box.close();
var msgTxt = "a message was sent to .";
msgTxt = msgTxt.replace(new RegExp("","g"),this.userName);
showMsgBox('alert', msgTxt);
} else {
//this.close();
}
}
}
this.checkReqLength = function(obj) {
if (obj.value) {
//alert(obj.value.length);
//if (obj.value.length > 256 ) {
//var txt = obj.value.substring(0,255);
//alert(obj.value.substring(0,255));
//obj.value = obj.value.substring(0,255);
//obj.value = txt;
//return;
//alert(obj.value);
//}
//obj.value = obj.value.replace(obj.value, obj.value.substring(255));
//if (txt) obj.value = txt;
}
}
this.prepareFriendMsg = function(val) {
var editor = document.getElementById('FRMSG');
if (val) {
if (editor.value == "Enter the request message.") {
editor.value = "";
editor.focus();
}
} else {
if (editor.value == "" )
editor.value = "Enter the request message.";
}
}
this.requestMessage = function(sender, receiver, userName) {
// login User info
var data = userHandler.params(true)
.context('/','')
.set('userType','login')
.dest('/jsp/ajax/ajaxUserCheck.jsp')
.view(this.userID);
var ax = ajaxGet( data,false );
ax.send( null );
var ar = eval(ax.responseText);
/*
ar[0] = friend, ar[1] = userId, ar[2] = alias
, ar[3] = texMsg, ar[4] = myInfoCnt, ar[5] = relatedOption
if (ar[4] != 3) {
this.noRequest(ar[3]);
return;
}
*/
var content = "\r\n\t\t\r\n\t\t\t
Send a message to #thisUser#
\r\n\t\t\t
\r\n\t\t\t
characters (limit 200)
\r\n\t\t\t
\r\n\t\t
";
content = content.replace('#thisUser#',receiver);
this.sender = sender;
this.receiver = receiver;
this.userName = userName;
var msgBox = document.getElementById('commonPopupBox');
if (msgBox == null ) {
this.box = new CommonPopup()
.add()
.attachEvents()
.setOpacity(1)
.setEnableOuterClose(false)
.setContent(content,'left');
this.box.owner = this;
this.box.render();
}
}
this.noRequest = function(msg) {
this.close();
showMsgBox('alert',msg);
}
this.goSite = function(id) {
// login User info
var data = userHandler.params(true)
.context('/',id)
.set('userType','readAcc')
.dest('/jsp/ajax/ajaxUserCheck.jsp')
.view(id);
var ax = ajaxGet( data,false );
ax.send( null );
var val = eval(ax.responseText);
if (val)
document.location = 'http://www.memothis.com/'+id;
else
showMsgBox('alert',"Sorry.
You can't visit the blog.
The owner has decided to keep the blog private.");
}
}
userInfoLayer.prototype = new jpLayer;
function showUserInfo(userID, val) {
if( !userID ) userID = "";
if (val)
new userInfoLayer().goSite(userID);
else
new userInfoLayer().add().attachEvents().transparent(10).setID(userID).render();
}
function NewsLetterLayer() {
this.useTheme = false;
this.enableOuterClose = false;
this.backgroundWhite = false;
this.getHTML = function() {
if( !this.getLayout ) this.getData();
return this.getLayout();
}
this.getData = function() {
var qry = newsLetterHandler.params(true)
.dest("/jsp/ajax/ajaxNewsLetter.jsp")
.view();
var ax = ajaxGet( qry,false );
ax.send( null ); eval( ax.responseText );
}
this.updateLayout = function() {
this.getData();
this.refresh();
}
this.setID = function(userID) {
this.userID = userID;
return this;
}
this.accessFriend = function(sender, receiver) {
if( !(sender == receiver)){
var post = memberHandler.params().dest("/jsp/truth.jsp").requestMember(sender, receiver);
var ax = getXmlHttpRequest();
var ax = ajaxPost( memberHandler.toURL(),false );
ax.send( post); eval( ax.responseText );
//alert(ax.responseText);
}
}
this.memoSelect = function() {
var memos = new NewsLetterSelect( siteID(),"","001","00000" );
memos.owner = this;
memos.onApply = function(ids,cs) { this.owner.applyReferences(ids,cs); }
memos.add().attachEvents().render();
}
}
NewsLetterLayer.prototype = new jpLayer;
function makeNewsLetter(id) {
new NewsLetterLayer().add().attachEvents().transparent(10).render();
}
function NewsLetterSelect(ds,cs,ct,ci) {
assertNotNull(ds,"ds(destSite)");
if( isEmpty(cs) ) cs = siteID();
if( isEmpty(ct) ) ct = contentType();
if( isEmpty(ci) ) ci = contentID();
this._super = this.superClass;
this.superClass = this;
this.ds = ds;
this.cs = cs;
this.ct = ct;
this.ci = ci;
this.useTheme = false;
this.backgroundWhite = false;
this.maxCheck = 0;
var parentID = '00000';
this.updateLayout = function(ct,ci) {
this.searchMemo(ct,ci);
this.refresh();
}
this.getHTML = function() {
return this.getLayout();
}
this.doApply = function() {
var ids = [];
var chks = document.getElementsByName("mmCHKS");
for(var i=0;i < chks.length;i++) {
if( chks[i].checked )
ids[ids.length] = chks[i].value;
}
if( ids.length==0 ) {
showMsgBox('alert',"Please select memo.");
return;
}
try { this.onApply( ids.join(","),this.cs ); }
catch(e) {}
this.close();
}
this.search = function(st,ed) {
var names = document.getElementsByName('mmCHKS');
var checkID = this.checkID;
if (names.length > 0) {
for (var i = 0; i < names.length; ++i) {
var id = names[i].value;
if (names[i].checked) {
if (checkID != undefined) {
if (checkID.indexOf(id) < 0) {
if (checkID) {
checkID += ',' + id;
} else {
checkID = id;
}
}
} else {
if (checkID) {
checkID += ',' + id;
} else {
checkID = id;
}
}
} else {
checkID = checkID.replace(id,'').replace(',,',',');
if (checkID.indexOf(',') == 0 )
checkID = checkID.replace(',','');
}
}
}
this.checkID = checkID;
var ax = ajaxPost(memoHandler.toURL() );
var pm = memoHandler.params()
.set('checkID', this.checkID)
.dest("/jsp/ajax/ajaxHeadlineSelects.jsp")
.bounds("cntList",st,ed)
.searchActives(this.cs, this.ci, true, null, 'READ_ACC', 'all');
//.searchActives(this.cs,this.ci,true);
ax.send( pm ); eval( ax.responseText );
this.refresh();
}
this.searchMemo = function(ct,ci) {
var obj = document.getElementsByName('headlineCntID');
var arrID = [];
if(obj) {
this.maxCheck = obj.length;
for (var i = 0; i < obj.length; ++i) {
arrID[i] = obj[i].value;
//alert(obj[i].value);
}
this.checkID = arrID.join(",");
}
if( isEmpty(ct) ) ct = "001";
if( isEmpty(ci) ) ci = "00000";
var ax = ajaxPost(memoHandler.toURL() );
var pm = memoHandler.params()
.set('checkID', this.checkID)
.dest("/jsp/ajax/ajaxNewsLetterSelects.jsp")
.bounds("cntList",0,9)
.searchActives(cs, ci, true, null, 'READ_ACC', 'all');
//.searchActives(cs,ci,true);
ax.send( pm ); eval( ax.responseText );
}
this.checkVal = function(obj) {
if (obj.checked) {
if (this.maxCheck > 2) {
showMsgBox('alert',"Please headline max 3 items. ");
obj.checked = false;
} else {
++this.maxCheck;
}
} else {
--this.maxCheck;
}
}
this.headPublish = function(){
if(checkedValues(elms("mmCHKS")) == null || checkedValues(elms("mmCHKS")) == "" ) return showMsgBox('alert',"Please select memo.");
var selected = checkedValues(elms("mmCHKS"));
var ax = getXmlHttpRequest();
var param = memoHandler.params(true)
.dest("/jsp/ajax/ajaxHeadline.jsp")
.getPublishings( siteID(),parentID);
var datas = memoHandler.params(true)
.dest( param )
.publish( siteID(), selected, parentID );
var query = memoHandler.toURL();
ax.open( "POST", query, false);
setPost(ax);
ax.send(datas);
eval( ax.responseText );
this.owner.updateLayout();
this.owner.refresh();
this.close();
}
this.initItems = function() {
this.searchMemo(ct,ci);
return this;
}
this.add();
this.attachEvents();
this.initItems();
}
NewsLetterSelect.prototype = new jpLayer;
//