From f5f400aa103ce7c0436fc6352bf540ed4c6274ef Mon Sep 17 00:00:00 2001 From: Peter Martischka Date: Sun, 4 Apr 2010 03:44:37 +0200 Subject: Opportunity to enable/disable the Pro Feature with a config flag --- etherpad/etc/etherpad.localdev-default.properties | 1 + etherpad/src/etherpad/globals.js | 6 ++++++ etherpad/src/etherpad/pro/pro_utils.js | 5 ++++- .../twitterStyleTags/controllers/tagBrowser.js | 6 +++++- .../twitterStyleTags/static/css/tagBrowser.css | 2 +- .../plugins/twitterStyleTags/templates/tagBrowser.ejs | 19 +++++++++++++++---- etherpad/src/static/css/home-opensource.css | 4 ++-- etherpad/src/templates/framed/framedheader-pro.ejs | 6 +++--- etherpad/src/templates/main/home.ejs | 14 ++++++++------ 9 files changed, 45 insertions(+), 18 deletions(-) diff --git a/etherpad/etc/etherpad.localdev-default.properties b/etherpad/etc/etherpad.localdev-default.properties index 26bc8e5..97f420f 100644 --- a/etherpad/etc/etherpad.localdev-default.properties +++ b/etherpad/etc/etherpad.localdev-default.properties @@ -8,6 +8,7 @@ etherpad.SQL_JDBC_DRIVER = com.mysql.jdbc.Driver etherpad.SQL_JDBC_URL = jdbc:mysql://localhost:3306/etherpad etherpad.SQL_PASSWORD = password etherpad.SQL_USERNAME = etherpad +etherpad.proAccounts = true listen = 9000 logDir = ./data/logs modulePath = ./src diff --git a/etherpad/src/etherpad/globals.js b/etherpad/src/etherpad/globals.js index 343a989..53a3f95 100644 --- a/etherpad/src/etherpad/globals.js +++ b/etherpad/src/etherpad/globals.js @@ -1,5 +1,6 @@ /** * Copyright 2009 Google Inc. + * Copyright 2010 Pita, Peter Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +27,11 @@ function isProduction() { return (appjet.config['etherpad.isProduction'] == "true"); } +function isProAccountEnabled() { + return (appjet.config['etherpad.proAccounts'] == "true"); +} + + var SUPERDOMAINS = { 'localbox.info': true, 'localhost': true, diff --git a/etherpad/src/etherpad/pro/pro_utils.js b/etherpad/src/etherpad/pro/pro_utils.js index 787f424..c9874f0 100644 --- a/etherpad/src/etherpad/pro/pro_utils.js +++ b/etherpad/src/etherpad/pro/pro_utils.js @@ -1,5 +1,6 @@ /** * Copyright 2009 Google Inc. + * Copyright 2010 Pita, Peter Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +55,9 @@ function getRequestSuperdomain() { } function isProDomainRequest() { - // the result of this function never changes within the same request. + if(!isProAccountEnabled()) + return false; + // the result of this function never changes within the same request. var c = appjet.requestCache; if (c.isProDomainRequest === undefined) { c.isProDomainRequest = _computeIsProDomainRequest(); diff --git a/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js b/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js index eb42b10..793067d 100644 --- a/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js +++ b/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js @@ -1,5 +1,6 @@ /** * Copyright 2009 RedHog, Egil Möller + * Copyright 2010 Pita, Peter Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -179,6 +180,7 @@ function newTagsSql(querySql) { 'where ' + ' tp.TAG_ID = t.ID ' + ' and tp.PAD_ID in %(query_post_table)s ' + + ' and tp.PAD_ID NOT LIKE \'%$%\'' + 'group by t.NAME, tn.total ' + 'having ' + ' count(tp.PAD_ID) > 0 and count(tp.PAD_ID) < tn.total ' + @@ -210,7 +212,7 @@ function onRequest() { var queryNewTagsSql = newTagsSql(querySql); var newTags = sqlobj.executeRaw(queryNewTagsSql.sql, queryNewTagsSql.params); - /* Select the 10 last changed matching pads and some extra information on them. */ + /* Select the 10 last changed matching pads and some extra information on them. Except the Pro Pads*/ var sql = '' + 'select ' + ' m.id as ID, ' + @@ -222,6 +224,8 @@ function onRequest() { ' m.id = q.ID ' + ' join PAD_TAG_CACHE as c on ' + ' c.PAD_ID = q.ID ' + + 'where ' + + ' m.id NOT LIKE \'%$%\'' + 'order by ' + ' m.lastWriteTime desc ' + 'limit 10'; diff --git a/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css b/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css index 94b2be8..f3321a4 100644 --- a/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css +++ b/etherpad/src/plugins/twitterStyleTags/static/css/tagBrowser.css @@ -49,7 +49,7 @@ h1 { margin-top: 0; } -#home-newpad { +#home-newpad, #home-newteam { display: block; background-color: #a3bde0; color: #555555; diff --git a/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs b/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs index 1f1c0e3..7a91547 100644 --- a/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs +++ b/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs @@ -1,4 +1,6 @@ -<% /* Copyright 2009 Google Inc. +<% /* +Copyright 2009 Google Inc. +Copyright 2010 Pita, Peter Martischka Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -77,9 +79,18 @@ limitations under the License. */ %>
- - Create new pad - + <% if (isProAccountEnabled()) { %> + + Create new pad + + + Create new team + + <% } else { %> + + Create new pad + + <% } %>
diff --git a/etherpad/src/static/css/home-opensource.css b/etherpad/src/static/css/home-opensource.css index 41e7996..82f15da 100644 --- a/etherpad/src/static/css/home-opensource.css +++ b/etherpad/src/static/css/home-opensource.css @@ -10,7 +10,7 @@ font-size: 3.6em; } -#home a#home-newpad { +#home a#home-newpad, #home a#home-newteam{ display: block; padding: 1em; margin: 12px 60px; @@ -20,7 +20,7 @@ color: #fff; } -#home a#home-newpad:hover { +#home a#home-newpad:hover, #home a#home-newteam:hover{ background: #26b; } diff --git a/etherpad/src/templates/framed/framedheader-pro.ejs b/etherpad/src/templates/framed/framedheader-pro.ejs index 857fa3e..73b0e99 100644 --- a/etherpad/src/templates/framed/framedheader-pro.ejs +++ b/etherpad/src/templates/framed/framedheader-pro.ejs @@ -1,4 +1,6 @@ -<% /* Copyright 2009 Google Inc. +<% /* +Copyright 2009 Google Inc. +Copyright 2010 Pita, Peter Martischka Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -64,10 +66,8 @@ limitations under the License. */ %><% helpers.addBodyClass("pro-withtopbar"); %
- <% if (validLicense && account) { %> <%= renderProTopNav() %> <%= helpers.clearFloats() %> - <% } %>
diff --git a/etherpad/src/templates/main/home.ejs b/etherpad/src/templates/main/home.ejs index 3fc0484..aa5d934 100644 --- a/etherpad/src/templates/main/home.ejs +++ b/etherpad/src/templates/main/home.ejs @@ -1,4 +1,6 @@ -<% /* Copyright 2009 Google Inc. +<% /* +Copyright 2009 Google Inc. +Copyright 2010 Pita, Peter Martischka Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,11 +25,11 @@ limitations under the License. */ %><% helpers.setHtmlTitle("EtherPad: Open-Sour Create new pad - + <% if (isProAccountEnabled()) { %> + + Create team site + + <% } %>
-- cgit v1.2.3