Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:redhog/pad
Browse files Browse the repository at this point in the history
  • Loading branch information
Egil Moeller committed May 13, 2011
2 parents 909fafa + 57c1316 commit b1202fb
Show file tree
Hide file tree
Showing 130 changed files with 8,982 additions and 190 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,4 +1,6 @@
*~
\#*#
.#*
etherpad/etc/etherpad.local.properties
etherpad/src/etherpad/collab/ace/contentcollector.js
etherpad/src/etherpad/collab/ace/domline.js
Expand Down Expand Up @@ -26,4 +28,4 @@ debian/files
etherpad/src/plugins/fileUpload/upload
build-stamp
infrastructure/lib/mysql-*.jar
.DS_Store
.DS_Store
13 changes: 13 additions & 0 deletions bin/build.sh
Expand Up @@ -29,3 +29,16 @@ source "$ETHERPADDIR/bin/exports.sh"
( cd "$ETHERPADDIR"/infrastructure/ace; bin/make normal etherpad; )
cp "$ETHERPADDIR"/infrastructure/build/appjet.jar $ETHERPADDIR/etherpad/appjet-eth-dev.jar
rm -rf "$ETHERPADDIR"/infrastructure/{appjet,build,buildjs,buildcache}

# Rebuild modules
(
cd "$ETHERPADDIR"
ls etherpad/src/plugins/ | while read name; do
(
cd "$ETHERPADDIR/etherpad/src/plugins/$name"
if [ -e "build.sh" ]; then
./build.sh
fi
)
done
)
37 changes: 37 additions & 0 deletions contrib/other-software.txt
@@ -0,0 +1,37 @@
Extensions
-----------
Use Etherpad to write and collaborate on HTML, CSS, and JavaScript
https://github.com/toolness/htmlpad

A script (ideal for cron job'n) to login to your Etherpad account, download all pads, archive them and save locally or push to S3
https://github.com/jrk/EtherPad-Backup

Integrations
-------------
Use Etherpad as editor in the Drupal CMS
http://drupal.org/project/etherpad

Use Etherpad as editor in the Wordpress blog engine/CMS
https://github.com/bsoule/expost

Chrome App for managing your etherpads
https://github.com/boazsender/etherpads

shinx + s6 + etherpad + keynote-like thema
https://github.com/nati/sphinx-s6-misc

Software using Etherpad
------------------------
A tool designed to help organise the rapid development of apps
https://github.com/JordanHatch/RapidHackr

A content management system using etherpad as a backend
https://github.com/themasch/PadCMS

APIs
-----
Ruby Etherpad API
https://github.com/adammck/reefer

Create a new etherpad page and upload a file from the command line
https://github.com/tomjnixon/etherpad_upload
5 changes: 5 additions & 0 deletions etherpad/.gitignore
Expand Up @@ -7,3 +7,8 @@ appjet-eth*.jar
etherpad-pne-*.jar


src/plugins/.extdeps/
src/plugins/sketchSpace/static/js/dojo
src/plugins/sketchSpace/static/js/dojox
src/plugins/sketchSpace/static/js/dijit
src/plugins/sketchSpace/static/js/build
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions etherpad/src/etherpad/control/pad/pad_control.js
Expand Up @@ -96,6 +96,8 @@ function onRequest() {
//----------------------------------------------------------------

function getDefaultPadText() {
if (appjet.config.defaultPadContent !== undefined)
return {padId: appjet.config.defaultPadContent};
if (pro_utils.isProDomainRequest()) {
return pro_config.getConfig().defaultPadText;
}
Expand Down
2 changes: 1 addition & 1 deletion etherpad/src/etherpad/control/pad/pad_view_control.js
Expand Up @@ -169,7 +169,7 @@ function onRequest() {
var isPro = isProDomainRequest();
var isProUser = (isPro && ! padusers.isGuest(userId));

var bodyClass = ["limwidth",
var bodyClass = ["timeslider", "limwidth",
(isPro ? "propad" : "nonpropad"),
(isProUser ? "prouser" : "nonprouser")].join(" ");

Expand Down
22 changes: 20 additions & 2 deletions etherpad/src/etherpad/pad/model.js
Expand Up @@ -227,8 +227,26 @@ function accessPadGlobal(padId, padFunc, rwMode) {
meta.status.dirty = true;
meta.supportsTimeSlider = true;

var firstChangeset = Changeset.makeSplice("\n", 0, 0,
cleanText(optText || ''));
var firstChangeset;
if (typeof(optText) == "string") {
firstChangeset = Changeset.makeSplice("\n", 0, 0, optText, [], pad.pool());
} else if (optText.padId !== undefined) {
var cloneData = accessPadGlobal(optText.padId, function(pad) {
var cloneRevNum = pad.getHeadRevisionNumber();
return {
'padText':pad.getRevisionText(cloneRevNum),
'padAText': pad.getInternalRevisionAText(cloneRevNum),
'pool': pad.pool()
};
}, 'r');
var pool = pad.pool();
pool.fromJsonable(cloneData.pool.toJsonable());
var assem = Changeset.smartOpAssembler();
Changeset.appendATextToAssembler(cloneData.padAText, assem);
assem.endDocument();
firstChangeset = Changeset.pack(1, cloneData.padText.length + 1, assem.toString(), cloneData.padText);
}

addRevision(firstChangeset, '');

_insertPadMetaData(padId, meta);
Expand Down
16 changes: 14 additions & 2 deletions etherpad/src/plugins/copyPad/controllers/copyPad.js
Expand Up @@ -33,6 +33,7 @@ import("etherpad.pad.padutils");
import("etherpad.pad.model");
import("etherpad.collab.server_utils");
import("etherpad.collab.collab_server.buildHistoricalAuthorDataMapForPadHistory");
import("etherpad.collab.ace.easysync2.{Changeset,AttribPool}");

function formatAuthorData(historicalAuthorData) {
var authors_all = [];
Expand Down Expand Up @@ -73,14 +74,25 @@ function createCopy(localPadId, pad, clonePadId, cloneRevNum) {

return {
'padText':pad.getRevisionText(cloneRevNum),
'padAText': pad.getInternalRevisionAText(cloneRevNum),
'pool': pad.pool(),
'historicalAuthorData': buildHistoricalAuthorDataMapForPadHistory(pad)
};
}, 'r');

var author_list = formatAuthorData(cloneData.historicalAuthorData);
var header = "This pad builds on [["+clonePadId+"/rev."+cloneRevNum + "]], created by " + author_list.join(" & ") + "\n\n";
var header = "This pad builds on [["+clonePadId+"/rev."+cloneRevNum + "]], created by " + author_list.join(" & ") + "\n\n";

pad.create('');

var pool = pad.pool();
pool.fromJsonable(cloneData.pool.toJsonable());
var assem = Changeset.smartOpAssembler();
assem.appendOpWithText('+', header, [], pool);
Changeset.appendATextToAssembler(cloneData.padAText, assem);
assem.endDocument();
pad.appendRevision(Changeset.pack(1, header.length + cloneData.padText.length + 1, assem.toString(), header + cloneData.padText));

pad.create(header + cloneData.padText);
return;
}

Expand Down
93 changes: 93 additions & 0 deletions etherpad/src/plugins/deletePad/controllers/ui.js
@@ -0,0 +1,93 @@
/**
* Copyright 2009 RedHog, Egil Möller <egil.moller@piratpartiet.se>
* Copyright 2010 Pita, Peter Martischka <petermartischka@googlemail.com>
*
* Some code from http://groups.google.com/group/etherpad-open-source-discuss/msg/5001fe0ef2fac58a
* Copyright by dannydulai@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import("faststatic");
import("dispatch.{Dispatcher,PrefixMatcher,forward}");

import("etherpad.utils.*");
import("etherpad.collab.server_utils");
import("etherpad.globals.*");
import("etherpad.log");
import("etherpad.pad.padusers");
import("etherpad.pro.pro_utils");
import("etherpad.pro.domains");
import("etherpad.helpers");
import("etherpad.pro.pro_accounts.getSessionProAccount");
import("sqlbase.sqlbase");
import("sqlbase.sqlcommon");
import("sqlbase.sqlobj");
import("etherpad.pad.padutils");
import("etherpad.admin.plugins");
import("fastJSON");
import("etherpad.pad.model");
import("etherpad.pad.dbwriter");
import("etherpad.collab.collab_server");
import("etherpad.sessions.getSession");

function _isAuthorizedAdmin() {
if (!isProduction()) {
return true;
}
return (getSession().adminAuth === true);
}

function onRequest() {
if (!_isAuthorizedAdmin()) {
getSession().cont = request.path;
response.redirect('/ep/admin/auth');
}

var isPro = pro_utils.isProDomainRequest();
var userId = padusers.getUserId();

helpers.addClientVars({
userAgent: request.headers["User-Agent"],
debugEnabled: request.params.djs,
clientIp: request.clientAddr,
colorPalette: COLOR_PALETTE,
serverTimestamp: +(new Date),
isProPad: isPro,
userIsGuest: padusers.isGuest(userId),
userId: userId
});

var isProUser = (isPro && ! padusers.isGuest(userId));

if (request.isPost) {
log.info({'PAD': request.params.pad_id});

model.accessPadGlobal(request.params.pad_id, function(pad) {
collab_server.bootUsersFromPad(pad, "deleted");
pad.destroy();
});
dbwriter.taskFlushPad(request.params.pad_id, "delete");
}

renderHtml(
"ui.ejs",
{
bodyClass: 'delete-pad',
isPro: isPro,
isProAccountHolder: isProUser,
account: getSessionProAccount() // may be falsy
},
['deletePad']);
return true;
}
8 changes: 8 additions & 0 deletions etherpad/src/plugins/deletePad/hooks.js
@@ -0,0 +1,8 @@
import("etherpad.log");
import("dispatch.{Dispatcher,PrefixMatcher,forward}");
import("plugins.deletePad.controllers.ui");
import("sqlbase.sqlobj");

function handlePath() {
return [[PrefixMatcher('/ep/admin/delete-pad'), forward(ui)]];
}
23 changes: 23 additions & 0 deletions etherpad/src/plugins/deletePad/main.js
@@ -0,0 +1,23 @@
import("etherpad.log");
import("plugins.deletePad.hooks");
import("sqlbase.sqlobj");
import("sqlbase.sqlcommon");

function deletePadInit() {
this.hooks = ['handlePath'];
this.description = 'Allows admin to delete pads permanently';
this.configLink = '/ep/admin/delete-pad';
this.handlePath = hooks.handlePath;

this.install = install;
this.uninstall = uninstall;
}

function install() {
log.info("Installing delete pad");
}

function uninstall() {
log.info("Uninstalling delete pad");
}

37 changes: 37 additions & 0 deletions etherpad/src/plugins/deletePad/templates/ui.ejs
@@ -0,0 +1,37 @@
<% /*
Copyright 2009 Google Inc.
Copyright 2010 Pita, Peter Martischka <petermartischka@googlemail.com>
Copyright 2010 Egil Möller <egil.moller@piratpartiet.se>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */ %>
<%
template.inherit('admin/page.ejs');
helpers.setHtmlTitle(appjet.config.customBrandingName +": Manage plugins");
plugin_registry = plugins.loadPlugins();
%>

<% template.define('docBarTitle', function() { var ejs_data=''; %>
<td id="docbarpadtitle"><span>Permanently delete a pad</span></td>
<% return ejs_data; }); %>

<% template.define('contentArea', function() { var ejs_data=''; %>
<div id="editorcontainer">
<form method="post">
Pad id: <input type="text" name="pad_id"><br>
<br>
<em>Yes, I have read and understood that I'm about to permanently stuff something up, and I still want to do it!</em><br>
<br>
<button type="submit">Yes, really do delete that pad</button>
</form>
</div>
<% return ejs_data; }); %>
1 change: 1 addition & 0 deletions etherpad/src/plugins/imageConvert/README
@@ -0,0 +1 @@
apt-get install imagemagick poppler-utils ghostscript sed

0 comments on commit b1202fb

Please sign in to comment.