@openmrs/angularjs-openmrs-api
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -497,12 +497,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
openmrsTranslateProvider.$inject = ['$translateProvider', '$http']; | ||
function openmrsTranslateProvider($translateProvider, $http) { | ||
openmrsTranslateProvider.$inject = ['$translateProvider']; | ||
function openmrsTranslateProvider($translateProvider) { | ||
function init() { | ||
var contextPath; | ||
if (typeof OPENMRS_CONTEXT_PATH === 'undefined') { | ||
contextPath = 'openmrs'; | ||
} else { | ||
contextPath = OPENMRS_CONTEXT_PATH; | ||
} | ||
var contextPath = getContextPath(); | ||
@@ -513,8 +508,2 @@ $translateProvider.fallbackLanguage('en').preferredLanguage('en').useUrlLoader('/' + contextPath + '/module/uicommons/messages/messages.json', { | ||
.forceAsyncReload(true); // this line is what allows use to merge the list of statistically-defined locations with those loaded via URL, see https://angular-translate.github.io/docs/#/guide/12_asynchronous-loading | ||
$http.get('/' + contextPath + '/ws/rest/v1/session').then(function success(response) { | ||
if (response['locale'] != null) { | ||
$translateProvider.preferredLanguage(response['locale']); | ||
} | ||
}); | ||
} | ||
@@ -524,7 +513,2 @@ | ||
return { | ||
addTranslations: addTranslations, | ||
$get: ['$translate', provideOpenmrsTranslate] | ||
}; | ||
function addTranslations(key, newMessages) { | ||
@@ -538,11 +522,37 @@ var oldMessages = $translateProvider.translations(key); | ||
function provideOpenmrsTranslate($translate) { | ||
return { | ||
changeLanguage: changeLanguage | ||
}; | ||
function getContextPath() { | ||
if (typeof OPENMRS_CONTEXT_PATH === 'undefined') { | ||
return 'openmrs'; | ||
} else { | ||
return OPENMRS_CONTEXT_PATH; | ||
} | ||
} | ||
function provideOpenmrsTranslate($translate, $http) { | ||
function init() { | ||
$http.get('/' + getContextPath() + '/ws/rest/v1/session').then(function (response) { | ||
if (response.data['locale'] != null) { | ||
$translate.use(response.data['locale']); | ||
} | ||
}); | ||
} | ||
init(); | ||
function changeLanguage(key) { | ||
$translate.use(key); | ||
$http.post('/' + getContextPath() + '/ws/rest/v1/session', { 'locale': key }).then(function (response) { | ||
console.log("Locale changed to " + key); | ||
}); | ||
} | ||
return { | ||
changeLanguage: changeLanguage | ||
}; | ||
} | ||
return { | ||
addTranslations: addTranslations, | ||
$get: ['$translate', '$http', provideOpenmrsTranslate] | ||
}; | ||
} | ||
@@ -549,0 +559,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):"function"==typeof define&&define.amd?define("angularjs-openmrs-api",["angular","angular-resource","angular-translate","angular-translate-loader-url"],n):"object"==typeof exports?exports["angularjs-openmrs-api"]=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):e["angularjs-openmrs-api"]=n(e.angular,e["angular-resource"],e["angular-translate"],e["angular-translate-loader-url"])}(this,function(e,n,r,t){return function(e){function n(t){if(r[t])return r[t].exports;var u=r[t]={i:t,l:!1,exports:{}};return e[t].call(u.exports,u,u.exports,n),u.l=!0,u.exports}var r={};return n.m=e,n.c=r,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=3)}([function(e,n){e.exports=require("angular")},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e){function n(){return r}var r={};return{getConfig:n}}function a(e,n,r){return{responseError:function(t){if(!r.getConfig.test&&(401===t.status||403===t.status)&&n.confirm("The operation cannot be completed, because you are no longer logged in. Do you want to go to login page?")){var u=n.location.href;u=u.replace("#","_HASHTAG_"),u=u.slice(u.indexOf("/openmrs"));var a;if(d.default.isDefined(r.getConfig().href))a=r.getConfig().href;else{var o=n.location.pathname;o=i(o),a=o}var a=a+"/login.htm?redirect_url="+u;n.location.href=a}return e.reject(t)}}}function o(e){e.interceptors.push("authInterceptor"),e.defaults.headers.common["Disable-WWW-Authenticate"]="true"}function i(e){return e.substring(0,e.indexOf("/owa/"))}function s(e,n,r,t,u){function a(){function e(){var e=n.location.pathname;a.href=i(e),o.resolve(a)}var a=u.getConfig(),o=t.defer();return d.default.isUndefined(a.href)?r.get("manifest.webapp").then(function(n){n.data.activities.openmrs.testConfig?(a.href=n.data.activities.openmrs.testConfig.href,a.test=!0,r.defaults.headers.common["Disable-WWW-Authenticate"]=!1,r.defaults.withCredentials=!0,o.resolve(a)):e()},e):o.resolve(a),o.promise}function o(e){var r=e;r=n.location.pathname,r=r.substring(0,r.indexOf(e)),r.endsWith("/")&&(r=r.substring(0,r.length-1)),u.getConfig().href=r}function s(n){var r=t.defer();return a().then(function(t){var u,a;if(d.default.isString(n)){n={resource:n,url:"/"+n}}if(n.unnatural)u=n.params,a=t.href+"/ws/rest/v1"+n.url+"/:uuid";else{var o=d.default.copy(l.defaultConfig);u=d.default.extend(o,n.params),a=t.href+"/ws/rest/v1"+n.url+"/:uuid"}var i=n.actions||l.extraActions;l[n.resource]=e(a,u,i),r.resolve(l[n.resource])}),r.promise}var l={defaultConfig:{uuid:"@uuid"},add:s,getOpenmrsContextConfig:a,setBaseAppPath:o};return l}function l(){function e(e,n){return["openmrsRest",function(r){return r.list(e,n)}]}function n(e,n){return["openmrsRest",function(r){return r.get(e,n)}]}function r(e,n,r){function t(){var n=r.defer();return e.getOpenmrsContextConfig().then(function(e){n.resolve(e.href)}),n.promise}function u(n){e.setBaseAppPath(n)}function a(r,t){return e.add(r).then(function(e){return e.get(t).$promise.then(function(e){return new f(e,n)})})}function o(e,n){return n=x(n,"full"),a(e,n)}function i(e,n){return n=x(n,"ref"),a(e,n)}function s(n,r){return e.add(n).then(function(e){return e.get(r).$promise.then(function(e){return e})})}function l(e,n){return n=x(n,"full"),s(e,n)}function c(e,n){return n=x(n,"ref"),s(e,n)}function p(n,r){return e.add(n).then(function(e){return e.save(r).$promise.then(function(e){return e})})}function g(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},r).$promise.then(function(e){return e})})}function m(n,r,t){return e.add(n).then(function(e){return e.remove({uuid:r.uuid,reason:t}).$promise.then(function(e){return e})})}function h(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},{retired:!1}).$promise.then(function(e){return e})})}function v(n,r){var t={uuid:r.uuid};return null==t?t={purge:!0}:d.default.extend(t,{purge:!0}),e.add(n).then(function(e){return e.remove(t).$promise.then(function(e){return e})})}function x(e,n){return null==e?{v:n}:d.default.extend(e,{v:n})}return{list:a,listFull:o,listRef:i,get:s,getFull:l,getRef:c,create:p,update:g,remove:m,retire:m,unretire:h,purge:v,getServerUrl:t,setBaseAppPath:u}}return{list:e,get:n,$get:["openmrsApi","$document","$q",function(e,n,t){return r(e,n,t)}]}}function f(e,n){function r(){return null!=o}function t(){return null!=i}function u(e){var r=n[0].createElement("a");r.href=e;var t=r.search.slice(1).split("&"),u={};return t.forEach(function(e){""!==e&&(e=e.split("="),u[e[0]]=decodeURIComponent(e[1]||""))}),u}var a=e.results,o=null,i=null;return function(){if(null!=e.links)for(var n=0;n<e.links.length;n++){var r=e.links[n];"next"===r.rel?o=u(r.uri):"prev"===r.rel&&(i=u(r.uri))}}(),{results:a,hasNext:r,nextQuery:o,hasPrevious:t,previousQuery:i}}Object.defineProperty(n,"__esModule",{value:!0});var c=r(0),d=t(c),p=r(4);t(p);n.default=d.default.module("angularjs-openmrs-api-rest",["ngResource"]).factory("openmrsContext",u).factory("openmrsApi",s).factory("authInterceptor",a).config(o).provider("openmrsRest",l).name,u.$inject=["$window"],a.$inject=["$q","$window","openmrsContext"],o.$inject=["$httpProvider"],s.$inject=["$resource","$window","$http","$q","openmrsContext"]},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e,n){function r(n,r){var t=e.translations(n);angular.isDefined(t)||(t={}),e.translations(n,angular.extend(t,r))}function t(e){function n(n){e.use(n)}return{changeLanguage:n}}return function(){var r;r="undefined"==typeof OPENMRS_CONTEXT_PATH?"openmrs":OPENMRS_CONTEXT_PATH,e.fallbackLanguage("en").preferredLanguage("en").useUrlLoader("/"+r+"/module/uicommons/messages/messages.json",{queryParameter:"localeKey"}).useSanitizeValueStrategy("escape").forceAsyncReload(!0),n.get("/"+r+"/ws/rest/v1/session").then(function(n){null!=n.locale&&e.preferredLanguage(n.locale)})}(),{addTranslations:r,$get:["$translate",t]}}Object.defineProperty(n,"__esModule",{value:!0});var a=r(5),o=(t(a),r(6));t(o);n.default=angular.module("angularjs-openmrs-api-translate",["pascalprecht.translate"]).provider("openmrsTranslate",u).name,u.$inject=["$translateProvider","$http"]},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var u=r(0),a=t(u),o=r(1),i=t(o),s=r(2),l=t(s);n.default=a.default.module("angularjs-openmrs-api",[i.default,l.default]).name},function(e,n){e.exports=require("angular-resource")},function(e,n){e.exports=require("angular-translate")},function(e,n){e.exports=require("angular-translate-loader-url")}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):"function"==typeof define&&define.amd?define("angularjs-openmrs-api",["angular","angular-resource","angular-translate","angular-translate-loader-url"],n):"object"==typeof exports?exports["angularjs-openmrs-api"]=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):e["angularjs-openmrs-api"]=n(e.angular,e["angular-resource"],e["angular-translate"],e["angular-translate-loader-url"])}(this,function(e,n,r,t){return function(e){function n(t){if(r[t])return r[t].exports;var u=r[t]={i:t,l:!1,exports:{}};return e[t].call(u.exports,u,u.exports,n),u.l=!0,u.exports}var r={};return n.m=e,n.c=r,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=3)}([function(e,n){e.exports=require("angular")},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e){function n(){return r}var r={};return{getConfig:n}}function o(e,n,r){return{responseError:function(t){if(!r.getConfig.test&&(401===t.status||403===t.status)&&n.confirm("The operation cannot be completed, because you are no longer logged in. Do you want to go to login page?")){var u=n.location.href;u=u.replace("#","_HASHTAG_"),u=u.slice(u.indexOf("/openmrs"));var o;if(d.default.isDefined(r.getConfig().href))o=r.getConfig().href;else{var a=n.location.pathname;a=i(a),o=a}var o=o+"/login.htm?redirect_url="+u;n.location.href=o}return e.reject(t)}}}function a(e){e.interceptors.push("authInterceptor"),e.defaults.headers.common["Disable-WWW-Authenticate"]="true"}function i(e){return e.substring(0,e.indexOf("/owa/"))}function s(e,n,r,t,u){function o(){function e(){var e=n.location.pathname;o.href=i(e),a.resolve(o)}var o=u.getConfig(),a=t.defer();return d.default.isUndefined(o.href)?r.get("manifest.webapp").then(function(n){n.data.activities.openmrs.testConfig?(o.href=n.data.activities.openmrs.testConfig.href,o.test=!0,r.defaults.headers.common["Disable-WWW-Authenticate"]=!1,r.defaults.withCredentials=!0,a.resolve(o)):e()},e):a.resolve(o),a.promise}function a(e){var r=e;r=n.location.pathname,r=r.substring(0,r.indexOf(e)),r.endsWith("/")&&(r=r.substring(0,r.length-1)),u.getConfig().href=r}function s(n){var r=t.defer();return o().then(function(t){var u,o;if(d.default.isString(n)){n={resource:n,url:"/"+n}}if(n.unnatural)u=n.params,o=t.href+"/ws/rest/v1"+n.url+"/:uuid";else{var a=d.default.copy(l.defaultConfig);u=d.default.extend(a,n.params),o=t.href+"/ws/rest/v1"+n.url+"/:uuid"}var i=n.actions||l.extraActions;l[n.resource]=e(o,u,i),r.resolve(l[n.resource])}),r.promise}var l={defaultConfig:{uuid:"@uuid"},add:s,getOpenmrsContextConfig:o,setBaseAppPath:a};return l}function l(){function e(e,n){return["openmrsRest",function(r){return r.list(e,n)}]}function n(e,n){return["openmrsRest",function(r){return r.get(e,n)}]}function r(e,n,r){function t(){var n=r.defer();return e.getOpenmrsContextConfig().then(function(e){n.resolve(e.href)}),n.promise}function u(n){e.setBaseAppPath(n)}function o(r,t){return e.add(r).then(function(e){return e.get(t).$promise.then(function(e){return new f(e,n)})})}function a(e,n){return n=x(n,"full"),o(e,n)}function i(e,n){return n=x(n,"ref"),o(e,n)}function s(n,r){return e.add(n).then(function(e){return e.get(r).$promise.then(function(e){return e})})}function l(e,n){return n=x(n,"full"),s(e,n)}function c(e,n){return n=x(n,"ref"),s(e,n)}function p(n,r){return e.add(n).then(function(e){return e.save(r).$promise.then(function(e){return e})})}function g(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},r).$promise.then(function(e){return e})})}function m(n,r,t){return e.add(n).then(function(e){return e.remove({uuid:r.uuid,reason:t}).$promise.then(function(e){return e})})}function h(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},{retired:!1}).$promise.then(function(e){return e})})}function v(n,r){var t={uuid:r.uuid};return null==t?t={purge:!0}:d.default.extend(t,{purge:!0}),e.add(n).then(function(e){return e.remove(t).$promise.then(function(e){return e})})}function x(e,n){return null==e?{v:n}:d.default.extend(e,{v:n})}return{list:o,listFull:a,listRef:i,get:s,getFull:l,getRef:c,create:p,update:g,remove:m,retire:m,unretire:h,purge:v,getServerUrl:t,setBaseAppPath:u}}return{list:e,get:n,$get:["openmrsApi","$document","$q",function(e,n,t){return r(e,n,t)}]}}function f(e,n){function r(){return null!=a}function t(){return null!=i}function u(e){var r=n[0].createElement("a");r.href=e;var t=r.search.slice(1).split("&"),u={};return t.forEach(function(e){""!==e&&(e=e.split("="),u[e[0]]=decodeURIComponent(e[1]||""))}),u}var o=e.results,a=null,i=null;return function(){if(null!=e.links)for(var n=0;n<e.links.length;n++){var r=e.links[n];"next"===r.rel?a=u(r.uri):"prev"===r.rel&&(i=u(r.uri))}}(),{results:o,hasNext:r,nextQuery:a,hasPrevious:t,previousQuery:i}}Object.defineProperty(n,"__esModule",{value:!0});var c=r(0),d=t(c),p=r(4);t(p);n.default=d.default.module("angularjs-openmrs-api-rest",["ngResource"]).factory("openmrsContext",u).factory("openmrsApi",s).factory("authInterceptor",o).config(a).provider("openmrsRest",l).name,u.$inject=["$window"],o.$inject=["$q","$window","openmrsContext"],a.$inject=["$httpProvider"],s.$inject=["$resource","$window","$http","$q","openmrsContext"]},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e){function n(n,r){var t=e.translations(n);angular.isDefined(t)||(t={}),e.translations(n,angular.extend(t,r))}function r(){return"undefined"==typeof OPENMRS_CONTEXT_PATH?"openmrs":OPENMRS_CONTEXT_PATH}function t(e,n){function t(t){e.use(t),n.post("/"+r()+"/ws/rest/v1/session",{locale:t}).then(function(e){console.log("Locale changed to "+t)})}return function(){n.get("/"+r()+"/ws/rest/v1/session").then(function(n){null!=n.data.locale&&e.use(n.data.locale)})}(),{changeLanguage:t}}return function(){var n=r();e.fallbackLanguage("en").preferredLanguage("en").useUrlLoader("/"+n+"/module/uicommons/messages/messages.json",{queryParameter:"localeKey"}).useSanitizeValueStrategy("escape").forceAsyncReload(!0)}(),{addTranslations:n,$get:["$translate","$http",t]}}Object.defineProperty(n,"__esModule",{value:!0});var o=r(5),a=(t(o),r(6));t(a);n.default=angular.module("angularjs-openmrs-api-translate",["pascalprecht.translate"]).provider("openmrsTranslate",u).name,u.$inject=["$translateProvider"]},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var u=r(0),o=t(u),a=r(1),i=t(a),s=r(2),l=t(s);n.default=o.default.module("angularjs-openmrs-api",[i.default,l.default]).name},function(e,n){e.exports=require("angular-resource")},function(e,n){e.exports=require("angular-translate")},function(e,n){e.exports=require("angular-translate-loader-url")}])}); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@openmrs/angularjs-openmrs-api", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "AngularJS (1.x) library for OpenMRS API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110033
547