var ATLAS_ANATOMY = 'Atlas Anatomy'; var CLINICAL_ILLUSTRATION = 'Clinical Illustrations'; var CLINICAL_ANIMATION = 'Clinical Animations'; var OpenedModuleItemList = []; var ModDetail = []; var moduleData; var modName; AIA.service('ModuleService', function($http, DataService) { return { loadModuleDataBasedOnModuleName: function(moduleName) { var jsonPath; modName = moduleName; //debugger; if (moduleName == ATLAS_ANATOMY) { jsonPath = '~/../content/data/json/aa/aa_dat_contentlist.json'; } else if (moduleName == CLINICAL_ANIMATION) { //to do, in next phase of project jsonPath = '~/../content/data/json/ca/ca_dat_contentlist.json'; } else if (moduleName == CLINICAL_ILLUSTRATION) { //to do, in next phase of project jsonPath = '~/../content/data/json/ci/ci_dat_contentlist.json'; } return $http.get(jsonPath, function (response) { moduleData = new jinqJs() .from(response.data.root.Item) // .orderBy([{field: '_Title', sort: 'asc' }]) .select(); // console.log(JSON.stringify(response, null, 4)); // response.data= moduleData; // return response.data; return moduleData; }); }, GetOpenedTileData: function (id,moduleJson) { if (modName == ATLAS_ANATOMY) { //debugger; var AADataForSelectedItem = []; var title = id; var selectedTileData = new jinqJs() .from(moduleJson.data.root.Item) .where("_Title == " + title) .select(); AADataForSelectedItem.push(selectedTileData[0]._ImageId); AADataForSelectedItem.push(selectedTileData[0]._BodyRegion); AADataForSelectedItem.push(selectedTileData[0]._BodySystem); AADataForSelectedItem.push(selectedTileData[0]._ImageName); AADataForSelectedItem.push(selectedTileData[0]._ImageType); AADataForSelectedItem.push(selectedTileData[0]._TileImageName); AADataForSelectedItem.push(selectedTileData[0]._Title); AADataForSelectedItem.push("ViewOrientation: " + selectedTileData[0]._ViewOrientation); return AADataForSelectedItem; } }, getPinDataForImage: function (imageName) { var pindataFileNamePart1 = imageName.replace("aa_img_", ""); var pinFileNamePart2 = pindataFileNamePart1.replace(".jpg", ""); var pinDatajsonPath = '~/../content/data/json/aa/aa_pindata/aa_dat_pindata_' + pinFileNamePart2 + '.json'; return $http.get(pinDatajsonPath, function (response) { var pinData = new jinqJs() .from(response.data.Root.Item) .select(); // alert(pinData.Root.Item); return pinData; }); } }; });