Commit 643e1501 by Jose Antonio

addPicto Arasaac license button

ToDo: test with real data
parent f71c85b4
......@@ -111,6 +111,7 @@
"enlarge": "Enlarge",
"enormous": "Enormous",
"error_adding_picto": "Error adding picto",
"error_arasaac_license": "Error accepting Arasaac license",
"error_creating_session": "Error when creating session",
"error_deleting_picto": "Error deleting picto",
"error_downloading_supervisors": "Error downloading supervisors",
......
......@@ -114,6 +114,7 @@
"expand_navigation": "Desplegar navegación",
"expression": "Expresión",
"error_adding_picto": "Error al añadir el picto",
"error_arasaac_license": "Error al aceptar la licencia de Arasaac",
"error_creating_session": "Error al crear sesión",
"error_deleting_picto": "Error borrando el picto",
"error_downloading_supervisors": "Error al descargar los supervisores",
......
......@@ -29,6 +29,7 @@ dashboardControllers.controller('AddPictoCtrl', function (
$scope.loadingCatPictos = false;
$scope.radioModel = 'Middle';
$scope.onlyOwn = onlyOwn;
$scope.showArasaacLicense = !supervisor.arasaacLicense; //If true, won't show license agreement
/*
* Get data about SymbolStix
......@@ -72,6 +73,48 @@ dashboardControllers.controller('AddPictoCtrl', function (
});
};
$scope.accept_arasaac = function (){
$http.get(config.backend + '/sup/arasaac_license/' + supervisor.id)
.success(function () {
$scope.showArasaacLicense = false;
$scope.load_arasaac_pictos();
})
.error(function () {
$translate('error_arasaac_license').then(function (translation) {
ngToast.danger({ content: translation });
});
});
};
$scope.load_arasaac_pictos = function () {
$scope.pictos = [];
if(!$scope.showArasaacLicense){
$scope.loadingCatPictos = true;
var request = "";
//Request page X from all pictos (symbolstx)
request = config.backend + '/sup/' + supervisor.id +
'/pic_fromArasaac/page/'+$scope.page+'/limit/'+$scope.limit;
$http.get(request)
.success(function (data) {
if (data && $scope.source == 'arasaac'){
$scope.pictos = data;
}
$scope.loadingCatPictos = false;
setTimeout(function () { $scope.$apply(); });
})
.error(function () {
$translate('error_loading_pictos').then(function (translation) {
ngToast.danger({ content: translation });
});
$scope.loadingCatPictos = false;
});
}
};
//
// Load pictos owned by the actual supervisor
//
......@@ -298,7 +341,7 @@ dashboardControllers.controller('AddPictoCtrl', function (
'/pic_fromCatSubcat/category/'+$scope.breadcrumbs[$scope.breadcrumbs.length-1].id
+'/page/'+$scope.page+'/limit/'+$scope.limit;
}
}else if($scope.source == "symbolstx"){
}else if($scope.source == "arasaac"){
//Request page X from all pictos (symbolstx)
request = config.backend + '/sup/' + supervisor.id +
'/pic_fromArasaac/page/'+$scope.page+'/limit/'+$scope.limit;
......@@ -352,7 +395,7 @@ dashboardControllers.controller('AddPictoCtrl', function (
if($scope.source == "ownpictos"){
source = 2;
}else if($scope.source == "ownpictos"){
}else if($scope.source == "arasaac"){
source = 3;
}
request = config.backend + '/sup/' + supervisor.id +
......
......@@ -75,6 +75,13 @@
<!-- Collections row -->
<div class="row">
<div id="arasaac_agreement" class="col-md-12" ng-show="showArasaacLicense && source == 'arasaac'">
<h2><small>
Los símbolos pictográficos utilizados en esta sección son propiedad de <b>CATEDU</b> (<a href="http://arasaac.org/">Arasaac</a>) bajo licencia Creative Commons y han sido creados por Sergio Palao.
<br>Para usarlos deberá aceptar la licencia de uso haciendo clic sobre el botón importar.</small>
</h2>
<button class="btn btn-primary" ng-click="accept_arasaac()">Importar</button>
</div>
<!-- Collections -->
<div id="collections" class="col-md-12 category-collection"
......@@ -108,6 +115,9 @@
</div><!-- /modal-body -->
<div class="modal-footer">
<div id="arasaac_license" ng-show="source == 'arasaac'">
<p class="small">Los símbolos pictográficos utilizados son propiedad de CATEDU (<a href="http://arasaac.org/">Arasaac</a>) bajo licencia Creative Commons y han sido creados por Sergio Palao</p>
</div>
<button class="btn btn-success pull-left" ng-show="source == 'ownpictos'" ngf-select ng-model="picFile" accept="image/*" ngf-change="addOwnPicto()">
<i class="fa fa-folder-open" aria-hidden="true"></i> {{ 'new_img' | translate }}
</button>
......
......@@ -33,6 +33,7 @@ dashboardControllers.controller('SupervisorCtrl', function SupervisorCtrl(
$scope.user.lang = user.lang;
$scope.user.isSupAdmin = user.isSupAdmin;
$scope.user.isTutor = user.isTutor;
$scope.user.arasaacLicense = user.arasaacLicense;
// Link to setup
$scope.setup = function(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment