Merge branch 'develop' of github.com:Amab/SWADroid into develop

This commit is contained in:
Alejandro Alcalde 2014-02-19 19:26:02 +01:00
commit aeebe59c1f
10 changed files with 202 additions and 193 deletions

Binary file not shown.

View File

@ -314,6 +314,11 @@
<string name="practicesprogramModuleLabel">Programa de Práctiques</string>
<string name="theoryprogramModuleLabel">Programa de Teoria</string>
<string name="teachingguideModuleLabel">Guia Docent</string>
<string name="informationProgressDescription">Obtenint informació&#8230;\nSi us plau, esperi&#8230;</string>
<string name="informationProgressTitle">Informació</string>
<string name="emptyInformation">Informació no disponible</string>
<string name="pradoLoginToast">La contrasenya d\'SWAD té almenys 8 caràcters alfanumèrics</string>
<string name="error_password_summaryUGR">Recorda que has d\'introduir la contrasenya de SWAD, no la d\'Accés identificat</string>

View File

@ -225,6 +225,11 @@
<string name="practicesprogramModuleLabel">Practices Programma</string>
<string name="theoryprogramModuleLabel">Theory Programma</string>
<string name="teachingguideModuleLabel">Pedagogisch begeleider</string>
<string name="informationProgressDescription">Informatie opvragen &#8230;\nEven geduld aub&#8230;</string>
<string name="informationProgressTitle">Informatie</string>
<string name="emptyInformation">Informatie niet beschikbaar</string>
<string name="pradoLoginToast">SWAD Das Passwort ist mindestens 8 alphanumerischen Zeichen</string>
<string name="error_password_summaryUGR">Denken Sie daran, geben Sie Ihr Passwort SWAD nicht identifiziert die Access</string>

View File

@ -347,7 +347,7 @@
<string name="teachingguideModuleLabel">Guía Docente</string>
<string name="informationProgressDescription">Obteniendo información&#8230;\nPor favor, espere&#8230;</string>
<string name="informationProgressTitle">Información</string>
<string name="emptyInformation">Información no disponible</string>
<string name="pradoLoginToast">La contraseña de SWAD tiene al menos 8 caracteres alfanuméricos</string>

View File

@ -315,6 +315,10 @@
<string name="practicesprogramModuleLabel">Programme des pratiques</string>
<string name="theoryprogramModuleLabel">Théorie du programme</string>
<string name="teachingguideModuleLabel">Guide des cours</string>
<string name="informationProgressDescription">La collecte d\'informations&#8230;\nS\'il vous plaît, attendre&#8230;</string>
<string name="informationProgressTitle">Informations</string>
<string name="emptyInformation">Information non disponible</string>
<string name="pradoLoginToast">SWAD Le mot de passe est au moins 8 caractères alphanumériques</string>
<string name="error_password_summaryUGR">N\'oubliez pas de saisir votre mot de passe SWAD pas identifié l\'accès</string>

View File

@ -312,6 +312,10 @@
<string name="practicesprogramModuleLabel">Pratiche di programma</string>
<string name="theoryprogramModuleLabel">Teoria del programma</string>
<string name="teachingguideModuleLabel">Guida didattica</string>
<string name="informationProgressDescription">Raccolta di informazioni&#8230;\nAttendere prego&#8230;</string>
<string name="informationProgressTitle">Informazioni</string>
<string name="emptyInformation">Informazioni no disponible</string>
<string name="pradoLoginToast">La password è di almeno 8 caratteri alfanumerici</string>
<string name="error_password_summaryUGR">Ricordate di inserire il vostro SWAD password non identificato Access</string>

View File

@ -303,6 +303,11 @@
<string name="practicesprogramModuleLabel">Program praktyk</string>
<string name="theoryprogramModuleLabel">Teoria programu</string>
<string name="teachingguideModuleLabel">Podręcznik nauczania</string>
<string name="informationProgressDescription">Zbieranie informacji&#8230;\nProszę czekać&#8230;</string>
<string name="informationProgressTitle">Informacja</string>
<string name="emptyInformation">Informacje niedostępne</string>
<string name="pradoLoginToast">Swad hasło jest co najmniej 8 znaków alfanumerycznych</string>
<string name="error_password_summaryUGR">Pamiętaj, aby wpisać hasło SWAD nie zidentyfikował dostęp</string>

View File

