Skip to content

Commit

Permalink
Version 1.14.0, corresponding to December 2018 release of ArcGIS Online
Browse files Browse the repository at this point in the history
  • Loading branch information
asizer committed Dec 20, 2018
1 parent 8b5c327 commit 7fc15db
Show file tree
Hide file tree
Showing 46 changed files with 269 additions and 110 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Story Map Series app lets you present a series of maps via tabs, numbered bu
[Download](http://links.esri.com/storymaps/map_series_template_zip) |
[Map Series page on Esri Story Maps website](http://links.esri.com/storymaps/map_series_app)

**Latest release is version 1.13.0**, if you want to be informed of new releases, we recommend you to watch this repository ([see GitHub help](https://help.github.com/articles/watching-repositories)). See the [release page](https://github.com/Esri/map-series-storytelling-template-js/releases) for release notes.
**Latest release is version 1.14.0**, if you want to be informed of new releases, we recommend you to watch this repository ([see GitHub help](https://help.github.com/articles/watching-repositories)). See the [release page](https://github.com/Esri/map-series-storytelling-template-js/releases) for release notes.

For more infomation about using and customizing Esri's Storytelling Apps follow the [Story Maps Developers' Corner](https://developerscorner.storymaps.arcgis.com).

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Storymaps-MapSeries",
"version": "1.13.0",
"version": "1.14.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.4.0",
Expand Down
1 change: 0 additions & 1 deletion src/app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ app.cfg = {
YOUTUBE_TERMS_LINK: "http://links.esri.com/storymaps/youtube-terms",
VIMEO_TERMS_LINK: "http://links.esri.com/storymaps/vimeo-terms",
FLICKR_TERMS_LINK: "http://links.esri.com/storymaps/flickr-terms",
GOOGLE_TERMS_LINK: "http://links.esri.com/storymaps/google-terms",

// Control the authorized data source (for initialization and import screen)
AUTHORIZED_IMPORT_SOURCE: {
Expand Down
243 changes: 144 additions & 99 deletions src/app/storymaps/common/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,25 @@ define(["lib-build/css!lib-app/bootstrap/css/bootstrap.min",
// Direct creation and signed in
if (app.isDirectCreation) {
portalLogin().then(function(){
initializeUI();
_mainView.startFromScratch();
appInitComplete();
var oAuthInfo = new ArcGISOAuthInfo({
appId: 'storymaps',
portalUrl: 'https:' + app.indexCfg.sharingurl.split('/sharing')[0],
popup: true
});
IdentityManager.registerOAuthInfos([oAuthInfo]);
IdentityManager.checkAppAccess('https:' + app.indexCfg.sharingurl, 'storymaps').then(function(identityResponse){
if (identityResponse && identityResponse.code && identityResponse.code === "IdentityManagerBase.1") {
initError("notAuthorizedBuilder");
return;
}else {
initializeUI();
_mainView.startFromScratch();
appInitComplete();
}
}, function() {
initError("notAuthorizedBuilder");
return;
});
});
return;
}
Expand Down Expand Up @@ -574,103 +590,28 @@ define(["lib-build/css!lib-app/bootstrap/css/bootstrap.min",
initError("appLoadingFail");
return;
}

var itemRq = response.item,
dataRq = response.itemData;

app.data.setWebAppItem(itemRq);

if(app.appCfg.mediaPickerConfigureForceMode == "shortlist" && app.cfg.HTML_SANITIZER_DATE && itemRq.created > app.cfg.HTML_SANITIZER_DATE){
dataRq = app.sanitizer.sanitize(dataRq);
}

app.data.getWebAppData().set(dataRq);

app.userCanEdit = app.data.userIsAppOwner();

// Prevent app from accessing the cookie in viewer when user is not the owner
//if ( ! app.isInBuilder && ! app.userCanEdit ) {
// if( ! document.__defineGetter__ ) {
// Object.defineProperty(document, 'cookie', {
// get: function(){ return ''; },
// set: function(){ return true; }
// });
// }
// else {
// document.__defineGetter__("cookie", function() { return ''; });
// document.__defineSetter__("cookie", function() {} );
// }
//}

if( app.indexCfg.authorizedOwners && app.indexCfg.authorizedOwners.length > 0 && app.indexCfg.authorizedOwners[0] ) {
var owner = itemRq.owner,
ownerFound = false;

if( owner )
ownerFound = $.inArray(owner, app.indexCfg.authorizedOwners) != -1;

if ( ! ownerFound && app.indexCfg.authorizedOwners[0] == "*" )
ownerFound = true;

if ( ! ownerFound ) {
$.each(app.indexCfg.authorizedOwners, function(i, owner){
var test = owner.match(/^\[(.*)\]$/);
if ( test ) {
if ( itemRq.orgId == test[1] ) {
ownerFound = true;
}
}
});
}

if ( ! ownerFound ) {
initError("invalidConfigOwner");
var oAuthInfo = new ArcGISOAuthInfo({
appId: 'storymaps',
portalUrl: 'https:' + app.indexCfg.sharingurl.split('/sharing')[0],
popup: true
});
IdentityManager.registerOAuthInfos([oAuthInfo]);
if(response.item.access !== "public") {
IdentityManager.checkAppAccess('https:' + app.indexCfg.sharingurl, 'storymaps').then(function(identityResponse){
if (identityResponse && identityResponse.code && identityResponse.code === "IdentityManagerBase.1") {
initError("notAuthorizedLicense");
return;
} else {
loadWebMappingAppStep3(response);
return;
}
}, function() {
initError("notAuthorizedLicense");
return;
}
}

// App proxies
if (itemRq && itemRq.appProxies) {
var layerMixins = array.map(itemRq.appProxies, function (p) {
return {
"url": p.sourceUrl,
"mixin": {
"url": p.proxyUrl
}
};
});
app.data.setAppProxies(layerMixins);
}

// If in builder, check that user is app owner or org admin
if (app.isInBuilder && isProd() && !app.userCanEdit) {
initError("notAuthorized");
return;
}

_mainView.webAppConfigLoaded();

var useWebmapInApp = !! (app.appCfg ? app.appCfg.useWebmapInApp : true);
var webmapId = app.data.getWebAppData().getWebmap() || CommonHelper.getWebmapID(isProd());

if ((webmapId && useWebmapInApp && app.data.getWebAppData().isBlank()) || (app.isGalleryCreation)){
_mainView.startFromScratch();
initializeUI();
}
else if (webmapId && useWebmapInApp)
loadWebMap(webmapId);

else if ( ! useWebmapInApp || (! webmapId && useWebmapInApp)) {
initializeUI();
_mainView.loadWebmapFromData();
} else {
loadWebMappingAppStep3(response);
}
// ArcGIS Gallery page start the app with an appid that doesn't include a webmap
else if (CommonHelper.getPortalUser() || ! isProd() && app.data.getWebAppData().isBlank() )
redirectToBuilderFromGallery();
else if ( ! app.data.getWebAppData().isBlank() )
loadWebMap(app.data.getWebAppData().getViews()[0].cfg.webmap.id);
else
initError("appLoadingFail");
},
function(error)
{
Expand All @@ -684,6 +625,106 @@ define(["lib-build/css!lib-app/bootstrap/css/bootstrap.min",
);
}

function loadWebMappingAppStep3(response)
{
var itemRq = response.item,
dataRq = response.itemData;

app.data.setWebAppItem(itemRq);

if(app.appCfg.mediaPickerConfigureForceMode == "shortlist" && app.cfg.HTML_SANITIZER_DATE && itemRq.created > app.cfg.HTML_SANITIZER_DATE){
dataRq = app.sanitizer.sanitize(dataRq);
}

app.data.getWebAppData().set(dataRq);

app.userCanEdit = app.data.userIsAppOwner();

// Prevent app from accessing the cookie in viewer when user is not the owner
//if ( ! app.isInBuilder && ! app.userCanEdit ) {
// if( ! document.__defineGetter__ ) {
// Object.defineProperty(document, 'cookie', {
// get: function(){ return ''; },
// set: function(){ return true; }
// });
// }
// else {
// document.__defineGetter__("cookie", function() { return ''; });
// document.__defineSetter__("cookie", function() {} );
// }
//}

if( app.indexCfg.authorizedOwners && app.indexCfg.authorizedOwners.length > 0 && app.indexCfg.authorizedOwners[0] ) {
var owner = itemRq.owner,
ownerFound = false;

if( owner )
ownerFound = $.inArray(owner, app.indexCfg.authorizedOwners) != -1;

if ( ! ownerFound && app.indexCfg.authorizedOwners[0] == "*" )
ownerFound = true;

if ( ! ownerFound ) {
$.each(app.indexCfg.authorizedOwners, function(i, owner){
var test = owner.match(/^\[(.*)\]$/);
if ( test ) {
if ( itemRq.orgId == test[1] ) {
ownerFound = true;
}
}
});
}

if ( ! ownerFound ) {
initError("invalidConfigOwner");
return;
}
}

// App proxies
if (itemRq && itemRq.appProxies) {
var layerMixins = array.map(itemRq.appProxies, function (p) {
return {
"url": p.sourceUrl,
"mixin": {
"url": p.proxyUrl
}
};
});
app.data.setAppProxies(layerMixins);
}

// If in builder, check that user is app owner or org admin
if (app.isInBuilder && isProd() && !app.userCanEdit) {
initError("notAuthorized");
return;
}

_mainView.webAppConfigLoaded();

var useWebmapInApp = !! (app.appCfg ? app.appCfg.useWebmapInApp : true);
var webmapId = app.data.getWebAppData().getWebmap() || CommonHelper.getWebmapID(isProd());

if ((webmapId && useWebmapInApp && app.data.getWebAppData().isBlank()) || (app.isGalleryCreation)){
_mainView.startFromScratch();
initializeUI();
}
else if (webmapId && useWebmapInApp)
loadWebMap(webmapId);

else if ( ! useWebmapInApp || (! webmapId && useWebmapInApp)) {
initializeUI();
_mainView.loadWebmapFromData();
}
// ArcGIS Gallery page start the app with an appid that doesn't include a webmap
else if (CommonHelper.getPortalUser() || ! isProd() && app.data.getWebAppData().isBlank() )
redirectToBuilderFromGallery();
else if ( ! app.data.getWebAppData().isBlank() )
loadWebMap(app.data.getWebAppData().getViews()[0].cfg.webmap.id);
else
initError("appLoadingFail");
}

function portalLogin()
{
var resultDeferred = new Deferred();
Expand All @@ -692,7 +733,6 @@ define(["lib-build/css!lib-app/bootstrap/css/bootstrap.min",

app.portal.signIn().then(
function() {

// If in builder, check that user is user can create/edit item
if (app.isInBuilder && ! app.data.checkUserItemPrivileges()) {
initError("notAuthorizedBuilder");
Expand Down Expand Up @@ -873,7 +913,12 @@ define(["lib-build/css!lib-app/bootstrap/css/bootstrap.min",
cleanLoadingTimeout();
$("#loadingIndicator").hide();

errorMsg = errorMsg.replace(/%TPL_NAME%/g, app.cfg.TPL_NAME);
if ( error == "notAuthorizedLicense" ) {
errorMsg = i18n.commonCore.licenseChange2018.noAccess;
errorMsg = errorMsg.replace(/%USER_NAME%/g, CommonHelper.getPortalUser() ? CommonHelper.getPortalUser() : '');
} else {
errorMsg = errorMsg.replace(/%TPL_NAME%/g, app.cfg.TPL_NAME);
}

if ( error == "notAuthorized" && app.indexCfg.oAuthAppId ) {
errorMsg += '<div><button class="btn btn-sm btn-default" onclick="esri.id.destroyCredentials(); window.location.reload();">' + i18n.viewer.errors.signOut + '</button></div>';
Expand Down
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/ar/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ define({
"enlarge": "توسيع",
"newTab": "فتح في علامة تبويب جديدة",
"tagline": "خريطة قصة"
},
"licenseChange2018": {
"noAccess": "حسابك (%USER_NAME%) غير مرخص لفتح خريطة قصة غير عامة. رجاءً اطلب من مسئولي المؤسسة تعيينك كنوع مستخدم يتضمن خرائط القصة أو ترخيص التطبيقات الأساسية المضافة."
}
}
});
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/bs/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ define({
"enlarge": "Uvećaj",
"newTab": "Otvori u novoj kartici",
"tagline": "Story Map"
},
"licenseChange2018": {
"noAccess": "Vaš račun (%USER_NAME%) nije licenciran za upotrebu Story Mapa koji nije javan. Obratite se administratoru svoje organizacije da vam dodijeli vrstu korisnika koja sadrži licencu za Story Map ili za dodatke za osnovne appove."
}
}
});
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/ca/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ define({
"enlarge": "Amplia",
"newTab": "Obre-ho en una pestanya nova",
"tagline": "Un Story Map"
},
"licenseChange2018": {
"noAccess": "El vostre compte (%USER_NAME%) no té llicència per obrir un story map que no sigui públic. Demaneu a l'administrador de l'organització que us assigni un tipus d'usuari que inclogui story maps o una llicència d'aplicacions bàsiques de complement."
}
}
});
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ define({
enlarge: "Enlarge",
newTab: "Open in a new tab",
tagline: "A Story Map"
},
licenseChange2018: {
noAccess: "Your account (%USER_NAME%) is not licensed to open a Story Map that is not public. Please ask your organization administrator to assign you a user type that includes Story Maps or an add-on Essential Apps license."
}
}
}),
Expand Down
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/cs/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ define({
"enlarge": "Zvětšit",
"newTab": "Otevřít na nové kartě.",
"tagline": "Mapa s příběhem"
},
"licenseChange2018": {
"noAccess": "Váš účet (%USER_NAME%) nevlastní licenci k otevření mapy s příběhem, která není veřejná. Požádejte prosím správce své organizace, aby vám přidělil typ uživatele, jehož součástí jsou mapy s příběhem nebo doplňková licence základních aplikací."
}
}
});
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/da/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ define({
"enlarge": "Forstør",
"newTab": "Åbn på en ny fane",
"tagline": "Et Story Map"
},
"licenseChange2018": {
"noAccess": "Din konto (%USER_NAME%) har ikke licens til at åbne et Story Map, der ikke er offentlige. Bed din organisationsadministrator om at knytte dig til en brugertype, der omfatter Story Maps eller en add-on Essential Apps-licens."
}
}
});
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/de/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ define({
"enlarge": "Vergrößern",
"newTab": "In neuer Registerkarte öffnen",
"tagline": "Eine Story-Map"
},
"licenseChange2018": {
"noAccess": "Ihr Konto (%USER_NAME%) ist nicht dafür lizenziert, eine nicht öffentliche Story-Map zu öffnen. Bitten Sie den Administrator der Organisation, Ihnen einen Benutzertyp mit Story-Maps oder eine Add-On-Lizenz für Essential Apps zuzuweisen."
}
}
});
3 changes: 3 additions & 0 deletions src/app/storymaps/common/_resources/nls/el/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ define({
"enlarge": "Μεγέθυνση",
"newTab": "Άνοιγμα σε νέα καρτέλα",
"tagline": "Ένα story map"
},
"licenseChange2018": {
"noAccess": "Ο λογαριασμός σας (%USER_NAME%) δεν διαθέτει άδεια χρήσης για άνοιγμα Story Map που δεν είναι δημόσιο. Ζητήστε από τον διαχειριστή του οργανισμού σας να σας εκχωρήσει τύπο χρήστη που να περιλαμβάνει Story Map ή πρόσθετη άδεια χρήσης για Βασικές Εφαρμογές."
}
}
});
Loading

0 comments on commit 7fc15db

Please sign in to comment.