Browse Source

Merge branch 'develop' into oc_framework_cleanup_and_documentation

David A. Velasco 11 years ago
parent
commit
3f4e615d5e

BIN
libs/jackrabbit-webdav-2.2.5-jar-with-dependencies.jar


BIN
oc_framework/libs/commons-httpclient-3.1.jar


BIN
oc_framework/libs/jackrabbit-webdav-2.2.5-jar-with-dependencies.jar


BIN
oc_framework/libs/jackrabbit-webdav-2.7.2.jar


BIN
oc_framework/libs/slf4j-api-1.7.5.jar


+ 1 - 7
oc_framework/pom.xml

@@ -29,16 +29,10 @@
             <scope>provided</scope>
         </dependency>
 
-        <dependency>
-          <groupId>commons-httpclient</groupId>
-          <artifactId>commons-httpclient</artifactId>
-          <version>3.1</version>
-        </dependency>
-
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-webdav</artifactId>
-            <version>2.5.2</version>
+            <version>2.7.2</version>
         </dependency>
 
     </dependencies>

+ 2 - 3
oc_framework/src/com/owncloud/android/oc_framework/accounts/AccountUtils.java

@@ -118,8 +118,8 @@ public class AccountUtils {
     
     public static class AccountNotFoundException extends AccountsException {
         
-        /** Generated - should be refreshed every time the class changes!! */
-        private static final long serialVersionUID = -9013287181793186830L;
+		/** Generated - should be refreshed every time the class changes!! */
+		private static final long serialVersionUID = -1684392454798508693L;
         
         private Account mFailedAccount; 
                 
@@ -132,5 +132,4 @@ public class AccountUtils {
             return mFailedAccount;
         }
     }
-
 }

+ 6 - 2
oc_framework/src/com/owncloud/android/oc_framework/operations/RemoteOperationResult.java

@@ -40,6 +40,7 @@ import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.jackrabbit.webdav.DavException;
+import org.json.JSONException;
 
 import com.owncloud.android.oc_framework.accounts.AccountUtils.AccountNotFoundException;
 import com.owncloud.android.oc_framework.network.CertificateCombinedException;
