Skip to content

Commit

Permalink
ContextPath Prefixed for multiple calls via $.ajax/.getJson & more
Browse files Browse the repository at this point in the history
- Fixes Issue brightcove#64
  • Loading branch information
friendlymahi committed Dec 9, 2023
1 parent 035c9d8 commit 9140ed0
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
CONTENT_FINDER_NAME = 'Brightcove Videos';

// Get Brightcove Videos Asset Path from OSGI Config
$.getJSON("/bin/brightcove/getBrightcoveAssetPath.json").done(function(data){
$.getJSON(Granite.HTTP.externalize("/bin/brightcove/getBrightcoveAssetPath.json")).done(function(data){
assetPath = data["brightcoveAssetPath"];

getBrightcoveAssetsPath(assetPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
var ACTION = 'playlists';
var CONDITION = ( $(DIALOG_PLAYLIST_FIELD_SELECTOR).length > 0 ) ? existingValues.videoPlayerPL : existingValues.videoPlayer;

$.getJSON("/bin/brightcove/getLocalVideoList.json", {
$.getJSON(Granite.HTTP.externalize("/bin/brightcove/getLocalVideoList.json"), {
source: ACTION,
account_id: account_id
}).done(function(data) {
Expand Down Expand Up @@ -87,7 +87,7 @@
accountSelector.addEventListener('coral-select:showitems', function(event) {
accountSelector.items.clear();
if (accountSelector.items.length == 0) {
$.getJSON("/bin/brightcove/accounts.json").done(function(data) {
$.getJSON(Granite.HTTP.externalize("/bin/brightcove/accounts.json")).done(function(data) {
var accounts = data.accounts;
event.preventDefault();
accounts.forEach(function(value, index) {
Expand Down Expand Up @@ -126,7 +126,7 @@
? accountSelector.selectedItem.value : "";

if (playerSelector.items.length == 0) {
$.getJSON("/bin/brightcove/getLocalVideoList.json", {
$.getJSON(Granite.HTTP.externalize("/bin/brightcove/getLocalVideoList.json"), {
source: 'players',
account_id: account_id
}).done(function(data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

accountSelector.addEventListener('coral-select:showitems', function(event) {
if (accountSelector.items.length == 0) {
$.getJSON("/bin/brightcove/accounts.json").done(function(data) {
$.getJSON(Granite.HTTP.externalize("/bin/brightcove/accounts.json")).done(function(data) {
var accounts = data.accounts;
var selected;
event.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
$("[role='option']",playerID._selectList).remove();

var x = $("[name='./playerID']").closest(".coral-Select").find('option').remove().end();
$.getJSON("/bin/brightcove/api?a=players&account_id="+selectedAccount).done(function(data){
$.getJSON(Granite.HTTP.externalize("/bin/brightcove/api?a=players&account_id="+selectedAccount)).done(function(data){
_.each(data.items, function(value, id) {
var test2 = $("[name='./playerID']")[0];
$("<option "+(selectedPlayer === value.id ? "selected" : "")+" >").appendTo(test2).val(value.id).html(value.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//CONFIG

var brc_admin = brc_admin || {},
apiLocation = brc_admin.apiProxy; //This should be set to point to proxy.jsp on your server
apiLocation = Granite.HTTP.externalize(brc_admin.apiProxy); //This should be set to point to proxy.jsp on your server


//Default Fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ $(function () {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand Down Expand Up @@ -188,7 +188,7 @@ $(function () {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand All @@ -213,7 +213,7 @@ $(function () {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand All @@ -240,7 +240,7 @@ $(function () {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand All @@ -257,7 +257,7 @@ $(function () {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand Down Expand Up @@ -464,7 +464,7 @@ function loadFolders() {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand Down Expand Up @@ -520,7 +520,7 @@ function loadLabels() {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand Down Expand Up @@ -549,7 +549,7 @@ function loadLabels() {
};
$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand Down Expand Up @@ -585,7 +585,7 @@ function editLabels(event) {

$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: $.param(playlistData, true),
async: true,
success: function (data)
Expand Down Expand Up @@ -627,7 +627,7 @@ function editPlaylistHandler(event) {

$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: data,
async: true,
success: function (data)
Expand All @@ -654,7 +654,7 @@ function editPlaylistListingCallback(data) {

$.ajax({
type: 'GET',
url: '/bin/brightcove/api.js',
url: Granite.HTTP.externalize('/bin/brightcove/api.js'),
data: $.param(playlistData, true),
async: true,
success: function (data)
Expand Down Expand Up @@ -1180,7 +1180,7 @@ CQ.Ext.brightcove.economics = new CQ.Ext.data.JsonStore({
function syncDB()
{
syncStart();
var url = window.location.origin + "/bin/brightcove/dataload";
var url = window.location.origin + CQ.shared.HTTP.getContextPath()+ "/bin/brightcove/dataload";
data = "account_id="+$("#selAccount").val();
$.ajax({
type: 'GET',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
CQ.wcm.ContentFinderTab.REFRESH_BUTTON
]
},{
"url": "/bin/brightcove/api.json?a=local_players"
"url": CQ.shared.HTTP.getContextPath() +"/bin/brightcove/api.json?a=local_players"
},{
"autoLoad":false,
"reader": new CQ.Ext.data.JsonReader({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
}
]
},{
"url": "/bin/brightcove/api?a=list_playlists"
"url": CQ.shared.HTTP.getContextPath() +"/bin/brightcove/api?a=list_playlists"
},{
"autoLoad":false,
"reader": new CQ.Ext.data.JsonReader({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
}
]
},{
"url": "/bin/brightcove/api?a=list_videos"
"url": CQ.shared.HTTP.getContextPath() +"/bin/brightcove/api?a=list_videos"
},{
"autoLoad":false,
"reader": new CQ.Ext.data.JsonReader({
Expand Down

0 comments on commit 9140ed0

Please sign in to comment.