Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.class
*.pyc
*.pyo
.svn
_svn
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>files_etherpad</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.aptana.projects.webnature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion ajax/host.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
OCP\User::checkLoggedIn();
echo(OC_Appconfig::getValue('files_etherpad', 'files_etherpad_host',''));
$get_host='files_etherpad_host';
if($_REQUEST['type']=='calc') $get_host='files_etherpad_calc_host';
// SOme other formats
echo(OC_Appconfig::getValue('files_etherpad', $get_host,''));
?>
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<id>files_etherpad</id>
<name>Files Etherpad</name>
<description>Create etherpad shortcuts</description>
<version>0.1.7</version>
<version>0.3.0</version>
<licence>CC BY-NC 3.0</licence>
<author>Bastien Ho (EELV), Ernesto Ruge</author>
<require>5.0</require>
Expand Down
1 change: 1 addition & 0 deletions appinfo/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.0
Binary file added img/calc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/pad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 93 additions & 11 deletions js/files_etherpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,23 +36,20 @@ FileToPad.prototype={
$("#editor").hide();
$('#content table').hide();
$('#controls').hide();
var oldcontent = $('#content').html();
//pad headline
$('#content').html(oldcontent+'<div id="filetopad_bar">'+t('files_etherpad', 'Title')+': <strong>'+pad.file.replace('.url','')+'</strong>, '+t('files_etherpad', 'public link')+': <a href="'+pad.url+'">'+pad.url+'</a>'+'<a id="filetopad_close">x</a></div><iframe style="width:100%;height:90%;display:block;" id="filetopad_frame" src="'+pad.url+'"></iframe>');
$('#content').append('<div id="filetopad_bar">'+t('files_etherpad', 'Title')+': <strong>'+pad.file.replace('.url','')+'</strong>, '+t('files_etherpad', 'public link')+': <a href="'+pad.url+'">'+pad.url+'</a>'+'<a id="filetopad_close">x</a></div><iframe style="width:100%;height:90%;display:block;" id="filetopad_frame" src="'+pad.url+'"></iframe>');
$('#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();
}
};

Expand All @@ -52,15 +58,19 @@ $(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);
});
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) {
$('<li><p>' + t('files_etherpad', 'Pad') + '</p></li>')
.attr('id', 'newPadFile')
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -129,5 +140,76 @@ $(document).ready(function(){
});
});
});
//create calc file type
getMimeIcon('text/plain', function(icon) {
$('<li><p>' + t('files_etherpad', 'Calc') + '</p></li>')
.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=$('<form></form>');
var input=$('<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('<p>'+t('files_etherpad', 'Calc')+'</p>');
$('#new>a').click();
});
});
});

}
});
107 changes: 0 additions & 107 deletions js/loader.js

This file was deleted.

8 changes: 6 additions & 2 deletions l10n/de.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?php $TRANSLATIONS = array(
'Collaborative Documents'=>'Collaborative Documents',
'Edit' => '&Auml;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.',
);
14 changes: 9 additions & 5 deletions l10n/fr.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?php $TRANSLATIONS = array(
'Collaborative Documents'=>'Documents collaboratifs',
'Edit' => '&Eacute;diter',
'Etherpad Host' => 'H&ocirc;te Etherpad',
'ex' => 'ex',
'Ethercalc Host' => 'H&ocirc;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éé.',
);
3 changes: 0 additions & 3 deletions push

This file was deleted.

1 change: 1 addition & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
$params = array(
'files_etherpad_host',
'files_etherpad_calc_host',
);

if ($_POST) {
Expand Down
Loading