@@ -58,9 +59,9 @@ import android.util.Log;
  * @author David A. Velasco
  */
 public class RemoteOperationResult implements Serializable {
-
+	
 	/** Generated - should be refreshed every time the class changes!! */
-	private static final long serialVersionUID = -2469951225222759283L;
+	private static final long serialVersionUID = -8257349554488668693L;
     
     private static final String TAG = "RemoteOperationResult";
     
@@ -301,6 +302,9 @@ public class RemoteOperationResult implements Serializable {
             } else if (mException instanceof AccountsException) {
                 return "Exception while using account";
                 
+            } else if (mException instanceof JSONException) {
+            	return "JSON exception";
+            	
             } else {
                 return "Unexpected exception";
             }

+ 127 - 0
oc_framework/src/com/owncloud/android/oc_framework/operations/remote/GetUserNameRemoteOperation.java

@@ -0,0 +1,127 @@
+
+/* ownCloud Android client application
+ *   Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package com.owncloud.android.oc_framework.operations.remote;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.http.HttpStatus;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.util.Log;
+
+import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
+import com.owncloud.android.oc_framework.operations.RemoteOperation;
+import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
+
+
+/**
+ * @author masensio
+ *
+ * Get the UserName for a SAML connection, from a JSON with the format:
+ * 		id
+ * 		display-name
+ * 		email
+ */
+
+public class GetUserNameRemoteOperation extends RemoteOperation {
+	
+	private static final String TAG = GetUserNameRemoteOperation.class.getSimpleName();
+
+	// HEADER
+	private static final String HEADER_OCS_API = "OCS-APIREQUEST";
+	private static final String HEADER_OCS_API_VALUE = "true";
+
+	// OCS Route
+	private static final String OCS_ROUTE ="/index.php/ocs/cloud/user?format=json"; 
+
+	// JSON Node names
+	private static final String NODE_OCS = "ocs";
+	private static final String NODE_DATA = "data";
+	private static final String NODE_ID = "id";
+	private static final String NODE_DISPLAY_NAME= "display-name";
+	private static final String NODE_EMAIL= "email";
+
+	private String mUserName;
+
+	public String getUserName() {
+		return mUserName;
+	}
+
+	
+	public GetUserNameRemoteOperation() {
+	}
+
+	@Override
+	protected RemoteOperationResult run(WebdavClient client) {
+        RemoteOperationResult result = null;
+        int status = -1;
+        
+        // Get Method
+        GetMethod get = new GetMethod(client.getBaseUri() + OCS_ROUTE);
+        Log.d(TAG, "URL ------> " + client.getBaseUri() + OCS_ROUTE);
+        // Add the Header
+        get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
+        
+        //Get the user
+        try {
+			status = client.executeMethod(get);
+			if(isSuccess(status)) {
+				 Log.d(TAG, "Obtain RESPONSE");
+				 String response = get.getResponseBodyAsString();
+				 
+				 Log.d(TAG, "GET RESPONSE.................... " + response);
+
+				 // Parse the response
+				 JSONObject respJSON = new JSONObject(response);
+				 JSONObject respOCS = respJSON.getJSONObject(NODE_OCS);
+				 JSONObject respData = respOCS.getJSONObject(NODE_DATA);
+				 String id = respData.getString(NODE_ID);
+				 String displayName = respData.getString(NODE_DISPLAY_NAME);
+				 String email = respData.getString(NODE_EMAIL);
+				 
+				 // Result
+				 result = new RemoteOperationResult(isSuccess(status), status, (get != null ? get.getResponseHeaders() : null));
+				 mUserName =  displayName;
+				 
+				 Log.d(TAG, "Response: " + id + " - " + displayName + " - " + email);
+				 
+			}
+		} catch (HttpException e) {
+			result = new RemoteOperationResult(e);
+			e.printStackTrace();
+		} catch (IOException e) {
+			result = new RemoteOperationResult(e);
+			e.printStackTrace();
+		} catch (JSONException e) {
+			result = new RemoteOperationResult(e);
+			e.printStackTrace();
+		} finally {
+			get.releaseConnection();
+		}
+        
+		return result;
+	}
+
+    private boolean isSuccess(int status) {
+        return (status == HttpStatus.SC_OK);
+    }
+    
+}

+ 0 - 6
pom.xml

@@ -50,12 +50,6 @@
             <type>apklib</type>
         </dependency>
 
-        <dependency>
-            <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-webdav</artifactId>
-            <version>2.5.2</version>
-        </dependency>
-        
         <!-- MUST BE INSTALLED FIRST: cd oc_framework; mvn install -->
         <dependency>
          <groupId>com.owncloud.android</groupId>

+ 9 - 9
res/values-es/strings.xml

@@ -1,14 +1,14 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
-  <string name="about_android">App Android %1$s</string>
+  <string name="about_android">%1$s para Android</string>
   <string name="about_version">versión %1$s</string>
   <string name="actionbar_sync">Actualizar cuenta</string>
-  <string name="actionbar_upload">Subir archivo</string>
+  <string name="actionbar_upload">Subir</string>
   <string name="actionbar_upload_from_apps">Contenido de otras aplicaciones</string>
   <string name="actionbar_upload_files">Archivos</string>
   <string name="actionbar_open_with">Abrir con</string>
   <string name="actionbar_mkdir">Crear directorio</string>
-  <string name="actionbar_settings">Ajustes</string>
+  <string name="actionbar_settings">Configuración</string>
   <string name="actionbar_see_details">Detalles</string>
   <string name="prefs_category_general">General</string>
   <string name="prefs_category_more">Más</string>
@@ -16,7 +16,7 @@
   <string name="prefs_manage_accounts">Gestionar cuentas</string>
   <string name="prefs_pincode">PIN de aplicación </string>
   <string name="prefs_pincode_summary">Proteja su cliente</string>
-  <string name="prefs_instant_upload">Habilita la subida instantánea</string>
+  <string name="prefs_instant_upload">Activar la subida instantánea</string>
   <string name="prefs_instant_upload_summary">Subir instantáneamente las fotos tomadas por la cámara</string>
   <string name="prefs_log_title">Habilitar registro</string>
   <string name="prefs_log_summary">Esto es usado para registrar problemas</string>
@@ -38,14 +38,14 @@
   <string name="setup_btn_connect">Conectar</string>
   <string name="uploader_btn_upload_text">Subir</string>
   <string name="uploader_top_message">Escoja el directorio de carga:</string>
-  <string name="uploader_wrn_no_account_title">No se encontraron cuentas</string>
+  <string name="uploader_wrn_no_account_title">No se encontró la cuenta</string>
   <string name="uploader_wrn_no_account_text">No hay cuentas de %1$s en tu dispositivo. Por favor configura una cuenta primero.</string>
   <string name="uploader_wrn_no_account_setup_btn_text">Configuración</string>
   <string name="uploader_wrn_no_account_quit_btn_text">Salir</string>
   <string name="uploader_wrn_no_content_title">No hay contenido para subir</string>
   <string name="uploader_wrn_no_content_text">Ningún contenido ha sido recibido. No hay nada que subir.</string>
   <string name="uploader_error_forbidden_content">%1$s no está autorizado para acceder al contenido compartido</string>
-  <string name="uploader_info_uploading">Enviando</string>
+  <string name="uploader_info_uploading">Subiendo...</string>
   <string name="file_list_empty">No hay archivos en esta carpeta.\nPuedes añadir nuevos archivos con la opción \"Subir\" del menú.</string>
   <string name="filedetails_select_file">Pulsa sobre un archivo para mostrar información adicional.</string>
   <string name="filedetails_size">Tamaño:</string>
@@ -78,7 +78,7 @@
   <string name="uploader_upload_failed_ticker">Error en la subida</string>
   <string name="uploader_upload_failed_content_single">La subida de %1$s no se pudo completar</string>
   <string name="downloader_download_in_progress_ticker">Descargando ...</string>
-  <string name="downloader_download_in_progress_content">%1$s Descargada de %2$s</string>
+  <string name="downloader_download_in_progress_content">%1$d%% Descargado de %2$s</string>
   <string name="downloader_download_succeeded_ticker">Descarga completa</string>
   <string name="downloader_download_succeeded_content">%1$s se ha descargado con éxito</string>
   <string name="downloader_download_failed_ticker">Falló la descarga</string>
@@ -178,7 +178,7 @@
   <string name="filename_forbidden_characters">Carácteres ilegales: / \\ &lt; &gt; : \" | ? *</string>
   <string name="wait_a_moment">Espere un momento</string>
   <string name="filedisplay_unexpected_bad_get_content">Problema inesperado; por favor, prueba otra app para seleccionar el archivo</string>
-  <string name="filedisplay_no_file_selected">No fué seleccionado ningún archivo</string>
+  <string name="filedisplay_no_file_selected">No hay ficheros seleccionados.</string>
   <string name="oauth_check_onoff">Ingresar con oAuth2</string>
   <string name="oauth_login_connection">Conectando al servidor oAuth2...</string>
   <string name="ssl_validator_header">La identidad del sitio no puede ser verificada</string>
@@ -209,7 +209,7 @@
   <string name="placeholder_filesize">389 KB</string>
   <string name="placeholder_timestamp">2012/05/18 12:23 PM</string>
   <string name="placeholder_media_time">12:23:45</string>
-  <string name="instant_upload_on_wifi">Subir imágenes sólo via WiFi</string>
+  <string name="instant_upload_on_wifi">Subir imágenes sólo cuando hay WiFi</string>
   <string name="instant_upload_path">/SubidasInstantáneas</string>
   <string name="conflict_title">Conflicto en la actualización</string>
   <string name="conflict_message">El archivo remoto %s no está sincronizado con el archivo local. Si continúa, se reemplazará el contenido del archivo en el servidor.</string>

+ 19 - 0
res/values-ku-rIQ/strings.xml

@@ -1,11 +1,30 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <resources>
   <string name="actionbar_upload">بارکردن</string>
+  <string name="actionbar_upload_files">په‌ڕگەکان</string>
+  <string name="actionbar_mkdir">درووستکردنى بوخچە</string>
   <string name="actionbar_settings">ده‌ستكاری</string>
+  <string name="prefs_category_general">گشتی</string>
+  <string name="prefs_accounts">هەژمارەکان</string>
   <string name="prefs_help">یارمەتی</string>
   <string name="auth_username">ناوی به‌کارهێنه‌ر</string>
   <string name="auth_password">وشەی تێپەربو</string>
+  <string name="sync_string_files">په‌ڕگەکان</string>
+  <string name="setup_btn_connect">بەستنەوە</string>
   <string name="uploader_btn_upload_text">بارکردن</string>
+  <string name="uploader_wrn_no_account_title">هیچ هەژمارێک نه‌دۆزرایه‌وه‌</string>
+  <string name="uploader_wrn_no_account_setup_btn_text">جێگیرکردن</string>
+  <string name="uploader_wrn_no_account_quit_btn_text">دەرچوون</string>
+  <string name="uploader_info_uploading">بارکردن</string>
+  <string name="filedetails_size">قەبارە:</string>
+  <string name="filedetails_type">جۆر:</string>
+  <string name="filedetails_created">درووستبووە:</string>
+  <string name="filedetails_modified">گۆردراو:</string>
   <string name="filedetails_download">داگرتن</string>
+  <string name="common_yes">بەڵێ</string>
+  <string name="common_no">نەخێر</string>
+  <string name="common_ok">باشە</string>
+  <string name="common_cancel">لابردن</string>
+  <string name="common_save_exit">پاشکەوتکردن &amp; دەرچوون</string>
   <string name="common_error">هه‌ڵه</string>
 </resources>

+ 32 - 0
res/values-sq/strings.xml

@@ -2,21 +2,53 @@
 <resources>
   <string name="actionbar_upload">Ngarko</string>
   <string name="actionbar_upload_files">Skedarët</string>
+  <string name="actionbar_mkdir">Krijo kartelë</string>
   <string name="actionbar_settings">Parametrat</string>
   <string name="prefs_category_general">Përgjithshme</string>
   <string name="prefs_category_more">Më tepër</string>
+  <string name="prefs_accounts">Llogarit</string>
   <string name="prefs_help">Ndihmë</string>
+  <string name="prefs_imprint">Stampoj</string>
   <string name="auth_username">Përdoruesi</string>
   <string name="auth_password">Kodi</string>
   <string name="sync_string_files">Skedarët</string>
+  <string name="setup_btn_connect">Lidhu</string>
   <string name="uploader_btn_upload_text">Ngarko</string>
+  <string name="uploader_wrn_no_account_title">Nuk u gjend asnjë llogari</string>
+  <string name="uploader_wrn_no_account_text">Nuk ka %1$s llogari në pajisjen tuaj. Ju lutemi të krijojnë një llogari të parë.</string>
+  <string name="uploader_wrn_no_account_setup_btn_text">Ndërto</string>
+  <string name="uploader_wrn_no_account_quit_btn_text">Dil</string>
+  <string name="uploader_info_uploading">Ngarko</string>
+  <string name="filedetails_select_file">Trokitje e lehtë në një dokument për të shfaqur informacion shtesë.</string>
+  <string name="filedetails_size">Dimensioni:</string>
+  <string name="filedetails_type">Tipi:</string>
+  <string name="filedetails_created">Krijuar:</string>
+  <string name="filedetails_modified">Modifikuar:</string>
   <string name="filedetails_download">Shkarko</string>
   <string name="common_yes">Po</string>
   <string name="common_no">Jo</string>
+  <string name="common_ok">Ok</string>
   <string name="common_cancel_upload">Anulo ngarkimin</string>
   <string name="common_cancel">Anulo</string>
   <string name="common_error">Veprim i gabuar</string>
+  <string name="common_error_unknown">Gabim panjohur</string>
+  <string name="about_title">Rreth</string>
   <string name="change_password">Ndrysho fjalëkalimin</string>
+  <string name="delete_account">Fshi llogarin</string>
+  <string name="create_account">Krijo llogari</string>
+  <string name="upload_chooser_title">Ngarko nga...</string>
+  <string name="uploader_upload_in_progress_ticker">Ngarkim...</string>
+  <string name="uploader_upload_in_progress_content">%1$d%% Ngarkim %2$s</string>
+  <string name="uploader_upload_succeeded_ticker">Ngarkimi me sukses.</string>
+  <string name="uploader_upload_succeeded_content_single">%1$s u ngarkua me sukses</string>
   <string name="uploader_upload_failed_ticker">Ngarkimi dështoi</string>
+  <string name="uploader_upload_failed_content_single">Ngarkimi i %1$s nuk mund te behej</string>
+  <string name="downloader_download_in_progress_ticker">Shkarkimi...</string>
+  <string name="downloader_download_in_progress_content">%1$d%% Shkarkimi %2$s</string>
+  <string name="downloader_download_succeeded_ticker">Shkarkimi me sukses</string>
+  <string name="downloader_download_succeeded_content">%1$s u shkarkua me sukses</string>
+  <string name="downloader_download_failed_ticker">Shkarkimi dështoj</string>
+  <string name="auth_secure_connection">Lidhja e Sigurt vendos</string>
   <string name="common_rename">Riemërto</string>
+  <string name="common_remove">Hiq</string>
 </resources>

+ 36 - 0
res/values-sr-rSP/strings.xml

@@ -2,16 +2,52 @@
 <resources>
   <string name="actionbar_upload">Pošalji</string>
   <string name="actionbar_upload_files">Fajlovi</string>
+  <string name="actionbar_mkdir">Novi folder</string>
   <string name="actionbar_settings">Podešavanja</string>
+  <string name="actionbar_see_details">Detaljnije</string>
+  <string name="prefs_category_general">Opšte</string>
+  <string name="prefs_accounts">Nalozi</string>
+  <string name="prefs_manage_accounts">Upravljaj nalozima</string>
   <string name="prefs_help">Pomoć</string>
   <string name="auth_username">Korisničko ime</string>
   <string name="auth_password">Lozinka</string>
   <string name="sync_string_files">Fajlovi</string>
   <string name="uploader_btn_upload_text">Pošalji</string>
+  <string name="uploader_wrn_no_account_title">Nalog nije nađen</string>
+  <string name="uploader_info_uploading">Šalje se</string>
+  <string name="filedetails_size">Veličina:</string>
+  <string name="filedetails_type">Tip:</string>
   <string name="filedetails_download">Preuzmi</string>
   <string name="common_yes">Da</string>
   <string name="common_no">Ne</string>
   <string name="common_cancel">Otkaži</string>
   <string name="common_error">Greška</string>
   <string name="change_password">Izmeni lozinku</string>
+  <string name="delete_account">Ukloni nalog</string>
+  <string name="create_account">Novi nalog</string>
+  <string name="uploader_upload_in_progress_ticker">Otpremanje...</string>
+  <string name="uploader_upload_succeeded_ticker">Uspešno otpremljeno</string>
+  <string name="uploader_upload_failed_ticker">Otpremanje nije uspelo</string>
+  <string name="downloader_download_in_progress_ticker">Preuzimanje...</string>
+  <string name="downloader_download_succeeded_ticker">Uspešno preuzeto</string>
+  <string name="downloader_download_failed_ticker">Preuzimanje nije uspelo</string>
+  <string name="common_choose_account">Odaberite nalog</string>
+  <string name="auth_no_net_conn_title">Nema konekcije</string>
+  <string name="auth_nossl_plain_ok_title">Sigurna konekcija nije dostupna.</string>
+  <string name="auth_connection_established">Konekcija uspostavljena</string>
+  <string name="common_rename">Preimenij</string>
+  <string name="common_remove">Ukloni</string>
+  <string name="confirmation_remove_alert">Da li želite da uklonite %1$s ?</string>
+  <string name="remove_success_msg">Uklanjanje je uspelo</string>
+  <string name="remove_fail_msg">Uklanjanje nije uspelo</string>
+  <string name="wait_a_moment">Molim pričekajte</string>
+  <string name="ssl_validator_btn_details_see">Detaljnije</string>
+  <string name="ssl_validator_btn_details_hide">Sakrij</string>
+  <string name="ssl_validator_label_O">Organizacija:</string>
+  <string name="ssl_validator_label_C">Država:</string>
+  <string name="ssl_validator_label_L">Lokacija:</string>
+  <string name="ssl_validator_label_validity_from">Od:</string>
+  <string name="ssl_validator_label_validity_to">Za:</string>
+  <string name="ssl_validator_label_signature">Potpis:</string>
+  <string name="conflict_keep_both">Zadrži oboje</string>
 </resources>

+ 21 - 1
res/values-vi/strings.xml

@@ -24,7 +24,13 @@
   <string name="prefs_log_summary_history">Hiển thị các nhật trình đã được ghi nhận lại</string>
   <string name="prefs_log_delete_history_button">Xóa lịch sử</string>
   <string name="prefs_help">Giúp đỡ</string>
+  <string name="prefs_recommend">Giới thiệu đến bạn bè</string>
+  <string name="prefs_feedback">Phản hồi</string>
+  <string name="prefs_imprint">Đánh dấu</string>
+  <string name="recommend_subject">Thử %1$s trên smartphone của bạn!</string>
+  <string name="recommend_text">Tôi muốn mời bạn sử dụng %1$s trên smartphone của bạn!\nTải về tại đây: %2$s</string>
   <string name="auth_check_server">Kiểm tra máy chủ</string>
+  <string name="auth_host_url">Địa chỉ máy chủ https://…</string>
   <string name="auth_username">Tên người dùng</string>
   <string name="auth_password">Mật khẩu</string>
   <string name="auth_register">Lần đầu mới đến %1$s?</string>
@@ -40,7 +46,7 @@
   <string name="uploader_wrn_no_content_text">Không có nội dung được nhận. Không có gì để tải lên.</string>
   <string name="uploader_error_forbidden_content">%1$s không cho phép truy cập vào các nội dung chia sẻ</string>
   <string name="uploader_info_uploading">Đang tải lên</string>
-  <string name="file_list_empty">Không có các tập tin trong thư mục này ⏎ tập tin mới có thể được thêm vào với tùy chọn trình đơn \"Tải lên\".</string>
+  <string name="file_list_empty">Không có tập tin trong thư mục này. tập tin mới có thể được thêm vào với tùy chọn \"Tải lên\".</string>
   <string name="filedetails_select_file">Tap vào một tập tin để hiển thị thêm thông tin</string>
   <string name="filedetails_size">Kích thước:</string>
   <string name="filedetails_type">Loại:</string>
@@ -88,6 +94,8 @@
   <string name="sync_fail_in_favourites_content">Nội dung tập tin %1$d không thể đồng bộ (%2$d xung đột)</string>
   <string name="sync_foreign_files_forgotten_ticker">Một số tập tin cục bộ bị quên</string>
   <string name="sync_foreign_files_forgotten_content">Các tập tin %1$d ở ngoài thư mục %2$s không thể được chép vào</string>
+  <string name="sync_foreign_files_forgotten_explanation">\"Từ phiên bản 1.3.16, các tập tin tải lên từ thiết bị này được chép vào thư mục cục bộ %1$s để đề phòng mất dữ liệu khi một tập tin được đồng bộ với nhiều tài khoản.\n\nDo thay đổi này, tất cả các tập tin được tải lên ở phiên bản trước của ứng dụng này được chép vào thư mục %2$s. Tuy nhiên, đã có lỗi ngăn cản việc này trong lúc đồng bộ tài khoản. Bạn có thể để (các) tập tin như vậy và xóa liên kết đến %3$s, hoặc di chuyển (các) tập tin vào thư mục %1$s và giữ lại liên kết tới %4$s.\n\nDanh sách bên dưới là (các) tập tin cục bộ và (các) tập tin ở xa trong %5$s mà chúng được liên kết tới.</string>
+  <string name="sync_current_folder_was_removed">Thư mục %1$s không còn tồn tại</string>
   <string name="foreign_files_move">Di chuyển tất cả</string>
   <string name="foreign_files_success">Tất cả tập tin đã được chuyển đi</string>
   <string name="foreign_files_fail">Một vài tập tin không thể chuyển đi</string>
@@ -113,6 +121,7 @@
   <string name="media_err_unsupported">Codec của media không được hỗ trợ</string>
   <string name="media_err_io">Không thể đọc dữ liệu từ tập tin media</string>
   <string name="media_err_malformed">Tập tin media không được mã hóa đúng quy định</string>
+  <string name="media_err_timeout">Tạm ngừng trong khi đang cố gắng chạy</string>
   <string name="media_err_invalid_progressive_playback">Không thể phân luồng dữ liệu tập tin media</string>
   <string name="media_err_unknown">Tập tin media không thể được phát với trình phát media của stock</string>
   <string name="media_err_security_ex">Lỗi bảo mật khi cố phát %1$s</string>
@@ -127,12 +136,15 @@
   <string name="auth_connection_established">Kết nối đã thiết lập</string>
   <string name="auth_testing_connection">Đang kiểm tra kết nối...</string>
   <string name="auth_not_configured_title">Thay đổi cấu hình máy chủ </string>
+  <string name="auth_account_not_new">Một tài khoản với cùng tên người dùng và máy chủ đã tồn tại trong thiết bị</string>
+  <string name="auth_account_not_the_same">Tên người dùng đã nhập không đúng với tên người dùng của tài khoản này</string>
   <string name="auth_unknown_error_title">Không xác định được lỗi!</string>
   <string name="auth_unknown_host_title">Không thể tìm thấy máy chủ</string>
   <string name="auth_incorrect_path_title">Phiên bản máy chủ không tìm thấy</string>
   <string name="auth_timeout_title">Máy chủ đã quá dài để đáp ứng</string>
   <string name="auth_incorrect_address_title">Thay đổi URL</string>
   <string name="auth_ssl_general_error_title">SSL khởi tạo thất bại</string>
+  <string name="auth_ssl_unverified_server_title">không thể xác minh danh tính của máy chủ SSL</string>
   <string name="auth_bad_oc_version_title">Không chấp nhận phiên bản máy chủ</string>
   <string name="auth_wrong_connection_title">Không thể thiết lập kết nối</string>
   <string name="auth_secure_connection">Kết nối an toàn đã được thiết lập</string>
@@ -140,7 +152,12 @@
   <string name="auth_oauth_error">Xác nhận không thành công</string>
   <string name="auth_oauth_error_access_denied">Từ chối truy cập vì xác nhận từ phía máy chủ</string>
   <string name="auth_wtf_reenter_URL">Trạng thái không rõ, vui lòng điền lại đường dẫn liên kết một lần nữa</string>
+  <string name="auth_expired_oauth_token_toast">Hạn xác nhận của bạn đã hết. Vui lòng, xác nhận lại</string>
   <string name="auth_expired_basic_auth_toast">Vui lòng điền vào mật khẩu hiện tại của bạn</string>
+  <string name="auth_expired_saml_sso_token_toast">Phiên làm việc của bạn đã kết thúc. Vui lòng kết nối lại</string>
+  <string name="auth_connecting_auth_server">Đang kết nối đến máy chủ xác thực...</string>
+  <string name="auth_unsupported_auth_method">Máy chủ không hổ trợ phương thức xác thực này</string>
+  <string name="auth_unsupported_multiaccount">%1$s  không hỗ trợ nhiều tài khoản</string>
   <string name="fd_keep_in_sync">Giữ tập tin cập nhật</string>
   <string name="common_rename">Sửa tên</string>
   <string name="common_remove">Xóa</string>
@@ -158,9 +175,11 @@
   <string name="sync_file_fail_msg">Tập tin từ xa không được kiểm tra</string>
   <string name="sync_file_nothing_to_do_msg">Nội dung tập tin đã đồng bộ</string>
   <string name="create_dir_fail_msg">Thư mục không thể được tạo</string>
+  <string name="filename_forbidden_characters">Những kí tự không được dùng: / \\ &lt; &gt; : \" | ? *</string>
   <string name="wait_a_moment">Chờ một lúc</string>
   <string name="filedisplay_unexpected_bad_get_content">Vấn đề bất ngờ ; hãy thử ứng dụng khác để chọn tập tin</string>
   <string name="filedisplay_no_file_selected">Không có tập tin nào được chọn</string>
+  <string name="oauth_check_onoff">Đăng nhập bằng oAuth2.</string>
   <string name="oauth_login_connection">Đang kết nối đến máy chủ oAuth2...</string>
   <string name="ssl_validator_header">Không thể xác minh danh tính của site</string>
   <string name="ssl_validator_reason_cert_not_trusted">Chứng chỉ này không đáng tin cậy</string>
@@ -200,6 +219,7 @@
   <string name="preview_image_description">Xem trước hình ảnh</string>
   <string name="preview_image_error_unknown_format">Không thể hiển thị hình ảnh</string>
   <string name="error__upload__local_file_not_copied">%1$s không thể sao chép vào %2$s thư mục cục bộ</string>
+  <string name="actionbar_failed_instant_upload">Tải lên nhanh bị lỗi</string>
   <string name="failed_upload_headline_text">Tải lên nhanh bị lỗi</string>
   <string name="failed_upload_headline_hint">Tóm tắt tất cả các tải lên nhanh bị lỗi</string>
   <string name="failed_upload_all_cb">chọn tất cả</string>

+ 44 - 45
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -64,6 +64,7 @@ import com.owncloud.android.oc_framework.operations.RemoteOperation;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
 import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.oc_framework.operations.remote.ExistenceCheckRemoteOperation;
+import com.owncloud.android.oc_framework.operations.remote.GetUserNameRemoteOperation;
 import com.owncloud.android.ui.dialog.SamlWebViewDialog;
 import com.owncloud.android.ui.dialog.SslValidatorDialog;
 import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;
@@ -102,8 +103,6 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT";
     private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON";
     private static final String KEY_REFRESH_BUTTON_ENABLED = "KEY_REFRESH_BUTTON_ENABLED";
-    
-    private static final String KEY_OC_USERNAME_EQUALS = "oc_username=";
 
     private static final String AUTH_ON = "on";
     private static final String AUTH_OFF = "off";
@@ -792,10 +791,41 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             } else {
                 onAuthorizationCheckFinish((ExistenceCheckRemoteOperation)operation, result);
             }
