var oPageMessage = new PageMessage();
function PageMessage(){
this.oPageMessageSpan = document.getElementById("PageMessage");
this.otdPageMessage = document.getElementById("tdPageMessage");
this.sPageMessage = "";
this.iMessageType = 0;
this.sReplaceToken = "%-TOKEN-%";
this.sTokenReplacementValue = "";
}
PageMessage.prototype.SetFocus = function()
{
var sLinkName = "#hPageMessage";
var sLinkName2 = "#h2PageMessage2";
var sDocLocation = document.location + ""; // this forces the variable to be considered a string and not a document.location object
if ((sDocLocation.indexOf('#hPageMessage') == -1) && (sDocLocation.indexOf('#h2PageMessage2') == -1))
document.location = sDocLocation + sLinkName;
else
{
if ((sDocLocation.indexOf('#hPageMessage') != -1) && (sDocLocation.indexOf('#h2PageMessage2') == -1))
{
document.location = sDocLocation.substr(0,(sDocLocation.indexOf('#hPageMessage'))) + sLinkName2;
}
if ((sDocLocation.indexOf('#hPageMessage') == -1) && (sDocLocation.indexOf('#h2PageMessage2') != -1))
document.location = sDocLocation.substr(0,(sDocLocation.indexOf('#h2PageMessage2'))) + sLinkName;
}
}
PageMessage.prototype.Message = function(sMessage)
{
this.sPageMessage =sMessage;
}
PageMessage.prototype.MessageType = function(iType)
{
/*
Priority
0 = Standard/default
1 = success
2 = warning
3 = failure
4 = Delete
5 = blue_question
*/
this.iMessageType = iType;
}
PageMessage.prototype.RenderMessage = function()
{
sTableBegin = "
| ";
sTableMiddle =" | ";
sTableEnd = " |
";
this.oPageMessageSpan.innerHTML = sTableBegin + this._RenderMessageImage() + sTableMiddle + this.sPageMessage + sTableEnd;
this.otdPageMessage.style.display="inline";
//this.otdPageMessage["className"] = this._RenderPageMessageClass();
}
PageMessage.prototype.HideMessage = function()
{
this.otdPageMessage.style.display="none";
}
PageMessage.prototype.TokenReplacement = function()
{
this.sPageMessage = this.sPageMessage.replace(this.sReplaceToken,this.sTokenReplacementValue);
}
PageMessage.prototype.saved = function()
{
this.sPageMessage = 'Your changes have been saved.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.canceled = function()
{
this.sPageMessage = 'Your un-saved changes have been canceled.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.welcome = function()
{
this.sPageMessage = 'Welcome back, %-TOKEN-%!';
this.iMessageType = 6;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.problem = function()
{
this.sPageMessage = 'There was a problem. Please see below.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.login_problem = function()
{
this.sPageMessage = 'These login credentials do not match our records.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.remove_success = function()
{
this.sPageMessage = 'The image has been removed.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.upload_success = function()
{
this.sPageMessage = 'Your changes have been saved.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.uploading = function()
{
this.sPageMessage = 'Uploading Image. Please wait.';
this.iMessageType = 5;
this.RenderMessage();
}
PageMessage.prototype.logout = function()
{
this.sPageMessage = 'You have been logged out. Come back soon!';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.login_required = function()
{
this.sPageMessage = 'You must be logged in to view this page. Please login below.';
this.iMessageType = 2;
this.RenderMessage();
}
PageMessage.prototype.no_org = function()
{
this.sPageMessage = 'No organization was selected. Please try again.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.password_reset_sent = function()
{
this.sPageMessage = 'You have been sent an e-mail with directions on how to complete the password reset process.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.email_not_found = function()
{
this.sPageMessage = 'This e-mail address was not found in our system.';
this.iMessageType = 2;
this.RenderMessage();
}
PageMessage.prototype.email_in_use = function()
{
this.sPageMessage = 'This e-mail is already in use.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.email_sent = function()
{
this.sPageMessage = 'Your %-TOKEN-% message has been sent';
this.iMessageType = 1;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.general_error = function()
{
this.sPageMessage = '%-TOKEN-%';
this.iMessageType = 2;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.access_denied = function()
{
this.sPageMessage = 'You are not authorized to view this page or item.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.please_select_item_publish = function()
{
this.sPageMessage = 'Please select at least one item.';
this.iMessageType = 2;
this.RenderMessage();
}
PageMessage.prototype.successful_registration = function()
{
this.sPageMessage = 'We\'ve sent a message to confirm your e-mail. Please click on the link in this message to activate your account.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.delete_successful = function()
{
this.sPageMessage = 'Your item(s) have been permanently deleted.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.limit_storage = function()
{
this.sPageMessage = 'The total storage limit for this account has been reached or exceeded. Please delete some content, or click here to to upgrade your account.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.limit_throughput = function()
{
this.sPageMessage = 'The total throughput (traffic) limit for this account has been reached or exceeded. Please click here to upgrade your account.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.limit_saved_content = function()
{
this.sPageMessage = 'You\'ve reached your account\'s limit on Saved items of this type. Please delete items or \074a href = \"/accounts/org_account_upgrade_options.php?\"\076click here\074/a\076 to upgrade.';
this.iMessageType = 3;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.limit_published_content = function()
{
this.sPageMessage = 'You\'ve reached your account\'s limit on Published items of this type. Please un-publish items or \074a href = \"/accounts/org_account_upgrade_options.php?\"\076click here\074/a\076 to upgrade.';
this.iMessageType = 3;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.limit_saved_feeds = function()
{
this.sPageMessage = 'You have reached the total limit for [content type pl] for your account. Please delete other items or upgrade now.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.limit_published_feeds = function()
{
this.sPageMessage = 'The total limit on PUBLISHED feeds for this account has been reached or exceeded. Please un-publish or delete some feeds, or click here to upgrade your account.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.limit_saved_widgets = function()
{
this.sPageMessage = 'The total limit on SAVED widgets for this account has been reached or exceeded. Please delete some widgets, or click here to upgrade your account.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.limit_published_widgets = function()
{
this.sPageMessage = 'The total limit on PUBLISHED widgets for this account has been reached or exceeded. Please un-publish or delete some widgets, or click here to upgrade your account.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.limit_admin_users = function()
{
this.sPageMessage = 'You have reached the total user limit for your account. Please decline other users or upgrade now.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.limit_free_org_accounts = function()
{
this.sPageMessage = 'The total limit on new org accounts you can create has been reached or exceeded. Please click here to upgrade your personal account.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.editing_lockout_other_user = function()
{
this.sPageMessage = 'This item is being edited by another user (user name and link).';
this.iMessageType = 2;
this.RenderMessage();
}
PageMessage.prototype.per_favorite_successful = function()
{
this.sPageMessage = 'Saved to your personal collections!';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.org_favorite_successful = function()
{
this.sPageMessage = 'Saved to this account\'s collections!';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.personal_note_submitted = function()
{
this.sPageMessage = 'Your personal note has been saved.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.please_select_item_unfavorite = function()
{
this.sPageMessage = 'Please select an item to remove from your Collection.';
this.iMessageType = 2;
this.RenderMessage();
}
PageMessage.prototype.wrong_image_format = function()
{
this.sPageMessage = 'Images must be JPG, GIF or PNG file types.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.image_too_large = function()
{
this.sPageMessage = 'Image is too large. Maximum file size is 1 MB.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.flag_submitted = function()
{
this.sPageMessage = 'Your flag has been submitted for review.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.flag_deleted = function()
{
this.sPageMessage = 'Your flag has been deleted.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.publish_successful_default = function()
{
this.sPageMessage = 'Publish successful!';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.publish_successful_distributed_content = function()
{
this.sPageMessage = 'Publish successful! Our %-TOKEN-% should display this content on their sites within 24 hours (varies by partner).';
this.iMessageType = 1;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.unpublish_successful_default = function()
{
this.sPageMessage = 'Un-Publish successful!';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.save_successful_not_published = function()
{
this.sPageMessage = 'Save successful! Content will not be visible or promoted until Published.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.content_not_available = function()
{
this.sPageMessage = 'Sorry! This content was not found on the system or cannot be displayed at this time.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.comment_submitted = function()
{
this.sPageMessage = 'Your comment has been submitted for review.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.user_message_sent = function()
{
this.sPageMessage = 'Your message has been sent!';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.email_sent = function()
{
this.sPageMessage = 'Your message has been sent!';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.pw_change_success = function()
{
this.sPageMessage = 'Your password has been changed.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.capture_to_stuff_successful = function()
{
this.sPageMessage = 'Item successfully copied to your Stuff. Please review license terms.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.em_confirmation_pending = function()
{
this.sPageMessage = 'Please login once you\'ve clicked on the link in the confirmation e-mail message.';
this.iMessageType = 2;
this.RenderMessage();
}
PageMessage.prototype.save_as_successful = function()
{
this.sPageMessage = '\"Save As\" successful';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.em_confirmation_success = function()
{
this.sPageMessage = 'Welcome to MassPublisher! Please login below.';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.em_confirmation_mismatch = function()
{
this.sPageMessage = 'The confirmation code does not match your e-mail.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.select_membership_option = function()
{
this.sPageMessage = 'Please select an option.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.page_not_found = function()
{
this.sPageMessage = 'The requested page was not found on our site';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.bad_captcha = function()
{
this.sPageMessage = 'Characters do not match. Please try again.';
this.iMessageType = 3;
this.RenderMessage();
}
PageMessage.prototype.saved_with_status_update = function()
{
this.sPageMessage = 'Your changes have been saved. \074a href=\"javascript: oPageMessage._PostAnnouncement(iContentMasterID, sAjaxSecurityAppend);\"\076Click here\074/a\076 to post status update.';
this.iMessageType = 1;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.publish_with_status_update = function()
{
this.sPageMessage = 'Publish successful. \074a href=\"javascript: oPageMessage._PostAnnouncement(iContentMasterID, sAjaxSecurityAppend);\"\076Click here\074/a\076 to post status update.';
this.iMessageType = 1;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype.successful_status_update = function()
{
this.sPageMessage = 'Status Update Successful';
this.iMessageType = 1;
this.RenderMessage();
}
PageMessage.prototype.first_personal_login = function()
{
this.sPageMessage = 'Welcome, %-TOKEN-%! This is the Home page for your \074em\076personal\074/em\076 account. If you\'d like to create a \074b\076business account\074/b\076, \074a href=\"/orgs/create_new_account.php?\"\076click here\074/a\076. Good publishing!';
this.iMessageType = 6;
this.TokenReplacement();
this.RenderMessage();
}
PageMessage.prototype._RenderMessageImage = function()
{
ReturnString = "";
switch (this.iMessageType)
{
case 1:
ReturnString = "
";
break;
case 2:
ReturnString = "
";
break;
case 3:
ReturnString = "
";
break;
case 4:
ReturnString = "
";
break;
case 5:
ReturnString = "
";
break;
case 6:
ReturnString = "
";
break;
default:
$ReturnString = "";
}
return ReturnString;
}
PageMessage.prototype._RenderPageMessageClass = function()
{
ReturnString = "";
switch (this.iMessageType)
{
case 1:
ReturnString = "PageMessageTD_check";
break;
case 2:
ReturnString = "PageMessageTD_info";
break;
case 3:
ReturnString = "PageMessageTD_exclamation";
break;
case 4:
ReturnString = "PageMessageTD_delete";
break;
case 5:
ReturnString = "PageMessageTD_question";
break;
case 6:
ReturnString = "PageMessageTD";
break;
default:
ReturnString = "PageMessageTD";
}
return ReturnString;
}
PageMessage.prototype._RenderPageMessageTableClass = function()
{
ReturnString = "";
switch (this.iMessageType)
{
case 1:
ReturnString = "PageMessageTABLE_check";
break;
case 2:
ReturnString = "PageMessageTABLE_info";
break;
case 3:
ReturnString = "PageMessageTABLE_exclamation";
break;
case 4:
ReturnString = "PageMessageTABLE_delete";
break;
case 5:
ReturnString = "PageMessageTABLE_question";
break;
case 6:
ReturnString = "PageMessageTABLE";
break;
default:
ReturnString = "PageMessageTD";
}
return ReturnString;
}
PageMessage.prototype._PostAnnouncement = function(ContentMasterID, AjaxSecurityCode)
{
if (ContentMasterID != null && AjaxSecurityCode != null)
{
document.body.style.cursor='wait';
var sURL_PrependObjInfo = "Content_Master_ID=" + ContentMasterID;
RequestManager.send({
priority : 1,
type : "get",
url : "/services/_post_announcement.php?" + sURL_PrependObjInfo + AjaxSecurityCode,
onsuccess : this.Success_PostAnnouncement,
onfailure : this.Failure_PostAnnouncement,
onnotmodified : this.Success_PostAnnouncement
});
}
}
PageMessage.prototype.Failure_PostAnnouncement = function(oResponse)
{
document.body.style.cursor='default';
this.sTokenReplacementValue = "Submission failure. Please try again later.";
this.Message("general_error");
}
PageMessage.prototype.Success_PostAnnouncement = function(oResponse)
{
document.body.style.cursor='default';
var oRequest = oResponse.request;
eval(oRequest.transport.responseText);
if (oJson_Twitter != null)
{
if (oJson_Twitter.TwitterObjects.length > 0)
{
if (oJson_Twitter.TwitterObjects[0].PageMessageToken != "")
oPageMessage.sTokenReplacementValue = oJson_Twitter.TwitterObjects[0].PageMessageToken;
if (oJson_Twitter.TwitterObjects[0].PageMessage != "")
{
eval('oPageMessage.' + oJson_Twitter.TwitterObjects[0].PageMessage + '();');
oPageMessage.SetFocus();
}
}
}
}