Skip to content

Commit

Permalink
Merge pull request #100 from percussion/javascript-updates
Browse files Browse the repository at this point in the history
updated several js service files
  • Loading branch information
natechadwick committed Apr 16, 2021
2 parents 77d532c + f9a46fe commit a36d718
Show file tree
Hide file tree
Showing 24 changed files with 333 additions and 631 deletions.
160 changes: 10 additions & 150 deletions WebUI/war/services/PercBlogService.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@
*/
function getBlogsForSite(siteName, callback) {
var requestUrl = $.perc_paths.BLOG_LOAD;
if(siteName != "@all")
requestUrl += "/" + siteName;
else
requestUrl = requestUrl.replace("blogs","allBlogs");

if(siteName !== "@all") {
requestUrl += "/" + siteName;
}
else {
requestUrl = requestUrl.replace("blogs", "allBlogs");
}

$.PercServiceUtils.makeJsonRequest(
requestUrl,
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
} else {
var defaultMsg = $.PercServiceUtils.extractDefaultErrorMessage(result.request);
Expand All @@ -68,156 +70,14 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
} else {
var defaultMsg = $.PercServiceUtils.extractDefaultErrorMessage(result.request);
callback($.PercServiceUtils.STATUS_ERROR, defaultMsg);
}
}
);
}
var getBlogsForSiteMock = { "blogs" : [
{ "title" : "Short Title",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "me",
"description" : "Short Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Medium Title Medium Title Medium Title",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "myself",
"description" : "Short Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "andi",
"description" : "Short Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 2",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "pluto",
"description" : "Medium Description Medium Description Medium Description Medium Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 3",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "mickey",
"description" : "Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 4",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "minnie",
"description" : "Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description",
"tags" : ["medium","list","of","tags","medium","list","of","tags","medium","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 5",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "donald",
"description" : "Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description",
"tags" : ["long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Short Title 2",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "me",
"description" : "Short Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Medium Title Medium Title Medium Title 3",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "myself",
"description" : "Short Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 6",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "andi",
"description" : "Short Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 7",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "pluto",
"description" : "Medium Description Medium Description Medium Description Medium Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 8",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "mickey",
"description" : "Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description",
"tags" : ["short","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 9",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "minnie",
"description" : "Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description",
"tags" : ["medium","list","of","tags","medium","list","of","tags","medium","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
},
{ "title" : "Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title Long Title 10",
"id" : "1234-4321",
"postTemplateId" : "2345-5423",
"author" : "donald",
"description" : "Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description Long Description",
"tags" : ["long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags","long","list","of","tags"],
"postCount" : 12,
"lastPublishedDate" : "2/3/2011",
"lastPublishedTime" : "11:23 PM"
}
]};
}

})(jQuery);
31 changes: 9 additions & 22 deletions WebUI/war/services/PercCategoryService.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@


function getCategories(sitename, callback){

var self = this;

$.PercServiceUtils.makeJsonRequest(
$.perc_paths.CAT_ALL + "/" + sitename,
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
else {
Expand All @@ -62,15 +60,13 @@
}

function editCategories(categories, sitename, callback) {

var self = this;


$.PercServiceUtils.makeJsonRequest(
$.perc_paths.CAT_UPDATE + "/" + sitename,
$.PercServiceUtils.TYPE_POST,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
else {
Expand All @@ -83,14 +79,12 @@
}

function getTabLockData(callback) {
var self = this;

$.PercServiceUtils.makeJsonRequest(
$.perc_paths.CAT_LOCK_INFO,
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
else {
Expand All @@ -102,16 +96,14 @@
}

function lockCategoryTab(callback) {

var self = this;
var currentDate = (new Date()).toString();
var currentDate = (new Date()).toString();

$.PercServiceUtils.makeJsonRequest(
$.perc_paths.CAT_LOCK_TAB + "/" + currentDate,
$.PercServiceUtils.TYPE_POST,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
else {
Expand All @@ -123,15 +115,12 @@
}

function removeCatTabLock(callback) {

var self = this;

$.PercServiceUtils.makeJsonRequest(
$.perc_paths.CAT_REMOVE_TAB_LOCK,
$.PercServiceUtils.TYPE_POST,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
else {
Expand All @@ -143,9 +132,7 @@
}

function publishToDTS(deliveryServer, sitename, callback) {

var self = this;
if (sitename==null || typeof sitename == "undefined" || sitename.length == 0)
if (sitename==null || typeof sitename === "undefined" || sitename.length === 0)
{
sitename="all";
}
Expand All @@ -154,7 +141,7 @@
$.PercServiceUtils.TYPE_POST,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS);
}
else {
Expand Down
12 changes: 4 additions & 8 deletions WebUI/war/services/PercCookieConsentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data, I18N.message("perc.ui.gadgets.cookieConsent@Success retrieving cookie consent entries"));
}
else {
Expand All @@ -73,7 +73,7 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
callback($.PercServiceUtils.STATUS_SUCCESS, result.data, I18N.message("perc.ui.gadgets.cookieConsent@Success retrieving cookie consent entries"));
}
else {
Expand All @@ -97,19 +97,15 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if(status == $.PercServiceUtils.STATUS_SUCCESS) {
if(status === $.PercServiceUtils.STATUS_SUCCESS) {
result.url = url;
callback($.PercServiceUtils.STATUS_SUCCESS, result);
}
else {
var defaultMsg = $.PercServiceUtils.extractDefaultErrorMessage(result.request);
callback($.PercServiceUtils.STATUS_ERROR, defaultMsg);
}
}
,""
,"text/csv"
,"text"
);
},"","text/csv","text");
}

/**
Expand Down
14 changes: 7 additions & 7 deletions WebUI/war/services/PercFolderService.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if (status == $.PercServiceUtils.STATUS_SUCCESS)
if (status === $.PercServiceUtils.STATUS_SUCCESS)
{
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
Expand All @@ -81,7 +81,7 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if (status == $.PercServiceUtils.STATUS_SUCCESS)
if (status === $.PercServiceUtils.STATUS_SUCCESS)
{
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
Expand All @@ -103,7 +103,7 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if (status == $.PercServiceUtils.STATUS_SUCCESS)
if (status === $.PercServiceUtils.STATUS_SUCCESS)
{
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
Expand All @@ -129,7 +129,7 @@
false,
function(status, result)
{
if(status == $.PercServiceUtils.STATUS_SUCCESS)
if(status === $.PercServiceUtils.STATUS_SUCCESS)
{
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
Expand All @@ -150,7 +150,7 @@
false,
function(status, result)
{
if(status == $.PercServiceUtils.STATUS_SUCCESS)
if(status === $.PercServiceUtils.STATUS_SUCCESS)
{
callback(true, result.data);
}
Expand All @@ -171,7 +171,7 @@
$.PercServiceUtils.TYPE_GET,
sync,
function(status, result) {
if (status == $.PercServiceUtils.STATUS_SUCCESS)
if (status === $.PercServiceUtils.STATUS_SUCCESS)
{
callback($.PercServiceUtils.STATUS_SUCCESS, result.data);
}
Expand All @@ -190,7 +190,7 @@
$.PercServiceUtils.TYPE_GET,
false,
function(status, result) {
if (status == $.PercServiceUtils.STATUS_SUCCESS)
if (status === $.PercServiceUtils.STATUS_SUCCESS)
{
callback(result.data);
}
Expand Down

0 comments on commit a36d718

Please sign in to comment.