+        } else if (operation instanceof GetUserNameRemoteOperation) {
+            onGetUserNameFinish((GetUserNameRemoteOperation) operation, result);
+             
         }
+        
     }
-    
-    
+
+    private void onGetUserNameFinish(GetUserNameRemoteOperation operation, RemoteOperationResult result) {
+        if (result.isSuccess()) {
+            boolean success = false;
+            String username = operation.getUserName();
+            
+            if ( mAction == ACTION_CREATE) {
+                mUsernameInput.setText(username);
+                success = createAccount();
+            } else {
+                
+                if (!mUsernameInput.getText().toString().equals(username)) {
+                    // fail - not a new account, but an existing one; disallow
+                    result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); 
+                    updateAuthStatusIconAndText(result);
+                    showAuthStatus();
+                    Log_OC.d(TAG, result.getLogMessage());
+                } else {
+                  updateToken();
+                  success = true;
+                }
+            }
+            
+            if (success)
+                finish();
+        }
+        
+    }
+
     private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperation operation, RemoteOperationResult result) {
         try {
             dismissDialog(DIALOG_LOGIN_PROGRESS);
@@ -1120,7 +1150,8 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
                 success = createAccount();
 
             } else {
-                success = updateToken();
+                updateToken();
+                success = true;
             }
 
             if (success) {
@@ -1166,7 +1197,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
      * Sets the proper response to get that the Account Authenticator that started this activity saves 
      * a new authorization token for mAccount.
      */
-    private boolean updateToken() {
+    private void updateToken() {
         Bundle response = new Bundle();
         response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name);
         response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);
@@ -1177,16 +1208,6 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
             
         } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) {
-            String username = getUserNameForSamlSso();
-            if (!mUsernameInput.getText().toString().equals(username)) {
-                // fail - not a new account, but an existing one; disallow
-                RemoteOperationResult result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); 
-                updateAuthStatusIconAndText(result);
-                showAuthStatus();
-                Log_OC.d(TAG, result.getLogMessage());
-                
-                return false;
-            }
             
             response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);
             // the next line is necessary; by now, notifications are calling directly to the AuthenticatorActivity to update, without AccountManager intervention
