Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
matefun
Frontend
Commits
04977f27
Commit
04977f27
authored
Jul 18, 2018
by
Bruno Daniel Di Bello Baladan
Browse files
Funcionando con moodlecloud
parent
0ee7d707
Changes
7
Hide whitespace changes
Inline
Side-by-side
.DS_Store
0 → 100644
View file @
04977f27
File added
Frontend Angular 4/src/app/shared/config.ts
View file @
04977f27
...
...
@@ -5,5 +5,6 @@
//export const GHCI_URL = 'ws://localhost:9090/endpoint';
//Configuracion dinamica pensando en servidor con ip dinamica
export
const
SERVER
=
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
host
;
//'http://localhost:9090';
//export const SERVER = window.location.protocol + '//' + window.location.host;//'http://localhost:9090';
export
const
SERVER
=
'
http://localhost:8080
'
;
export
const
GHCI_URL
=
window
.
location
.
protocol
==
'
http:
'
?
'
ws://
'
+
window
.
location
.
host
+
'
/endpoint
'
:
'
wss://
'
+
window
.
location
.
host
+
'
/endpoint
'
;
Servidor JEE/WebContent/WEB-INF/matefun.properties
View file @
04977f27
#Deben definirse moodle_endpoint y moodle_group para conectar con el API de moodle.
#De lo contrario solo se realizara login local.
moodle_endpoint
=
https://
tics
.moodlecloud.com
moodle_group
=
Piloto
moodle_endpoint
=
https://
matefun
.moodlecloud.com
moodle_group
=
introduction to moodle
#El grupo se define como liceoId#grado#grupo#anio
#Si no se sefine default_group entonces no se asigna grupo para docente o alumno.
default_group
=
0#2#Año#2017
Servidor JEE/pom.xml
View file @
04977f27
...
...
@@ -46,7 +46,11 @@
<artifactId>
jackson-annotations
</artifactId>
<version>
2.9.0
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.42
</version>
</dependency>
</dependencies>
<build>
...
...
Servidor JEE/src/main/java/edu/proygrado/dto/MoodleCoursesInfoDTO.java
View file @
04977f27
...
...
@@ -21,7 +21,7 @@ public class MoodleCoursesInfoDTO {
private
Boolean
confirmed
;
private
String
lang
;
private
String
theme
;
private
Lo
ng
timezone
;
private
Stri
ng
timezone
;
private
Long
mailformat
;
private
String
description
;
private
Long
descriptionformat
;
...
...
@@ -118,10 +118,10 @@ public class MoodleCoursesInfoDTO {
public
void
setTheme
(
String
theme
)
{
this
.
theme
=
theme
;
}
public
Lo
ng
getTimezone
()
{
public
Stri
ng
getTimezone
()
{
return
timezone
;
}
public
void
setTimezone
(
Lo
ng
timezone
)
{
public
void
setTimezone
(
Stri
ng
timezone
)
{
this
.
timezone
=
timezone
;
}
public
Long
getMailformat
()
{
...
...
Servidor JEE/src/main/java/edu/proygrado/ejb/LoginEJB.java
View file @
04977f27
...
...
@@ -15,13 +15,17 @@ import java.util.Date;
import
java.util.List
;
import
java.util.Properties
;
import
javax.annotation.Resource
;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
import
javax.ejb.TransactionManagement
;
import
javax.ejb.TransactionManagementType
;
import
javax.inject.Inject
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.TypedQuery
;
import
javax.servlet.ServletContext
;
import
javax.transaction.UserTransaction
;
import
javax.ws.rs.client.ClientBuilder
;
import
javax.ws.rs.core.GenericType
;
...
...
@@ -50,6 +54,7 @@ import edu.proygrado.modelo.Usuario;
* @author gonzalo
*/
@Stateless
@TransactionManagement
(
value
=
TransactionManagementType
.
BEAN
)
public
class
LoginEJB
{
@Inject
...
...
@@ -63,6 +68,9 @@ public class LoginEJB {
@EJB
private
InvitadoEJB
invitadoEJB
;
@Resource
private
UserTransaction
userTransaction
;
public
boolean
validarSesion
(
String
token
){
Sesion
sesion
=
em
.
find
(
Sesion
.
class
,
token
);
...
...
@@ -80,7 +88,14 @@ public class LoginEJB {
sesion
.
setToken
(
token
);
sesion
.
setUsuario
(
usuario
);
sesion
.
setTimestamp
(
new
Date
());
em
.
persist
(
sesion
);
try
{
userTransaction
.
begin
();
em
.
persist
(
sesion
);
userTransaction
.
commit
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Error persistiendo sesion: "
+
e
.
getMessage
());
}
}
else
{
sesion
.
setTimestamp
(
new
Date
());
}
...
...
@@ -222,9 +237,15 @@ public class LoginEJB {
conf
.
setFontSizeEditor
(
12
);
conf
.
setThemeEditor
(
"dracula"
);
nuevoDesdeMoodle
.
setConfiguracion
(
conf
);
em
.
persist
(
conf
);
em
.
persist
(
root
);
em
.
persist
(
nuevoDesdeMoodle
);
try
{
userTransaction
.
begin
();
em
.
persist
(
conf
);
em
.
persist
(
root
);
em
.
persist
(
nuevoDesdeMoodle
);
userTransaction
.
commit
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Error guardando configuracion de usuario"
);
}
String
tokenAuth
=
generateToken
();
updateSession
(
tokenAuth
,
usuario
);
invitadoEJB
.
setUsuario
(
tokenAuth
,
nuevoDesdeMoodle
);
...
...
Servidor JEE/src/main/resources/META-INF/persistence.xml
View file @
04977f27
...
...
@@ -25,7 +25,7 @@
<persistence-unit
name=
"matefunDS"
transaction-type=
"JTA"
>
<provider>
org.eclipse.persistence.jpa.PersistenceProvider
</provider>
<jta-data-source>
j
dbc/azureDSjta
</jta-data-source>
<jta-data-source>
j
ava:/matefun
</jta-data-source>
<class>
edu.proygrado.modelo.Alumno
</class>
<class>
edu.proygrado.modelo.Archivo
</class>
<class>
edu.proygrado.modelo.Configuracion
</class>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment