diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d1b767f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.class
+*.pyc
+*.pyo
+.svn
+_svn
diff --git a/.project b/.project
new file mode 100644
index 0000000..500f5c4
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ files_etherpad
+
+
+
+
+
+ com.aptana.ide.core.unifiedBuilder
+
+
+
+
+
+ com.aptana.projects.webnature
+
+
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 26442d1..93dbcfb 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,15 @@
+v 0.3.0
+Add : Ethercalc support
+Fix : Opening a document kill hover actions
+
+v 0.2.0
+Add : OC5 compability
+Add : DE translation
+Add : Token for pad name
+Fix : Security issues
+Fix : bug fix
+By : Ernesto Ruge
+
v 0.1.6
Fix : modifications to respect the Coding Style Guide
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4e3d429
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+This is a plugin for Owncloud which adds Etherpads as a file. It's a fork of http://apps.owncloud.com/content/show.php/Files+Etherpad?content=155237
diff --git a/ajax/host.php b/ajax/host.php
index dc2ded3..4c31b6d 100644
--- a/ajax/host.php
+++ b/ajax/host.php
@@ -1,4 +1,7 @@
\ No newline at end of file
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 468f3c2..6e5eeb5 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -3,7 +3,7 @@
files_etherpad
Files Etherpad
Create etherpad shortcuts
- 0.1.7
+ 0.3.0
CC BY-NC 3.0
Bastien Ho (EELV), Ernesto Ruge
5.0
diff --git a/appinfo/version b/appinfo/version
new file mode 100644
index 0000000..0d91a54
--- /dev/null
+++ b/appinfo/version
@@ -0,0 +1 @@
+0.3.0
diff --git a/img/calc.png b/img/calc.png
new file mode 100644
index 0000000..eb534d4
Binary files /dev/null and b/img/calc.png differ
diff --git a/img/pad.png b/img/pad.png
index 3efa483..8f9341a 100644
Binary files a/img/pad.png and b/img/pad.png differ
diff --git a/js/files_etherpad.js b/js/files_etherpad.js
index afcab5a..b87d4d6 100644
--- a/js/files_etherpad.js
+++ b/js/files_etherpad.js
@@ -6,6 +6,15 @@ $.fn.filterExtension = function(extension) {
}
});
};
+$.fn.filterSubExtension = function(extension) {
+ return this.filter(function() {
+ var filename = $(this).attr('data-file');
+ if(filename.lastIndexOf('.')){
+ filename = filename.substr(0,filename.lastIndexOf('.'));
+ return filename.substr(filename.lastIndexOf('.')+1) === extension;
+ }
+ });
+};
function FileToPad(dir,file){
pad=this;
@@ -27,23 +36,20 @@ FileToPad.prototype={
$("#editor").hide();
$('#content table').hide();
$('#controls').hide();
- var oldcontent = $('#content').html();
//pad headline
- $('#content').html(oldcontent+'
'+t('files_etherpad', 'Title')+':
'+pad.file.replace('.url','')+', '+t('files_etherpad', 'public link')+':
'+pad.url+''+'
x ');
+ $('#content').append(''+t('files_etherpad', 'Title')+':
'+pad.file.replace('.url','')+', '+t('files_etherpad', 'public link')+':
'+pad.url+''+'
x ');
$('#pageWidthOption').attr('selected','selected');
- $('#filetopad_bar').css('padding-left','30px');
-
+ $('#filetopad_bar').css('padding-left','30px');
$('#filetopad_close').click(function(){pad.hide();});
- $('#filetopad_close').css('float','right');
- $('#filetopad_close').css('padding','5px');
+ $('#filetopad_close').css({float:'right',padding:'5px'});
},
hide:function(){
- $('#content table').show();
$('#controls').show();
+ $('#content table').show();
$('#editor').show();
$('iframe').remove();
- $('a.action').remove();
- $('#filetopad_bar').remove();
+ //$('a.action').remove();
+ $('#filetopad_bar').remove();
}
};
@@ -52,6 +58,8 @@ $(document).ready(function(){
if(location.href.indexOf('files')!=-1) {
$('tr').filterAttr('data-type', 'file').filterExtension( 'url').attr('data-mime','text/x-url');
$('tr').filterAttr('data-type', 'file').filterExtension( 'url').children('td:first-child').css('background-image','url('+OC.imagePath('files_etherpad', 'pad.png')+')');
+ //For files created after v 0.2.0 : sub extension check
+ $('tr').filterAttr('data-type', 'file').filterExtension( 'url').filterSubExtension( 'calc').children('td:first-child').css('background-image','url('+OC.imagePath('files_etherpad', 'calc.png')+')');
if (typeof FileActions!=='undefined'){
FileActions.register('text/x-url',t('files_etherpad','Edit'), OC.PERMISSION_READ, '',function(filename){
pad=new FileToPad($('#dir').val(),filename);
@@ -59,8 +67,10 @@ $(document).ready(function(){
FileActions.setDefault('text/x-url',t('files_etherpad','Edit'));
}
}
- //create pad file type
+ // New button hook
if($('div#new>ul>li').length > 0) {
+
+ //create pad file type
getMimeIcon('text/plain', function(icon) {
$('' + t('files_etherpad', 'Pad') + '
')
.attr('id', 'newPadFile')
@@ -89,10 +99,11 @@ $(document).ready(function(){
OC.Notification.show(t('files_etherpad', 'Padname cannot be empty'));
return false;
}
- var filename = getUniqueName(rawfilename+'.url');
+ var filename = getUniqueName(rawfilename+'.pad.url');
//get etherpad url
$.get(
OC.filePath('files_etherpad', 'ajax', 'host.php'),
+ {type:'pad'},
function (url) {
//generate .url file
var content='[InternetShortcut]\nURL='+url+'/p/'+CryptoJS.MD5('owncloud' + new Date().getMilliseconds() + 'etherpad');
@@ -129,5 +140,76 @@ $(document).ready(function(){
});
});
});
+ //create calc file type
+ getMimeIcon('text/plain', function(icon) {
+ $('' + t('files_etherpad', 'Calc') + '
')
+ .attr('id', 'newCalcFile')
+ .appendTo('div#new>ul')
+ .css('background-image', 'url(' + OC.imagePath('files_etherpad', 'calc.png') + ')')
+ .data('type', 'text')
+ .off('click')
+ .click(function() {
+ //prevent double input
+ if($(this).children('p').length==0)
+ return;
+ //show input for pad name
+ $(this).children('p').remove();
+ var form=$('');
+ var input=$('');
+ form.append(input);
+ form.appendTo('#newCalcFile');
+ input.focus();
+ form.submit(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ //check pad name
+ var rawfilename = input.val();
+ if (rawfilename.length == 0) {
+ $("#notification").text('');
+ OC.Notification.show(t('files_etherpad', 'Document name cannot be empty'));
+ return false;
+ }
+ var filename = getUniqueName(rawfilename+'.calc.url');
+ //get etherpad url
+ $.get(
+ OC.filePath('files_etherpad', 'ajax', 'host.php'),
+ {type:'calc'},
+ function (url) {
+ //generate .url file
+ var content='[InternetShortcut]\nURL='+url+'/'+CryptoJS.MD5('owncloud' + new Date().getMilliseconds() + 'ethercalc');
+ //send file to server using files app api
+ $.post(
+ OC.filePath('files','ajax','newfile.php'),
+ {dir:$('#dir').val(),filename:filename,content:content},
+ function(result){
+ if (result.status == 'success') {
+ //update file list
+ var date=new Date();
+ FileList.addFile(filename,0,date,false,false);
+ var tr=$('tr').filterAttr('data-file',filename);
+ tr.attr('data-mime','text/x-url');
+ tr.attr('data-id', result.data.id);
+ var path = $('#dir').val();
+ getMimeIcon('text/plain',function(path){
+ tr.find('td.filename').attr('style','background-image:url('+OC.imagePath('files_etherpad', 'calc.png')+')');
+ });
+ $("#notification").text('');
+ OC.Notification.show(t('files_etherpad', t('files_etherpad', 'New document named ')+filename+t('files_etherpad', ' was created.')));
+ }
+ else
+ OC.dialogs.alert(result.data.message, 'Error');
+ }
+ );
+ }
+ );
+ //restore description, close new dialogue
+ var li=form.parent();
+ form.remove();
+ li.append(''+t('files_etherpad', 'Calc')+'
');
+ $('#new>a').click();
+ });
+ });
+ });
+
}
});
diff --git a/js/loader.js b/js/loader.js
deleted file mode 100644
index 44e90b3..0000000
--- a/js/loader.js
+++ /dev/null
@@ -1,107 +0,0 @@
-$.fn.filterExtension = function(extension) {
- return this.filter(function() {
- var filename = $(this).attr('data-file');
- if(filename.lastIndexOf('.')){
- return filename.substr(filename.lastIndexOf('.')+1) === extension;
- }
- });
-};
-
-function FileToPad(dir,file){
- pad=this;
- pad.dir=dir;
- pad.file=file;
- pad.url='about:blank';
- $.get(
- OC.filePath('files','ajax','download.php?dir='+dir+'&files='+file),
- function name(link) {
- pad.url=link.split('\n')[1].substr(4);
- pad.show();
- }
- );
-}
-
-FileToPad.prototype={
- show:function(){
- $("#editor").hide();
- $('#content table').hide();
- $('#controls').hide();
- var oldcontent = $('#content').html();
- $('#content').html(oldcontent+'Titel:
'+pad.file.replace('.pad','')+', Öffentlicher Link:
'+pad.url+''+'
x ');
- $('#pageWidthOption').attr('selected','selected');
- $('#filetopad_bar').css('padding-left','30px');
-
- $('#filetopad_close').click(function(){pad.hide();});
- $('#filetopad_close').css('float','right');
- $('#filetopad_close').css('padding','5px');
- },
- hide:function(){
- $('#content table').show();
- $('#controls').show();
- $('#editor').show();
- $('iframe').remove();
- $('a.action').remove();
- $('#filetopad_bar').remove();
- }
-};
-
-$(document).ready(function(){
- if(location.href.indexOf('files')!=-1) {
- $('tr').filterAttr('data-type', 'file').filterExtension( 'pad').attr('data-mime','text/x-url');
- $('tr').filterAttr('data-type', 'file').filterExtension( 'pad').children('td:first-child').css('background-image','url('+OC.imagePath('files_etherpad', 'pad.png')+')');
- if (typeof FileActions!=='undefined'){
- FileActions.register('text/x-url',t('files_etherpad','Edit'), OC.PERMISSION_READ, '',function(filename){
- pad=new FileToPad($('#dir').val(),filename);
- });
- FileActions.setDefault('text/x-url',t('files_etherpad','Edit'));
- }
- }
- if($('div#new>ul>li').length > 0) {
- getMimeIcon('text/plain', function(icon) {
- $('' + t('files_etherpad', 'Pad') + '
')
- .attr('id', 'newPadFile')
- .appendTo('div#new>ul')
- .css('background-image', 'url(' + OC.imagePath('files_etherpad', 'pad.png') + ')')
- .data('type', 'text')
- .children('p')
- .click(function() {
- $(this).hide();
- var form=$('');
- var input=$('');
- form.append(input);
- form.appendTo('#newPadFile');
- input.focus();
- form.submit(function(event){
- event.stopPropagation();
- event.preventDefault();
- $.get(
- OC.filePath('files_etherpad', 'ajax', 'host.php'),
- function (url) {
- var filename=input.val();
- var content='[EtherpadShortcut]\nURL='+url+'/p/'+CryptoJS.MD5('owncloud' + new Date().getMilliseconds() + 'etherpad');
- $.post(
- OC.filePath('files','ajax','newfile.php'),
- {dir:$('#dir').val(),filename:filename+'.pad',content:content},
- function(result){
- if (result.status == 'success') {
- var date=new Date();
- FileList.addFile(filename+'.pad',0,date,false,false);
- var tr=$('tr').filterAttr('data-file',filename+'.pad');
- tr.attr('data-mime','text/x-url');
- tr.attr('data-id', result.data.id);
- var path = $('#dir').val();
- getMimeIcon('text/plain',function(path){
- tr.find('td.filename').attr('style','background-image:url('+OC.imagePath('files_etherpad', 'pad.png')+')');
- });
- } else {
- OC.dialogs.alert(result.data.message, 'Error');
- }
- }
- );
- }
- );
- });
- });
- });
- }
-});
diff --git a/l10n/de.php b/l10n/de.php
index 90dc4dd..4bdfdea 100644
--- a/l10n/de.php
+++ b/l10n/de.php
@@ -1,12 +1,16 @@
'Collaborative Documents',
'Edit' => 'Ändern',
'Etherpad Host' => 'Etherpad Host',
- 'ex' => 'Z.B.',
+ 'Ethercalc Host' => 'Ethercalc Host',
+ 'ex:' => 'Z.B.:',
'Title' => 'Titel',
'public link' => 'öffentlicher Link',
'Pad' => 'Pad',
+ 'Calc' => 'Calc',
'save' => 'speichern',
'Padname cannot be empty' => 'Pad muss benannt werden',
- 'New pad named ' => 'Neues Pad mit dem Namen ',
+ 'Document name cannot be empty' => 'Document name cannot be empty',
+ 'New document named ' => 'Neues document mit dem Namen ',
' was created.' => ' wurde erstellt.',
);
diff --git a/l10n/fr.php b/l10n/fr.php
index 4a8381c..1ae2ca9 100644
--- a/l10n/fr.php
+++ b/l10n/fr.php
@@ -1,12 +1,16 @@
'Documents collaboratifs',
'Edit' => 'Éditer',
'Etherpad Host' => 'Hôte Etherpad',
- 'ex' => 'ex',
+ 'Ethercalc Host' => 'Hôte Ethercalc',
+ 'ex:' => 'ex :',
'Title' => 'Titre',
- 'public link' => 'Lien publique',
- 'Pad' => 'Pad',
- 'save' => 'save',
+ 'public link' => 'Lien public',
+ 'Pad' => 'Document collaboratif',
+ 'Calc' => 'Tableur collaboratif',
+ 'save' => 'Sauvegarder',
'Padname cannot be empty' => 'Le nom du Pad ne peut être vide',
- 'New pad named ' => 'Nouveau Pad nommé ',
+ 'Document name cannot be empty' => 'Le nom du document ne peut être vide',
+ 'New document named ' => 'Nouveau document nommé ',
' was created.' => ' a été créé.',
);
diff --git a/push b/push
deleted file mode 100644
index 85a8912..0000000
--- a/push
+++ /dev/null
@@ -1,3 +0,0 @@
-sudo -u upload git add .
-sudo -u upload git commit -m "init"
-sudo -u upload git push -u origin master
diff --git a/settings.php b/settings.php
index c63a923..9e2283d 100644
--- a/settings.php
+++ b/settings.php
@@ -22,6 +22,7 @@
*/
$params = array(
'files_etherpad_host',
+ 'files_etherpad_calc_host',
);
if ($_POST) {
diff --git a/templates/settings.php b/templates/settings.php
index 3be797f..4486d51 100644
--- a/templates/settings.php
+++ b/templates/settings.php
@@ -1,12 +1,18 @@