diff --git a/appinfo/app.php b/appinfo/app.php index d7845a3a..693cbf33 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,5 +1,4 @@ getContainer(); - \OCP\App::registerAdmin('richdocuments', 'admin'); -$navigationEntry = function () use ($c) { - return [ - 'id' => 'richdocuments_index', - 'order' => 2, - 'href' => $c->query('ServerContainer')->getURLGenerator()->linkToRoute('richdocuments.document.index'), - 'icon' => $c->query('ServerContainer')->getURLGenerator()->imagePath('richdocuments', 'app.svg'), - 'name' => $c->query('L10N')->t('Office') - ]; -}; -$c->getServer()->getNavigationManager()->add($navigationEntry); - //Script for registering file actions $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener( @@ -59,5 +42,5 @@ if (class_exists('\OC\Files\Type\TemplateManager')) { $manager->registerTemplate('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'apps/richdocuments/assets/pptxtemplate.pptx'); } -//Listen to delete file signal +// Listen to delete file signal \OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA\Richdocuments\Storage", "onDelete"); diff --git a/css/style.css b/css/style.css index 3b5d3f06..73821bbb 100644 --- a/css/style.css +++ b/css/style.css @@ -1,12 +1,3 @@ -/* 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; } @@ -28,49 +19,6 @@ 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: 46px; - width: 200px; - background-repeat: no-repeat; - background-size: 32px; - background-position: 3%; -} - -.add-document .add-odt, -.add-document .add-ods, -.add-document .add-odp, -.add-document .upload { - opacity: .7; - border: 1px solid #e8e8e8; -} -.add-document .upload { - margin-top: 12px; -} -.add-document .add-odt:hover, -.add-document .add-ods:hover, -.add-document .add-odp:hover, -.add-document .add-odt:focus, -.add-document .add-ods:focus, -.add-document .add-odp: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; } diff --git a/js/documents.js b/js/documents.js index 263a904b..4f5baaa7 100644 --- a/js/documents.js +++ b/js/documents.js @@ -8,10 +8,6 @@ $.widget('oc.documentGrid', { members : {} }, - _create : function (){ - - }, - render : function(fileId){ var that = this; jQuery.when(this._load(fileId)) @@ -21,65 +17,6 @@ $.widget('oc.documentGrid', { }); }, - 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})) - .attr('title', document.path) - .attr('original-title', document.path) - .attr('urlsrc', document.urlsrc) - .attr('action', document.action) - .attr('lolang', document.lolang) - .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'); - - if ( $('#previews_enabled').length && document.hasPreview) { - 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 (fileId){ var that = this; var url = 'apps/richdocuments/ajax/documents/list'; @@ -108,6 +45,8 @@ $.widget('oc.documentGrid', { that.options.documents = result.documents; that.options.sessions = result.sessions; that.options.members = result.members; + documentsMain.urlsrc = result.documents[0].urlsrc; + documentsMain.fullPath = result.documents[0].path; } }) .fail(function(data){ @@ -133,33 +72,6 @@ $.widget('oc.documentGrid', { ); return; } - - $.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(''); - docElem.addClass('session'); - } else { - console.log('Could not find file '+session.file_id+' for session '+session.es_id); - } - } - }); - - if (!hasDocuments){ - $(this.options.context).before('
' - + t('richdocuments', 'No documents were found. Upload or create a document to get started!') - + '
' - ); - } else { - $('#emptycontent').remove(); - } } }); @@ -250,10 +162,10 @@ var documentsMain = { // document; we add various parameters to that. // The discovery is available at // https://:9980/hosting/discovery - var urlsrc = $('li[data-id='+ fileId.replace(/_.*/, '') +']>a').attr('urlsrc') + + var urlsrc = documentsMain.urlsrc + "WOPISrc=" + wopisrc + "&title=" + encodeURIComponent(title) + - "&lang=" + $('li[data-id='+ fileId.replace(/_.*/, '') +']>a').attr('lolang') + + "&lang=" + OC.getLocale() + "&permission=readonly"; // access_token - must be passed via a form post @@ -410,7 +322,7 @@ var documentsMain = { $('#revisionsContainer li').first().find('.versionPreview').click(); }, - showEditor : function(title, action){ + showEditor : function(title, fileId, action){ if (documentsMain.isGuest){ // !Login page mess wih WebODF toolbars $(document.body).attr('id', 'body-user'); @@ -432,7 +344,7 @@ var documentsMain = { $('title').text(title + ' - ' + documentsMain.UI.mainTitle); - $.get(OC.generateUrl('apps/richdocuments/wopi/token/{fileId}', { fileId: documentsMain.fileId }), + $.get(OC.generateUrl('apps/richdocuments/wopi/token/{fileId}', { fileId: fileId }), function (result) { if (!result || result.status === 'error') { if (result && result.message){ @@ -450,10 +362,10 @@ var documentsMain = { // document; we add various parameters to that. // The discovery is available at // https://:9980/hosting/discovery - var urlsrc = $('li[data-id='+ documentsMain.fileId +']>a').attr('urlsrc') + + var urlsrc = documentsMain.urlsrc + "WOPISrc=" + wopisrc + "&title=" + encodeURIComponent(title) + - "&lang=" + $('li[data-id='+ documentsMain.fileId +']>a').attr('lolang') + + "&lang=" + OC.getLocale() + "&closebutton=1" + "&revisionhistory=1"; if (!documentsMain.canEdit || action === "view") { @@ -468,7 +380,7 @@ var documentsMain = { ''; // iframe that contains the Collabora Online - var frame = '