@@ -1198,7 +1219,6 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         }
         setAccountAuthenticatorResult(response);
         
-        return true;
     }
 
 
@@ -1216,10 +1236,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 
         Uri uri = Uri.parse(mHostBaseUrl);
         String username = mUsernameInput.getText().toString().trim();
-        if (isSaml) {
-            username = getUserNameForSamlSso();
-            
-        } else if (isOAuth) {
+        if (isOAuth) {
             username = "OAuth_user" + (new java.util.Random(System.currentTimeMillis())).nextLong();
         }            
         String accountName = username + "@" + uri.getHost();
@@ -1279,20 +1296,6 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         }
     }
 
-    
-    private String getUserNameForSamlSso() {
-        if (mAuthToken != null) {
-            String [] cookies = mAuthToken.split(";");
-            for (int i=0; i<cookies.length; i++) {
-                if (cookies[i].startsWith(KEY_OC_USERNAME_EQUALS )) {
-                    String value = Uri.decode(cookies[i].substring(KEY_OC_USERNAME_EQUALS.length()));
-                    return value;
-                }
-            }
-        }
-        return "";
-    }
-
 
     /**
      * {@inheritDoc}
@@ -1593,16 +1596,11 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         
         if (sessionCookie != null && sessionCookie.length() > 0) {
             mAuthToken = sessionCookie;
-            boolean success = false;
-            if (mAction == ACTION_CREATE) {
-                success = createAccount();
-        
-            } else {
-                success = updateToken();
-            }
-            if (success) {
-                finish();
-            }
+
+            GetUserNameRemoteOperation getUserOperation = new GetUserNameRemoteOperation();            
+            WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl), getApplicationContext(), true);
+            client.setSsoSessionCookie(mAuthToken);
+            getUserOperation.execute(client, this, mHandler);
         }
 
             
@@ -1652,4 +1650,5 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         }
         return super.onTouchEvent(event);
     }
+    
 }

+ 11 - 6
src/com/owncloud/android/authentication/SsoWebViewClient.java

@@ -21,12 +21,16 @@ import java.lang.ref.WeakReference;
 
 import com.owncloud.android.utils.Log_OC;
 
-
 import android.graphics.Bitmap;
+import android.net.http.SslError;
 import android.os.Handler;
 import android.os.Message;
+import android.view.KeyEvent;
 import android.view.View;
 import android.webkit.CookieManager;
+import android.webkit.HttpAuthHandler;
+import android.webkit.SslErrorHandler;
+import android.webkit.WebResourceResponse;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
 
@@ -107,7 +111,7 @@ public class SsoWebViewClient extends WebViewClient {
             view.setVisibility(View.GONE);
             CookieManager cookieManager = CookieManager.getInstance();
             final String cookies = cookieManager.getCookie(url);
-            //Log_OC.d(TAG, "Cookies: " + cookies);
+            Log_OC.d(TAG, "Cookies: " + cookies);
             if (mListenerHandler != null && mListenerRef != null) {
                 // this is good idea because onPageFinished is not running in the UI thread
                 mListenerHandler.post(new Runnable() {
@@ -115,16 +119,16 @@ public class SsoWebViewClient extends WebViewClient {
                     public void run() {
                         SsoWebViewClientListener listener = mListenerRef.get();
                         if (listener != null) {
+                        	// Send Cookies to the listener
                             listener.onSsoFinished(cookies);
                         }
                     }
                 });
             }
-        }
-
+        } 
     }
     
-    /*
+    
     @Override
     public void doUpdateVisitedHistory (WebView view, String url, boolean isReload) {
         Log_OC.d(TAG, "doUpdateVisitedHistory : " + url);
@@ -133,6 +137,7 @@ public class SsoWebViewClient extends WebViewClient {
     @Override
     public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
         Log_OC.d(TAG, "onReceivedSslError : " + error);
+        handler.proceed();
     }
     
     @Override
@@ -172,5 +177,5 @@ public class SsoWebViewClient extends WebViewClient {
         Log_OC.d(TAG, "shouldOverrideKeyEvent : " + event);
         return false;
     }
-    */
+
 }