@ -305,6 +305,10 @@
<string name="practicesprogramModuleLabel">Prácticas do programa</string>
<string name="theoryprogramModuleLabel">Teoria do programa</string>
<string name="teachingguideModuleLabel">Guia de ensino</string>
<string name="informationProgressDescription">Coleta de informações&#8230;\nPor favor, espere&#8230;</string>
<string name="informationProgressTitle">Informação</string>
<string name="emptyInformation">Informação não disponível</string>
<string name="pradoLoginToast">SWAD A senha é pelo menos 8 caracteres alfanuméricos</string>
<string name="error_password_summaryUGR">Lembre-se de digitar o seu SWAD senha não identificou o acesso</string>

View File

@ -349,6 +349,10 @@
<string name="practicesprogramModuleLabel">Practices Program</string>
<string name="theoryprogramModuleLabel">Theory Program</string>
<string name="teachingguideModuleLabel">Teaching Guide</string>
<string name="informationProgressDescription">Getting information&#8230;\nWait, please&#8230;</string>
<string name="informationProgressTitle">Information</string>
<string name="emptyInformation">Information unavailable</string>
<string name="pradoLoginToast">SWAD\'s password is at least 8 alphanumeric characters long</string>
<string name="error_password_summaryUGR">Remember you must enter SWAD\'s password, not e-Administration (PRADO)</string>

View File

