mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
merged upstream develop
This commit is contained in:
commit
5bf79971b8
20 changed files with 246 additions and 196 deletions
|
@ -68,7 +68,7 @@
|
|||
"maxAge" : 21600, // 60 * 60 * 6 = 6 hours
|
||||
|
||||
/* This is the path to the Abiword executable. Setting it to null, disables abiword.
|
||||
Abiword is needed to enable the import/export of pads*/
|
||||
Abiword is needed to advanced import/export features of pads*/
|
||||
"abiword" : null,
|
||||
|
||||
/* This setting is used if you require authentication of all users.
|
||||
|
|
|
@ -21,6 +21,9 @@ pad.toolbar.showusers.title = Show the users on this pad
|
|||
pad.colorpicker.save = Save
|
||||
pad.colorpicker.cancel = Cancel
|
||||
pad.loading = Loading...
|
||||
pad.passwordRequired = You need a password to access this pad
|
||||
pad.permissionDenied = You do not have permission to access this pad
|
||||
pad.wrongPassword = Your password was wrong
|
||||
pad.settings.padSettings = Pad Settings
|
||||
pad.settings.myView = My View
|
||||
pad.settings.stickychat = Chat always on screen
|
||||
|
@ -41,6 +44,7 @@ pad.importExport.exportword = Microsoft Word
|
|||
pad.importExport.exportpdf = PDF
|
||||
pad.importExport.exportopen = ODF (Open Document Format)
|
||||
pad.importExport.exportdokuwiki = DokuWiki
|
||||
pad.importExport.abiword.innerHTML = You only can import from plain text or html formats. For more advanced import features please <a href="https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-in-Ubuntu-or-OpenSuse-or-SLES-with-AbiWord">install abiword</a>.
|
||||
pad.modals.connected = Connected.
|
||||
pad.modals.reconnecting = Reconnecting to your pad..
|
||||
pad.modals.forcereconnect = Force reconnect
|
||||
|
|
|
@ -46,6 +46,7 @@ pad.importExport.exportword = Microsoft Word
|
|||
pad.importExport.exportpdf = PDF
|
||||
pad.importExport.exportopen = ODF (Open Document Format)
|
||||
pad.importExport.exportdokuwiki = DokuWiki
|
||||
pad.importExport.abiword.innerHTML = Sólo puede importar formatos de texto plano o html. Para funciones más avanzadas instale <a href="https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-in-Ubuntu-or-OpenSuse-or-SLES-with-AbiWord">abiword</a>.
|
||||
pad.modals.connected = Conectado.
|
||||
pad.modals.reconnecting = Reconectando a tu pad..
|
||||
pad.modals.forcereconnect = Reconexión forzosa
|
||||
|
|
|
@ -25,7 +25,7 @@ var async = require("async");
|
|||
var authorManager = require("./AuthorManager");
|
||||
var padManager = require("./PadManager");
|
||||
var sessionManager = require("./SessionManager");
|
||||
var settings = require("../utils/Settings")
|
||||
var settings = require("../utils/Settings");
|
||||
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,7 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback)
|
|||
// grant access, with author of token
|
||||
callback(null, statusObject);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//don't continue
|
||||
return;
|
||||
|
@ -133,10 +133,16 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback)
|
|||
var now = Math.floor(new Date().getTime()/1000);
|
||||
|
||||
//is it for this group?
|
||||
if(sessionInfo.groupID != groupID) return;
|
||||
if(sessionInfo.groupID != groupID) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
//is validUntil still ok?
|
||||
if(sessionInfo.validUntil <= now) return;
|
||||
if(sessionInfo.validUntil <= now){
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// There is a valid session
|
||||
validSession = true;
|
||||
|
@ -282,4 +288,4 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback(null, statusObject);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -28,18 +28,25 @@ var resolve = require("resolve");
|
|||
exports.info = {
|
||||
buf_stack: [],
|
||||
block_stack: [],
|
||||
blocks: {},
|
||||
file_stack: [],
|
||||
args: []
|
||||
};
|
||||
|
||||
function getCurrentFile() {
|
||||
return exports.info.file_stack[exports.info.file_stack.length-1];
|
||||
}
|
||||
|
||||
function createBlockId(name) {
|
||||
return getCurrentFile().path + '|' + name;
|
||||
}
|
||||
|
||||
exports._init = function (b, recursive) {
|
||||
exports.info.buf_stack.push(exports.info.buf);
|
||||
exports.info.buf = b;
|
||||
}
|
||||
|
||||
exports._exit = function (b, recursive) {
|
||||
exports.info.file_stack[exports.info.file_stack.length-1].inherit.forEach(function (item) {
|
||||
getCurrentFile().inherit.forEach(function (item) {
|
||||
exports._require(item.name, item.args);
|
||||
});
|
||||
exports.info.buf = exports.info.buf_stack.pop();
|
||||
|
@ -59,29 +66,17 @@ exports.end_capture = function () {
|
|||
}
|
||||
|
||||
exports.begin_define_block = function (name) {
|
||||
if (typeof exports.info.blocks[name] == "undefined")
|
||||
exports.info.blocks[name] = {};
|
||||
exports.info.block_stack.push(name);
|
||||
exports.begin_capture();
|
||||
}
|
||||
|
||||
exports.super = function () {
|
||||
exports.info.buf.push('<!eejs!super!>');
|
||||
}
|
||||
|
||||
exports.end_define_block = function () {
|
||||
content = exports.end_capture();
|
||||
var name = exports.info.block_stack.pop();
|
||||
if (typeof exports.info.blocks[name].content == "undefined")
|
||||
exports.info.blocks[name].content = content;
|
||||
else if (typeof exports.info.blocks[name].content.indexOf('<!eejs!super!>'))
|
||||
exports.info.blocks[name].content = exports.info.blocks[name].content.replace('<!eejs!super!>', content);
|
||||
|
||||
return exports.info.blocks[name].content;
|
||||
return content;
|
||||
}
|
||||
|
||||
exports.end_block = function () {
|
||||
var name = exports.info.block_stack[exports.info.block_stack.length-1];
|
||||
var name = exports.info.block_stack.pop();
|
||||
var renderContext = exports.info.args[exports.info.args.length-1];
|
||||
var args = {content: exports.end_define_block(), renderContext: renderContext};
|
||||
hooks.callAll("eejsBlock_" + name, args);
|
||||
|
@ -91,7 +86,7 @@ exports.end_block = function () {
|
|||
exports.begin_block = exports.begin_define_block;
|
||||
|
||||
exports.inherit = function (name, args) {
|
||||
exports.info.file_stack[exports.info.file_stack.length-1].inherit.push({name:name, args:args});
|
||||
getCurrentFile().inherit.push({name:name, args:args});
|
||||
}
|
||||
|
||||
exports.require = function (name, args, mod) {
|
||||
|
@ -101,7 +96,7 @@ exports.require = function (name, args, mod) {
|
|||
var paths = [];
|
||||
|
||||
if (exports.info.file_stack.length) {
|
||||
basedir = path.dirname(exports.info.file_stack[exports.info.file_stack.length-1].path);
|
||||
basedir = path.dirname(getCurrentFile().path);
|
||||
}
|
||||
if (mod) {
|
||||
basedir = path.dirname(mod.filename);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
/*
|
||||
* 2011 Peter 'Pita' Martischka (Primary Technology Ltd)
|
||||
* 2012 Iván Eixarch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -18,26 +19,23 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var ERR = require("async-stacktrace");
|
||||
var padManager = require("../db/PadManager");
|
||||
var padMessageHandler = require("./PadMessageHandler");
|
||||
var async = require("async");
|
||||
var fs = require("fs");
|
||||
var settings = require('../utils/Settings');
|
||||
var formidable = require('formidable');
|
||||
var os = require("os");
|
||||
var ERR = require("async-stacktrace")
|
||||
, padManager = require("../db/PadManager")
|
||||
, padMessageHandler = require("./PadMessageHandler")
|
||||
, async = require("async")
|
||||
, fs = require("fs")
|
||||
, path = require("path")
|
||||
, settings = require('../utils/Settings')
|
||||
, formidable = require('formidable')
|
||||
, os = require("os")
|
||||
, importHtml = require("../utils/ImportHtml");
|
||||
|
||||
//load abiword only if its enabled
|
||||
if(settings.abiword != null)
|
||||
var abiword = require("../utils/Abiword");
|
||||
|
||||
var tempDirectory = "/tmp/";
|
||||
|
||||
//tempDirectory changes if the operating system is windows
|
||||
if(os.type().indexOf("Windows") > -1)
|
||||
{
|
||||
tempDirectory = process.env.TEMP;
|
||||
}
|
||||
//for node 0.6 compatibily, os.tmpDir() only works from 0.8
|
||||
var tmpDirectory = process.env.TEMP || process.env.TMPDIR || process.env.TMP || '/tmp';
|
||||
|
||||
/**
|
||||
* do a requested import
|
||||
|
@ -45,32 +43,28 @@ if(os.type().indexOf("Windows") > -1)
|
|||
exports.doImport = function(req, res, padId)
|
||||
{
|
||||
//pipe to a file
|
||||
//convert file to text via abiword
|
||||
//set text in the pad
|
||||
//convert file to html via abiword
|
||||
//set html in the pad
|
||||
|
||||
var srcFile, destFile;
|
||||
var pad;
|
||||
var text;
|
||||
var srcFile, destFile
|
||||
, pad
|
||||
, text;
|
||||
|
||||
async.series([
|
||||
//save the uploaded file to /tmp
|
||||
function(callback)
|
||||
{
|
||||
function(callback) {
|
||||
var form = new formidable.IncomingForm();
|
||||
form.keepExtensions = true;
|
||||
form.uploadDir = tempDirectory;
|
||||
form.uploadDir = tmpDirectory;
|
||||
|
||||
form.parse(req, function(err, fields, files)
|
||||
{
|
||||
form.parse(req, function(err, fields, files) {
|
||||
//the upload failed, stop at this point
|
||||
if(err || files.file === undefined)
|
||||
{
|
||||
if(err || files.file === undefined) {
|
||||
console.warn("Uploading Error: " + err.stack);
|
||||
callback("uploadFailed");
|
||||
}
|
||||
//everything ok, continue
|
||||
else
|
||||
{
|
||||
else {
|
||||
//save the path of the uploaded file
|
||||
srcFile = files.file.path;
|
||||
callback();
|
||||
|
@ -80,57 +74,48 @@ exports.doImport = function(req, res, padId)
|
|||
|
||||
//ensure this is a file ending we know, else we change the file ending to .txt
|
||||
//this allows us to accept source code files like .c or .java
|
||||
function(callback)
|
||||
{
|
||||
var fileEnding = (srcFile.split(".")[1] || "").toLowerCase();
|
||||
var knownFileEndings = ["txt", "doc", "docx", "pdf", "odt", "html", "htm"];
|
||||
|
||||
//find out if this is a known file ending
|
||||
var fileEndingKnown = false;
|
||||
for(var i in knownFileEndings)
|
||||
{
|
||||
if(fileEnding == knownFileEndings[i])
|
||||
{
|
||||
fileEndingKnown = true;
|
||||
}
|
||||
}
|
||||
function(callback) {
|
||||
var fileEnding = path.extname(srcFile).toLowerCase()
|
||||
, knownFileEndings = [".txt", ".doc", ".docx", ".pdf", ".odt", ".html", ".htm"]
|
||||
, fileEndingKnown = (knownFileEndings.indexOf(fileEnding) > -1);
|
||||
|
||||
//if the file ending is known, continue as normal
|
||||
if(fileEndingKnown)
|
||||
{
|
||||
if(fileEndingKnown) {
|
||||
callback();
|
||||
}
|
||||
//we need to rename this file with a .txt ending
|
||||
else
|
||||
{
|
||||
else {
|
||||
var oldSrcFile = srcFile;
|
||||
srcFile = srcFile.split(".")[0] + ".txt";
|
||||
srcFile = path.join(path.dirname(srcFile),path.basename(srcFile, fileEnding)+".txt");
|
||||
|
||||
fs.rename(oldSrcFile, srcFile, callback);
|
||||
}
|
||||
},
|
||||
|
||||
//convert file to text
|
||||
function(callback)
|
||||
{
|
||||
//convert file to html
|
||||
function(callback) {
|
||||
var randNum = Math.floor(Math.random()*0xFFFFFFFF);
|
||||
destFile = tempDirectory + "eplite_import_" + randNum + ".txt";
|
||||
abiword.convertFile(srcFile, destFile, "txt", function(err){
|
||||
//catch convert errors
|
||||
if(err){
|
||||
console.warn("Converting Error:", err);
|
||||
return callback("convertFailed");
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
destFile = path.join(tmpDirectory, "eplite_import_" + randNum + ".htm");
|
||||
|
||||
if (abiword) {
|
||||
abiword.convertFile(srcFile, destFile, "htm", function(err) {
|
||||
//catch convert errors
|
||||
if(err) {
|
||||
console.warn("Converting Error:", err);
|
||||
return callback("convertFailed");
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// if no abiword only rename
|
||||
fs.rename(srcFile, destFile, callback);
|
||||
}
|
||||
},
|
||||
|
||||
//get the pad object
|
||||
function(callback)
|
||||
{
|
||||
padManager.getPad(padId, function(err, _pad)
|
||||
{
|
||||
function(callback) {
|
||||
padManager.getPad(padId, function(err, _pad){
|
||||
if(ERR(err, callback)) return;
|
||||
pad = _pad;
|
||||
callback();
|
||||
|
@ -138,52 +123,47 @@ exports.doImport = function(req, res, padId)
|
|||
},
|
||||
|
||||
//read the text
|
||||
function(callback)
|
||||
{
|
||||
fs.readFile(destFile, "utf8", function(err, _text)
|
||||
{
|
||||
function(callback) {
|
||||
fs.readFile(destFile, "utf8", function(err, _text){
|
||||
if(ERR(err, callback)) return;
|
||||
text = _text;
|
||||
|
||||
//node on windows has a delay on releasing of the file lock.
|
||||
//We add a 100ms delay to work around this
|
||||
if(os.type().indexOf("Windows") > -1)
|
||||
{
|
||||
setTimeout(function()
|
||||
{
|
||||
callback();
|
||||
}, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback();
|
||||
}
|
||||
if(os.type().indexOf("Windows") > -1){
|
||||
setTimeout(function() {callback();}, 100);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//change text of the pad and broadcast the changeset
|
||||
function(callback)
|
||||
{
|
||||
pad.setText(text);
|
||||
function(callback) {
|
||||
var fileEnding = path.extname(srcFile).toLowerCase();
|
||||
if (abiword || fileEnding == ".htm" || fileEnding == ".html") {
|
||||
importHtml.setPadHTML(pad, text);
|
||||
} else {
|
||||
pad.setText(text);
|
||||
}
|
||||
padMessageHandler.updatePadClients(pad, callback);
|
||||
},
|
||||
|
||||
//clean up temporary files
|
||||
function(callback)
|
||||
{
|
||||
function(callback) {
|
||||
//for node < 0.7 compatible
|
||||
var fileExists = fs.exists || path.exists;
|
||||
async.parallel([
|
||||
function(callback)
|
||||
{
|
||||
fs.unlink(srcFile, callback);
|
||||
function(callback){
|
||||
fileExists (srcFile, function(exist) { (exist)? fs.unlink(srcFile, callback): callback(); });
|
||||
},
|
||||
function(callback)
|
||||
{
|
||||
fs.unlink(destFile, callback);
|
||||
function(callback){
|
||||
fileExists (destFile, function(exist) { (exist)? fs.unlink(destFile, callback): callback(); });
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
], function(err)
|
||||
{
|
||||
], function(err) {
|
||||
|
||||
var status = "ok";
|
||||
|
||||
//check for known errors and replace the status
|
||||
|
@ -196,6 +176,6 @@ exports.doImport = function(req, res, padId)
|
|||
ERR(err);
|
||||
|
||||
//close the connection
|
||||
res.send("<script type='text/javascript' src='/static/js/jquery.js'></script><script> if ( (!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.top.require('/pad_impexp').padimpexp.handleFrameCall('" + status + "');</script>", 200);
|
||||
res.send("<script type='text/javascript' src='/static/js/jquery.js'></script><script> if ( (!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.parent.require('/pad_impexp').padimpexp.handleFrameCall('" + status + "');</script>", 200);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -66,8 +66,6 @@ exports.restartServer = function () {
|
|||
|
||||
} else {
|
||||
|
||||
console.log( "SSL -- not enabled!" );
|
||||
|
||||
var http = require('http');
|
||||
server = http.createServer(app);
|
||||
}
|
||||
|
|
|
@ -28,12 +28,6 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
|||
|
||||
//handle import requests
|
||||
args.app.post('/p/:pad/import', function(req, res, next) {
|
||||
//if abiword is disabled, skip handling this request
|
||||
if(settings.abiword == null) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
hasPadAccess(req, res, function() {
|
||||
importHandler.doImport(req, res, req.params.pad);
|
||||
});
|
||||
|
|
|
@ -15,8 +15,8 @@ exports.basicAuth = function (req, res, next) {
|
|||
}
|
||||
|
||||
var authorize = function (cb) {
|
||||
// Do not require auth for static paths...this could be a bit brittle
|
||||
if (req.path.match(/^\/(static|javascripts|pluginfw)/)) return cb(true);
|
||||
// Do not require auth for static paths and the API...this could be a bit brittle
|
||||
if (req.path.match(/^\/(static|javascripts|pluginfw|api)/)) return cb(true);
|
||||
|
||||
if (req.path.indexOf('/admin') != 0) {
|
||||
if (!settings.requireAuthentication) return cb(true);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var languages = require('languages')
|
||||
var languages = require('languages4translatewiki')
|
||||
, fs = require('fs')
|
||||
, path = require('path')
|
||||
, express = require('express')
|
||||
|
@ -8,22 +8,23 @@ var localesPath = __dirname+"/../../locales";
|
|||
// Serve English strings directly with /locales.ini
|
||||
var localeIndex = fs.readFileSync(localesPath+'/en.ini')+'\r\n';
|
||||
|
||||
// add language base 'en' to availableLangs
|
||||
exports.availableLangs = {en: languages.getLanguageInfo('en')}
|
||||
exports.availableLangs = {'en': {'nativeName': 'English', 'direction': 'ltr'}};
|
||||
|
||||
fs.readdir(localesPath, function(er, files) {
|
||||
files.forEach(function(locale) {
|
||||
locale = locale.split('.')[0]
|
||||
if(locale.toLowerCase() == 'en') return;
|
||||
var ext = path.extname(locale);
|
||||
locale = path.basename(locale, ext).toLowerCase();
|
||||
if(locale == 'en' || ext != '.ini') return;
|
||||
|
||||
// build locale index
|
||||
localeIndex += '['+locale+']\r\n@import url(locales/'+locale+'.ini)\r\n'
|
||||
|
||||
// add info language {name, nativeName, direction} to availableLangs
|
||||
// add info language {nativeName, direction} to availableLangs
|
||||
exports.availableLangs[locale]=languages.getLanguageInfo(locale);
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
exports.expressCreateServer = function(n, args) {
|
||||
|
||||
args.app.use('/locales', express.static(localesPath));
|
||||
|
|
|
@ -11,32 +11,32 @@
|
|||
{ "name": "Marcel Klehr" }
|
||||
],
|
||||
"dependencies" : {
|
||||
"yajsml" : "1.1.6",
|
||||
"request" : "2.9.100",
|
||||
"require-kernel" : "1.0.5",
|
||||
"resolve" : "0.2.x",
|
||||
"socket.io" : "0.9.x",
|
||||
"ueberDB" : "0.1.8",
|
||||
"async" : "0.1.x",
|
||||
"express" : "3.x",
|
||||
"connect" : "2.4.x",
|
||||
"clean-css" : "0.3.2",
|
||||
"uglify-js" : "1.2.5",
|
||||
"formidable" : "1.0.9",
|
||||
"log4js" : "0.5.x",
|
||||
"jsdom-nocontextifiy" : "0.2.10",
|
||||
"async-stacktrace" : "0.0.2",
|
||||
"npm" : "1.1.x",
|
||||
"npm-registry-client" : "0.2.10",
|
||||
"ejs" : "0.6.1",
|
||||
"graceful-fs" : "1.1.5",
|
||||
"slide" : "1.1.3",
|
||||
"semver" : "1.0.13",
|
||||
"security" : "1.0.0",
|
||||
"tinycon" : "0.0.1",
|
||||
"underscore" : "1.3.1",
|
||||
"unorm" : "1.0.0",
|
||||
"languages" : "0.1.1"
|
||||
"yajsml" : "1.1.6",
|
||||
"request" : "2.9.100",
|
||||
"require-kernel" : "1.0.5",
|
||||
"resolve" : "0.2.x",
|
||||
"socket.io" : "0.9.x",
|
||||
"ueberDB" : "0.1.8",
|
||||
"async" : "0.1.x",
|
||||
"express" : "3.x",
|
||||
"connect" : "2.4.x",
|
||||
"clean-css" : "0.3.2",
|
||||
"uglify-js" : "1.2.5",
|
||||
"formidable" : "1.0.9",
|
||||
"log4js" : "0.5.x",
|
||||
"jsdom-nocontextifiy" : "0.2.10",
|
||||
"async-stacktrace" : "0.0.2",
|
||||
"npm" : "1.1.x",
|
||||
"npm-registry-client" : "0.2.10",
|
||||
"ejs" : "0.6.1",
|
||||
"graceful-fs" : "1.1.5",
|
||||
"slide" : "1.1.3",
|
||||
"semver" : "1.0.13",
|
||||
"security" : "1.0.0",
|
||||
"tinycon" : "0.0.1",
|
||||
"underscore" : "1.3.1",
|
||||
"unorm" : "1.0.0",
|
||||
"languages4translatewiki" : "0.1.3"
|
||||
},
|
||||
"bin": { "etherpad-lite": "./node/server.js" },
|
||||
"devDependencies": {
|
||||
|
|
|
@ -22,6 +22,7 @@ iframe {
|
|||
.readonly .acl-write {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#users {
|
||||
background: #f7f7f7;
|
||||
background: -webkit-linear-gradient( #F7F7F7,#EEE);
|
||||
|
@ -190,6 +191,19 @@ a img {
|
|||
height: 30px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#editorloadingbox .passForm{
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
#editorloadingbox input{
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
#editorloadingbox button{
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
#editorcontainerbox {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
|
@ -571,15 +585,20 @@ table#otheruserstable {
|
|||
#exportdokuwiki {
|
||||
background-position: 0px -459px
|
||||
}
|
||||
#importstatusball {
|
||||
display: none
|
||||
|
||||
/* hidden element */
|
||||
#importstatusball,
|
||||
#importarrow,
|
||||
#importmessagesuccess,
|
||||
#importmessageabiword {
|
||||
display: none;
|
||||
}
|
||||
#importarrow {
|
||||
display: none
|
||||
}
|
||||
#importmessagesuccess {
|
||||
display: none
|
||||
|
||||
#importmessageabiword {
|
||||
color: #900;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
#importsubmitinput {
|
||||
height: 25px;
|
||||
width: 85px;
|
||||
|
@ -755,7 +774,7 @@ input[type=checkbox] {
|
|||
border-radius: 3px;
|
||||
border: 1px solid #ccc;
|
||||
outline: none;
|
||||
min-width: 105px;
|
||||
width: 120px;
|
||||
}
|
||||
.column {
|
||||
float: left;
|
||||
|
@ -878,3 +897,15 @@ input[type=checkbox] {
|
|||
line-height: 24px
|
||||
}
|
||||
}
|
||||
|
||||
#passwordRequired{
|
||||
display:none;
|
||||
}
|
||||
|
||||
#permissionDenied{
|
||||
display:none;
|
||||
}
|
||||
|
||||
#wrongPassword{
|
||||
display:none;
|
||||
}
|
||||
|
|
|
@ -113,10 +113,15 @@ $(document).ready(function () {
|
|||
for (plugin_name in data.results) {
|
||||
var plugin = data.results[plugin_name];
|
||||
var row = widget.find(".template tr").clone();
|
||||
var version = '0.0.0';
|
||||
// hack to access "versions" property of the npm package object
|
||||
for (version in data.results[plugin_name].versions) break;
|
||||
|
||||
for (attr in plugin) {
|
||||
row.find("." + attr).html(plugin[attr]);
|
||||
}
|
||||
row.find(".version").html(version);
|
||||
|
||||
widget.find(".results").append(row);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,18 +51,20 @@ var randomString = require('./pad_utils').randomString;
|
|||
|
||||
var hooks = require('./pluginfw/hooks');
|
||||
|
||||
function createCookie(name, value, days, path)
|
||||
{
|
||||
function createCookie(name, value, days, path){ /* Warning Internet Explorer doesn't use this it uses the one from pad_utils.js */
|
||||
if (days)
|
||||
{
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
var expires = "; expires=" + date.toGMTString();
|
||||
}
|
||||
else var expires = "";
|
||||
else{
|
||||
var expires = "";
|
||||
}
|
||||
|
||||
if(!path)
|
||||
if(!path){ // If the path isn't set then just whack the cookie on the root path
|
||||
path = "/";
|
||||
}
|
||||
|
||||
//Check if the browser is IE and if so make sure the full path is set in the cookie
|
||||
if(navigator.appName=='Microsoft Internet Explorer'){
|
||||
|
@ -202,6 +204,7 @@ function savePassword()
|
|||
createCookie("password",$("#passwordinput").val(),null,document.location.pathname);
|
||||
//reload
|
||||
document.location=document.location;
|
||||
return false;
|
||||
}
|
||||
|
||||
function handshake()
|
||||
|
@ -298,21 +301,25 @@ function handshake()
|
|||
//the access was not granted, give the user a message
|
||||
if(!receivedClientVars && obj.accessStatus)
|
||||
{
|
||||
$('.passForm').submit(require(module.id).savePassword);
|
||||
|
||||
if(obj.accessStatus == "deny")
|
||||
{
|
||||
$("#editorloadingbox").html("<b>You do not have permission to access this pad</b>");
|
||||
$('#loading').hide();
|
||||
$("#permissionDenied").show();
|
||||
}
|
||||
else if(obj.accessStatus == "needPassword")
|
||||
{
|
||||
$("#editorloadingbox").html("<b>You need a password to access this pad</b><br>" +
|
||||
"<input id='passwordinput' type='password' name='password'>"+
|
||||
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword()") + "\">ok</button>");
|
||||
$('#loading').hide();
|
||||
$('#passwordRequired').show();
|
||||
$("#passwordinput").focus();
|
||||
}
|
||||
else if(obj.accessStatus == "wrongPassword")
|
||||
{
|
||||
$("#editorloadingbox").html("<b>Your password was wrong</b><br>" +
|
||||
"<input id='passwordinput' type='password' name='password'>"+
|
||||
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword()") + "\">ok</button>");
|
||||
$('#loading').hide();
|
||||
$('#wrongPassword').show();
|
||||
$('#passwordRequired').show();
|
||||
$("#passwordinput").focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,14 +219,17 @@ var padimpexp = (function()
|
|||
$("#exportplaina").attr("href", pad_root_path + "/export/txt");
|
||||
$("#exportdokuwikia").attr("href", pad_root_path + "/export/dokuwiki");
|
||||
|
||||
// activate action to import in the form
|
||||
$("#importform").attr('action', pad_root_url + "/import");
|
||||
|
||||
//hide stuff thats not avaible if abiword is disabled
|
||||
if(clientVars.abiwordAvailable == "no")
|
||||
{
|
||||
$("#exportworda").remove();
|
||||
$("#exportpdfa").remove();
|
||||
$("#exportopena").remove();
|
||||
$(".importformdiv").remove();
|
||||
$("#import").html("Import is not available. To enable import please install abiword");
|
||||
|
||||
$("#importmessageabiword").show();
|
||||
}
|
||||
else if(clientVars.abiwordAvailable == "withoutPDF")
|
||||
{
|
||||
|
@ -237,16 +240,12 @@ var padimpexp = (function()
|
|||
|
||||
$("#importexport").css({"height":"142px"});
|
||||
$("#importexportline").css({"height":"142px"});
|
||||
|
||||
$("#importform").attr('action', pad_root_url + "/import");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#exportworda").attr("href", pad_root_path + "/export/doc");
|
||||
$("#exportpdfa").attr("href", pad_root_path + "/export/pdf");
|
||||
$("#exportopena").attr("href", pad_root_path + "/export/odt");
|
||||
|
||||
$("#importform").attr('action', pad_root_path + "/import");
|
||||
}
|
||||
|
||||
$("#impexp-close").click(function()
|
||||
|
|
|
@ -39,20 +39,29 @@ function randomString(len)
|
|||
return randomstring;
|
||||
}
|
||||
|
||||
function createCookie(name, value, days, path)
|
||||
{
|
||||
function createCookie(name, value, days, path){ /* Used by IE */
|
||||
if (days)
|
||||
{
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
var expires = "; expires=" + date.toGMTString();
|
||||
}
|
||||
else var expires = "";
|
||||
else{
|
||||
var expires = "";
|
||||
}
|
||||
|
||||
if(!path)
|
||||
if(!path){ // IF the Path of the cookie isn't set then just create it on root
|
||||
path = "/";
|
||||
}
|
||||
|
||||
//Check if the browser is IE and if so make sure the full path is set in the cookie
|
||||
if(navigator.appName=='Microsoft Internet Explorer'){
|
||||
document.cookie = name + "=" + value + expires + "; path=/"; /* Note this bodge fix for IE is temporary until auth is rewritten */
|
||||
}
|
||||
else{
|
||||
document.cookie = name + "=" + value + expires + "; path=" + path;
|
||||
}
|
||||
|
||||
document.cookie = name + "=" + value + expires + "; path=" + path;
|
||||
}
|
||||
|
||||
function readCookie(name)
|
||||
|
|
|
@ -91,9 +91,12 @@ exports.search = function(query, cache, cb) {
|
|||
if (er) return cb(er);
|
||||
var res = {};
|
||||
var i = 0;
|
||||
for (key in data) {
|
||||
for (key in data) { // for every plugin in the data from npm
|
||||
if ( key.indexOf(plugins.prefix) == 0
|
||||
&& key.indexOf(query.pattern) != -1) {
|
||||
&& key.indexOf(query.pattern) != -1
|
||||
|| key.indexOf(plugins.prefix) == 0
|
||||
&& data[key].description.indexOf(query.pattern) != -1
|
||||
) { // If the name contains ep_ and the search string is in the name or description
|
||||
i++;
|
||||
if (i > query.offset
|
||||
&& i <= query.offset + query.limit) {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Version</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -37,6 +38,7 @@
|
|||
<tr id="installed-plugin-template">
|
||||
<td class="name"></td>
|
||||
<td class="description"></td>
|
||||
<td class="version"></td>
|
||||
<td class="actions">
|
||||
<input type="button" value="Uninstall" class="do-uninstall">
|
||||
</td>
|
||||
|
@ -58,6 +60,7 @@
|
|||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Version</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -65,6 +68,7 @@
|
|||
<tr>
|
||||
<td class="name"></td>
|
||||
<td class="description"></td>
|
||||
<td class="version"></td>
|
||||
<td class="actions">
|
||||
<input type="button" value="Install" class="do-install">
|
||||
</td>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
if(language) document.documentElement.lang = language[1];
|
||||
})(document)
|
||||
</script>
|
||||
<script type="text/javascript" src="static/js/l10n.js" async></script>
|
||||
<script type="text/javascript" src="static/js/l10n.js"></script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
|
|
|
@ -184,7 +184,19 @@
|
|||
<div id="editorcontainerbox">
|
||||
<div id="editorcontainer"></div>
|
||||
<div id="editorloadingbox">
|
||||
<p data-l10n-id="pad.loading">Loading...</p>
|
||||
<div id="passwordRequired">
|
||||
<p data-l10n-id="pad.passwordRequired">You need a password to access this pad</p>
|
||||
<form class='passForm' method='POST'>
|
||||
<input id='passwordinput' type='password' name='password'><input type='submit' value='Submit'>
|
||||
</form>
|
||||
</div>
|
||||
<div id="permissionDenied">
|
||||
<p data-l10n-id="pad.permissionDenied">You do not have permission to access this pad</p>
|
||||
</div>
|
||||
<div id="wrongPassword">
|
||||
<p data-l10n-id="pad.wrongPassword">Your password was wrong</p>
|
||||
</div>
|
||||
<p data-l10n-id="pad.loading" id="loading">Loading...</p>
|
||||
<noscript><strong>Sorry, you have to enable Javascript in order to use this.</strong></noscript>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -246,10 +258,11 @@
|
|||
<h1 data-l10n-id="pad.importExport.import_export"></h1>
|
||||
<div class="column acl-write">
|
||||
<% e.begin_block("importColumn"); %>
|
||||
<h2 data-l10n-id="pad.importExport.import"></h2><br>
|
||||
<h2 data-l10n-id="pad.importExport.import"></h2>
|
||||
<div class="importmessage" id="importmessageabiword" data-l10n-id="pad.importExport.abiword"></div><br>
|
||||
<form id="importform" method="post" action="" target="importiframe" enctype="multipart/form-data">
|
||||
<div class="importformdiv" id="importformfilediv">
|
||||
<input type="file" name="file" size="15" id="importfileinput">
|
||||
<input type="file" name="file" size="10" id="importfileinput">
|
||||
<div class="importmessage" id="importmessagefail"></div>
|
||||
</div>
|
||||
<div id="import"></div>
|
||||
|
|
Loading…
Reference in a new issue