[Pkg-owncloud-commits] [owncloud] 55/59: Imported Upstream version 7.0.0~rc3+dfsg
David Prévot
taffit at moszumanska.debian.org
Fri Jul 18 16:19:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 7ccf1e9024a46ad5bf005ba4677e38f97685955b
Merge: 3967a0d ef20250
Author: David Prévot <taffit at debian.org>
Date: Fri Jul 18 09:31:14 2014 -0400
Imported Upstream version 7.0.0~rc3+dfsg
apps/documents/ajax/admin.php | 3 +-
apps/documents/css/style.css | 83 +++++++----
apps/documents/js/documents.js | 9 +-
apps/documents/lib/converter.php | 1 +
apps/external/ajax/setsites.php | 16 ++-
apps/external/appinfo/app.php | 12 +-
apps/external/index.php | 11 +-
apps/external/js/admin.js | 14 +-
apps/external/lib/external.php | 6 +-
apps/external/settings.php | 1 +
apps/external/templates/settings.php | 9 +-
apps/files_encryption/appinfo/app.php | 4 +
apps/files_encryption/files/error.php | 1 +
apps/files_encryption/hooks/hooks.php | 59 ++++----
apps/files_encryption/lib/crypt.php | 23 +---
.../lib/exceptions.php} | 35 +++--
apps/files_encryption/lib/util.php | 25 ++--
apps/files_encryption/tests/crypt.php | 2 +
apps/files_encryption/tests/migration.php | 43 +++++-
apps/files_encryption/tests/share.php | 48 +++++++
apps/files_external/css/settings.css | 15 +-
apps/files_external/js/settings.js | 12 +-
apps/files_external/templates/settings.php | 14 +-
apps/files_external/tests/mountconfig.php | 37 +++++
apps/files_sharing/js/share.js | 2 +-
apps/files_sharing/lib/cache.php | 2 +-
apps/files_sharing/tests/cache.php | 19 +++
apps/files_sharing/tests/js/shareSpec.js | 8 +-
apps/files_trashbin/appinfo/app.php | 2 +
.../lib/exceptions.php} | 18 +--
apps/files_trashbin/lib/trashbin.php | 24 +++-
apps/files_versions/lib/versions.php | 32 +++--
apps/gallery/css/styles.css | 9 ++
apps/gallery/js/gallery.js | 33 +++--
apps/gallery/public.php | 6 +-
apps/gallery/templates/index.php | 1 +
apps/user_ldap/lib/user/manager.php | 3 +-
apps/user_ldap/tests/user/manager.php | 151 +++++++++++++++++++++
apps/user_webdavauth/appinfo/info.xml | 2 +-
config/config.sample.php | 2 +-
core/js/share.js | 4 +-
core/js/tests/specs/shareSpec.js | 14 +-
db_structure.xml | 12 --
lib/private/db.php | 10 ++
lib/private/db/mdb2schemamanager.php | 6 +-
lib/private/defaults.php | 2 +-
lib/private/files/view.php | 3 +-
lib/private/group/metadata.php | 100 +++++++-------
lib/private/installer.php | 13 +-
lib/private/log.php | 2 +-
lib/private/ocsclient.php | 2 +-
lib/private/search/result/file.php | 55 +++-----
lib/private/share/share.php | 2 +-
lib/private/user/manager.php | 3 +-
lib/private/user/session.php | 3 +-
lib/private/user/user.php | 3 +-
lib/public/iservercontainer.php | 7 +
lib/public/iuser.php | 105 ++++++++++++++
lib/public/iusermanager.php | 105 ++++++++++++++
lib/public/iusersession.php | 13 ++
settings/ajax/grouplist.php | 14 +-
settings/css/settings.css | 5 +
settings/js/users/deleteHandler.js | 4 +-
settings/js/users/filter.js | 6 +-
settings/js/users/groups.js | 7 +-
settings/js/users/users.js | 16 ++-
settings/templates/users/part.grouplist.php | 4 +-
settings/users.php | 9 +-
version.php | 6 +-
69 files changed, 1005 insertions(+), 327 deletions(-)
diff --cc apps/documents/ajax/admin.php
index 48b6ea0,0000000..524b978
mode 100644,000000..100644
--- a/apps/documents/ajax/admin.php
+++ b/apps/documents/ajax/admin.php
@@@ -1,69 -1,0 +1,70 @@@
+<?php
+
+namespace OCA\Documents;
+
+\OCP\JSON::callCheck();
+\OCP\JSON::checkAdminUser();
+
+$converter = isset($_POST['converter']) ? $_POST['converter'] : null;
+$url = isset($_POST['url']) ? $_POST['url'] : null;
+try {
+ if (!is_null($converter)){
+ Config::setConverter($converter);
+ }
+
+ if (!is_null($url)){
+ Config::setConverterUrl($url);
+ }
+
+ if (Config::getConverter()!='local'){
+ if (!Converter::checkConnection()){
+ Helper::warnLog('Bad response from Format Filter Server');
+ \OCP\JSON::error(array( 'data'=>
+ array('message' => Config::getL10n()->t('Format filter server is down or misconfigured') )
+ ));
+ exit();
+ }
+ } else {
+ $targetFilter = 'odt:writer8';
+ $targetExtension = 'odt';
+ $input = '0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAOwADAP7/CQAGAAAAAAAAAAAAAAABAAAAKQAAAAAAAAAAEAAAAgAAAAEAAAD+////AAAAAAAAAAD//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [...]
+YAXoQAAF2EAABghMQCBiQBAAQAQ0ocAAAALgAIEAEAAgAuAAAACQBIAGUAYQBkAGkAbgBnACAAOAAAAAUACAAGJAEABABDShwASAAJEAEAAgBIAAAACQBIAGUAYQBkAGkAbgBnACAAOQAAAB0ACQASZGQAAAADJAFhJAFehAAAXYQAAGCEAAAGJAEABgA1CAFcCAEAAAAAAAAAAAAALgD+H/L/8QAuAAAACQBXAFcAOABOAHUAbQAxAHoAMAAAAAwAT0oBAFFKAQBeSgEALgD+H/L/AQEuAAAACQBXAFcAOABOAHUAbQAyAHoAMAAAAAwAT0oBAFFKAQBeSgEALgD+H/L/EQEuAAAACQBXAFcAOABOAHUAbQAyAHoAMQAAAAwAT0oGAFFKBgBeSgYALgD+H/L/IQEuAAAACQBXAFcAOABOAHUAbQAyAHoAMgAAAAwAT0oHAFFKBwBeSgcAIgD+H/L/MQEiAAAACQBXAFcAO [...]
+gQUkAAAACgBXAFcAOABOAHUAbQAxADMAegAyAAAAAAAkAP4f8v+RBSQAAAAKAFcAVwA4AE4AdQBtADEAMwB6ADMAAAAAACQA/h/y/6EFJAAAAAoAVwBXADgATgB1AG0AMQAzAHoANAAAAAAAJAD+H/L/sQUkAAAACgBXAFcAOABOAHUAbQAxADMAegA1AAAAAAAkAP4f8v/BBSQAAAAKAFcAVwA4AE4AdQBtADEAMwB6ADYAAAAAACQA/h/y/9EFJAAAAAoAVwBXADgATgB1AG0AMQAzAHoANwAAAAAAJAD+H/L/4QUkAAAACgBXAFcAOABOAHUAbQAxADMAegA4AAAAAAAwAP4f8v/xBTAAAAAKAFcAVwA4AE4AdQBtADEANAB6ADAAAAAMAE9KAQBRSgEAXkoBACQA/h/y/wEGJAAAAAoAVwBXADgATgB1AG0AMQA0AHoAMQAAAAAAJAD+H/L/EQYkAAAACgBXAFcAOAB [...]
+8BBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAA0AAAAAAAAAAAgAAAAAAAAAAAAABQAAAA4AAAAiAAAABAAADgAAAAD/////BAA2DgAAAAD/////BABvDgAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAcAAAAACAAAQggAAAUAAAAACAAARAgAAAYAAAAFAAAACwAAAAwAAAAOAAAAEw0U/xWAAAAAAAcAAAAJAAAADQAAABMhFP8VgA8AAPBAAAAAAAAG8CAAAAABCAAAAwAAAAQAAAACAAAAAQAAAAIAAAACAAAAAgAAAEAAHvEQAAAABAAACAEAAAgCAAAI9wAAEAEPAALw+gAAABAACPAIAAAAA [...]
+AlAEQAMAAlAEEAMAAlAEQAMAAlAEIAOAAlAEQAMQAlADgAMQAlAEQAMQAlADgAMwAlAEQAMAAlAEIARAAlAEQAMAAlAEIARQAlAEQAMAAbAF8AXwBSAGUAZgBIAGUAYQBkAGkAbgBnAF8AXwAxADIANABfADgAMwA0ADEAMAA2ADAAMwA4ABsAXwBfAFIAZQBmAEgAZQBhAGQAaQBuAGcAXwBfADEAMgA2AF8AOAAzADQAMQAwADYAMAAzADgAGwBfAF8AUgBlAGYASABlAGEAZABpAG4AZwBfAF8AMQAyADgAXwA4ADMANAAxADAANgAwADMAOAAbAF8AXwBSAGUAZgBIAGUAYQBkAGkAbgBnAF8AXwAxADMAMABfADgAMwA0ADEAMAA2ADAAMwA4ABsAXwBfAFIAZQBmAEgAZQBhAGQAaQBuAGcAXwBfADEAMwAyAF8AOAAzADQAMQAwADYAMAAzADgAGwBfAF8AUgBlA [...]
+w8AAAEAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAQAABehDcCYIQAABXGBQABNwIGAgAAAC4AAQAAAAAAAQMAAAAAAAAAAAAAAAAAAAAAABAAAF6EOAJghAAAFcYFAAE4AgYEAAAALgABAC4AAQAAAAAAAQMFAAAAAAAAAAAAAAAAAAAAABAAAF6ENwJghAAAFcYFAAE3AgYGAAAALgABAC4AAgAuAAEAAAAAAAEDBQcAAAAAAAAAAAAAAAAAAAAQAABehMAGYIR4/RXGBQABwAYGCAAAAC4AAQAuAAIALgADAC4AAQAAAAAAAQMFBwkAAAAAAAAAAAAAAAAAABAAAF6EuAhghOj8FcYFAAG4CAYKAAAALgABAC4AAgAuAAMALgAEAC4AAQAAAAAAAQMFBwkLAAAAAAAAAAAAAAAAABAAAF6EsApghFj8FcYFAAGwCgYMAAAALgABAC4AAgAuAAMALgAEAC4ABQAuAAEAAAAA [...]
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8DAAAB4AAABgMwAAGAAAAAAAAAAAAAAA6hkAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeDMAAAgAAAAAAAAAAAAAAIAzAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA [...]
+wAAAQACAAAAAAAAAAAAAAAAAAAAAAACAAAAAtXN1ZwuGxCTlwgAKyz5rkQAAAAF1c3VnC4bEJOXCAArLPmuXAAAABgAAAABAAAAAQAAABAAAAACAAAA6f0AABgAAAABAAAAAQAAABAAAAACAAAA6f0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUgBvAG8AdAAgAEUAbgB0AHIAeQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYABQD//////////wEAAAAGCQIAAAAAAMAAAAAAAABGAAAAAAAAAAAAAAAAAAAAAAAA [...]
+
+ $infile = \OCP\Files::tmpFile();
+ $outdir = \OCP\Files::tmpFolder();
+ $outfile = $outdir . '/' . basename($infile) . '.' . $targetExtension;
+ $cmd = Helper::findOpenOffice();
+
+ $params = ' --headless --convert-to ' . escapeshellarg($targetFilter) . ' --outdir '
+ . escapeshellarg($outdir)
- . ' --writer '. escapeshellarg($infile) . ' 2>&1';
++ . ' --writer '. escapeshellarg($infile)
++ . ' -env:UserInstallation=file://' . escapeshellarg(get_temp_dir()) . ' 2>&1'
+ ;
+ file_put_contents($infile, $input);
+
+ $result = shell_exec($cmd . $params);
+ $exists = file_exists($outfile);
+
+ if (!$exists){
+ Helper::warnLog('Conversion failed. Raw output:' . $result);
+ \OCP\JSON::error(array( 'data'=>
+ array('message' => Config::getL10n()->t('Conversion failed. Check log for details.') )
+ ));
+ exit();
+ } else {
+ unlink($outfile);
+ }
+ }
+
+ \OCP\JSON::success(array( 'data'=>array('message'=>Config::getL10n()->t('Saved')) ));
+} catch (\Exception $e){
+ \OCP\JSON::error(array( 'data'=>
+ array('message' => $e->getMessage() )
+ ));
+}
diff --cc apps/documents/css/style.css
index 8a67773,0000000..1792e89
mode 100644,000000..100644
--- a/apps/documents/css/style.css
+++ b/apps/documents/css/style.css
@@@ -1,327 -1,0 +1,354 @@@
+/* IE 8 fixes */
+.ie8 .document label {
+ background-color: #fff;
+}
+.ie8 .add-document .upload {
+ margin-top: 5px;
+}
+/* end IE 8 fixes */
+
++#editor {
++ box-shadow: none !important;
++}
++
+#editor ::-webkit-scrollbar-thumb {
+ background-color: #fff;
+}
+
+.documentslist { padding:5px; }
+
+.documentslist .document,
+.documentslist .progress,
+.documentslist .add-document{
+ display: inline-block;
+ height: 200px;
+ width: 200px;
+ float: left;
+ margin: 14px;
+ vertical-align: top;
+}
+
+.add-document a {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ display: inline-block;
+ position: relative;
+ height: 100px;
+ width: 200px;
+ background-repeat: no-repeat;
+ background-size: 32px;
+ background-position: 50%;
+}
+
+.add-document a.add {
+ border-bottom: 1px solid #fff;
+}
+.add-document .add,
+.add-document .upload {
+ opacity: .7;
+ border: 1px solid #e8e8e8;
+}
+.add-document .upload {
+ margin-top: 4px;
+}
+.add-document .add:hover,
+.add-document .add:focus,
+.add-document #upload:hover .upload,
+.add-document .upload:focus {
+ opacity: 1;
+ border: 1px solid #818181;
+}
+
+.add-document label {
+ position: absolute;
+ bottom: 10px;
+ width: 100%;
+ font-weight: normal;
+ text-align: center;
+}
+
+.documentslist .progress{
+ border: 1px solid #e8e8e8;
+}
+
+.documentslist .progress div{
+ margin-top: 144px;
+ text-align: center;
+}
+
+.documentslist .document:hover,
+.documentslist .document a:focus {
+ background-color: #ddd;
+}
+
+.documentslist .session-active {
+ position: relative;
+ margin-left: 128px;
+ margin-top: 128px;
+ width: 32px;
+}
+.document a {
+ display: block;
+ position: relative;
+ height: 200px;
+ width: 200px;
+ background-repeat: no-repeat;
+ background-size: 200px;
+ border: 1px solid #e8e8e8;
+}
+.document a:hover {
+ border: 1px solid #818181;
+}
+.document label {
+ background: rgba(255, 255, 255, 0.7);
+ position: absolute;
+ bottom: 0px;
+ width: 100%;
+ font-weight: normal;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ text-align: center;
+ padding: 0 8px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ white-space: nowrap;
+}
+
+#odf-toolbar{
+ text-align: left;
+ position: absolute;
+ width: 100%;
+ padding:0;
+ z-index: 500;
+}
+
+#odf-toolbar #dropdown{
+ right: auto;
- top: 66px;
++ top: 83px;
+}
+
+#body-user #document-title #header{
- height: 32px;
++ height: 45px;
+}
+
+#document-title{
+ padding: 4px 0 5px;
+ border-bottom: 1px solid #E9E9E9;
+
+ text-align: center;
+ font-weight: bold;
+ color:#fff;
+ background-color:#1d2d44;
+}
+
+#document-title div.logo-wide{
- float:left;
- height: 24px;
- width: 110px;
- margin: 3px;
- background-size:110px 24px;
++ float: left;
++ margin: 5px;
+ z-index: 110;
+}
+
+#document-title div{
+ position: relative;
+}
- #document-title #header input {
- height:14px;
- margin: 0;
- padding:3px 6px;
++#document-title .filename {
++ margin-top: 8px !important;
+ width: 300px;
- font-size: 12px;
++}
++#document-title-container {
++ padding-top: 7px;
++ font-weight: normal;
+}
+
+#odf-close{
- margin-top:0;
++ margin-top: 0;
+ float: right;
+}
++#odf-close.icon-close {
++ height: 29px;
++ width: 29px;
++}
+
+#odf-invite{
- margin-top:0;
++ margin-top: 0;
++ margin-left: 3px;
+ float: left;
++ background-position: 5px center;
++ padding-left: 24px;
+}
+
+#mainContainer{
- position:absolute;
- z-index:500;
++ position: absolute;
++ z-index: 500;
++ background-color: #ddd !important;
+}
+
+#documents-overlay, #documents-overlay-below{
+ position: fixed;
- top: 32px;
++ top: 45px;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ filter:alpha(opacity=60);
+ opacity: .6;
+ z-index: 1000;
+ background-color: #fff;
+}
+
+#documents-overlay-below{
- right:72px;
- top:65px;
++ right: 72px;
++ top: 83px;
+ filter:alpha(opacity=100);
+ opacity: 1;
+ background:#fff;
+ z-index: 999;
+}
+
+#file_upload_start{
+ display: block;
+ position:relative;
+ left:0; top:0; width:200px; height:100px;
+ margin-bottom: -110px;padding:0;
+ cursor:pointer; overflow:hidden;
+ font-size:1em;
+ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0;
+ z-index:20;
+}
+
+#saving-document{
+ float:right;
+ display:none;
+}
+
+#warning-connection-lost{
+ padding: 6px 0;
+ text-align: center;
+ color: #ffffff;
+ background-color: #CE7070;
+ font-size: 16px;
+ font-weight: bold;
+}
+
+#warning-connection-lost img {
+ margin-right: 4px;
+ float: right;
+ height: 20px;
+}
+
+#connection-lost{
+ right: 5px;
+ background: #fff;
+ width: 95%;
+ position: absolute;
+ top: 87px;
+}
+
+/* override WebODF styling here */
+#mainContainer #collaboration{
+ float:right;position: relative;z-index: 1;
+ width: 70px;padding:5px;
+}
+
- #members{
- padding-top: 69px !important;
++#members {
++ padding-top: 86px !important;
++ background-color: #ddd !important;
++}
++
++.memberListButton {
++ background-color: transparent !important;
++ box-shadow: none !important;
++ border: none !important;
+}
+
- .memberListButton span{
++.memberListButton span {
+ display: block;
- box-shadow: 0px 0px 5px rgb(90, 90, 90) inset;
- background-color: rgb(200, 200, 200);
- border-radius: 5px;
- border: 2px solid;
++ border-radius: 3px;
+ display: block;
+ margin: auto;
+}
+
+.memberListButton img{
+ border: 0 none !important;
+}
+
+.memberListButton input{
+ width:46px;
+}
+
++#memberList .memberListLabel {
++ color: #555 !important;
++ border-radius: 3px !important;
++ padding: 0 !important;
++ font-size: 10px !important;
++}
++
+#toolbar {
- top:30px !important;
++ top: 45px !important;
+ border-bottom: none !important;
+ padding: 5px 0 0 !important;
++ box-shadow: none !important;
++ background-color: rgba(255,255,255,.95);
+}
+
+#toolbar > .dijit{
+ margin-left:3px;
+}
+#toolbar > span.dijit{
+ margin-left: 0;
+}
+
+#container {
- top: 38px !important;
++ top: 83px !important;
++}
++
++#canvas > div {
++ box-shadow: none !important;
+}
+
+cursor > div {
+ padding-bottom: 0 !important;
+}
+
+editinfo > div.editInfoMarker {
+ width: 4px;
+ border-radius: 0;
+ box-shadow: 0 0 0 #fff;
+ background-clip:content-box;
+ padding: 0 5px;
+}
+
+editinfo > div.editInfoMarker:hover {
+}
+
+.dijitToolbar{
+ min-height: 31px;
+}
+
+.dijitToolbar .dijitDropDownButton {
+ padding-top: 2px;
+}
+
+.dijitSpinner .dijitSpinnerButtonContainer .dijitArrowButton {
+margin-top: -1px;
+}
+
+.claro .dijitTextBox .dijitInputInner,
+.claro .dijitSpinner .dijitSpinnerButtonInner {
+ margin: 0;
+}
+
+/* part of dojo.css */
+.dojoTabular {border-collapse: collapse; border-spacing: 0; border: 1px solid #ccc; margin: 0 1.5em;}
+.dojoTabular th {text-align: center; font-weight: bold;}
+.dojoTabular thead,.dojoTabular tfoot {background-color: #efefef; border: 1px solid #ccc; border-width: 1px 0;}
+.dojoTabular th,.dojoTabular td {padding: 0.25em 0.5em;}
+
+/* raise notification z-index above the documents app */
+#odf-toolbar + #notification-container {
+ z-index: 501;
+}
+
+document p{
+ cursor:auto;
+}
diff --cc apps/documents/js/documents.js
index fba8023,0000000..8485574
mode 100644,000000..100644
--- a/apps/documents/js/documents.js
+++ b/apps/documents/js/documents.js
@@@ -1,817 -1,0 +1,816 @@@
+/*globals $,OC,fileDownloadPath,t,document,odf,webodfEditor,alert,require,dojo,runtime */
+
+$.widget('oc.documentGrid', {
+ options : {
+ context : '.documentslist',
+ documents : {},
+ sessions : {},
+ members : {}
+ },
+
+ _create : function (){
+
+ },
+
+ render : function(){
+ var that = this;
+ jQuery.when(this._load())
+ .then(function(){
+ that._render();
+ });
+ },
+
+ add : function(document) {
+ var docElem = $(this.options.context + ' .template').clone(),
+ a = docElem.find('a')
+ ;
+
+ //Fill an element
+ docElem.removeClass('template').attr('data-id', document.fileid);
+ a.css('background-image', 'url("'+document.icon+'")')
+ .attr('href', OC.generateUrl('apps/files/download{file}',{file:document.path}))
+ .find('label').text(document.name)
+ ;
+
+ docElem.appendTo(this.options.context).show();
+
+ //Preview
+ var previewURL,
+ urlSpec = {
+ file : document.path.replace(/^\/\//, '/'),
+ x : 200,
+ y : 200,
+ c : document.etag,
+ forceIcon : 0
+ };
+
+ if ( $('#isPublic').length ) {
+ urlSpec.t = $('#dirToken').val();
+ }
+
+ if (!urlSpec.x) {
+ urlSpec.x = $('#filestable').data('preview-x');
+ }
+ if (!urlSpec.y) {
+ urlSpec.y = $('#filestable').data('preview-y');
+ }
+ urlSpec.y *= window.devicePixelRatio;
+ urlSpec.x *= window.devicePixelRatio;
+
+ previewURL = OC.generateUrl('/core/preview.png?') + $.param(urlSpec);
+ previewURL = previewURL.replace('(', '%28').replace(')', '%29');
+
+ var img = new Image();
+ img.onload = function(){
+ var ready = function (node){
+ return function(path){
+ node.css('background-image', 'url("'+ path +'")');
+ };
+ }(a);
+ ready(previewURL);
+ };
+ img.src = previewURL;
+ },
+
+ _load : function (){
+ var that = this;
+ var def = new $.Deferred();
+ $.getJSON(OC.generateUrl('apps/documents/ajax/documents/list'))
+ .done(function (data) {
+ that.options.documents = data.documents;
+ that.options.sessions = data.sessions;
+ that.options.members = data.members;
+ def.resolve();
+ })
+ .fail(function(data){
+ console.log(t('documents','Failed to load documents.'));
+ });
+ return def;
+ },
+
+ _render : function (data){
+ var that = this,
+ documents = data && data.documents || this.options.documents,
+ sessions = data && data.sessions || this.options.sessions,
+ members = data && data.members || this.options.members,
+ hasDocuments = false
+ ;
+
+ $(this.options.context + ' .document:not(.template,.progress)').remove();
+
+ $.each(documents, function(i, document){
+ hasDocuments = true;
+ that.add(document);
+ });
+
+ $.each(sessions, function(i, session){
+ if (members[session.es_id].length > 0) {
+ var docElem = $(that.options.context + ' .document[data-id="'+session.file_id+'"]');
+ if (docElem.length > 0) {
+ docElem.attr('data-esid', session.es_id);
+ docElem.find('label').after('<img class="svg session-active" src="'+OC.imagePath('core','places/contacts-dark')+'">');
+ docElem.addClass('session');
+ } else {
+ console.log('Could not find file '+session.file_id+' for session '+session.es_id);
+ }
+ }
+ });
+
+ if (!hasDocuments){
+ $(this.options.context).before('<div id="emptycontent">'
- + t('documents', 'No documents are found. Please upload or create a document!')
++ + t('documents', 'No documents were found. Upload or create a document to get started!')
+ + '</div>'
+ );
+ } else {
+ $('#emptycontent').remove();
+ }
+ }
+});
+
+$.widget('oc.documentOverlay', {
+ options : {
+ parent : 'document.body'
+ },
+ _create : function (){
+ $(this.element).hide().appendTo(document.body);
+ },
+ show : function(){
+ $(this.element).fadeIn('fast');
+ },
+ hide : function(){
+ $(this.element).fadeOut('fast');
+ }
+});
+
+$.widget('oc.documentToolbar', {
+ options : {
+ innerhtml : '<div id="document-title">' +
+ ' <div id="header">' +
+ ' <div class="logo-wide"></div>' +
+ ' <div id="document-title-container"> </div>' +
+ ' </div>' +
+ '</div>' +
+
+ '<span id="toolbar" class="claro">' +
- ' <button id="odf-invite" class="drop hidden">' +
++ ' <button id="odf-invite" class="drop hidden icon-share svg">' +
+ t('documents', 'Share') +
+ ' </button>' +
- ' <button id="odf-close">' +
- t('documents', 'Close') +
- ' </button>' +
++ ' <button id="odf-close" class="icon-close svg"></button>' +
+ ' <img id="saving-document" alt=""' +
+ ' src="' + OC.imagePath('core', 'loading.gif') + '"' +
+ ' />' +
+ '</span>'
+ },
+ _create : function (){
+ $(this.element).html(this.options.innerhtml).hide().prependTo(document.body);
+ },
+ show : function (){
+ $(this.element).show();
+ },
+ hide : function(){
+ $(this.element).fadeOut('fast');
+ $(this.element).html(this.options.innerhtml);
+ }
+});
+
+var documentsMain = {
+ isEditormode : false,
+ useUnstable : false,
+ isGuest : false,
+ memberId : false,
+ esId : false,
+ ready :false,
+ fileName: null,
+
+ UI : {
+ /* Editor wrapper HTML */
+ container : '<div id = "mainContainer" class="claro">' +
+ ' <div id = "editor">' +
+ ' <div id = "container">' +
+ ' <div id="canvas"></div>' +
+ ' </div>' +
+ ' </div>' +
+ ' <div id = "collaboration">' +
+ ' <div id = "collabContainer">' +
+ ' <div id = "members">' +
+ ' <div id = "inviteButton"></div>' +
+ ' <div id = "memberList"></div>' +
+ ' </div>' +
+ ' </div>' +
+ ' </div>' +
+ '</div>',
+
+ /* Previous window title */
+ mainTitle : '',
+
+ init : function(){
+ documentsMain.UI.mainTitle = $('title').text();
+ },
+
+ showEditor : function(title, canShare){
+ if (documentsMain.isGuest){
+ // !Login page mess wih WebODF toolbars
+ $(document.body).attr('id', 'body-user');
+ }
+
+ $('#document-title-container').text(title);
+ if (!canShare){
+ $('#odf-invite').remove();
+ } else {
+ $('#odf-invite').show();
+ }
+ $(document.body).addClass("claro");
+ $(document.body).prepend(documentsMain.UI.container);
+ // in case we are on the public sharing page we shall display the odf into the preview tag
+ $('#preview').html(container);
+ $('title').text(title + ' - ' + documentsMain.UI.mainTitle);
+ },
+
+ hideEditor : function(){
+ if (documentsMain.isGuest){
+ // !Login page mess wih WebODF toolbars
+ $(document.body).attr('id', 'body-login');
+ $('header,footer,nav').show();
+ }
+
+ documentsMain.toolbar.documentToolbar('hide');
+
+ // Fade out editor
+ $('#mainContainer').fadeOut('fast', function() {
+ $('#mainContainer').remove();
+ $('#content').fadeIn('fast');
+ $(document.body).removeClass('claro');
+ $('title').text(documentsMain.UI.mainTitle);
+ });
+ },
+
+ showSave : function (){
+ $('#odf-close').hide();
+ $('#saving-document').show();
+ },
+
+ hideSave : function(){
+ $('#saving-document').hide();
+ $('#odf-close').show();
+ },
+
+ showProgress : function(message){
+ if (!message){
+ message = ' ';
+ }
+ $('.documentslist .progress div').text(message);
+ $('.documentslist .progress').show();
+ },
+
+ hideProgress : function(){
+ $('.documentslist .progress').hide();
+ },
+
+ showLostConnection : function(){
+ $('#memberList .memberListButton').css({opacity : 0.3});
+ $('#odf-toolbar').children(':not(#document-title)').hide();
+ $('<div id="connection-lost"></div>').prependTo('#memberList');
+ $('<div id="warning-connection-lost">' + t('documents', 'No connection to server. Trying to reconnect.') +'<img src="'+ OC.imagePath('core', 'loading-dark.gif') +'" alt="" /></div>').appendTo('#odf-toolbar');
+ },
+
+ hideLostConnection : function() {
+ $('#connection-lost,#warning-connection-lost').remove();
+ $('#odf-toolbar').children(':not(#document-title,#saving-document)').show();
+ $('#memberList .memberListButton').css({opacity : 1});
+ },
+
+ notify : function(message){
+ OC.Notification.show(message);
+ setTimeout(OC.Notification.hide, 10000);
+ }
+ },
+
+ onStartup: function() {
+ var fileId;
+ "use strict";
+ documentsMain.useUnstable = $('#webodf-unstable').val()==='true';
+ documentsMain.UI.init();
+
+ if (!OC.currentUser){
+ documentsMain.isGuest = true;
+
+ if ($("[name='document']").val()){
+ documentsMain.toolbar.documentToolbar('show');
+ documentsMain.prepareSession();
+ documentsMain.joinSession(
+ $("[name='document']").val()
+ );
+ }
+
+ } else {
+ // Does anything indicate that we need to autostart a session?
+ fileId = parent.location.hash.replace(/\W*/g, '');
+ }
+
+ documentsMain.show();
+ if (fileId){
+ documentsMain.overlay.documentOverlay('show');
+ }
+
+ var webodfSource = (oc_debug === true) ? 'webodf-debug' : 'webodf';
+ OC.addScript('documents', '3rdparty/webodf/' + webodfSource).done(function() {
+ // preload stuff in the background
+ require({}, ["dojo/ready"], function(ready) {
+ ready(function() {
+ require({}, ["webodf/editor/Editor"], function(Editor) {
+ runtime.setTranslator(function(s){return t('documents', s);});
+ documentsMain.ready = true;
+ if (fileId){
+ documentsMain.prepareSession();
+ documentsMain.joinSession(fileId);
+ }
+ });
+ });
+ });
+ });
+ },
+
+ prepareSession : function(){
+ documentsMain.isEditorMode = true;
+ documentsMain.overlay.documentOverlay('show');
+ $(window).on('beforeunload', function(){
+ return t('documents', "Leaving this page in Editor mode might cause unsaved data. It is recommended to use 'Close' button instead.");
+ });
+ $(window).on("unload", documentsMain.onTerminate);
+ },
+
+ prepareGrid : function(){
+ documentsMain.isEditorMode = false;
+ documentsMain.overlay.documentOverlay('hide');
+ },
+
+ initSession: function(response) {
+ "use strict";
+
+ if(response && (response.id && !response.es_id)){
+ return documentsMain.view(response.id);
+ }
+
+ $('header,footer,nav').hide();
+ documentsMain.toolbar.documentToolbar('show');
+
+ if (!response || !response.status || response.status==='error'){
+ documentsMain.onEditorShutdown(t('documents', 'Failed to load this document. Please check if it can be opened with an external odt editor. This might also mean it has been unshared or deleted recently.'));
+ return;
+ }
+
+ //Wait for 3 sec if editor is still loading
+ if (!documentsMain.ready){
+ setTimeout(function(){ documentsMain.initSession(response); }, 3000);
+ console.log('Waiting for the editor to start...');
+ return;
+ }
+
+ require({ }, ["owncloud/ServerFactory", "webodf/editor/Editor"], function (ServerFactory, Editor) {
+ // fade out file list and show WebODF canvas
+ $('#content').fadeOut('fast').promise().done(function() {
+
+ documentsMain.fileId = response.file_id;
+ documentsMain.fileName = response.title;
+ documentsMain.UI.showEditor(
+ documentsMain.fileName || response.title,
+ typeof OC.Share !== 'undefined' && response.permissions & OC.PERMISSION_SHARE && !documentsMain.isGuest
+ );
+ if (documentsMain.isGuest){
+ $('#odf-close').text(t('documents', 'Save') );
++ $('#odf-close').removeClass('icon-close');
+ }
+ var serverFactory = new ServerFactory();
+ documentsMain.esId = response.es_id;
+ documentsMain.memberId = response.member_id;
+
+ // TODO: set webodf translation system, by passing a proper function translate(!string):!string in "runtime.setTranslator(translate);"
+
+ documentsMain.webodfServerInstance = serverFactory.createServer();
+ documentsMain.webodfServerInstance.setToken(oc_requesttoken);
+ documentsMain.webodfEditorInstance = new Editor({unstableFeaturesEnabled: documentsMain.useUnstable}, documentsMain.webodfServerInstance, serverFactory);
+ documentsMain.webodfEditorInstance.addEventListener(Editor.EVENT_BEFORESAVETOFILE, documentsMain.UI.showSave);
+ documentsMain.webodfEditorInstance.addEventListener(Editor.EVENT_SAVEDTOFILE, documentsMain.UI.hideSave);
+ documentsMain.webodfEditorInstance.addEventListener(Editor.EVENT_ERROR, documentsMain.onEditorShutdown);
+ documentsMain.webodfEditorInstance.addEventListener(Editor.EVENT_HASSESSIONHOSTCONNECTIONCHANGED, function(has) {
+ if (has){
+ documentsMain.UI.hideLostConnection();
+ } else {
+ documentsMain.UI.showLostConnection();
+ }
+ });
+ // load the document and get called back when it's live
+ documentsMain.webodfEditorInstance.openSession(documentsMain.esId, documentsMain.memberId, function() {
+ documentsMain.webodfEditorInstance.startEditing();
+ documentsMain.overlay.documentOverlay('hide');
+ parent.location.hash = response.file_id;
+ });
+ });
+ });
+ },
+
+
+ joinSession: function(fileId) {
+ console.log('joining session '+fileId);
+ var url;
+ if (documentsMain.isGuest){
+ url = OC.generateUrl('apps/documents/ajax/session/joinasguest/{token}', {token: fileId});
+ } else {
+ url = OC.generateUrl('apps/documents/ajax/session/joinasuser/{file_id}', {file_id: fileId});
+ }
+ $.post(
+ url,
+ { name : $("[name='memberName']").val() },
+ documentsMain.initSession
+ );
+ },
+
+ view : function(id){
+ OC.addScript('documents', 'viewer/viewer', function() {
+ documentsMain.prepareGrid();
+ $(window).off('beforeunload');
+ $(window).off('unload');
+ var path = $('li[data-id='+ id +']>a').attr('href');
+ odfViewer.isDocuments = true;
+ odfViewer.onView(path);
+ });
+ },
+
+ onCreate: function(event){
+ event.preventDefault();
+ var docElem = $('.documentslist .template').clone();
+ docElem.removeClass('template');
+ docElem.addClass('document');
+ docElem.insertAfter('.documentslist .template');
+ docElem.show();
+ $.post(
+ OC.generateUrl('apps/documents/ajax/documents/create'),
+ {},
+ function(response){
+ if (response && response.fileid){
+ documentsMain.prepareSession();
+ documentsMain.joinSession(response.fileid);
+ } else {
+ if (response && response.message){
+ documentsMain.UI.notify(response.message);
+ }
+ documentsMain.show();
+ }
+ }
+
+ );
+ },
+
+ onInvite: function(event) {
+ event.preventDefault();
+ if (OC.Share.droppedDown) {
+ OC.Share.hideDropDown();
+ } else {
+ (function() {
+ var target = OC.Share.showLink;
+ OC.Share.showLink = function() {
+ var r = target.apply( this, arguments );
+ $('#linkText').val( $('#linkText').val().replace('service=files', 'service=documents') );
+ return r;
+ };
+ })();
+
+ OC.Share.showDropDown(
+ 'file',
+ parent.location.hash.replace(/\W*/g, ''),
+ $("#odf-toolbar"),
+ true,
+ OC.PERMISSION_READ | OC.PERMISSION_SHARE | OC.PERMISSION_UPDATE
+ );
+ }
+ },
+
+ changeNick: function(memberId, name, node){
+ var url = OC.generateUrl('apps/documents/ajax/user/rename/{member_id}', {member_id: memberId});
+ $.post(
+ url,
+ { name : name },
+ function(result) {
+ if (result && result.status === 'error') {
+ if (result.message){
+ documentsMain.UI.notify(result.message);
+ }
+ return;
+ }
+ }
+ );
+ },
+
+ onNickChange: function(memberId, fullNameNode){
+ if (!documentsMain.isGuest || memberId !== documentsMain.memberId){
+ return;
+ }
+ if ($(fullNameNode.parentNode).children('input').length !== 0){
+ return;
+ }
+
+ var input = $('<input type="text"/>').val($(fullNameNode).attr('fullname'));
+ $(fullNameNode.parentNode).append(input);
+ $(fullNameNode).hide();
+
+ input.on('blur', function(){
+ var newName = input.val();
+ if (!newName || newName === name) {
+ input.tipsy('hide');
+ input.remove();
+ $(fullNameNode).show();
+ return;
+ }
+ else {
+ try {
+ input.tipsy('hide');
+ input.removeClass('error');
+ input.tipsy('hide');
+ input.remove();
+ $(fullNameNode).show();
+ documentsMain.changeNick(memberId, newName, fullNameNode);
+ }
+ catch (error) {
+ input.attr('title', error);
+ input.tipsy({gravity: 'n', trigger: 'manual'});
+ input.tipsy('show');
+ input.addClass('error');
+ }
+ }
+ });
+ input.on('keyup', function(event){
+ if (event.keyCode === 27) {
+ // cancel by putting in an empty value
+ $(this).val('');
+ $(this).blur();
+ event.preventDefault();
+ }
+ if (event.keyCode === 13) {
+ $(this).blur();
+ event.preventDefault();
+ }
+ });
+ input.focus();
+ input.selectRange(0, name.length);
+ },
+
+ renameDocument: function(name) {
+ var url = OC.generateUrl('apps/documents/ajax/documents/rename/{file_id}', {file_id: documentsMain.fileId});
+ $.post(
+ url,
+ { name : name },
+ function(result) {
+ if (result && result.status === 'error') {
+ if (result.message){
+ documentsMain.IU.notify(result.message);
+ }
+ return;
+ }
+ documentsMain.fileName = name;
+ $('title').text(documentsMain.UI.mainTitle + '| ' + name);
+ $('#document-title-container').text(name);
+ }
+ );
+ },
+
+
+ onRenamePrompt: function() {
+ var name = documentsMain.fileName;
+ var lastPos = name.lastIndexOf('.');
+ var extension = name.substr(lastPos + 1);
+ name = name.substr(0, lastPos);
+ var input = $('<input type="text" class="filename"/>').val(name);
+ $('#header').append(input);
+ $('#document-title-container').hide();
+
+ input.on('blur', function(){
+ var newName = input.val();
+ if (!newName || newName === name) {
+ input.tipsy('hide');
+ input.remove();
+ $('#document-title-container').show();
+ return;
+ }
+ else {
+ newName = newName + '.' + extension;
+ try {
+ input.tipsy('hide');
+ input.removeClass('error');
+ if (Files.isFileNameValid(newName)) {
+ input.tipsy('hide');
+ input.remove();
+ $('#document-title-container').show();
+ documentsMain.renameDocument(newName);
+ }
+ }
+ catch (error) {
+ input.attr('title', error);
+ input.tipsy({gravity: 'n', trigger: 'manual'});
+ input.tipsy('show');
+ input.addClass('error');
+ }
+ }
+ });
+ input.on('keyup', function(event){
+ if (event.keyCode === 27) {
+ // cancel by putting in an empty value
+ $(this).val('');
+ $(this).blur();
+ event.preventDefault();
+ }
+ if (event.keyCode === 13) {
+ $(this).blur();
+ event.preventDefault();
+ }
+ });
+ input.focus();
+ input.selectRange(0, name.length);
+ },
+
+ onEditorShutdown : function (message){
+ OC.Notification.show(message);
+
+ $(window).off('beforeunload');
+ $(window).off('unload');
+ if (documentsMain.isEditorMode){
+ documentsMain.isEditorMode = false;
+ parent.location.hash = "";
+ } else {
+ setTimeout(OC.Notification.hide, 7000);
+ }
+ documentsMain.prepareGrid();
+ try {
+ documentsMain.webodfEditorInstance.endEditing();
+ documentsMain.webodfEditorInstance.closeSession(function() {
+ documentsMain.webodfEditorInstance.destroy(documentsMain.UI.hideEditor);
+ });
+ } catch (e){
+ documentsMain.UI.hideEditor();
+ }
+
+ documentsMain.show();
+ },
+
+
+ onClose: function() {
+ "use strict";
+
+ if (!documentsMain.isEditorMode){
+ return;
+ }
+ documentsMain.isEditorMode = false;
+ $(window).off('beforeunload');
+ $(window).off('unload');
+ parent.location.hash = "";
+
+ documentsMain.webodfEditorInstance.endEditing();
+ documentsMain.webodfEditorInstance.closeSession(function() {
+ // successfull shutdown - all is good.
+ // TODO: proper session leaving call to server, either by webodfServerInstance or custom
+// documentsMain.webodfServerInstance.leaveSession(sessionId, memberId, function() {
+
+ $('header,footer,nav').show();
+ documentsMain.webodfEditorInstance.destroy(documentsMain.UI.hideEditor);
+
+ var url = '';
+ if (documentsMain.isGuest){
+ url = OC.generateUrl('apps/documents/ajax/user/disconnectGuest/{member_id}', {member_id: documentsMain.memberId});
+ } else {
+ url = OC.generateUrl('apps/documents/ajax/user/disconnect/{member_id}', {member_id: documentsMain.memberId});
+ }
+
+ $.post(url, {esId: documentsMain.esId});
+
+ documentsMain.show();
+// });
+ });
+ },
+
+ onTerminate: function(){
+ var url = '';
+ if (documentsMain.isGuest){
+ url = OC.generateUrl('apps/documents/ajax/user/disconnectGuest/{member_id}', {member_id: documentsMain.memberId});
+ } else {
+ url = OC.generateUrl('apps/documents/ajax/user/disconnect/{member_id}', {member_id: documentsMain.memberId});
+ }
+ $.ajax({
+ type: "POST",
+ url: url,
+ data: {esId: documentsMain.esId},
+ dataType: "json",
+ async: false // Should be sync to complete before the page is closed
+ });
+
+
+ documentsMain.webodfEditorInstance.endEditing();
+ documentsMain.webodfEditorInstance.closeSession(function() {
+ if (documentsMain.isGuest){
+ $('header,footer,nav').show();
+ }
+ documentsMain.webodfEditorInstance.destroy(documentsMain.UI.hideEditor);
+ });
+
+ },
+
+ show: function(){
+ if (documentsMain.isGuest){
+ return;
+ }
+ documentsMain.UI.showProgress(t('documents', 'Loading documents...'));
+ documentsMain.docs.documentGrid('render');
+ documentsMain.UI.hideProgress();
+ }
+};
+
+
+//web odf bootstrap code. Added here to reduce number of requests
+/*globals navigator,dojoConfig */
+var usedLocale = "C";
+
+if (navigator && navigator.language && navigator.language.match(/^(de)/)) {
+ usedLocale = navigator.language.substr(0,2);
+}
+
+dojoConfig = {
+ locale: usedLocale,
+ paths: {
+ "webodf/editor": OC.appswebroots.documents + "/js/3rdparty/webodf/editor",
+ "dijit": OC.appswebroots.documents + "/js/3rdparty/resources/dijit",
+ "dojox": OC.appswebroots.documents + "/js/3rdparty/resources/dojox",
+ "dojo": OC.appswebroots.documents + "/js/3rdparty/resources/dojo",
+ "resources": OC.appswebroots.documents + "/js/3rdparty/resources",
+ "owncloud" : OC.appswebroots.documents + "/js"
+ }
+};
+
+
+//init
+var Files = Files || {
+ // FIXME: copy/pasted from Files.isFileNameValid, needs refactor into core
+ isFileNameValid:function (name) {
+ if (name === '.') {
+ throw t('files', '\'.\' is an invalid file name.');
+ } else if (name.length === 0) {
+ throw t('files', 'File name cannot be empty.');
+ }
+
+ // check for invalid characters
+ var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
+ for (var i = 0; i < invalid_characters.length; i++) {
+ if (name.indexOf(invalid_characters[i]) !== -1) {
+ throw t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed.");
+ }
+ }
+ return true;
+ },
+
+ updateStorageStatistics: function(){}
+},
+FileList = FileList || {};
+
+FileList.getCurrentDirectory = function(){
+ return $('#dir').val() || '/';
+};
+
+$(document).ready(function() {
+ "use strict";
+
+ documentsMain.docs = $('.documentslist').documentGrid();
+ documentsMain.overlay = $('<div id="documents-overlay" class="icon-loading"></div><div id="documents-overlay-below" class="icon-loading-dark"></div>').documentOverlay();
+ documentsMain.toolbar = $('<div id="odf-toolbar" class="dijitToolbar"></div>').documentToolbar();
+
+ $('.documentslist').on('click', 'li:not(.add-document)', function(event) {
+ event.preventDefault();
+
+ if (documentsMain.isEditorMode){
+ return;
+ }
+
+ documentsMain.prepareSession();
+ if ($(this).attr('data-id')){
+ documentsMain.joinSession($(this).attr('data-id'));
+ }
+ });
+
+ $(document.body).on('click', '#document-title-container', documentsMain.onRenamePrompt);
+ $(document.body).on('click', '#odf-close', documentsMain.onClose);
+ $(document.body).on('click', '#odf-invite', documentsMain.onInvite);
+
+ $('.add-document').on('click', '.add', documentsMain.onCreate);
+
+
+ var file_upload_start = $('#file_upload_start');
+ if (typeof supportAjaxUploadWithProgress !== 'undefined' && supportAjaxUploadWithProgress()) {
+ file_upload_start.on('fileuploadstart', function(e, data) {
+ $('#upload').addClass('icon-loading');
+ $('.add-document .upload').css({opacity:0});
+ });
+ }
+ file_upload_start.on('fileuploaddone', function(){
+ $('#upload').removeClass('icon-loading');
+ $('.add-document .upload').css({opacity:0.7});
+ documentsMain.show();
+ });
+
+ OC.addScript('documents', '3rdparty/webodf/dojo-amalgamation', documentsMain.onStartup);
+});
diff --cc apps/documents/lib/converter.php
index b3bc7ca,0000000..50fa1f0
mode 100644,000000..100644
--- a/apps/documents/lib/converter.php
+++ b/apps/documents/lib/converter.php
@@@ -1,94 -1,0 +1,95 @@@
+<?php
+
+/**
+ * ownCloud - Documents App
+ *
+ * @author Victor Dubiniuk
+ * @copyright 2014 Victor Dubiniuk victor.dubiniuk at gmail.com
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ */
+
+namespace OCA\Documents;
+
+class Converter {
+
+ public static function convert($input, $targetFilter, $targetExtension){
+ if (Config::getConverter() == 'local'){
+ $output = self::convertLocal($input, $targetFilter, $targetExtension);
+ } else {
+ $output = self::convertExternal($input, $targetExtension);
+ }
+
+ if (empty($output)){
+ Helper::warnLog('Empty conversion output');
+ throw new \RuntimeException('Empty conversion output');
+ }
+ return $output;
+ }
+
+ public static function checkConnection(){
+ $expected = file_get_contents(__DIR__ . '/response.odt');
+ $converted = self::convertExternal('', 'application/vnd.oasis.opendocument.text');
+
+ return $converted === $expected;
+ }
+
+ /**
+ * convert via openOffice hosted on the same server
+ * @param string $input
+ * @param string $targetFilter
+ * @param string $targetExtension
+ * @return string
+ */
+ protected static function convertLocal($input, $targetFilter, $targetExtension){
+ $infile = \OCP\Files::tmpFile();
+ $outdir = \OCP\Files::tmpFolder();
+ $cmd = Helper::findOpenOffice();
+ $params = ' --headless --convert-to ' . $targetFilter . ' --outdir '
+ . escapeshellarg($outdir)
+ . ' --writer '. escapeshellarg($infile)
++ . ' -env:UserInstallation=file://' . escapeshellarg(get_temp_dir())
+ ;
+
+ file_put_contents($infile, $input);
+ shell_exec($cmd . $params);
+ $output = file_get_contents($outdir . '/' . basename($infile) . '.' . $targetExtension);
+
+ return $output;
+ }
+
+ /**
+ * convert via format-filter-server installed on the same host with openOffice
+ * @param string $input
+ * @return string
+ */
+ protected static function convertExternal($input, $targetExtension){
+ $options = array(
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_HEADER => false,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_ENCODING => "",
+ CURLOPT_AUTOREFERER => true,
+ CURLOPT_CONNECTTIMEOUT => 120,
+ CURLOPT_TIMEOUT => 120,
+ CURLOPT_MAXREDIRS => 2,
+ CURLOPT_POST => 1,
+ CURLOPT_POSTFIELDS => $input,
+ CURLOPT_SSL_VERIFYHOST => 0,
+ CURLOPT_SSL_VERIFYPEER => 0,
+ CURLOPT_VERBOSE => 1
+ );
+
+ $ch = curl_init(Config::getConverterUrl() . '?target_format=' . $targetExtension);
+ curl_setopt_array($ch, $options);
+ $content = curl_exec($ch);
+ if (curl_errno($ch)){
+ Helper::debugLog('cURL error' . curl_errno($ch) . ':' . curl_error($ch));
+ }
+ curl_close($ch);
+
+ return $content;
+ }
+
+}
diff --cc apps/external/ajax/setsites.php
index 9a1a71a,0000000..b1614a8
mode 100644,000000..100644
--- a/apps/external/ajax/setsites.php
+++ b/apps/external/ajax/setsites.php
@@@ -1,26 -1,0 +1,40 @@@
+<?php
+
+/**
+ * 2012 Frank Karlitschek frank at owncloud.org
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */
+
+
++OCP\JSON::checkAppEnabled('external');
+OCP\User::checkAdminUser();
+OCP\JSON::callCheck();
+
+$sites = array();
+for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
+ if (!empty($_POST['site_name'][$i]) && !empty($_POST['site_url'][$i])) {
+ array_push($sites, array(strip_tags($_POST['site_name'][$i]), strip_tags($_POST['site_url'][$i])));
+ }
+}
+
++$l=OC_L10N::get('external');
++
++foreach($sites as $site) {
++ if (strpos($site[1], 'https://') === 0) {
++ continue;
++ }
++ if (strpos($site[1], 'http://') === 0) {
++ continue;
++ }
++ OC_JSON::error(array("data" => array( "message" => $l->t('Please enter valid urls - they have to start with either http:// or https://') )));
++ return;
++}
++
+if (sizeof($sites) == 0) {
+ $appConfig = \OC::$server->getAppConfig();
+ $appConfig->deleteKey('external', 'sites');
+} else {
+ OCP\Config::setAppValue('external', 'sites', json_encode($sites));
+}
- echo 'true';
++OC_JSON::success(array("data" => array( "message" => $l->t("External sites saved.") )));
diff --cc apps/external/appinfo/app.php
index 0e8d426,0000000..656ca27
mode 100644,000000..100644
--- a/apps/external/appinfo/app.php
+++ b/apps/external/appinfo/app.php
@@@ -1,33 -1,0 +1,37 @@@
+<?php
+
+/**
+ * ownCloud - External app
+ *
+ * @author Frank Karlitschek
+ * @copyright 2012 Frank Karlitschek frank at owncloud.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
- OC::$CLASSPATH['OC_External'] = 'external/lib/external.php';
- OCP\Util::addStyle( 'external', 'style');
++use OCA\External\External;
+
++OCP\Util::addStyle( 'external', 'style');
+OCP\App::registerAdmin('external', 'settings');
+
- $sites = OC_External::getSites();
++$sites = External::getSites();
+for ($i = 0; $i < sizeof($sites); $i++) {
+ OCP\App::addNavigationEntry(
- array('id' => 'external_index' . ($i + 1), 'order' => 80 + $i, 'href' => OCP\Util::linkTo('external', 'index.php') . '?id=' . ($i + 1), 'icon' => OCP\Util::imagePath('external', 'external.png'), 'name' => $sites[$i][0]));
++ array(
++ 'id' => 'external_index' . ($i + 1), 'order' => 80 + $i,
++ 'href' => OCP\Util::linkTo('external', 'index.php') . '?id=' . ($i + 1),
++ 'icon' => OCP\Util::imagePath('external', 'external.png'),
++ 'name' => $sites[$i][0]));
+}
diff --cc apps/external/index.php
index 8b196b6,0000000..f3737bc
mode 100644,000000..100644
--- a/apps/external/index.php
+++ b/apps/external/index.php
@@@ -1,41 -1,0 +1,46 @@@
+<?php
+
+/**
+ * ownCloud - External plugin
+ *
+ * @author Frank Karlitschek
+ * @copyright 2012 Frank Karlitschek frank at owncloud.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
- require_once 'lib/external.php';
+
++use OCA\External\External;
++
++OCP\JSON::checkAppEnabled('external');
+OCP\User::checkLoggedIn();
+
+$id = isset($_GET['id']) ? (int)$_GET['id'] : 1;
+
- $sites = OC_External::getSites();
++$sites = External::getSites();
+if (sizeof($sites) >= $id) {
+ $url = $sites[$id - 1][1];
+ OCP\App::setActiveNavigationEntry('external_index' . $id);
+
+ $tmpl = new OCP\Template('external', 'frame', 'user');
+ //overwrite x-frame-options
- $tmpl->addHeader('X-Frame-Options', 'ALLOW-FROM *');
++ header('X-Frame-Options: ALLOW-FROM *');
+
+ $tmpl->assign('url', $url);
+ $tmpl->printPage();
++} else {
++ \OC_Util::redirectToDefaultPage();
+}
++
diff --cc apps/external/js/admin.js
index 02ce843,0000000..10f5773
mode 100644,000000..100644
--- a/apps/external/js/admin.js
+++ b/apps/external/js/admin.js
@@@ -1,55 -1,0 +1,57 @@@
+$(document).ready(function(){
- newSiteHtml = '<li><input type="text" class="site_name" name="site_name[]" value="" placeholder="Name" />\n\
- <input type="text" name="site_url[]" class="site_url" value="" placeholder="URL" />\n\
- <img class="svg action delete_button" src="'+OC.imagePath("core", "actions/delete") +'" title="Remove site" /></li>';
++ var newSiteHtml = '<li><input type="text" class="site_name" name="site_name[]" value="" placeholder="Name" />\n' +
++ '<input type="text" name="site_url[]" class="site_url" value="" placeholder="URL" />' +
++ '<img class="svg action delete_button" src="' +
++ OC.imagePath("core", "actions/delete") +'" title="Remove site" /></li>';
+
+ // Handler functions
+ function addSiteEventHandler(event) {
+ event.preventDefault();
+
+ saveSites();
+ }
+
+ function deleteButtonEventHandler(event) {
+ event.preventDefault();
+
+ $(this).tipsy('hide');
+ $(this).parent().remove();
+
+ saveSites();
+ }
+
+ function saveSites() {
+ var post = $('#external').serialize();
++ OC.msg.startSaving('#external .msg');
+ $.post( OC.filePath('external','ajax','setsites.php') , post, function(data) {
- // OC.msg.finishedSaving('#site_name .msg', data);
++ OC.msg.finishedSaving('#external .msg', data);
+ });
+ }
+
- function showDeleteButton(event) {
++ function showDeleteButton() {
+ $(this).find('img.delete_button').fadeIn(100);
+ }
+
- function hideDeleteButton(event) {
++ function hideDeleteButton() {
+ $(this).find('img.delete_button').fadeOut(100);
+ }
+
+ // Initialize events
+ $('input[name^=site_]').change(addSiteEventHandler);
+ $('img.delete_button').click(deleteButtonEventHandler);
+ $('img.delete_button').tipsy();
+
+ $('#external li').hover(showDeleteButton, hideDeleteButton);
+
+ $('#add_external_site').click(function(event) {
+ event.preventDefault();
+ $('#external ul').append(newSiteHtml);
+
+ $('input.site_url:last').prev('input.site_name').andSelf().change(addSiteEventHandler);
+ $('img.delete_button').click(deleteButtonEventHandler);
+ $('img.delete_button:last').tipsy();
+ $('#external li:last').hover(showDeleteButton, hideDeleteButton);
+
+ });
+
+});
diff --cc apps/external/lib/external.php
index c6354e7,0000000..6f2268a
mode 100644,000000..100644
--- a/apps/external/lib/external.php
+++ b/apps/external/lib/external.php
@@@ -1,34 -1,0 +1,36 @@@
+<?php
+
+/**
+ * ownCloud - external App
+ *
+ * @author Frank Karlitschek
+ * @copyright 2013 Frank Karlitschek frank at owncloud.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
- class OC_External {
++namespace OCA\External;
++
++class External {
+
+ public static function getSites() {
- if (($sites = json_decode(OCP\Config::getAppValue("external", "sites", ''))) != null) {
++ if (($sites = json_decode(\OCP\Config::getAppValue("external", "sites", ''))) != null) {
+ return $sites;
+ }
+
+ return array();
+ }
+
+}
diff --cc apps/external/settings.php
index 488444c,0000000..d1b055c
mode 100644,000000..100644
--- a/apps/external/settings.php
+++ b/apps/external/settings.php
@@@ -1,9 -1,0 +1,10 @@@
+<?php
+
+OCP\User::checkAdminUser();
++OCP\JSON::checkAppEnabled('external');
+
+OCP\Util::addscript( "external", "admin" );
+
+$tmpl = new OCP\Template( 'external', 'settings');
+
+return $tmpl->fetchPage();
diff --cc apps/external/templates/settings.php
index 95272a9,0000000..c93fa2d
mode 100644,000000..100644
--- a/apps/external/templates/settings.php
+++ b/apps/external/templates/settings.php
@@@ -1,21 -1,0 +1,28 @@@
+<form id="external">
+ <div class="section">
+ <h2><?php p($l->t('External Sites'));?></h2>
++ <p>
++ <em><?php p($l->t('Please note that some browsers will block displaying of sites via http if you are running https.')); ?></em>
++ <br>
++ <em><?php p($l->t('Furthermore please note that many sites these days disallow iframing due to security reasons.')); ?></em>
++ <br>
++ <em><?php p($l->t('We highly recommend to test the configured sites below properly.')); ?></em>
++ </p>
+ <ul class="external_sites">
+
+ <?php
- $sites = OC_External::getSites();
++ $sites = \OCA\External\External::getSites();
+ for($i = 0; $i < sizeof($sites); $i++) {
+ print_unescaped('<li><input type="text" name="site_name[]" class="site_name" value="'.OCP\Util::sanitizeHTML($sites[$i][0]).'" placeholder="'.$l->t('Name').'" />
+ <input type="text" class="site_url" name="site_url[]" value="'.OCP\Util::sanitizeHTML($sites[$i][1]).'" placeholder="'.$l->t('URL').'" />
+ <img class="svg action delete_button" src="'.OCP\image_path("", "actions/delete.svg") .'" title="'.$l->t("Remove site").'" />
+ </li>');
+ }
+ ?>
+
+ </ul>
+
+ <input type="button" id="add_external_site" value="<?php p($l->t("Add")); ?>" />
+ <span class="msg"></span>
+ </div>
+</form>
diff --cc apps/files_encryption/lib/crypt.php
index ee2c402,69ccce0..69ccce0
mode 100644,100755..100644
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
diff --cc apps/files_encryption/tests/crypt.php
index 3674381,03776de..03776de
mode 100644,100755..100644
--- a/apps/files_encryption/tests/crypt.php
+++ b/apps/files_encryption/tests/crypt.php
diff --cc apps/files_encryption/tests/share.php
index bb3d750,9217af2..9217af2
mode 100644,100755..100644
--- a/apps/files_encryption/tests/share.php
+++ b/apps/files_encryption/tests/share.php
diff --cc apps/gallery/css/styles.css
index 981bbc9,0000000..b618c14
mode 100644,000000..100644
--- a/apps/gallery/css/styles.css
+++ b/apps/gallery/css/styles.css
@@@ -1,114 -1,0 +1,123 @@@
+button.share {
+ display: none;
+}
+
+#gallery.hascontrols {
+ overflow: hidden;
+ text-align: justify;
+ top: 44px;
+ padding-bottom: 100px;
+}
+
+#gallery .row {
+ line-height: 0;
+ width: 100%;
+ white-space: nowrap;
+}
+
+#gallery .row:first-child {
+ margin-top: 2px;
+}
+
+#gallery .row a:first-child {
+ margin-left: 4px;
+}
+
+#gallery .row a:last-child {
+ margin-right: 4px;
+}
+
+#gallery .row a {
+ display: inline-block;
+ height: auto;
+ padding: 0;
+ margin: 2px;
+}
+
+#gallery a.album label, #gallery a.image label {
+ color: rgb(255, 255, 255);
+ text-shadow: 0 0 7px rgb(0, 0, 0);
+ position: relative;
+ bottom: 15px;
+ left: 10px;
+}
+
+#gallery a.album > img {
+ max-width: 200px;
+ max-height: 200px;
+}
+
+#gallery a.album > label {
+ color: white;
+ text-shadow: 0 0 10px #000;
+ position: absolute;
+ left: 0;
+ width: 100%;
+ text-align: center;
+ font-size: 18px;
+ line-height: normal;
+ box-sizing: border-box;
+ padding: 5px;
+ overflow-x: hidden;
+ text-overflow: ellipsis;
+ z-index: 11;
+}
+
+#gallery a {
+ display: inline-block;
+ margin: 0;
+ position: relative;
+ vertical-align: top;
+ *display: inline;
+ zoom: 1;
+}
+
+#gallery a.image > img {
+ max-height: 200px;
+}
+
+#gallery a.album,
+#gallery a.image {
+ opacity: 1;
+ transition: opacity 500ms;
+ -moz-transition: opacity 500ms;
+ -o-transition: opacity 500ms;
+ -ms-transition: opacity 500ms;
+ -webkit-transition: opacity 500ms;
+}
+
+#gallery a.album.loading,
+#gallery a.image.loading {
+ opacity: 0;
+}
+
+#controls > .right {
+ float: right;
+}
+
+#gallery > h2 {
+ background: #f7f7f7;
+ height: 2.8em;
+ border-top: 1px solid #eee;
+ border-bottom: 1px solid #eee;
+ vertical-align: middle;
+ font-weight: bold;
+ padding: 0.5em;
+ padding-left: 2em;
+}
+
+#dropdown {
+ top: 43px;
+ right: 0;
+ margin-right: 0;
+ border-bottom-right-radius: 0;
+}
++
++#loading {
++ font-size: 16px;
++ color: #888;
++ position: absolute;
++ text-align: center;
++ top: 30%;
++ width: 100%;
++}
diff --cc apps/gallery/js/gallery.js
index 8fedd3f,0000000..5397a3f
mode 100644,000000..100644
--- a/apps/gallery/js/gallery.js
+++ b/apps/gallery/js/gallery.js
@@@ -1,267 -1,0 +1,278 @@@
+var Gallery = {};
+Gallery.images = [];
+Gallery.currentAlbum = '';
+Gallery.users = [];
+Gallery.albumMap = {};
+Gallery.imageMap = {};
+
+Gallery.getAlbum = function (path) {
+ if (!Gallery.albumMap[path]) {
+ Gallery.albumMap[path] = new Album(path, [], [], OC.basename(path));
+ if (path !== '') {
+ var parent = OC.dirname(path);
+ if (parent === path) {
+ parent = '';
+ }
+ Gallery.getAlbum(parent).subAlbums.push(Gallery.albumMap[path]);
+ }
+ }
+ return Gallery.albumMap[path];
+};
+
+// fill the albums from Gallery.images
+Gallery.fillAlbums = function () {
+ var sortFunction = function (a, b) {
+ return a.path.toLowerCase().localeCompare(b.path.toLowerCase());
+ };
+ var token = $('#gallery').data('token');
+ var album, image;
+ return $.getJSON(OC.filePath('gallery', 'ajax', 'getimages.php'), {token: token}).then(function (data) {
+ Gallery.users = data.users;
+ Gallery.displayNames = data.displayNames;
+ Gallery.images = data.images;
+
+ for (var i = 0; i < Gallery.images.length; i++) {
+ var parts = Gallery.images[i].split('/');
+ parts.shift();
+ var path = parts.join('/');
+ image = new GalleryImage(Gallery.images[i], path);
+ var dir = OC.dirname(Gallery.images[i]);
+ parts = dir.split('/');
+ parts.shift();
+ dir = parts.join('/');
+ album = Gallery.getAlbum(dir);
+ album.images.push(image);
+ Gallery.imageMap[image.path] = image;
+ }
+
+ for (path in Gallery.albumMap) {
+ Gallery.albumMap[path].images.sort(sortFunction);
+ Gallery.albumMap[path].subAlbums.sort(sortFunction);
+ }
+ });
+};
+
+Gallery.getAlbumInfo = function (album) {
+ if (album === $('#gallery').data('token')) {
+ return [];
+ }
+ if (!Gallery.getAlbumInfo.cache[album]) {
+ var def = new $.Deferred();
+ Gallery.getAlbumInfo.cache[album] = def;
+ $.getJSON(OC.filePath('gallery', 'ajax', 'gallery.php'), {gallery: album}, function (data) {
+ def.resolve(data);
+ });
+ }
+ return Gallery.getAlbumInfo.cache[album];
+};
+Gallery.getAlbumInfo.cache = {};
+Gallery.getImage = function (image) {
+ return OC.filePath('gallery', 'ajax', 'image.php') + '?file=' + encodeURIComponent(image);
+};
+Gallery.share = function (event) {
+ if (!OC.Share.droppedDown) {
+ event.preventDefault();
+ event.stopPropagation();
+
+ (function () {
+ var target = OC.Share.showLink;
+ OC.Share.showLink = function () {
+ var r = target.apply(this, arguments);
+ $('#linkText').val($('#linkText').val().replace('service=files', 'service=gallery'));
+ return r;
+ };
+ })();
+
+ Gallery.getAlbumInfo(Gallery.currentAlbum).then(function (info) {
+ $('a.share').data('item', info.fileid).data('link', true)
+ .data('possible-permissions', info.permissions).
+ click();
+ if (!$('#linkCheckbox').is(':checked')) {
+ $('#linkText').hide();
+ }
+ });
+ }
+};
+Gallery.view = {};
+Gallery.view.element = null;
+Gallery.view.clear = function () {
+ Gallery.view.element.empty();
- Gallery.toggleControls(false);
++ Gallery.showLoading();
+};
+Gallery.view.cache = {};
+
+
+Gallery.view.viewAlbum = function (albumPath) {
+ var i, crumbs, path;
+ albumPath = albumPath || '';
+ if (!Gallery.albumMap[albumPath]) {
+ return;
+ }
+
+ Gallery.view.clear();
+ if (albumPath !== Gallery.currentAlbum) {
+ Gallery.view.loadVisibleRows.loading = false;
+ }
+ Gallery.currentAlbum = albumPath;
+
+ if (albumPath === '' || $('#gallery').data('token')) {
+ $('button.share').hide();
+ } else {
+ $('button.share').show();
+ }
+
+ OC.Breadcrumb.clear();
+ var albumName = $('#content').data('albumname');
+ if (!albumName) {
+ albumName = t('gallery', 'Pictures');
+ }
+ OC.Breadcrumb.push(albumName, '#').click(function () {
+ Gallery.view.viewAlbum('');
+ });
+ path = '';
+ crumbs = albumPath.split('/');
+ for (i = 0; i < crumbs.length; i++) {
+ if (crumbs[i]) {
+ if (path) {
+ path += '/' + crumbs[i];
+ } else {
+ path += crumbs[i];
+ }
+ Gallery.view.pushBreadCrumb(crumbs[i], path);
+ }
+ }
+
+ Gallery.getAlbumInfo(Gallery.currentAlbum); //preload album info
+
+ Gallery.albumMap[albumPath].viewedItems = 0;
+ setTimeout(function () {
+ Gallery.view.loadVisibleRows.activeIndex = 0;
+ Gallery.view.loadVisibleRows(Gallery.albumMap[Gallery.currentAlbum], Gallery.currentAlbum);
+ }, 0);
+};
+
+Gallery.view.loadVisibleRows = function (album, path) {
+ if (Gallery.view.loadVisibleRows.loading && Gallery.view.loadVisibleRows.loading.state() !== 'resolved') {
+ return Gallery.view.loadVisibleRows.loading;
+ }
+ // load 2 windows worth of rows
+ var targetHeight = ($(window).height() * 2) + $(window).scrollTop();
+ var showRows = function (album) {
+ if (!(album.viewedItems < album.subAlbums.length + album.images.length)) {
+ Gallery.view.loadVisibleRows.loading = null;
+ return;
+ }
+ return album.getNextRow(Gallery.view.element.width()).then(function (row) {
+ return row.getDom().then(function (dom) {
+ if (Gallery.currentAlbum !== path) {
+ Gallery.view.loadVisibleRows.loading = null;
+ return; //throw away the row if the user has navigated away in the meantime
+ }
+ if (Gallery.view.element.length == 1) {
- Gallery.toggleControls(true);
++ Gallery.showNormal();
+ }
+ Gallery.view.element.append(dom);
+ if (album.viewedItems < album.subAlbums.length + album.images.length && Gallery.view.element.height() < targetHeight) {
+ return showRows(album);
+ } else {
+ Gallery.view.loadVisibleRows.loading = null;
+ }
+ }, function () {
+ Gallery.view.loadVisibleRows.loading = null;
+ });
+ });
+ };
+ if (Gallery.view.element.height() < targetHeight) {
+ Gallery.view.loadVisibleRows.loading = true;
+ Gallery.view.loadVisibleRows.loading = showRows(album);
+ return Gallery.view.loadVisibleRows.loading;
+ }
+};
+Gallery.view.loadVisibleRows.loading = false;
+
+Gallery.view.pushBreadCrumb = function (text, path) {
+ OC.Breadcrumb.push(text, '#' + path).click(function () {
+ Gallery.view.viewAlbum(path);
+ });
+};
+
- Gallery.toggleControls = function(toggle) {
- if (toggle) {
- $('#emptycontent').addClass('hidden');
- $('#controls').removeClass('hidden');
- } else {
- $('#controls').addClass('hidden');
- $('#emptycontent').removeClass('hidden');
- }
++Gallery.showEmpty = function () {
++ $('#controls').addClass('hidden');
++ $('#emptycontent').removeClass('hidden');
++ $('#loading').addClass('hidden');
++};
++
++Gallery.showLoading = function () {
++ $('#emptycontent').addClass('hidden');
++ $('#controls').removeClass('hidden');
++ $('#loading').removeClass('hidden');
++};
++
++Gallery.showNormal = function () {
++ $('#emptycontent').addClass('hidden');
++ $('#controls').removeClass('hidden');
++ $('#loading').addClass('hidden');
+};
+
+$(document).ready(function () {
- Gallery.toggleControls(false);
++ Gallery.showLoading();
+
+ Gallery.view.element = $('#gallery');
+ Gallery.fillAlbums().then(function () {
++ if(Gallery.images.length === 0) {
++ Gallery.showEmpty();
++ }
+ OC.Breadcrumb.container = $('#breadcrumbs');
+ window.onhashchange();
+ $('button.share').click(Gallery.share);
+ });
+
+ Gallery.view.element.on('click', 'a.image', function (event) {
+ event.preventDefault();
+ var path = $(this).data('path');
+ var album = Gallery.albumMap[Gallery.currentAlbum];
+ if (location.hash !== encodeURI(path)) {
+ location.hash = encodeURI(path);
+ Thumbnail.paused = true;
+ var images = album.images.map(function (image) {
+ return Gallery.getImage(image.src);
+ });
+ var clickedImage = Gallery.imageMap[path];
+ var i = images.indexOf(Gallery.getImage(clickedImage.src));
+ Slideshow.start(images, i);
+ }
+ });
+
+ $('#openAsFileListButton').click(function (event) {
+ window.location.href = window.location.href.replace('service=gallery', 'service=files');
+ });
+
+ jQuery.fn.slideShow.onstop = function () {
+ $('#content').show();
+ Thumbnail.paused = false;
+ location.hash = encodeURI(Gallery.currentAlbum);
+ Thumbnail.concurrent = 3;
+ };
+
+ $(window).scroll(function () {
+ Gallery.view.loadVisibleRows(Gallery.albumMap[Gallery.currentAlbum], Gallery.currentAlbum);
+ });
+
+ $(window).resize(_.throttle(function () {
+ Gallery.view.viewAlbum(Gallery.currentAlbum);
+ }, 500));
+});
+
+window.onhashchange = function () {
+ var album = decodeURI(location.hash).substr(1);
+ if (!Gallery.imageMap[album]) {
+ Slideshow.end();
+ album = decodeURIComponent(album);
+ if (Gallery.currentAlbum !== album || album == '') {
+ Gallery.view.viewAlbum(album);
+ }
+ } else {
+ Gallery.view.viewAlbum(OC.dirname(album));
+ $('#gallery').find('a.image[data-path="' + album + '"]').click();
+ }
+};
diff --cc apps/gallery/public.php
index 26e128e,0000000..7de69cd
mode 100644,000000..100644
--- a/apps/gallery/public.php
+++ b/apps/gallery/public.php
@@@ -1,112 -1,0 +1,112 @@@
+<?php
+ /**
+ * ownCloud
+ *
+ * @author Thomas Müller
+ * @copyright 2013 Thomas Müller deepdiver at owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+\OCP\JSON::checkAppEnabled('gallery');
+
+OCP\Util::addStyle('gallery', 'styles');
+OCP\Util::addStyle('gallery', 'mobile');
+
+if (isset($_GET['t'])) {
+ $token = $_GET['t'];
+ $linkItem = \OCP\Share::getShareByToken($token, false);
+ if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
+ // seems to be a valid share
+ $type = $linkItem['item_type'];
+ $fileSource = $linkItem['file_source'];
+ $shareOwner = $linkItem['uid_owner'];
+ $path = null;
+ $rootLinkItem = \OCP\Share::resolveReShare($linkItem);
+ $fileOwner = $rootLinkItem['uid_owner'];
+ $albumName = trim($linkItem['file_target'], '//');
+ $ownerDisplayName = \OC_User::getDisplayName($fileOwner);
+
+ // stupid copy and paste job
+ if (isset($linkItem['share_with'])) {
+ // Authenticate share_with
+ $url = OCP\Util::linkToPublic('gallery') . '&t=' . $token;
+ if (isset($_GET['file'])) {
+ $url .= '&file=' . urlencode($_GET['file']);
+ } else {
+ if (isset($_GET['dir'])) {
+ $url .= '&dir=' . urlencode($_GET['dir']);
+ }
+ }
+ if (isset($_POST['password'])) {
+ $password = $_POST['password'];
+ if ($linkItem['share_type'] == OCP\Share::SHARE_TYPE_LINK) {
+ // Check Password
+ $forcePortable = (CRYPT_BLOWFISH != 1);
+ $hasher = new PasswordHash(8, $forcePortable);
+ if (!($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''),
+ $linkItem['share_with']))) {
+ OCP\Util::addStyle('files_sharing', 'authenticate');
+ $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest');
+ $tmpl->assign('URL', $url);
+ $tmpl->assign('wrongpw', true);
+ $tmpl->printPage();
+ exit();
+ } else {
+ // Save item id in session for future requests
- \OC::$session->set('public_link_authenticated', $linkItem['id']);
++ \OC::$server->getSession()->set('public_link_authenticated', $linkItem['id']);
+ }
+ } else {
+ OCP\Util::writeLog('share', 'Unknown share type '.$linkItem['share_type']
+ .' for share id '.$linkItem['id'], \OCP\Util::ERROR);
+ header('HTTP/1.0 404 Not Found');
+ $tmpl = new OCP\Template('', '404', 'guest');
+ $tmpl->printPage();
+ exit();
+ }
+
+ } else {
+ // Check if item id is set in session
- if ( ! \OC::$session->exists('public_link_authenticated')
- || \OC::$session->get('public_link_authenticated') !== $linkItem['id']
++ if ( ! \OC::$server->getSession()->exists('public_link_authenticated')
++ || \OC::$server->getSession()->get('public_link_authenticated') !== $linkItem['id']
+ ) {
+ // Prompt for password
+ OCP\Util::addStyle('files_sharing', 'authenticate');
+ $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest');
+ $tmpl->assign('URL', $url);
+ $tmpl->printPage();
+ exit();
+ }
+ }
+ }
+
+
+ // render template
+ $tmpl = new \OCP\Template('gallery', 'public', 'base');
+ OCP\Util::addScript('gallery', 'album');
+ OCP\Util::addScript('gallery', 'gallery');
+ OCP\Util::addScript('gallery', 'thumbnail');
+ OCP\Util::addStyle('gallery', 'public');
+ $tmpl->assign('token', $token);
+ $tmpl->assign('displayName', $ownerDisplayName);
+ $tmpl->assign('albumName', $albumName);
+
+ $tmpl->printPage();
+ exit;
+ }
+}
+
+$tmpl = new OCP\Template('', '404', 'guest');
+$tmpl->printPage();
diff --cc apps/gallery/templates/index.php
index 0edbea6,0000000..8f5b1ff
mode 100644,000000..100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@@ -1,13 -1,0 +1,14 @@@
+<div id="controls">
+ <div id='breadcrumbs'></div>
+ <span class="right">
+ <button class="share"><?php p($l->t("Share")); ?></button>
+ <a class="share" data-item-type="folder" data-item="" title="<?php p($l->t("Share")); ?>"
+ data-possible-permissions="31"></a>
+ </span>
+</div>
+<div id="gallery" class="hascontrols"></div>
+
+<div id="emptycontent" class="hidden"><?php p($l->t("No pictures found! If you upload pictures in the files app, they will be displayed here.")); ?></div>
++<div id="loading" class="hidden"><?php p($l->t("Loading...")); ?></div>
+
+<input type="hidden" name="allowShareWithLink" id="allowShareWithLink" value="yes" />
diff --cc apps/user_webdavauth/appinfo/info.xml
index 4e82b81,abbf791..abbf791
mode 100644,100755..100644
--- a/apps/user_webdavauth/appinfo/info.xml
+++ b/apps/user_webdavauth/appinfo/info.xml
diff --cc config/config.sample.php
index 1bfae36,24c1579..24c1579
mode 100644,100755..100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
diff --cc version.php
index cf4ca14,4b811ca..d5de91b
--- a/version.php
+++ b/version.php
@@@ -1,6 -1,19 +1,6 @@@
-<?php
-
-// We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades
-// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
-// when updating major/minor version number.
-$OC_Version=array(7, 0, 0, 6);
-
-// The human readable string
-$OC_VersionString='7.0 RC 3';
-
-// The ownCloud edition
-$OC_Edition='';
-
-// The ownCloud channel
-$OC_Channel='git';
-
-// The build number
-$OC_Build='';
-
+<?php
- $OC_Version = array(7,0,0,5);
- $OC_VersionString = '7.0 RC 2';
++$OC_Version = array(7,0,0,6);
++$OC_VersionString = '7.0 RC 3';
+$OC_Edition = '';
+$OC_Channel = 'testing';
- $OC_Build = '2014-07-14T11:28:12+00:00';
++$OC_Build = '2014-07-18T02:05:25+00:00';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list