EsriEduNL / veldwerk2.0

WebApp to use ArcGIS Online Organization account for student field trips
GNU General Public License v2.0
1 stars 0 forks source link

Reusable check #35

Closed dhunink closed 9 years ago

dhunink commented 9 years ago

Edit: the idea below should be extended to a robust and comprehensive compatibility check: does the selected webmap passes several checks so we're sure the webmap can be used for Veldwerk 2.0?

In vCalls there's a function which tries to identify the layer that holds the question. Currently it's embedded in vCalls.duplicateQuestions(). What would be best practice to make this function reusable in other vCalls and main.js?

itemUrl = portalUrl + "/sharing/rest/content/items/" + mastermapid+"/data"; var itemRequestItem = esriRequest({ url: itemUrl, content: { f: "json"}, handleAs: "json" });

        itemRequestItem
        .then(
          function(itemRequestItemResult)
          {
              opLayers = itemRequestItemResult.operationalLayers;

              var vragenLayer = itemRequestItemResult.operationalLayers.filter(function ( obj ) {
                return (obj.title.match(/vragen/i) || obj.title.match(/opgaven/i) || obj.title.match(/opdrachten/i) )
              })[0];
              vragenLayerURL = vragenLayer.url;
              console.log(vragenLayerURL);

              fsUrl = vragenLayer.url+"/query";
              var fsRequestQuery = esriRequest({
                url: fsUrl,
                content: { f: "json", outFields : "*", where : "GROUPID IS NULL"},
                handleAs: "json"
             });
             return fsRequestQuery;
          },
          function(err)
          {
              deferred.resolve(err);
          }
        )
dhunink commented 9 years ago

See https://github.com/EsriEduNL/veldwerk2.0/issues/62 for a more general explanation.

dhunink commented 9 years ago

Started general implementation