diff options
author | Tom Needham <tom@owncloud.com> | 2013-02-09 12:05:48 +0000 |
---|---|---|
committer | Tom Needham <tom@owncloud.com> | 2013-02-09 12:05:48 +0000 |
commit | 5d14a2cc463f09d010537a5537e3339a87d57558 (patch) | |
tree | e53b4fece6b204e7ffdaaa6ce3601ddaf25b5ba6 /apps/files_versions | |
parent | eefaefe87d4ef2271c7a079632744948ca8d2496 (diff) | |
parent | 0c73cae77b402355809c8f5f5be69d8a730fe3e2 (diff) | |
download | nextcloud-server-5d14a2cc463f09d010537a5537e3339a87d57558.tar.gz nextcloud-server-5d14a2cc463f09d010537a5537e3339a87d57558.zip |
Merge in master
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/ajax/getVersions.php | 2 | ||||
-rw-r--r-- | apps/files_versions/ajax/rollbackVersion.php | 5 | ||||
-rw-r--r-- | apps/files_versions/appinfo/app.php | 13 | ||||
-rw-r--r-- | apps/files_versions/history.php | 23 | ||||
-rw-r--r-- | apps/files_versions/l10n/ca.php | 8 | ||||
-rw-r--r-- | apps/files_versions/l10n/cs_CZ.php | 8 | ||||
-rw-r--r-- | apps/files_versions/l10n/de_DE.php | 4 | ||||
-rw-r--r-- | apps/files_versions/l10n/es.php | 8 | ||||
-rw-r--r-- | apps/files_versions/l10n/fr.php | 8 | ||||
-rw-r--r-- | apps/files_versions/l10n/it.php | 8 | ||||
-rw-r--r-- | apps/files_versions/l10n/ja_JP.php | 8 | ||||
-rw-r--r-- | apps/files_versions/l10n/lv.php | 10 | ||||
-rw-r--r-- | apps/files_versions/l10n/ru.php | 8 | ||||
-rw-r--r-- | apps/files_versions/l10n/sk_SK.php | 5 | ||||
-rw-r--r-- | apps/files_versions/lib/hooks.php | 2 | ||||
-rw-r--r-- | apps/files_versions/lib/versions.php | 8 | ||||
-rw-r--r-- | apps/files_versions/templates/history.php | 2 |
17 files changed, 108 insertions, 22 deletions
diff --git a/apps/files_versions/ajax/getVersions.php b/apps/files_versions/ajax/getVersions.php index 600e69cf798..53fc04625c6 100644 --- a/apps/files_versions/ajax/getVersions.php +++ b/apps/files_versions/ajax/getVersions.php @@ -5,7 +5,7 @@ $userDirectory = "/".OCP\USER::getUser()."/files"; $source = $_GET['source']; $count = 5; //show the newest revisions -if( ($versions = OCA_Versions\Storage::getVersions( $source, $count)) ) { +if( ($versions = OCA\Files_Versions\Storage::getVersions( $source, $count)) ) { $versionsFormatted = array(); diff --git a/apps/files_versions/ajax/rollbackVersion.php b/apps/files_versions/ajax/rollbackVersion.php index f2c211d9c1e..2970915ac63 100644 --- a/apps/files_versions/ajax/rollbackVersion.php +++ b/apps/files_versions/ajax/rollbackVersion.php @@ -8,9 +8,10 @@ $userDirectory = "/".OCP\USER::getUser()."/files"; $file = $_GET['file']; $revision=(int)$_GET['revision']; -if(OCA_Versions\Storage::rollback( $file, $revision )) { +if(OCA\Files_Versions\Storage::rollback( $file, $revision )) { OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file ))); }else{ - OCP\JSON::error(array("data" => array( "message" => "Could not revert:" . $file ))); + $l = OC_L10N::get('files_versions'); + OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) )))); } diff --git a/apps/files_versions/appinfo/app.php b/apps/files_versions/appinfo/app.php index 9ac86728cc6..d45c0c99a73 100644 --- a/apps/files_versions/appinfo/app.php +++ b/apps/files_versions/appinfo/app.php @@ -1,9 +1,10 @@ <?php //require_once 'files_versions/versions.php'; -OC::$CLASSPATH['OCA_Versions\Storage'] = 'apps/files_versions/lib/versions.php'; -OC::$CLASSPATH['OCA_Versions\Hooks'] = 'apps/files_versions/lib/hooks.php'; -OC::$CLASSPATH['OC_Files_Versions_Capabiltiies'] = 'apps/files_versions/lib/capabilities.php'; +OC::$CLASSPATH['OCA\Files_Versions\Storage'] = 'apps/files_versions/lib/versions.php'; +OC::$CLASSPATH['OCA\Files_Versions\Hooks'] = 'apps/files_versions/lib/hooks.php'; +OC::$CLASSPATH['OCA\Files_Versions\Capabiltiies'] = 'apps/files_versions/lib/capabilities.php'; + OCP\App::registerAdmin('files_versions', 'settings'); OCP\App::registerPersonal('files_versions', 'settings-personal'); @@ -11,7 +12,7 @@ OCP\App::registerPersonal('files_versions', 'settings-personal'); OCP\Util::addscript('files_versions', 'versions'); // Listen to write signals -OCP\Util::connectHook('OC_Filesystem', 'write', "OCA_Versions\Hooks", "write_hook"); +OCP\Util::connectHook('OC_Filesystem', 'write', "OCA\Files_Versions\Hooks", "write_hook"); // Listen to delete and rename signals -OCP\Util::connectHook('OC_Filesystem', 'post-delete', "OCA_Versions\Hooks", "remove_hook"); -OCP\Util::connectHook('OC_Filesystem', 'rename', "OCA_Versions\Hooks", "rename_hook");
\ No newline at end of file +OCP\Util::connectHook('OC_Filesystem', 'post-delete', "OCA\Files_Versions\Hooks", "remove_hook"); +OCP\Util::connectHook('OC_Filesystem', 'rename', "OCA\Files_Versions\Hooks", "rename_hook"); diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php index 6071240e583..437a3fec065 100644 --- a/apps/files_versions/history.php +++ b/apps/files_versions/history.php @@ -24,27 +24,34 @@ OCP\User::checkLoggedIn( ); OCP\Util::addStyle('files_versions', 'versions'); $tmpl = new OCP\Template( 'files_versions', 'history', 'user' ); +$l = OC_L10N::get('files_versions'); if ( isset( $_GET['path'] ) ) { $path = $_GET['path']; $tmpl->assign( 'path', $path ); - $versions = new OCA_Versions\Storage(); + $versions = new OCA\Files_Versions\Storage(); // roll back to old version if button clicked if( isset( $_GET['revert'] ) ) { if( $versions->rollback( $path, $_GET['revert'] ) ) { - $tmpl->assign( 'outcome_stat', 'success' ); + $tmpl->assign( 'outcome_stat', $l->t('success') ); - $tmpl->assign( 'outcome_msg', "File {$_GET['path']} was reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) ); + $message = $l->t('File %s was reverted to version %s', + array($_GET['path'], OCP\Util::formatDate( doubleval($_GET['revert']) ) ) ); + + $tmpl->assign( 'outcome_msg', $message); } else { - $tmpl->assign( 'outcome_stat', 'failure' ); + $tmpl->assign( 'outcome_stat', $l->t('failure') ); + + $message = $l->t('File %s could not be reverted to version %s', + array($_GET['path'], OCP\Util::formatDate( doubleval($_GET['revert']) ) ) ); - $tmpl->assign( 'outcome_msg', "File {$_GET['path']} could not be reverted to version ".OCP\Util::formatDate( doubleval($_GET['revert']) ) ); + $tmpl->assign( 'outcome_msg', $message); } @@ -52,18 +59,18 @@ if ( isset( $_GET['path'] ) ) { // show the history only if there is something to show $count = 999; //show the newest revisions - if( ($versions = OCA_Versions\Storage::getVersions( $path, $count)) ) { + if( ($versions = OCA\Files_Versions\Storage::getVersions( $path, $count)) ) { $tmpl->assign( 'versions', array_reverse( $versions ) ); }else{ - $tmpl->assign( 'message', 'No old versions available' ); + $tmpl->assign( 'message', $l->t('No old versions available') ); } }else{ - $tmpl->assign( 'message', 'No path specified' ); + $tmpl->assign( 'message', $l->t('No path specified') ); } diff --git a/apps/files_versions/l10n/ca.php b/apps/files_versions/l10n/ca.php index 01e0a116873..fc900c47dc7 100644 --- a/apps/files_versions/l10n/ca.php +++ b/apps/files_versions/l10n/ca.php @@ -1,5 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "No s'ha pogut revertir: %s", +"success" => "èxit", +"File %s was reverted to version %s" => "El fitxer %s s'ha revertit a la versió %s", +"failure" => "fallada", +"File %s could not be reverted to version %s" => "El fitxer %s no s'ha pogut revertir a la versió %s", +"No old versions available" => "No hi ha versións antigues disponibles", +"No path specified" => "No heu especificat el camí", "History" => "Historial", +"Revert a file to a previous version by clicking on its revert button" => "Reverteix un fitxer a una versió anterior fent clic en el seu botó de reverteix", "Files Versioning" => "Fitxers de Versions", "Enable" => "Habilita" ); diff --git a/apps/files_versions/l10n/cs_CZ.php b/apps/files_versions/l10n/cs_CZ.php index d219c3e68da..22d4a2ad827 100644 --- a/apps/files_versions/l10n/cs_CZ.php +++ b/apps/files_versions/l10n/cs_CZ.php @@ -1,5 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "Nelze navrátit: %s", +"success" => "úspěch", +"File %s was reverted to version %s" => "Soubor %s byl navrácen na verzi %s", +"failure" => "sehlhání", +"File %s could not be reverted to version %s" => "Soubor %s nemohl být navrácen na verzi %s", +"No old versions available" => "Nejsou dostupné žádné starší verze", +"No path specified" => "Nezadána cesta", "History" => "Historie", +"Revert a file to a previous version by clicking on its revert button" => "Navraťte soubor do předchozí verze kliknutím na tlačítko navrátit", "Files Versioning" => "Verzování souborů", "Enable" => "Povolit" ); diff --git a/apps/files_versions/l10n/de_DE.php b/apps/files_versions/l10n/de_DE.php index 2fcb996de7b..cf33bb071e6 100644 --- a/apps/files_versions/l10n/de_DE.php +++ b/apps/files_versions/l10n/de_DE.php @@ -1,4 +1,8 @@ <?php $TRANSLATIONS = array( +"success" => "Erfolgreich", +"failure" => "Fehlgeschlagen", +"No old versions available" => "keine älteren Versionen verfügbar", +"No path specified" => "Kein Pfad angegeben", "History" => "Historie", "Files Versioning" => "Dateiversionierung", "Enable" => "Aktivieren" diff --git a/apps/files_versions/l10n/es.php b/apps/files_versions/l10n/es.php index 4a8c34e5180..608e171a4b1 100644 --- a/apps/files_versions/l10n/es.php +++ b/apps/files_versions/l10n/es.php @@ -1,5 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "No se puede revertir: %s", +"success" => "exitoso", +"File %s was reverted to version %s" => "El archivo %s fue revertido a la version %s", +"failure" => "fallo", +"File %s could not be reverted to version %s" => "El archivo %s no puede ser revertido a la version %s", +"No old versions available" => "No hay versiones antiguas disponibles", +"No path specified" => "Ruta no especificada", "History" => "Historial", +"Revert a file to a previous version by clicking on its revert button" => "Revertir un archivo a una versión anterior haciendo clic en el boton de revertir", "Files Versioning" => "Versionado de archivos", "Enable" => "Habilitar" ); diff --git a/apps/files_versions/l10n/fr.php b/apps/files_versions/l10n/fr.php index 2d26b98860a..6b2cf9ba6b5 100644 --- a/apps/files_versions/l10n/fr.php +++ b/apps/files_versions/l10n/fr.php @@ -1,5 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "Impossible de restaurer %s", +"success" => "succès", +"File %s was reverted to version %s" => "Le fichier %s a été restauré dans sa version %s", +"failure" => "échec", +"File %s could not be reverted to version %s" => "Le fichier %s ne peut être restauré dans sa version %s", +"No old versions available" => "Aucune ancienne version n'est disponible", +"No path specified" => "Aucun chemin spécifié", "History" => "Historique", +"Revert a file to a previous version by clicking on its revert button" => "Restaurez un fichier dans une version antérieure en cliquant sur son bouton de restauration", "Files Versioning" => "Versionnage des fichiers", "Enable" => "Activer" ); diff --git a/apps/files_versions/l10n/it.php b/apps/files_versions/l10n/it.php index c57b0930111..3289f7f68d1 100644 --- a/apps/files_versions/l10n/it.php +++ b/apps/files_versions/l10n/it.php @@ -1,5 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "Impossibild ripristinare: %s", +"success" => "completata", +"File %s was reverted to version %s" => "Il file %s è stato ripristinato alla versione %s", +"failure" => "non riuscita", +"File %s could not be reverted to version %s" => "Il file %s non può essere ripristinato alla versione %s", +"No old versions available" => "Non sono disponibili versioni precedenti", +"No path specified" => "Nessun percorso specificato", "History" => "Cronologia", +"Revert a file to a previous version by clicking on its revert button" => "Ripristina un file a una versione precedente facendo clic sul rispettivo pulsante di ripristino", "Files Versioning" => "Controllo di versione dei file", "Enable" => "Abilita" ); diff --git a/apps/files_versions/l10n/ja_JP.php b/apps/files_versions/l10n/ja_JP.php index c97ba3d00ee..16018765708 100644 --- a/apps/files_versions/l10n/ja_JP.php +++ b/apps/files_versions/l10n/ja_JP.php @@ -1,5 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "元に戻せませんでした: %s", +"success" => "成功", +"File %s was reverted to version %s" => "ファイル %s をバージョン %s に戻しました", +"failure" => "失敗", +"File %s could not be reverted to version %s" => "ファイル %s をバージョン %s に戻せませんでした", +"No old versions available" => "利用可能な古いバージョンはありません", +"No path specified" => "パスが指定されていません", "History" => "履歴", +"Revert a file to a previous version by clicking on its revert button" => "もとに戻すボタンをクリックすると、ファイルを過去のバージョンに戻します", "Files Versioning" => "ファイルのバージョン管理", "Enable" => "有効化" ); diff --git a/apps/files_versions/l10n/lv.php b/apps/files_versions/l10n/lv.php index e363693e45d..2203dc706b8 100644 --- a/apps/files_versions/l10n/lv.php +++ b/apps/files_versions/l10n/lv.php @@ -1,3 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "Nevarēja atgriezt — %s", +"success" => "veiksme", +"File %s was reverted to version %s" => "Datne %s tika atgriezt uz versiju %s", +"failure" => "neveiksme", +"File %s could not be reverted to version %s" => "Datni %s nevarēja atgriezt uz versiju %s", +"No old versions available" => "Nav pieejamu vecāku versiju", +"No path specified" => "Nav norādīts ceļš", +"History" => "Vēsture", +"Revert a file to a previous version by clicking on its revert button" => "Atgriez datni uz iepriekšēju versiju, spiežot uz tās atgriešanas pogu", +"Files Versioning" => "Datņu versiju izskošana", "Enable" => "Aktivēt" ); diff --git a/apps/files_versions/l10n/ru.php b/apps/files_versions/l10n/ru.php index 4c7fb501091..221d24ce8d1 100644 --- a/apps/files_versions/l10n/ru.php +++ b/apps/files_versions/l10n/ru.php @@ -1,5 +1,13 @@ <?php $TRANSLATIONS = array( +"Could not revert: %s" => "Не может быть возвращён: %s", +"success" => "успех", +"File %s was reverted to version %s" => "Файл %s был возвращён к версии %s", +"failure" => "провал", +"File %s could not be reverted to version %s" => "Файл %s не может быть возвращён к версии %s", +"No old versions available" => "Нет доступных старых версий", +"No path specified" => "Путь не указан", "History" => "История", +"Revert a file to a previous version by clicking on its revert button" => "Вернуть файл к предыдущей версии нажатием на кнопку возврата", "Files Versioning" => "Версии файлов", "Enable" => "Включить" ); diff --git a/apps/files_versions/l10n/sk_SK.php b/apps/files_versions/l10n/sk_SK.php index a3a3567cb4f..8a59286b5a5 100644 --- a/apps/files_versions/l10n/sk_SK.php +++ b/apps/files_versions/l10n/sk_SK.php @@ -1,4 +1,9 @@ <?php $TRANSLATIONS = array( +"success" => "uspech", +"File %s was reverted to version %s" => "Subror %s bol vrateny na verziu %s", +"failure" => "chyba", +"No old versions available" => "Nie sú dostupné žiadne staršie verzie", +"No path specified" => "Nevybrali ste cestu", "History" => "História", "Files Versioning" => "Vytváranie verzií súborov", "Enable" => "Zapnúť" diff --git a/apps/files_versions/lib/hooks.php b/apps/files_versions/lib/hooks.php index 5cefc532895..dc02c605c44 100644 --- a/apps/files_versions/lib/hooks.php +++ b/apps/files_versions/lib/hooks.php @@ -10,7 +10,7 @@ * This class contains all hooks. */ -namespace OCA_Versions; +namespace OCA\Files_Versions; class Hooks { diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 003d548d2b2..b54bc4a4422 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -13,7 +13,7 @@ * A class to handle the versioning of files. */ -namespace OCA_Versions; +namespace OCA\Files_Versions; class Storage { @@ -195,6 +195,7 @@ class Storage { $files_view = new \OC_FilesystemView('/'.$uid.'/files'); $local_file = $files_view->getLocalFile($filename); + $local_file_md5 = \md5_file( $local_file ); foreach( $matches as $ma ) { $parts = explode( '.v', $ma ); @@ -206,7 +207,7 @@ class Storage { $versions[$key]['size'] = $versions_fileview->filesize($filename.'.v'.$version); // if file with modified date exists, flag it in array as currently enabled version - ( \md5_file( $ma ) == \md5_file( $local_file ) ? $versions[$key]['fileMatch'] = 1 : $versions[$key]['fileMatch'] = 0 ); + ( \md5_file( $ma ) == $local_file_md5 ? $versions[$key]['fileMatch'] = 1 : $versions[$key]['fileMatch'] = 0 ); } @@ -333,7 +334,8 @@ class Storage { } // calculate available space for version history - $rootInfo = \OC_FileCache::get('', '/'. $uid . '/files'); + $files_view = new \OC_FilesystemView('/'.$uid.'/files'); + $rootInfo = $files_view->getFileInfo('/'); $free = $quota-$rootInfo['size']; // remaining free space for user if ( $free > 0 ) { $availableSpace = ($free * self::DEFAULTMAXSIZE / 100) - $versionsSize; // how much space can be used for versions diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php index cc5a494f19e..850ece89c98 100644 --- a/apps/files_versions/templates/history.php +++ b/apps/files_versions/templates/history.php @@ -17,7 +17,7 @@ if( isset( $_['message'] ) ) { } echo( '<strong>Versions of '.$_['path'] ).'</strong><br>'; - echo('<p><em>Revert a file to a previous version by clicking on its revert button</em></p><br />'); + echo('<p><em>'.$l->t('Revert a file to a previous version by clicking on its revert button').'</em></p><br />'); foreach ( $_['versions'] as $v ) { echo ' '; |