if(!iQ.Ajax){alert('iQAjax.js Not Loaded');}; if(!iQ.Utils){alert('iQUtils.js Not Loaded');}; YAHOO.util.Event.addListener(window,"load",function(){doPageLoad()}); var objLogin_Panel = null; var objLogin_Checker = null; var objPasswordReminder_Panel = null; var objPasswordReminder_Checker = null; var objUser_Panel = null; var objUser_Checker = null; var m_BlogID = 'CB16E2F0-946B-5817-F590E114ED1CA5BB'; var m_OpenCommentsEntryID = 'D7CB5963-D02E-5FD1-946EC80FE3AF1AD0'; var m_UserAction = ''; function doGetComments(BlogID,EntryID,UseCache){ iQ.Utils.doShowProcessing(); var params = ''; params += '"UseCache":"' + UseCache + '",'; params += '"BlogID":"' + BlogID + '",'; params += '"EntryID":"' + EntryID + '",'; params += '"isAuthenticated":"' + encodeURIComponent(iQ.Utils.GetCookie('Blog_isAuthenticated_' + m_BlogID)) + '"'; var _Ajax = new iQ.Ajax(); _Ajax.CFCMethod = 'getComments'; _Ajax.URL = '/websvc/Blogs.cfc'; _Ajax.Params ={Params:'{' + params + '}'}; _Ajax.CallbackHandler = "onGetComments"; _Ajax.Send(); } function onGetComments(ret){ var jsonData = ret; var divid = 'Comments_' + jsonData.ENTRYID; var obj = iQ.Utils.getBrowserObject(divid); obj.innerHTML = jsonData.HTML; iQ.Utils.doHideProcessing(); } function doCreateComment(BlogID,EntryID){ var commentid = 'Comment_' + EntryID; if(iQ.Utils.getFieldValue('CommentForm',commentid) == ''){ return; } iQ.Utils.doShowProcessing(); var params = ''; params += '"Email":"' + encodeURIComponent(iQ.Utils.GetCookie('Blog_Email_' + m_BlogID)) + '",'; params += '"Comment":"' + encodeURIComponent(iQ.Utils.getFieldValue('CommentForm',commentid)) + '",'; params += '"BlogID":"' + BlogID + '",'; params += '"EntryID":"' + EntryID + '"'; var _Ajax = new iQ.Ajax(); _Ajax.CFCMethod = 'doCreateComment'; _Ajax.URL = '/websvc/Blogs.cfc'; _Ajax.Params ={Params:'{' + params + '}'}; _Ajax.CallbackHandler = "onCreateComment"; _Ajax.Send(); } function onCreateComment(jsonRet){ if(jsonRet.ERRORMESSAGE){ iQ.Utils.doHideProcessing(); iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ doGetComments(jsonRet.BLOGID,jsonRet.ENTRYID,'F') } } function ChangeSearchCriteria(){ document.DataForm.submit(); } function doShowLogin(EntryID){ var email = iQ.Utils.GetCookie('Blog_Email_' + m_BlogID); var password = iQ.Utils.GetCookie('Blog_Password_' + m_BlogID); var autologin = iQ.Utils.GetCookie('Blog_AutoLogin_' + m_BlogID); if(password){ iQ.Utils.setFieldValue('Login_Form','Password',password); iQ.Utils.setFieldValue('Login_Form','Email',email); iQ.Utils.setFieldValue('Login_Form','SaveLogin','T'); } if(autologin){ if(autologin == 'T'){ iQ.Utils.setFieldValue('Login_Form','AutoLogin','T'); } } iQ.Utils.setFieldValue('Login_Form','EntryID',EntryID); objLogin_Panel.center(); objLogin_Panel.show(); } function doShowPasswordReminder(){ objLogin_Checker.doClearAllStatus(); objLogin_Panel.cancel(); objPasswordReminder_Panel.center(); objPasswordReminder_Panel.show(); } function doPostLoginForm(){ iQ.Utils.doShowProcessing(); var params = iQ.Utils.BuildAjaxParamStruct('Login_Form'); //alert(params) var _Ajax = new iQ.Ajax(); _Ajax.CFCMethod = 'doLogin'; _Ajax.URL = '/websvc/Blogs.cfc'; _Ajax.Params ={Params:'{' + params + '}'}; _Ajax.CallbackHandler = "onLogin"; _Ajax.Send(); } function onLogin(jsonRet){ iQ.Utils.doHideProcessing(); objLogin_Checker.doClearAllStatus(); objLogin_Panel.cancel(); if(!jsonRet.RSERROR && !jsonRet.ERRORMESSAGE){ iQ.Utils.SetCookie('Blog_isAuthenticated_' + m_BlogID,'T',365); iQ.Utils.SetCookie('Blog_Email_' + m_BlogID,jsonRet.EMAIL,365); iQ.Utils.SetCookie('Blog_FirstName_' + m_BlogID,jsonRet.FIRSTNAME,365); iQ.Utils.SetCookie('Blog_LastName_' + m_BlogID,jsonRet.LASTNAME,365); if(jsonRet.SAVEINFO == 'T'){ iQ.Utils.SetCookie('Blog_Password_' + m_BlogID,jsonRet.PASSWORD,365); }else{ iQ.Utils.SetCookie('Blog_Password_' + m_BlogID,jsonRet.PASSWORD,0); } if(jsonRet.AUTOLOGIN == 'T'){ iQ.Utils.SetCookie('Blog_AutoLogin_' + m_BlogID,'T',365); }else{ iQ.Utils.SetCookie('Blog_AutoLogin_' + m_BlogID,'F',0); } } if(jsonRet.RSERROR){ iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ if(jsonRet.ERRORMESSAGE){ iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ //iQ.Utils.doMessagePanel('Message',jsonRet.MESSAGE); doGetComments(m_BlogID,jsonRet.ENTRYID,'F'); } } } function doLogoff(){ iQ.Utils.SetCookie('Blog_isAuthenticated_' + m_BlogID,'F',0); iQ.Utils.doMessagePanel('Message','Logoff Complete'); setTimeout("self.location = self.location",500); } function doPostPasswordReminderForm(){ iQ.Utils.doShowProcessing(); var params = iQ.Utils.BuildAjaxParamStruct('PasswordReminder_Form'); var _Ajax = new iQ.Ajax(); _Ajax.CFCMethod = 'doPasswordReminder'; _Ajax.URL = '/websvc/Blogs.cfc'; _Ajax.Params ={Params:'{' + params + '}'}; _Ajax.CallbackHandler = "onPasswordReminder"; _Ajax.Send(); } function onPasswordReminder(jsonRet){ iQ.Utils.doHideProcessing(); if(jsonRet.RSERROR){ iQ.Utils.doMessagePanel('Message','An unexpected error has occured. Please try again later.'); }else{ if(jsonRet.ERRORMESSAGE){ iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ iQ.Utils.doMessagePanel('Message',jsonRet.MESSAGE); } } objPasswordReminder_Checker.doClearAllStatus(); objPasswordReminder_Panel.cancel(); } function doShowUserForm(action){ m_UserAction = action; objLogin_Checker.doClearAllStatus(); objLogin_Panel.cancel(); if(action == 'Create'){ objUser_Panel.center(); objUser_Panel.show(); }else{ doGetUser(); } } function doPostUserForm(){ if(m_UserAction == 'Create'){ doCreateUser(); }else{ doUpdateUser(); } } function doCreateUser(){ iQ.Utils.doShowProcessing(); var params = iQ.Utils.BuildAjaxParamStruct('User_Form'); var _Ajax = new iQ.Ajax(); _Ajax.CFCMethod = 'doCreateUser'; _Ajax.URL = '/websvc/Blogs.cfc'; _Ajax.Params ={Params:'{' + params + '}'}; _Ajax.CallbackHandler = "onCreateUserReturn"; _Ajax.Send(); } function onCreateUserReturn(jret){ if(!jret.RSERROR && !jret.ERRORMESSAGE){ iQ.Utils.SetCookie('Blog_isAuthenticated_' + m_BlogID,'T',365); iQ.Utils.SetCookie('Blog_Email_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','Email'),365); iQ.Utils.SetCookie('Blog_Password_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','Password'),365); iQ.Utils.SetCookie('Blog_FirstName_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','FirstName'),365); iQ.Utils.SetCookie('Blog_LastName_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','LastName'),365); } iQ.Utils.doHideProcessing(); objUser_Checker.doClearAllStatus(); if(jret.RSERROR){ iQ.Utils.doMessagePanel('Message',jret.ERRORMESSAGE); }else{ if(jret.ERRORMESSAGE){ iQ.Utils.doMessagePanel('Message',jret.ERRORMESSAGE); }else{ objUser_Panel.cancel(); setTimeout("self.location = self.location",500); } } } function doGetUser(){ iQ.Utils.doShowProcessing(); var params = '"Email":"' + encodeURIComponent(iQ.Utils.GetCookie('Blog_Email_' + m_BlogID)) + '",'; params += '"BlogID":"' + encodeURIComponent(m_BlogID) + '"'; //alert(params); var _Ajax = new iQ.Ajax(); _Ajax.CFCMethod = 'doGetUser'; _Ajax.URL = '/websvc/Blogs.cfc'; _Ajax.Params ={Params:'{' + params + '}'}; _Ajax.CallbackHandler = "onGetUser"; _Ajax.Send(); } function onGetUser(jsonRet){ iQ.Utils.doHideProcessing(); if(jsonRet.RSERROR){ iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ if(jsonRet.ERRORMESSAGE){ iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ jsonCols = new Object(); var rsData = jsonRet.RSUSER; for(var i = 0;i < rsData.COLUMNS.length;i++){ jsonCols[rsData.COLUMNS[i]] = i; } iQ.Utils.setFieldValue('User_Form','Email',rsData.DATA[0][jsonCols["EMAIL"]]); iQ.Utils.setFieldValue('User_Form','Password',rsData.DATA[0][jsonCols["PASSWORD"]]); iQ.Utils.setFieldValue('User_Form','FirstName',rsData.DATA[0][jsonCols["FIRSTNAME"]]); iQ.Utils.setFieldValue('User_Form','LastName',rsData.DATA[0][jsonCols["LASTNAME"]]); iQ.Utils.setFieldValue('User_Form','DisplayName',rsData.DATA[0][jsonCols["DISPLAYNAME"]]); iQ.Utils.setFieldValue('User_Form','PasswordAgain',rsData.DATA[0][jsonCols["PASSWORD"]]); if(rsData.DATA[0][jsonCols["ENTRYNOTIFICATION"]] == 'T'){ iQ.Utils.setFieldValue('User_Form','EntryNotification','T'); } if(rsData.DATA[0][jsonCols["COMMENTNOTIFICATION"]] == 'T'){ iQ.Utils.setFieldValue('User_Form','CommentNotification','T'); } objUser_Panel.center(); objUser_Panel.show(); } } } function doUpdateUser(){ iQ.Utils.doShowProcessing(); var params = iQ.Utils.BuildAjaxParamStruct('User_Form'); params += ',' params += '"OriginalEmail":"' + encodeURIComponent(iQ.Utils.GetCookie('Blog_Email_' + m_BlogID)) + '"'; //alert(params); var _Ajax = new iQ.Ajax(); _Ajax.CFCMethod = 'doUpdateUser'; _Ajax.URL = '/websvc/Blogs.cfc'; _Ajax.Params ={Params:'{' + params + '}'}; _Ajax.CallbackHandler = "onUpdateUser"; _Ajax.Send(); } function onUpdateUser(jsonRet){ iQ.Utils.doHideProcessing(); if(jsonRet.RSERROR){ iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ if(jsonRet.ERRORMESSAGE){ iQ.Utils.doMessagePanel('Message',jsonRet.ERRORMESSAGE); }else{ iQ.Utils.doMessagePanel('Message',jsonRet.MESSAGE); iQ.Utils.SetCookie('Blog_Email_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','Email'),365); iQ.Utils.SetCookie('Blog_Password_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','Password'),365); iQ.Utils.SetCookie('Blog_FirstName_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','FirstName'),365); iQ.Utils.SetCookie('Blog_LastName_' + m_BlogID,iQ.Utils.getFieldValue('User_Form','LastName'),365); } } objUser_Checker.doClearAllStatus(); objUser_Panel.cancel(); } function doPageLoad(){ //*****login panel var objLogin_FormRules =[ {FormName:'Login_Form',FieldName:'Email',Required:true,Rule:''}, {FormName:'Login_Form',FieldName:'Password',Required:true,Rule:''} ] var onLoginSubmit = function(){ var check = objLogin_Checker.doCheckAllFields(); if(check){ doPostLoginForm(); } }; var onLoginCancel = function(){ objLogin_Checker.doClearAllStatus(); this.cancel(); }; objLogin_Panel = new YAHOO.widget.Dialog("Login_Panel", { postmethod:"none", width:"400px", disply:"table", visible:false, draggable:true, close:false, constraintoviewport:false, modal:true, zindex:500, buttons:[{text:"Submit",handler:onLoginSubmit,isDefault:true},{text:"Cancel",handler:onLoginCancel}] } ); objLogin_Panel.setBody('
Login
Options
'); objLogin_Panel.setHeader('Blog') objLogin_Panel.render(document.body); objLogin_Checker = new iQ.Form.Checker(objLogin_FormRules); objLogin_Checker.doLoad(); //*****password reminder panel var objPasswordReminder_FormRules =[ {FormName:'PasswordReminder_Form',FieldName:'Email',Required:true,Rule:''} ] var onPasswordReminderSubmit = function(){ var check = objPasswordReminder_Checker.doCheckAllFields(); if(check){ doPostPasswordReminderForm(); } }; var onPasswordReminderCancel = function(){ objPasswordReminder_Checker.doClearAllStatus(); this.cancel(); }; objPasswordReminder_Panel = new YAHOO.widget.Dialog("PasswordReminder_Panel", { postmethod:"none", width:"400px", disply:"table", visible:false, draggable:true, close:false, constraintoviewport:false, modal:true, zindex:500, buttons:[{text:"Submit",handler:onPasswordReminderSubmit,isDefault:true},{text:"Cancel",handler:onPasswordReminderCancel}] } ); objPasswordReminder_Panel.setBody('
Password Reminder
'); objPasswordReminder_Panel.setHeader('Blog') objPasswordReminder_Panel.render(document.body); objPasswordReminder_Checker = new iQ.Form.Checker(objPasswordReminder_FormRules); objPasswordReminder_Checker.doLoad(); //*****user panel var objUser_FormRules =[ {FormName:'User_Form',FieldName:'Email',Required:true,Rule:'email'}, {FormName:'User_Form',FieldName:'Password',Required:true,Rule:''}, {FormName:'User_Form',FieldName:'PasswordAgain',Required:true,Rule:''}, {FormName:'User_Form',FieldName:'DisplayName',Required:true,Rule:''}, {FormName:'User_Form',FieldName:'FirstName',Required:true,Rule:''}, {FormName:'User_Form',FieldName:'LastName',Required:true,Rule:''} ] var onUserSubmit = function(){ var check = objUser_Checker.doCheckAllFields(); if(check){ doPostUserForm(); } }; var onUserCancel = function(){ objUser_Checker.doClearAllStatus(); this.cancel(); }; objUser_Panel = new YAHOO.widget.Dialog("User_Panel", { postmethod:"none", width:"400px", disply:"table", visible:false, draggable:true, close:false, constraintoviewport:false, modal:true, zindex:500, buttons:[{text:"Submit",handler:onUserSubmit,isDefault:true},{text:"Cancel",handler:onUserCancel}] } ); objUser_Panel.setBody('
My Profile
'); objUser_Panel.setHeader('My Profile') objUser_Panel.render(document.body); objUser_Checker = new iQ.Form.Checker(objUser_FormRules); objUser_Checker.doLoad(); // if(m_OpenCommentsEntryID != ''){ doGetComments(m_BlogID,m_OpenCommentsEntryID,"T"); } }