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", "loglevel": "INFO",
// restrict socket.io transport methods // 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); ERR(err);
//close the connection //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: -moz-radial-gradient(circle,#aaa,#eee 60%) center fixed;
background: -ms-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; 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; padding: 15px;
background: #fff; width: 860px;
opacity: .9;
box-shadow: 0px 1px 8px rgba(0,0,0,0.3);
max-width: 700px;
margin: auto;
border-radius: 0 0 7px 7px; 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 { h1 {
font-size: 29px; font-size: 29px;
} }
@ -53,9 +86,6 @@ input[type="button"].do-install, input[type="button"].do-uninstall {
float: right; float: right;
width: 100px; width: 100px;
} }
input[type="button"]#do-search {
display: block;
}
input[type="text"] { input[type="text"] {
border-radius: 3px; border-radius: 3px;
box-sizing: border-box; box-sizing: border-box;
@ -84,41 +114,9 @@ td, th {
.template { .template {
display: none; display: none;
} }
.dialog { #progress {
display: none;
position: absolute; position: absolute;
left: 50%; bottom: 50px;
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;
} }
.settings { .settings {
margin-top:10px; margin-top:10px;
@ -128,3 +126,13 @@ td, th {
#response{ #response{
display:inline; 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() { function updateHandlers() {
$("#progress.dialog .close").unbind('click').click(function () {
$("#progress.dialog").hide();
});
$("form").submit(function(){ $("form").submit(function(){
var query = $('.search-results').data('query'); var query = $('.search-results').data('query');
query.pattern = $("#search-query").val(); query.pattern = $("#search-query").val();
@ -36,8 +32,8 @@ $(document).ready(function () {
search(); search();
return false; return false;
}); });
$("#do-search").unbind('click').click(function () { $("#search-query").unbind('keyup').keyup(function () {
var query = $('.search-results').data('query'); var query = $('.search-results').data('query');
query.pattern = $("#search-query").val(); query.pattern = $("#search-query").val();
query.offset = 0; query.offset = 0;
@ -47,13 +43,13 @@ $(document).ready(function () {
$(".do-install").unbind('click').click(function (e) { $(".do-install").unbind('click').click(function (e) {
var row = $(e.target).closest("tr"); var row = $(e.target).closest("tr");
doUpdate = true; doUpdate = true;
socket.emit("install", row.find(".name").html()); socket.emit("install", row.find(".name").text());
}); });
$(".do-uninstall").unbind('click').click(function (e) { $(".do-uninstall").unbind('click').click(function (e) {
var row = $(e.target).closest("tr"); var row = $(e.target).closest("tr");
doUpdate = true; doUpdate = true;
socket.emit("uninstall", row.find(".name").html()); socket.emit("uninstall", row.find(".name").text());
}); });
$(".do-prev-page").unbind('click').click(function (e) { $(".do-prev-page").unbind('click').click(function (e) {
@ -77,32 +73,32 @@ $(document).ready(function () {
updateHandlers(); updateHandlers();
socket.on('progress', function (data) { 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").show();
$("#progress.dialog").show();
$('#progress.dialog').data('progress', data.progress); $('#progress').data('progress', data.progress);
var message = "Unknown status"; var message = "Unknown status";
if (data.message) { if (data.message) {
message = "<span class='status'>" + data.message.toString() + "</span>"; message = data.message.toString();
} }
if (data.error) { 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) { if (data.progress >= 1) {
$("#progress").hide();
if (data.error) { if (data.error) {
$("#progress.dialog .close").show(); alert('An error occurred: '+data.error+' -- the server log might know more...');
} else { }else {
if (doUpdate) { if (doUpdate) {
doUpdate = false; doUpdate = false;
socket.emit("load"); socket.emit("load");
} }
$("#progress.dialog").hide();
} }
} }
}); });
@ -114,7 +110,11 @@ $(document).ready(function () {
widget.data('total', data.total); widget.data('total', data.total);
widget.find('.offset').html(data.query.offset); 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('.total').html(data.total);
widget.find(".results *").remove(); widget.find(".results *").remove();
@ -124,9 +124,12 @@ $(document).ready(function () {
var version = '0.0.0'; var version = '0.0.0';
// hack to access "versions" property of the npm package object // hack to access "versions" property of the npm package object
for (version in data.results[plugin_name].versions) break; for (version in data.results[plugin_name].versions) break;
for (attr in plugin) { 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); row.find(".version").html(version);
@ -144,7 +147,11 @@ $(document).ready(function () {
var row = $("#installed-plugin-template").clone(); var row = $("#installed-plugin-template").clone();
for (attr in plugin.package) { 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); $("#installed-plugins").append(row);
} }

View file

@ -361,7 +361,11 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
$(self).css('left', newloc); $(self).css('left', newloc);
// if(getSliderPosition() != Math.floor(newloc * sliderLength / ($("#ui-slider-bar").width()-2))) // if(getSliderPosition() != Math.floor(newloc * sliderLength / ($("#ui-slider-bar").width()-2)))
setSliderPosition(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. * IN THE SOFTWARE.
*/ */
window.html10n = (function(window, document, undefined) { window.html10n = (function(window, document, undefined) {
// fix console
var console = window.console var console = window.console
function interceptConsole(method){ function interceptConsole(method){
if (!console) return function() {} if (!console) return function() {}
@ -44,6 +46,39 @@ window.html10n = (function(window, document, undefined) {
, consoleError = interceptConsole('warn') , 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) * 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}); cb({progress: 0.5, message:message.msg + ": " + message.pref});
}); });
npmfn(function (er, data) { 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 = {}; if (!data) data = {};
data.progress = 1; data.progress = 1;
data.message = "Done."; data.message = "Done.";

View file

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

View file

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

View file

@ -1,6 +1,6 @@
<html> <html>
<head> <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"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link rel="stylesheet" href="../static/css/admin.css"> <link rel="stylesheet" href="../static/css/admin.css">
<script src="../static/js/jquery.js"></script> <script src="../static/js/jquery.js"></script>
@ -18,12 +18,16 @@
</div> </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> <div class="innerwrapper">
<a href="plugins/info">Technical information on installed plugins</a>
<div class="separator"></div>
<h2>Installed plugins</h2> <h2>Installed plugins</h2>
<table> <table>
<thead> <thead>
@ -50,11 +54,12 @@
<div class="paged listing search-results"> <div class="paged listing search-results">
<div class="separator"></div> <div class="separator"></div>
<h2>Search for plugins to install</h2>
<h2>Available plugins</h2>
<form> <form>
<input type="text" name="search" placeholder="Search term" id="search-query"> <input type="text" name="search" placeholder="Search for plugins to install" id="search-query">
<input type="button" value="Search" id="do-search">
</form> </form>
<table> <table>
<thead> <thead>
<tr> <tr>
@ -81,14 +86,9 @@
<span class="offset"></span>..<span class="limit"></span> of <span class="total"></span>. <span class="offset"></span>..<span class="limit"></span> of <span class="total"></span>.
<input type="button" value=">>" class="do-next-page"> <input type="button" value=">>" class="do-next-page">
</div> </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> </div>
<div id="topborder"></div>
</body> </body>
</html> </html>

View file

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

View file

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