gce

parent bce24892
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteRule ^ /index.html [L]
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Proyecto MateFun</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<!-- despues lo saco de aca -->
<!-- <link rel="stylesheet" type="text/css" href="node_modules/codemirror/addon/hint/show-hint.css"> -->
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</head>
<body>
<app-root>
<div class="loading">
<div class="loading-bar"></div>
<div class="loading-bar"></div>
<div class="loading-bar"></div>
<div class="loading-bar"></div>
<div class="loading-bar"></div>
</div>
</app-root>
<script type="text/javascript" src="inline.bundle.js"></script><script type="text/javascript" src="polyfills.bundle.js"></script><script type="text/javascript" src="scripts.bundle.js"></script><script type="text/javascript" src="styles.bundle.js"></script><script type="text/javascript" src="vendor.bundle.js"></script><script type="text/javascript" src="main.bundle.js"></script></body>
</html>
/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ var parentJsonpFunction = window["webpackJsonp"];
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [], result;
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ for(moduleId in moreModules) {
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
/******/ modules[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);
/******/ while(resolves.length) {
/******/ resolves.shift()();
/******/ }
/******/ if(executeModules) {
/******/ for(i=0; i < executeModules.length; i++) {
/******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]);
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // objects to store loaded and loading chunks
/******/ var installedChunks = {
/******/ 17: 0
/******/ };
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = function requireEnsure(chunkId) {
/******/ if(installedChunks[chunkId] === 0) {
/******/ return Promise.resolve();
/******/ }
/******/
/******/ // a Promise means "currently loading".
/******/ if(installedChunks[chunkId]) {
/******/ return installedChunks[chunkId][2];
/******/ }
/******/
/******/ // setup Promise in chunk cache
/******/ var promise = new Promise(function(resolve, reject) {
/******/ installedChunks[chunkId] = [resolve, reject];
/******/ });
/******/ installedChunks[chunkId][2] = promise;
/******/
/******/ // start chunk loading
/******/ var head = document.getElementsByTagName('head')[0];
/******/ var script = document.createElement('script');
/******/ script.type = 'text/javascript';
/******/ script.charset = 'utf-8';
/******/ script.async = true;
/******/ script.timeout = 120000;
/******/
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "" + chunkId + ".chunk.js";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var chunk = installedChunks[chunkId];
/******/ if(chunk !== 0) {
/******/ if(chunk) {
/******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));
/******/ }
/******/ installedChunks[chunkId] = undefined;
/******/ }
/******/ };
/******/ head.appendChild(script);
/******/
/******/ return promise;
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // on error function for async loading
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
/******/ })
/************************************************************************/
/******/ ([]);
//# sourceMappingURL=inline.bundle.js.map
\ No newline at end of file
{"version":3,"sources":["webpack/bootstrap efd1283c341e8772139e"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t17: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tif(installedChunks[chunkId] === 0) {\n \t\t\treturn Promise.resolve();\n \t\t}\n\n \t\t// a Promise means \"currently loading\".\n \t\tif(installedChunks[chunkId]) {\n \t\t\treturn installedChunks[chunkId][2];\n \t\t}\n\n \t\t// setup Promise in chunk cache\n \t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\tinstalledChunks[chunkId] = [resolve, reject];\n \t\t});\n \t\tinstalledChunks[chunkId][2] = promise;\n\n \t\t// start chunk loading\n \t\tvar head = document.getElementsByTagName('head')[0];\n \t\tvar script = document.createElement('script');\n \t\tscript.type = 'text/javascript';\n \t\tscript.charset = 'utf-8';\n \t\tscript.async = true;\n \t\tscript.timeout = 120000;\n\n \t\tif (__webpack_require__.nc) {\n \t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t}\n \t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".chunk.js\";\n \t\tvar timeout = setTimeout(onScriptComplete, 120000);\n \t\tscript.onerror = script.onload = onScriptComplete;\n \t\tfunction onScriptComplete() {\n \t\t\t// avoid mem leaks in IE.\n \t\t\tscript.onerror = script.onload = null;\n \t\t\tclearTimeout(timeout);\n \t\t\tvar chunk = installedChunks[chunkId];\n \t\t\tif(chunk !== 0) {\n \t\t\t\tif(chunk) {\n \t\t\t\t\tchunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));\n \t\t\t\t}\n \t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t}\n \t\t};\n \t\thead.appendChild(script);\n\n \t\treturn promise;\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap efd1283c341e8772139e"],"sourceRoot":"webpack:///"}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import { Component, OnInit } from '@angular/core';
import { MoodleService } from '../../shared/services/moodle.service';
import { AuthenticationService } from '../../shared/services/authentication.service';
@Component({
......@@ -12,7 +11,7 @@ import { AuthenticationService } from '../../shared/services/authentication.serv
export class GestcursosComponent implements OnInit {
constructor(private moodleService: MoodleService, private authenticationService: AuthenticationService) { }
constructor(private authenticationService: AuthenticationService) { }
ngOnInit() {
......
......@@ -4,7 +4,6 @@ import { FormsModule } from '@angular/forms';
import { GestcursosRoutingModule } from './gestcursos-routing.module';
import { GestcursosComponent } from './gestcursos.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { MoodleService } from '../../shared/services/moodle.service';
@NgModule({
imports: [
......@@ -14,6 +13,6 @@ import { MoodleService } from '../../shared/services/moodle.service';
GestcursosRoutingModule
],
declarations: [GestcursosComponent],
providers: [MoodleService]
providers: []
})
export class GestcursosModule { }
......@@ -17,13 +17,13 @@
<div id="matricular" style="border: 1px solid #B8B8B8; border-radius: 5px;" class="paddingdivs">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8"><p>Ingresar un nuevo centro educativo</p></div>
<div class="col-md-8"><h5>Ingresar un nuevo centro educativo</h5></div>
<div class="col-md-2"></div>
</div>
<div id="matricular"class="row paddingdivs">
<div class="col-md-1"></div>
<div class="col-md-10">
<label for="search">Nombre del centro educativo:</label>
<label for="search">Nombre del centro educativo</label>
<div class="input-group">
<input type="text" autocomplete="off" class="form-control" id="ietiqueta" [(ngModel)]="ietiqueta" [ngModelOptions]="{standalone: true}" >
</div>
......@@ -39,6 +39,17 @@
<div class="col-md-1"></div>
</div>
<div id="matricular"class="row paddingdivs">
<div class="col-md-1"></div>
<div class="col-md-10">
<label for="search">Nombre del usuario:</label>
<div class="input-group">
<input type="text" autocomplete="off" class="form-control" id="servicename" [(ngModel)]="username" [ngModelOptions]="{standalone: true}" >
</div>
</div>
<div class="col-md-1"></div>
</div>
<div id="matricular"class="row paddingdivs">
<div class="col-md-1"></div>
<div class="col-md-10">
......@@ -74,28 +85,31 @@
<div id="matricular" style="border: 1px solid #B8B8B8; border-radius: 5px;" class="paddingdivs">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8"><p>Editar/Eliminar centro educativo</p></div>
<div class="col-md-8"><h5>Editar/Eliminar centro educativo</h5></div>
<div class="col-md-2"></div>
</div>
<div id="matricular" class="row">
<div class="col-md-12">
<table class="table table-hover fixed">
<colgroup>
<col scope="col" width="50px" />
<col scope="col" width="90px" />
<col span="2" scope="col" width="60px" />
<col scope="col" width="30px" />
</colgroup>
<tr *ngFor="let school of schoolList">
<td class="td30" class="smallText">
<span class="{{viewclass[school.order]}}"><span class="bold">Nombre del centro educativo:</span> {{school.nombre}}</span>
<input class="{{editclass[school.order]}} altoFijo" id="nombre{{school.order}}" [(ngModel)]="editcentroeducativoname[school.order]" type="text"/>
<span class="{{viewclass[school.order]}}" ><span class="bold">URL Moodle:</span> {{school.moodleuri}}</span>
<input id="moodle{{school.order}}" class="{{editclass[school.order]}} altoFijo" [(ngModel)]="editmoodleuri[school.order]" type="text"/>
<br/>
<span class="{{viewclass[school.order]}}" ><span class="bold">Nombre Servicio:</span> {{school.servicename}}</span>
<span class="{{viewclass[school.order]}}" ><span class="bold">Nombre del servicio:</span> {{school.servicename}}</span>
<input class="{{editclass[school.order]}} altoFijo" id="servicename{{school.order}}" [(ngModel)]="editcentroeducativoservicename[school.order]" type="text"/>
<br/>
<span class="{{viewclass[school.order]}}"><span class="bold">Nombre del usuario:</span> {{school.moodleapiusername}}</span>
<input class="{{editclass[school.order]}} altoFijo" id="username{{school.order}}" [(ngModel)]="editcentroeducativousername[school.order]" type="text"/>
</td>
<td class="td30" class="smallText" colspan="2">
<span class="{{viewclass[school.order]}}" ><span class="bold">URI Moodle:</span> {{school.moodleuri}}</span>
<input id="moodle{{school.order}}" class="{{editclass[school.order]}} altoFijo" [(ngModel)]="editmoodleuri[school.order]" type="text"/>
<span class="{{viewclass[school.order]}}"><span class="bold">Nombre del centro educativo:</span> {{school.nombre}}</span>
<input class="{{editclass[school.order]}} altoFijo" id="nombre{{school.order}}" [(ngModel)]="editcentroeducativoname[school.order]" type="text"/>
<br/>
<span class="{{viewclass[school.order]}}" ><span class="bold">Token:</span> ******************************** </span>
<input class="{{editclass[school.order]}} altoFijo" id="servicetoken{{school.order}}" [(ngModel)]="editcentroeducativoservicetoken[school.order]" type="text"/>
......
......@@ -14,4 +14,4 @@ table.fixed { table-layout:fixed; }
table.fixed td { overflow: hidden; }
.altoFijo{ padding: 0px 0px; line-height: 10px; width: 100%; }
\ No newline at end of file
.altoFijo{ padding: 0px 0px; line-height: 10px; width: 100%; margin-top: 5px;}
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { MoodleService } from '../../shared/services/moodle.service';
import { AuthenticationService } from '../../shared/services/authentication.service';
import { Services } from '../../shared/services/services.service';
import { CentroEducativo } from '../../shared/services/CentroEducativo.service';
@Component({
moduleId: module.id,
......@@ -11,7 +10,6 @@ import { Services } from '../../shared/services/services.service';
})
export class IEducativaComponent implements OnInit {
ietiqueta = null
iurl = null
eetiqueta = null
......@@ -25,13 +23,13 @@ export class IEducativaComponent implements OnInit {
editcentroeducativoname : string[] = []
editcentroeducativoservicename : string[] = []
editcentroeducativoservicetoken : string[] = []
editcentroeducativousername : string[] = []
editmoodleuri : string[] = []
servicename : string
servicetoken : string
username: string
constructor(private moodleService: MoodleService, private genericServices : Services, private authenticationService: AuthenticationService) { }
constructor(private centroeducativoservice : CentroEducativo, private authenticationService: AuthenticationService) { }
resetEditForm(){
this.editmode = []
......@@ -43,13 +41,14 @@ export class IEducativaComponent implements OnInit {
}
getTodosLoscentroeducativos(){
this.authenticationService.getAllSchools().subscribe(
data => {
this.schoolList = data;
this.resetEditForm();
},
error => { console.log(error); }
_ => {
this.showErrorAlert('No se puede obtener la informacion de los centros educativos.');
}
);
}
......@@ -65,6 +64,7 @@ export class IEducativaComponent implements OnInit {
this.ietiqueta =
this.iurl =
this.servicename =
this.username =
this.servicetoken = ''
}
......@@ -86,54 +86,84 @@ export class IEducativaComponent implements OnInit {
this.alertText = ''
}
getLabel(key: string){
let label = '';
switch(key) {
case 'nombre':
label = 'Nombre del centro educativo';
break;
case 'moodleuri':
label = 'URL de Moodle';
break;
case 'servicename':
label = 'Nombre del servicio';
break;
case 'moodleapiusername':
label = 'Nombre del usuario';
break;
default:
label = 'Token';
}
return label;
}
checkData(data: any){
const keys = Object.keys(data);
for(let i=0; i<keys.length; i++){
let key = keys[i];
if (key!='idcentroeducativo' && !data[key]){
this.showErrorAlert("Valor invalido para '" + this.getLabel(key) + "'.");
return false;
}
}
return true;
}
addSchool() {
const data = { "idcentroeducativo": '' ,
"nombre": this.ietiqueta,
"moodleuri": this.iurl,
"servicename" : this.servicename,
"servicetoken" : this.servicetoken
}
//'/servicios/centroeducativo/addNewSchool
this.genericServices.POST('/servicios/centroeducativo/addNewSchool',data).subscribe(
data => {
const data = {"idcentroeducativo": '' , "nombre": this.ietiqueta, "moodleuri": this.iurl,
"servicename" : this.servicename, "servicetoken" : this.servicetoken, "moodleapiusername": this.username};
if (!this.checkData(data))
return;
this.centroeducativoservice.agregarNuevoCentroEducativo(data).subscribe(
_ => {
this.showAlert(this.ietiqueta + ' agregado con exito.')
this.resetAddcentroeducativoForm();
this.getTodosLoscentroeducativos();
},
error => {
this.showErrorAlert('Error al agregar ' + data.nombre)
_ => {
this.showErrorAlert('Error al agregar el centro educativo ' + data.nombre)
}
);
}
delete(event, centroeducativo){
if (confirm("Esta seguro que desea eliminar el centroeducativo: " + centroeducativo.nombre + "?")) {
this.moodleService.deleteSchool(centroeducativo.idcentroeducativo).subscribe(
data => {
this.centroeducativoservice.deleteSchool(centroeducativo.idcentroeducativo).subscribe(
_ => {
this.showAlert(centroeducativo.nombre + ' eliminado con exito')
this.schoolList = this.schoolList.filter(function(value, index, arr){
return value.idcentroeducativo != centroeducativo.idcentroeducativo;
});
this.schoolList = this.schoolList.filter((value) => value.idcentroeducativo != centroeducativo.idcentroeducativo );
},
error => {
_ => {
this.showErrorAlert('Error al eliminar el centroeducativo ' + centroeducativo.nombre )
}
);
}
}
edit(event, item){
this.viewclass[item.order] = 'hidden'
this.editclass[item.order] = 'visible'
this.editcentroeducativoname[item.order] = item.nombre
this.editmoodleuri[item.order] = item.moodleuri
this.editcentroeducativoservicename[item.order] = item.servicename
this.editcentroeducativoservicetoken[item.order] = item.servicetoken
this.viewclass[item.order] = 'hidden';
this.editclass[item.order] = 'visible';
this.editcentroeducativoname[item.order] = item.nombre;
this.editmoodleuri[item.order] = item.moodleuri;
this.editcentroeducativoservicename[item.order] = item.servicename;
this.editcentroeducativoservicetoken[item.order] = item.servicetoken;
this.editcentroeducativousername[item.order] = item.moodleapiusername;
}
canceledit(event, item){
......@@ -146,30 +176,27 @@ export class IEducativaComponent implements OnInit {
}
save(event, item){
save(event, item) {
const data = { "idcentroeducativo": item.idcentroeducativo,
"nombre": this.editcentroeducativoname[item.order],
"moodleuri": this.editmoodleuri[item.order],
"servicename": this.editcentroeducativoservicename[item.order],
"servicetoken": this.editcentroeducativoservicetoken[item.order]
}
this.genericServices.POST('/servicios/centroeducativo/updateSchool',data).subscribe(
data => {
this.showAlert('centroeducativo ' + item.nombre + ' actualizado con exito.')
this.schoolList[item.order].nombre = this.editcentroeducativoname[item.order]
this.schoolList[item.order].moodleuri = this.editmoodleuri[item.order]
this.schoolList[item.order].servicename = this.editcentroeducativoservicename[item.order]
this.schoolList[item.order].servicetoken = this.editcentroeducativoservicetoken[item.order]
this.resetEditForm();
},
error => {
this.showErrorAlert('Error al actualizar centroeducativo: ' + item.nombre)
"servicetoken": this.editcentroeducativoservicetoken[item.order],
"moodleapiusername": this.editcentroeducativousername[item.order]};
if (!this.checkData(data))
return;
this.centroeducativoservice.actualizarCentroEducativo(data).subscribe(
_ => {
this.showAlert('centroeducativo ' + item.nombre + ' actualizado con exito.');
this.schoolList[item.order].nombre = this.editcentroeducativoname[item.order];
this.schoolList[item.order].moodleuri = this.editmoodleuri[item.order];
this.schoolList[item.order].servicename = this.editcentroeducativoservicename[item.order];
this.schoolList[item.order].servicetoken = this.editcentroeducativoservicetoken[item.order];
this.schoolList[item.order].moodleapiusername = this.editcentroeducativousername[item.order];
this.resetEditForm();
}, _ => {
this.showErrorAlert('Error al actualizar centroeducativo: ' + item.nombre);
}
);
);
}
}
......@@ -4,8 +4,7 @@ import { FormsModule } from '@angular/forms';
import { IEducativaRoutingModule } from './ieducativa-routing.module';
import { IEducativaComponent } from './ieducativa.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { Services } from '../../shared/services/services.service';
import { MoodleService } from '../../shared/services/moodle.service';
import { CentroEducativo } from '../../shared/services/CentroEducativo.service';
@NgModule({
imports: [
......@@ -15,6 +14,6 @@ import { MoodleService } from '../../shared/services/moodle.service';
IEducativaRoutingModule
],
declarations: [IEducativaComponent],
providers: [Services, MoodleService]
providers: [CentroEducativo]
})
export class IEducativaModule { }
import { Injectable } from '@angular/core';
import { Http, Headers, Response, RequestOptions } from '@angular/http';
import 'rxjs/add/operator/map'
import { Authen