Merge branch 'develop' of https://github.com/ether/etherpad-lite into hardcoded-i18n

This commit is contained in:
mluto 2013-01-25 17:14:56 +01:00
commit 4a20a26cbf
13 changed files with 307 additions and 116 deletions

View File

@ -101,5 +101,5 @@
"loglevel": "INFO",
// restrict socket.io transport methods
"socketTransportProtocols" : ['xhr-polling', 'jsonp-polling', 'htmlfile']
"socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"]
}

File diff suppressed because one or more lines are too long

View File

@ -176,7 +176,7 @@ exports.doImport = function(req, res, padId)
ERR(err);
//close the connection
res.send("<head><script type='text/javascript' src='../../static/js/jquery.js'></script></head><script>$(window).load(function(){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);
res.send("<head><script type='text/javascript' src='../../static/js/jquery.js'></script></head><script>$(window).load(function(){if ( (!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf(\"1.8.\") == 0)) ){document.domain = document.domain;}var impexp = window.parent.padimpexp.handleFrameCall('" + status + "');})</script>", 200);
});
}

View File

@ -7,18 +7,51 @@ body {
background: -moz-radial-gradient(circle,#aaa,#eee 60%) center fixed;
background: -ms-radial-gradient(circle,#aaa,#eee 60%) center fixed;
background: -o-radial-gradient(circle,#aaa,#eee 60%) center fixed;
border-top: 8px solid rgba(51,51,51,.8);
}
#wrapper {
margin-top: 160px;
#topborder {
border-top: 8px solid rgba(51, 51, 51, 0.8);
position: fixed;
top: 0px;
width: 100%;
}
div.menu {
background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.75);
box-shadow: 0px -4px 4px rgba(0, 0, 0, 0.3);
display: block;
float: left;
height: 100%;
padding: 15px;
position: fixed;
width: 220px;
}
div.menu li {
list-style: none;
margin-left: 3px;
line-height: 1.6
}
div.innerwrapper {
display: block;
float: right;
opacity: 0.9;
padding: 15px;
background: #fff;
opacity: .9;
box-shadow: 0px 1px 8px rgba(0,0,0,0.3);
max-width: 700px;
margin: auto;
width: 860px;
border-radius: 0 0 7px 7px;
}
#wrapper {
background: none repeat scroll 0px 0px #FFFFFF;
box-shadow: 0px 1px 8px rgba(0, 0, 0, 0.3);
margin: auto;
max-width: 1150px;
min-height: 100%;
overflow: auto;
padding-left: 15px;
opacity: .9;
}
h1 {
font-size: 29px;
}
@ -53,9 +86,6 @@ input[type="button"].do-install, input[type="button"].do-uninstall {
float: right;
width: 100px;
}
input[type="button"]#do-search {
display: block;
}
input[type="text"] {
border-radius: 3px;
box-sizing: border-box;
@ -84,41 +114,9 @@ td, th {
.template {
display: none;
}
.dialog {
display: none;
#progress {
position: absolute;
left: 50%;
top: 50%;
width: 700px;
height: 500px;
margin-left: -350px;
margin-top: -250px;
border: 3px solid #999;
background: #eee;
}
.dialog .title {
margin: 0;
padding: 2px;
border-bottom: 3px solid #999;
font-size: 24px;
line-height: 24px;
height: 24px;
overflow: hidden;
}
.dialog .title .close {
float: right;
padding: 1px 10px;
}
.dialog .history {
background: #222;
color: #eee;
position: absolute;
top: 41px;
bottom: 10px;
left: 10px;
right: 10px;
padding: 2px;
overflow: auto;
bottom: 50px;
}
.settings {
margin-top:10px;
@ -128,3 +126,13 @@ td, th {
#response{
display:inline;
}
a:link, a:visited, a:hover, a:focus {
color: #333333;
text-decoration: none;
border-bottom: #333333 1px dotted;
}
a:focus, a:hover {
border-bottom: #333333 1px solid;
}

View File

@ -25,10 +25,6 @@ $(document).ready(function () {
}
function updateHandlers() {
$("#progress.dialog .close").unbind('click').click(function () {
$("#progress.dialog").hide();
});
$("form").submit(function(){
var query = $('.search-results').data('query');
query.pattern = $("#search-query").val();
@ -36,8 +32,8 @@ $(document).ready(function () {
search();
return false;
});
$("#do-search").unbind('click').click(function () {
$("#search-query").unbind('keyup').keyup(function () {
var query = $('.search-results').data('query');
query.pattern = $("#search-query").val();
query.offset = 0;
@ -47,13 +43,13 @@ $(document).ready(function () {
$(".do-install").unbind('click').click(function (e) {
var row = $(e.target).closest("tr");
doUpdate = true;
socket.emit("install", row.find(".name").html());
socket.emit("install", row.find(".name").text());
});
$(".do-uninstall").unbind('click').click(function (e) {
var row = $(e.target).closest("tr");
doUpdate = true;
socket.emit("uninstall", row.find(".name").html());
socket.emit("uninstall", row.find(".name").text());
});
$(".do-prev-page").unbind('click').click(function (e) {
@ -77,32 +73,32 @@ $(document).ready(function () {
updateHandlers();
socket.on('progress', function (data) {
if (data.progress > 0 && $('#progress.dialog').data('progress') > data.progress) return;
if (data.progress > 0 && $('#progress').data('progress') > data.progress) return;
$("#progress.dialog .close").hide();
$("#progress.dialog").show();
$("#progress").show();
$('#progress.dialog').data('progress', data.progress);
$('#progress').data('progress', data.progress);
var message = "Unknown status";
if (data.message) {
message = "<span class='status'>" + data.message.toString() + "</span>";
message = data.message.toString();
}
if (data.error) {
message = "<span class='error'>" + data.error.toString() + "<span>";
data.progress = 1;
}
$("#progress.dialog .message").html(message);
$("#progress.dialog .history").append("<div>" + message + "</div>");
$("#progress .message").html(message);
if (data.progress >= 1) {
$("#progress").hide();
if (data.error) {
$("#progress.dialog .close").show();
} else {
alert('An error occurred: '+data.error+' -- the server log might know more...');
}else {
if (doUpdate) {
doUpdate = false;
socket.emit("load");
}
$("#progress.dialog").hide();
}
}
});
@ -114,7 +110,11 @@ $(document).ready(function () {
widget.data('total', data.total);
widget.find('.offset').html(data.query.offset);
widget.find('.limit').html(data.query.offset + data.query.limit);
if (data.query.offset + data.query.limit > data.total){
widget.find('.limit').html(data.total);
}else{
widget.find('.limit').html(data.query.offset + data.query.limit);
}
widget.find('.total').html(data.total);
widget.find(".results *").remove();
@ -124,9 +124,12 @@ $(document).ready(function () {
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]);
if(attr == "name"){ // Hack to rewrite URLS into name
row.find(".name").html("<a target='_blank' href='https://npmjs.org/package/"+plugin['name']+"'>"+plugin[attr]+"</a>");
}else{
row.find("." + attr).html(plugin[attr]);
}
}
row.find(".version").html(version);
@ -144,7 +147,11 @@ $(document).ready(function () {
var row = $("#installed-plugin-template").clone();
for (attr in plugin.package) {
row.find("." + attr).html(plugin.package[attr]);
if(attr == "name"){ // Hack to rewrite URLS into name
row.find(".name").html("<a target='_blank' href='https://npmjs.org/package/"+plugin.package['name']+"'>"+plugin.package[attr]+"</a>");
}else{
row.find("." + attr).html(plugin.package[attr]);
}
}
$("#installed-plugins").append(row);
}

View File

@ -361,7 +361,11 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
$(self).css('left', newloc);
// if(getSliderPosition() != Math.floor(newloc * sliderLength / ($("#ui-slider-bar").width()-2)))
setSliderPosition(Math.floor(newloc * sliderLength / ($("#ui-slider-bar").width() - 2)))
self.currentLoc = parseInt($(self).css('left'));
if(parseInt($(self).css('left')) < 2){
$(self).css('left', '2px');
}else{
self.currentLoc = parseInt($(self).css('left'));
}
});
})

View File

@ -21,6 +21,8 @@
* IN THE SOFTWARE.
*/
window.html10n = (function(window, document, undefined) {
// fix console
var console = window.console
function interceptConsole(method){
if (!console) return function() {}
@ -44,6 +46,39 @@ window.html10n = (function(window, document, undefined) {
, consoleError = interceptConsole('warn')
// fix Array.prototype.instanceOf in, guess what, IE! <3
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n != n) { // shortcut for verifying if it's NaN
n = 0;
} else if (n != 0 && n != Infinity && n != -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
}
}
/**
* MicroEvent - to make any js object an event emitter (server or browser)

View File

@ -15,7 +15,10 @@ var withNpm = function (npmfn, final, cb) {
cb({progress: 0.5, message:message.msg + ": " + message.pref});
});
npmfn(function (er, data) {
if (er) return cb({progress:1, error:er.code + ": " + er.path});
if (er) {
console.error(er);
return cb({progress:1, error: er.message});
}
if (!data) data = {};
data.progress = 1;
data.message = "Done.";

View File

@ -1,6 +1,6 @@
<html>
<head>
<title>Etherpad Lite Admin Dashboard</title>
<title>Admin Dashboard - Etherpad lite</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link rel="stylesheet" href="../static/css/admin.css">
<script src="../static/js/jquery.js"></script>
@ -8,13 +8,14 @@
</head>
<body>
<div id="wrapper">
<h1>Etherpad Lite Admin Dashboard</h1>
<div>
<a href="../admin/plugins">Install and Uninstall plugins</a>
</div>
<div>
<a href="../admin/settings">Modify Server and Plugin Settings</a>
<div class="menu">
<h1>Etherpad lite</h1>
<li><a href="admin/plugins">Plugin manager</a> </li>
<li><a href="admin/settings">Settings</a> </li>
<li><a href="admin/plugins/info">Troubleshooting information</a> </li>
</div>
</div>
<div id="topborder"></div>
</body>
</html>

View File

@ -4,27 +4,36 @@
<html>
<head>
<title>Plugin information</title>
<title>Plugin information - Etherpad lite</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link rel="stylesheet" href="../../static/css/admin.css">
</head>
<body>
<div id="wrapper">
<h1>Etherpad Lite</h1>
<div class="separator"></div>
<div class="menu">
<h1>Etherpad lite</h1>
<li><a href="../plugins">Plugin manager</a> </li>
<li><a href="../settings">Settings</a> </li>
<li><a href="../plugins/info">Troubleshooting information</a> </li>
</div>
<h2>Installed plugins</h2>
<pre><%- plugins.formatPlugins().replace(", ","\n") %></pre>
<div class="innerwrapper">
<h2>Installed parts</h2>
<pre><%= plugins.formatParts() %></pre>
<h2>Installed plugins</h2>
<pre><%- plugins.formatPlugins().replace(", ","\n") %></pre>
<h2>Installed hooks</h2>
<h3>Server side hooks</h3>
<div><%- plugins.formatHooks() %></div>
<h2>Installed parts</h2>
<pre><%= plugins.formatParts() %></pre>
<h3>Client side hooks</h3>
<div><%- plugins.formatHooks("client_hooks") %></div>
<h2>Installed hooks</h2>
<h3>Server side hooks</h3>
<div><%- plugins.formatHooks() %></div>
<h3>Client side hooks</h3>
<div><%- plugins.formatHooks("client_hooks") %></div>
</div>
</div>
<div id="topborder"></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
<html>
<head>
<title>Plugin manager</title>
<title>Plugin manager - Etherpad lite</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link rel="stylesheet" href="../static/css/admin.css">
<script src="../static/js/jquery.js"></script>
@ -18,12 +18,16 @@
</div>
<% } %>
<div class="menu">
<h1>Etherpad lite</h1>
<li><a href="plugins">Plugin manager</a> </li>
<li><a href="settings">Settings</a> </li>
<li><a href="plugins/info">Troubleshooting information</a> </li>
<div id="progress"><img src="../static/img/loading.gif" alt=""/>&nbsp;&nbsp;<span class="message"></span></div>
</div>
<h1>Etherpad Lite</h1>
<a href="plugins/info">Technical information on installed plugins</a>
<div class="separator"></div>
<div class="innerwrapper">
<h2>Installed plugins</h2>
<table>
<thead>
@ -50,11 +54,12 @@
<div class="paged listing search-results">
<div class="separator"></div>
<h2>Search for plugins to install</h2>
<h2>Available plugins</h2>
<form>
<input type="text" name="search" placeholder="Search term" id="search-query">
<input type="button" value="Search" id="do-search">
<input type="text" name="search" placeholder="Search for plugins to install" id="search-query">
</form>
<table>
<thead>
<tr>
@ -81,14 +86,9 @@
<span class="offset"></span>..<span class="limit"></span> of <span class="total"></span>.
<input type="button" value=">>" class="do-next-page">
</div>
<div id="progress" class="dialog">
<h1 class="title">
Please wait: <span class="message"></span>
<input type="button" class="close" value="Close">
</h1>
<div class="history"></div>
</div>
</div>
<div id="topborder"></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
<html>
<head>
<title>Settings manager</title>
<title>Settings - Etherpad lite</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link rel="stylesheet" href="../static/css/admin.css">
<script src="../static/js/jquery.js"></script>
@ -22,13 +22,23 @@
<% } %>
<h1>Etherpad Lite Settings</h1>
<a href='https://github.com/ether/etherpad-lite/wiki/Example-Production-Settings.JSON'>Example production settings template</a>
<a href='https://github.com/ether/etherpad-lite/wiki/Example-Development-Settings.JSON'>Example development settings template</a>
<textarea class="settings"></textarea>
<input type="button" class="settingsButton" id="saveSettings" value="Save Settings">
<input type="button" class="settingsButton" id="restartEtherpad" value="Restart Etherpad">
<div id="response"></div>
<div class="menu">
<h1>Etherpad lite</h1>
<li><a href="plugins">Plugin manager</a> </li>
<li><a href="settings">Settings</a> </li>
<li><a href="plugins/info">Troubleshooting information</a> </li>
</div>
<div class="innerwrapper">
<a href='https://github.com/ether/etherpad-lite/wiki/Example-Production-Settings.JSON'>Example production settings template</a>
<a href='https://github.com/ether/etherpad-lite/wiki/Example-Development-Settings.JSON'>Example development settings template</a>
<textarea class="settings"></textarea>
<input type="button" class="settingsButton" id="saveSettings" value="Save Settings">
<input type="button" class="settingsButton" id="restartEtherpad" value="Restart Etherpad">
<div id="response"></div>
</div>
</div>
<div id="topborder"></div>
</body>
</html>

View File

@ -150,6 +150,7 @@
<link href="static/custom/index.css" rel="stylesheet">
<div id="wrapper">
<% e.begin_block("indexWrapper"); %>
<div id="inner">
<div id="button" onclick="go2Random()" data-l10n-id="index.newPad"></div>
<div id="label" data-l10n-id="index.createOpenPad"></div>
@ -158,6 +159,7 @@
<button type="submit">OK</button>
</form>
</div>
<% e.end_block(); %>
</div>
<script src="static/custom/index.js"></script>