Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-12-06 14:53:09 +0300
committerLukas Reschke <lukas@statuscode.ch>2016-12-06 14:53:09 +0300
commit62bd261c0b1bdc6267567c36f44b6d7a0b599bcf (patch)
tree9a96a4140e1a08f4732c35c13f79005ba9f02a0e
parentd359d1452fd990d470caad6393ef9f523551ed71 (diff)
Remove unrequired "Office" interface
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r--appinfo/app.php19
-rw-r--r--css/style.css52
-rw-r--r--js/documents.js335
-rw-r--r--templates/documents.php33
4 files changed, 14 insertions, 425 deletions
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 @@
<?php
-
/**
* ownCloud - Richdocuments App
*
@@ -23,24 +22,8 @@
namespace OCA\Richdocuments\AppInfo;
-use OCA\Richdocuments\Config;
-
-$app = new Application();
-$c = $app->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('<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('richdocuments', 'No documents were found. Upload or create a document to get started!')
- + '</div>'
- );
- } else {
- $('#emptycontent').remove();
- }
}
});
@@ -250,10 +162,10 @@ var documentsMain = {
// document; we add various parameters to that.
// The discovery is available at
// https://<loolwsd-server>: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://<loolwsd-server>: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 = {
'<input name="access_token" value="' + access_token + '" type="hidden"/></form>';
// iframe that contains the Collabora Online
- var frame = '<iframe id="loleafletframe" name= "loleafletframe" allowfullscreen style="width:100%;height:100%;position:absolute;" onload="this.contentWindow.focus()"/>';
+ var frame = '<iframe id="loleafletframe" name= "loleafletframe" allowfullscreen style="width:100%;height:100%;position:absolute;" />';
$('#mainContainer').append(form);
$('#mainContainer').append(frame);
@@ -499,7 +411,7 @@ var documentsMain = {
if (msg === 'UI_Close' || msg === 'close') {
documentsMain.onClose();
} else if (msg === 'rev-history') {
- documentsMain.UI.showRevHistory($('li[data-id=' + documentsMain.fileId + ']>a').attr('original-title'));
+ documentsMain.UI.showRevHistory(documentsMain.fullPath);
}
});
@@ -557,19 +469,6 @@ var documentsMain = {
$('.documentslist .progress').hide();
},
- showLostConnection : function(){
- $('#memberList .memberListButton').css({opacity : 0.3});
- $('#ocToolbar').children(':not(#document-title)').hide();
- $('<div id="connection-lost"></div>').prependTo('#memberList');
- $('<div id="warning-connection-lost">' + t('richdocuments', 'No connection to server. Trying to reconnect.') +'<img src="'+ OC.imagePath('core', 'loading-dark.gif') +'" alt="" /></div>').prependTo('#ocToolbar');
- },
-
- hideLostConnection : function() {
- $('#connection-lost,#warning-connection-lost').remove();
- $('#ocToolbar').children(':not(#document-title,#saving-document)').show();
- $('#memberList .memberListButton').css({opacity : 1});
- },
-
notify : function(message){
OC.Notification.show(message);
setTimeout(OC.Notification.hide, 10000);
@@ -630,11 +529,6 @@ var documentsMain = {
$(window).on("unload", documentsMain.onTerminate);
},
- prepareGrid : function(){
- documentsMain.isEditorMode = false;
- documentsMain.overlay.documentOverlay('hide');
- },
-
initSession: function(response) {
if(response && (response.id && !response.es_id)){
return documentsMain.view(response.id);
@@ -655,13 +549,6 @@ var documentsMain = {
return;
}
- var pollUrl = documentsMain.isGuest
- ? OC.generateUrl('apps/richdocuments/session/guest/poll/{token}', {'token' : $("[name='document']").val()})
- : OC.generateUrl('apps/richdocuments/session/user/poll'),
- saveUrl = documentsMain.isGuest
- ? OC.generateUrl('apps/richdocuments/session/guest/save/{token}', {'token' : $("[name='document']").val()})
- : OC.generateUrl('apps/richdocuments/session/user/save')
- ;
documentsMain.canShare = !documentsMain.isGuest
&& typeof OC.Share !== 'undefined' && response.permissions & OC.PERMISSION_SHARE;
@@ -675,7 +562,7 @@ var documentsMain = {
documentsMain.memberId = response.member_id;
documentsMain.canEdit = response.permissions & OC.PERMISSION_UPDATE;
- documentsMain.loadDocument();
+ documentsMain.loadDocument(response);
if (documentsMain.isGuest){
$('#odf-close').text(t('richdocuments', 'Save') );
@@ -702,7 +589,6 @@ var documentsMain = {
view : function(id){
OC.addScript('richdocuments', 'viewer/viewer', function() {
- documentsMain.prepareGrid();
$(window).off('beforeunload');
$(window).off('unload');
var path = $('li[data-id='+ id +']>a').attr('href');
@@ -711,160 +597,8 @@ var documentsMain = {
});
},
- onCreateODT: function(event){
- event.preventDefault();
- documentsMain.create('application/vnd.oasis.opendocument.text');
- },
-
- onCreateODS: function(event){
- event.preventDefault();
- documentsMain.create('application/vnd.oasis.opendocument.spreadsheet');
- },
-
- onCreateODP: function(event){
- event.preventDefault();
- documentsMain.create('application/vnd.oasis.opendocument.presentation');
- },
-
- onCreateDOCX: function(event){
- event.preventDefault();
- documentsMain.create('application/vnd.openxmlformats-officedocument.wordprocessingml.document');
- },
-
- onCreateXLSX: function(event){
- event.preventDefault();
- documentsMain.create('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
- },
-
- onCreatePPTX: function(event){
- event.preventDefault();
- documentsMain.create('application/vnd.openxmlformats-officedocument.presentationml.presentation');
- },
-
- create: function(mimetype){
- var docElem = $('.documentslist .template').clone();
- docElem.removeClass('template');
- docElem.addClass('document');
- docElem.insertAfter('.documentslist .template');
- docElem.show();
- $.post(
- OC.generateUrl('apps/richdocuments/ajax/documents/create'),
- { mimetype : mimetype },
- function(response){
- if (response && response.fileid){
- docElem.attr('data-id', response.fileid);
- docElem.find('a').attr('urlsrc', response.urlsrc);
- docElem.find('a').attr('lolang', response.lolang);
- documentsMain.prepareSession();
- documentsMain.joinSession(response.fileid);
- } else {
- if (response && response.message){
- documentsMain.UI.notify(response.message);
- }
- documentsMain.show();
- }
- }
-
- );
- },
-
- changeNick: function(memberId, name, node){
- var url = OC.generateUrl('apps/richdocuments/ajax/user/rename');
- $.ajax({
- url: url,
- type: "POST",
- data: JSON.stringify({
- name : name,
- memberId : memberId
- }),
- contentType: 'application/json; charset=utf-8',
- dataType:"json",
- success: 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);
- },
-
- loadDocument: function() {
- var action = $('li[data-id='+ documentsMain.fileId +']>a').attr('action');
- documentsMain.UI.showEditor(documentsMain.fileName, action);
- },
-
- renameDocument: function(name) {
- var url = OC.generateUrl('apps/richdocuments/ajax/documents/rename/{file_id}', {file_id: documentsMain.fileId});
- $.post(
- url,
- { name : name },
- function(result) {
- if (result && result.status === 'error') {
- if (result.message){
- documentsMain.UI.notify(result.message);
- }
- return;
- }
- documentsMain.fileName = name;
- $('title').text(documentsMain.UI.mainTitle + '| ' + name);
- $('#document-title').text(name);
- }
- );
+ loadDocument: function(response) {
+ documentsMain.UI.showEditor(response.title, response.file_id, 'write');
},
onEditorShutdown : function (message){
@@ -878,7 +612,6 @@ var documentsMain = {
} else {
setTimeout(OC.Notification.hide, 7000);
}
- documentsMain.prepareGrid();
documentsMain.UI.hideEditor();
documentsMain.show();
@@ -1037,48 +770,6 @@ $(document).ready(function() {
$('li.document a').tipsy({fade: true, live: true});
- $('.documentslist').on('click', 'li:not(.add-document)', function(event) {
- event.preventDefault();
-
- if (documentsMain.isEditorMode){
- return;
- }
-
- var item = $(this).find('a');
- if (item.attr('urlsrc') === undefined) {
- OC.Notification.showTemporary(t('richdocuments', 'Failed to open ' + item.attr('original-title') + ', file not supported.'));
- return;
- }
-
- documentsMain.prepareSession();
- if ($(this).attr('data-id')){
- documentsMain.joinSession($(this).attr('data-id'));
- }
- });
-
- $('.add-document').on('click', '.add-odt', documentsMain.onCreateODT);
- $('.add-document').on('click', '.add-ods', documentsMain.onCreateODS);
- $('.add-document').on('click', '.add-odp', documentsMain.onCreateODP);
- $('.add-document').on('click', '.add-docx', documentsMain.onCreateDOCX);
- $('.add-document').on('click', '.add-xlsx', documentsMain.onCreateXLSX);
- $('.add-document').on('click', '.add-pptx', documentsMain.onCreatePPTX);
-
- OC.Upload._isReceivedSharedFile = function () {
- return false;
- };
-
- 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();
- });
documentsMain.onStartup();
});
diff --git a/templates/documents.php b/templates/documents.php
index 1d3556c0..33978dc7 100644
--- a/templates/documents.php
+++ b/templates/documents.php
@@ -8,39 +8,6 @@ script('files', 'jquery.fileupload');
?>
<div id="documents-content">
<ul class="documentslist">
- <li class="add-document">
- <a class="icon-add add-<?php p($_['doc_format'] === 'ooxml' ? 'docx' : 'odt') ?> svg" target="_blank" href="">
- <label><?php p($l->t('New Document')) ?></label>
- </a>
- <a class="icon-add add-<?php p($_['doc_format'] === 'ooxml' ? 'xlsx' : 'ods') ?> svg" target="_blank" href="">
- <label><?php p($l->t('New Spreadsheet')) ?></label>
- </a>
- <a class="icon-add add-<?php p($_['doc_format'] === 'ooxml' ? 'pptx' : 'odp') ?> svg" target="_blank" href="">
- <label><?php p($l->t('New Presentation')) ?></label>
- </a>
- <div id="upload" title="<?php p($l->t('Upload (max. %s)', array($_['uploadMaxHumanFilesize']))) ?>">
- <form data-upload-id="1"
- id="data-upload-form"
- class="file_upload_form"
- action="<?php print_unescaped(link_to('files', 'ajax/upload.php')); ?>"
- method="post"
- enctype="multipart/form-data"
- target="file_upload_target_1">
- <?php if($_['uploadMaxFilesize'] >= 0):?>
- <input type="hidden" name="MAX_FILE_SIZE" id="max_upload"
- value="<?php p($_['uploadMaxFilesize']) ?>" />
- <?php endif;?>
- <!-- Send the requesttoken, this is needed for older IE versions
- because they don't send the CSRF token via HTTP header in this case -->
- <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken" />
- <input type="hidden" class="max_human_file_size"
- value="(max <?php p($_['uploadMaxHumanFilesize']); ?>)" />
- <input type="file" id="file_upload_start" name='files[]' />
- <a href="#" class="icon-upload upload svg">
- <label><?php p($l->t('Upload')) ?></label></a>
- </form>
- </div>
- </li>
<li class="progress icon-loading"><div><?php p($l->t('Loading documents...')); ?></div></li>
<li class="document template" data-id="" style="display:none;">
<a target="_blank" href=""><label></label></a>