@ -11,7 +11,6 @@ import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;
import es.ugr.swad.swadroid.Constants;
import es.ugr.swad.swadroid.R;
import es.ugr.swad.swadroid.model.User;
@ -20,219 +19,198 @@ import es.ugr.swad.swadroid.webservices.SOAPClient;
import org.ksoap2.serialization.SoapObject;
public class Information extends Module {
public static final String TAG = Constants.APP_TAG + " Information";
public static final String TAG = Constants.APP_TAG + " Information";
/**
* Information Type. String with the type of information (none, HTML, plain text...)
*/
private String infoSrc;
/**
* Information Content. String with the content of information.
*/
private String infoTxt;
/**
* Request code to get course's information
*/
private String infoTypeToAdd;
* Information Type. String with the type of information (none, HTML, plain
* text...)
*/
private String infoSrc;
/**
* Information Content. String with the content of information.
*/
private String infoTxt;
/**
* Request code to get course's information
*/
private String infoTypeToAdd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview_information_screen_layout);
//WebView webview = (WebView) this.findViewById(R.id.contentWebView);
ImageView moduleIcon;
TextView moduleText;
this.findViewById(R.id.courseSelectedText).setVisibility(View.VISIBLE);
int requestCode = this.getIntent().getIntExtra("requestCode", 0);
TextView courseNameText = (TextView) this.findViewById(R.id.courseSelectedText);
courseNameText.setText(Constants.getSelectedCourseShortName());
switch (requestCode) {
case Constants.INTRODUCTION_REQUEST_CODE:
infoTypeToAdd = "introduction";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.introductionModuleLabel);
break;
case Constants.FAQS_REQUEST_CODE:
infoTypeToAdd = "";/*falta en la funcion que obtiene la informacion de las asignaturas*/
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.faqsModuleLabel);
break;
case Constants.BIBLIOGRAPHY_REQUEST_CODE:
infoTypeToAdd = "bibliography";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.bibliographyModuleLabel);
break;
case Constants.PRACTICESPROGRAM_REQUEST_CODE:
infoTypeToAdd = "practicals";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.practicesprogramModuleLabel);
break;
case Constants.THEORYPROGRAM_REQUEST_CODE:
infoTypeToAdd = "";/*falta en la funcion que obtiene la informacion de las asignaturas*/
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.theoryprogramModuleLabel);
break;
case Constants.LINKS_REQUEST_CODE:
infoTypeToAdd = "links";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.linksModuleLabel);
break;
case Constants.TEACHINGGUIDE_REQUEST_CODE:
infoTypeToAdd = "guide";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.teachingguideModuleLabel);
break;
}
}
@Override
protected void connect() {
// TODO Auto-generated method stub
String progressDescription = getString(R.string.informationProgressDescription);
int progressTitle = R.string.informationProgressTitle;
startConnection(true, progressDescription, progressTitle);
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview_information_screen_layout);
ImageView moduleIcon;
TextView moduleText;
this.findViewById(R.id.courseSelectedText).setVisibility(View.VISIBLE);
int requestCode = this.getIntent().getIntExtra("requestCode", 0);
TextView courseNameText = (TextView) this
.findViewById(R.id.courseSelectedText);
courseNameText.setText(Constants.getSelectedCourseShortName());
switch (requestCode) {
case Constants.INTRODUCTION_REQUEST_CODE:
infoTypeToAdd = "introduction";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.introductionModuleLabel);
break;
case Constants.FAQS_REQUEST_CODE:
infoTypeToAdd = "";/*
* falta en la funcion que obtiene la
* informacion de las asignaturas
*/
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.faqsModuleLabel);
break;
case Constants.BIBLIOGRAPHY_REQUEST_CODE:
infoTypeToAdd = "bibliography";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.bibliographyModuleLabel);
break;
case Constants.PRACTICESPROGRAM_REQUEST_CODE:
infoTypeToAdd = "practicals";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.practicesprogramModuleLabel);
break;
case Constants.THEORYPROGRAM_REQUEST_CODE:
infoTypeToAdd = "";/*
* falta en la funcion que obtiene la
* informacion de las asignaturas
*/
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.theoryprogramModuleLabel);
break;
case Constants.LINKS_REQUEST_CODE:
infoTypeToAdd = "links";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.linksModuleLabel);
break;
case Constants.TEACHINGGUIDE_REQUEST_CODE:
infoTypeToAdd = "guide";
moduleIcon = (ImageView) this.findViewById(R.id.moduleIcon);
moduleIcon.setBackgroundResource(R.drawable.notif);
moduleText = (TextView) this.findViewById(R.id.moduleName);
moduleText.setText(R.string.teachingguideModuleLabel);
break;
}
setMETHOD_NAME("getCourseInfo");
}
@Override
protected void onStart() {
super.onStart();
try {
runConnection();
} catch (Exception e) {
String errorMsg = getString(R.string.errorServerResponseMsg);
error(TAG, errorMsg, e, true);
}
}
@Override
protected void connect() {
String progressDescription = getString(R.string.informationProgressDescription);
int progressTitle = R.string.informationProgressTitle;
startConnection(true, progressDescription, progressTitle);
}
@Override
protected void requestService() throws Exception {
// TODO Auto-generated method stub
createRequest(SOAPClient.CLIENT_TYPE);
addParam("wsKey", Constants.getLoggedUser().getWsKey());
addParam("courseCode", Constants.getSelectedCourseCode());
addParam("infoType", infoTypeToAdd);
sendRequest(User.class, false);
if (result != null) {
//ArrayList<?> res = new ArrayList<Object>((Vector<?>) result);
SoapObject soap = (SoapObject) result;
//infoType = res.get(1).toString();
//infoContent = res.get(2).toString();
infoSrc = soap.getProperty(infoSrc).toString();
infoTxt = soap.getPrimitiveProperty(infoTxt).toString();
//Request finalized without errors
setResult(RESULT_OK);
}
else{
infoTxt = getString (R.string.connectionRequired);
}
}
if (result != null) {
SoapObject soap = (SoapObject) result;
infoSrc = soap.getProperty(infoSrc).toString();
infoTxt = soap.getPrimitiveProperty(infoTxt).toString();
// Request finalized without errors
setResult(RESULT_OK);
} else {
infoTxt = getString(R.string.connectionRequired);
}
}
@Override
protected void postConnect() {
// TODO Auto-generated method stub
WebView webview = (WebView) this.findViewById(R.id.contentWebView);
if (infoSrc.equals("none")) {
webview.loadData("Información no disponible", "text/html; charset=UTF-8", null);//cargar el string traducible (no esta aun creado)
}
else {
if (infoSrc.equals("URL")) {
webview.loadUrl(infoTxt);
}
else{
webview.loadData(infoTxt, "text/html; charset=UTF-8", null);
}
}
WebView webview = (WebView) this.findViewById(R.id.contentWebView);
if (infoSrc.equals("none")) {
webview.loadData(getString(R.string.emptyInformation),
"text/html; charset=UTF-8", null);// cargar el string
// traducible (no esta
// aun creado)
} else if (infoSrc.equals("URL")) {
webview.loadUrl(infoTxt);
} else {
webview.loadData(infoTxt, "text/html; charset=UTF-8", null);
}
finish();
}
@Override
protected void onError() {
// TODO Auto-generated method stub
finish();
}
}
}