Merge lp:~davewalker/etherpad/ubuntu-full-width-default into lp:~etherpad/etherpad/ubuntu

Proposed by Dave Walker
Status: Merged
Merged at revision: 6
Proposed branch: lp:~davewalker/etherpad/ubuntu-full-width-default
Merge into: lp:~etherpad/etherpad/ubuntu
Prerequisite: lp:~davewalker/etherpad/ubuntu-micro-theme-fix
Diff against target: 266 lines (+211/-1)
6 files modified
.pc/applied-patches (+1/-0)
.pc/default-to-fullscreen.patch/etherpad/src/etherpad/pad/padutils.js (+191/-0)
debian/changelog (+3/-1)
debian/patches/default-to-fullscreen.patch (+14/-0)
debian/patches/series (+1/-0)
etherpad/src/etherpad/pad/padutils.js (+1/-0)
To merge this branch: bzr merge lp:~davewalker/etherpad/ubuntu-full-width-default
Reviewer Review Type Date Requested Status
etherpad Pending
Review via email: mp+58490@code.launchpad.net

Description of the change

Default to full width on page load.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2011-04-20 12:43:27 +0000
3+++ .pc/applied-patches 2011-04-20 12:43:27 +0000
4@@ -1,3 +1,4 @@
5 ace.patch
6 cleanup.patch
7 micro-theme-use-fix.patch
8+default-to-fullscreen.patch
9
10=== added directory '.pc/default-to-fullscreen.patch'
11=== added file '.pc/default-to-fullscreen.patch/.timestamp'
12=== added directory '.pc/default-to-fullscreen.patch/etherpad'
13=== added directory '.pc/default-to-fullscreen.patch/etherpad/src'
14=== added directory '.pc/default-to-fullscreen.patch/etherpad/src/etherpad'
15=== added directory '.pc/default-to-fullscreen.patch/etherpad/src/etherpad/pad'
16=== added file '.pc/default-to-fullscreen.patch/etherpad/src/etherpad/pad/padutils.js'
17--- .pc/default-to-fullscreen.patch/etherpad/src/etherpad/pad/padutils.js 1970-01-01 00:00:00 +0000
18+++ .pc/default-to-fullscreen.patch/etherpad/src/etherpad/pad/padutils.js 2011-04-20 12:43:27 +0000
19@@ -0,0 +1,191 @@
20+/**
21+ * Copyright 2009 Google Inc.
22+ *
23+ * Licensed under the Apache License, Version 2.0 (the "License");
24+ * you may not use this file except in compliance with the License.
25+ * You may obtain a copy of the License at
26+ *
27+ * http://www.apache.org/licenses/LICENSE-2.0
28+ *
29+ * Unless required by applicable law or agreed to in writing, software
30+ * distributed under the License is distributed on an "AS-IS" BASIS,
31+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32+ * See the License for the specific language governing permissions and
33+ * limitations under the License.
34+ */
35+
36+import("fastJSON");
37+import("stringutils");
38+
39+import("etherpad.control.pro.account_control");
40+
41+import("etherpad.pro.pro_utils");
42+import("etherpad.pro.domains");
43+import("etherpad.pro.pro_accounts");
44+import("etherpad.pro.pro_padmeta");
45+import("etherpad.pad.model");
46+import("etherpad.sessions.getSession");
47+import("etherpad.helpers");
48+
49+jimport("java.lang.System.out.println");
50+
51+
52+function setCurrentPad(p) {
53+ appjet.context.attributes().update("currentPadId", p);
54+}
55+
56+function clearCurrentPad() {
57+ appjet.context.attributes()['$minus$eq']("currentPadId");
58+}
59+
60+function getCurrentPad() {
61+ var padOpt = appjet.context.attributes().get("currentPadId");
62+ if (padOpt.isEmpty()) return null;
63+ return padOpt.get();
64+}
65+
66+function _parseCookie(text) {
67+ try {
68+ var cookieData = fastJSON.parse(unescape(text));
69+ return cookieData;
70+ }
71+ catch (e) {
72+ return null;
73+ }
74+}
75+
76+function getPrefsCookieData() {
77+ var prefsCookie = request.cookies['prefs'];
78+ if (!prefsCookie) {
79+ return null;
80+ }
81+
82+ return _parseCookie(prefsCookie);
83+}
84+
85+function getPrefsCookieUserId() {
86+ var cookieData = getPrefsCookieData();
87+ if (! cookieData) {
88+ return null;
89+ }
90+ return cookieData.userId || null;
91+}
92+
93+/**
94+ * Not valid to call this function outisde a HTTP request.
95+ */
96+function accessPadLocal(localPadId, fn, rwMode) {
97+ if (!request.isDefined) {
98+ throw Error("accessPadLocal() cannot run outside an HTTP request.");
99+ }
100+ var globalPadId = getGlobalPadId(localPadId);
101+ var fnwrap = function(pad) {
102+ pad.getLocalId = function() {
103+ return getLocalPadId(pad);
104+ };
105+ return fn(pad);
106+ }
107+ return model.accessPadGlobal(globalPadId, fnwrap, rwMode);
108+}
109+
110+/**
111+ * Not valid to call this function outisde a HTTP request.
112+ */
113+function getGlobalPadId(localPadId) {
114+ if (!request.isDefined) {
115+ throw Error("getGlobalPadId() cannot run outside an HTTP request.");
116+ }
117+ if (pro_utils.isProDomainRequest()) {
118+ return makeGlobalId(domains.getRequestDomainId(), localPadId);
119+ } else {
120+ // etherpad.com pads
121+ return localPadId;
122+ }
123+}
124+
125+function makeGlobalId(domainId, localPadId) {
126+ return [domainId, localPadId].map(String).join('$');
127+}
128+
129+function globalToLocalId(globalId) {
130+ var parts = globalId.split('$');
131+ if (parts.length == 1) {
132+ return parts[0];
133+ } else {
134+ return parts[1];
135+ }
136+}
137+
138+function getLocalPadId(pad) {
139+ var globalId = pad.getId();
140+ return globalToLocalId(globalId);
141+}
142+
143+function isProPadId(globalPadId) {
144+ return (globalPadId.indexOf("$") > 0);
145+}
146+
147+function isProPad(pad) {
148+ return isProPadId(pad.getId());
149+}
150+
151+function getDomainId(globalPadId) {
152+ var parts = globalPadId.split("$");
153+ if (parts.length < 2) {
154+ return null;
155+ } else {
156+ return Number(parts[0]);
157+ }
158+}
159+
160+function makeValidLocalPadId(str) {
161+ return str.replace(/[^a-zA-Z0-9\-]/g, '-');
162+}
163+
164+function getProDisplayTitle(localPadId, title) {
165+ if (title) {
166+ return title;
167+ }
168+ if (stringutils.isNumeric(localPadId)) {
169+ return ("Untitled "+localPadId);
170+ } else {
171+ return (localPadId);
172+ }
173+}
174+
175+
176+function setOptsAndCookiePrefs(request) {
177+ opts = {};
178+ if (request.params.fullScreen) { // tokbox, embedding
179+ opts.fullScreen = true;
180+ }
181+ if (request.params.tokbox) {
182+ opts.tokbox = true;
183+ }
184+ if (request.params.sidebar) {
185+ opts.sidebar = Boolean(Number(request.params.sidebar));
186+ }
187+ helpers.addClientVars({opts: opts});
188+
189+
190+ var prefs = getPrefsCookieData();
191+
192+ var prefsToSet = {
193+ fullWidth:false,
194+ hideSidebar:false
195+ };
196+ if (prefs) {
197+ prefsToSet.isFullWidth = !! prefs.fullWidth;
198+ prefsToSet.hideSidebar = !! prefs.hideSidebar;
199+ }
200+ if (opts.fullScreen) {
201+ prefsToSet.isFullWidth = true;
202+ if (opts.tokbox) {
203+ prefsToSet.hideSidebar = true;
204+ }
205+ }
206+ if ('sidebar' in opts) {
207+ prefsToSet.hideSidebar = ! opts.sidebar;
208+ }
209+ helpers.addClientVars({cookiePrefsToSet: prefsToSet});
210+}
211
212=== modified file 'debian/changelog'
213--- debian/changelog 2011-04-20 12:43:27 +0000
214+++ debian/changelog 2011-04-20 12:43:27 +0000
215@@ -2,8 +2,10 @@
216
217 * debian/patches/micro-theme-use-fix.patch: Allow micro theme to be used
218 by disabling css caching, which would consistently serve the default theme.
219+ * debian/patches/default-to-fullscreen.patch: Default to having full screen
220+ (full width) pads on pad load.
221
222- -- Dave Walker (Daviey) <DaveWalker@ubuntu.com> Wed, 20 Apr 2011 12:25:27 +0100
223+ -- Dave Walker (Daviey) <DaveWalker@ubuntu.com> Wed, 20 Apr 2011 12:54:11 +0100
224
225 etherpad (1.1+jarless1-0ubuntu1~ppa8) natty; urgency=low
226
227
228=== added file 'debian/patches/default-to-fullscreen.patch'
229--- debian/patches/default-to-fullscreen.patch 1970-01-01 00:00:00 +0000
230+++ debian/patches/default-to-fullscreen.patch 2011-04-20 12:43:27 +0000
231@@ -0,0 +1,14 @@
232+Description: Default to using full screen (full width)
233+ pads on page load, can still make it smaller if desired.
234+Author: Dave Walker (Daviey) <DaveWalker@ubuntu.com>
235+
236+--- a/etherpad/src/etherpad/pad/padutils.js
237++++ b/etherpad/src/etherpad/pad/padutils.js
238+@@ -159,6 +159,7 @@
239+ if (request.params.fullScreen) { // tokbox, embedding
240+ opts.fullScreen = true;
241+ }
242++ opts.fullScreen = true;
243+ if (request.params.tokbox) {
244+ opts.tokbox = true;
245+ }
246
247=== modified file 'debian/patches/series'
248--- debian/patches/series 2011-04-20 12:43:27 +0000
249+++ debian/patches/series 2011-04-20 12:43:27 +0000
250@@ -1,3 +1,4 @@
251 ace.patch
252 cleanup.patch
253 micro-theme-use-fix.patch
254+default-to-fullscreen.patch
255
256=== modified file 'etherpad/src/etherpad/pad/padutils.js'
257--- etherpad/src/etherpad/pad/padutils.js 2011-04-13 08:00:43 +0000
258+++ etherpad/src/etherpad/pad/padutils.js 2011-04-20 12:43:27 +0000
259@@ -159,6 +159,7 @@
260 if (request.params.fullScreen) { // tokbox, embedding
261 opts.fullScreen = true;
262 }
263+ opts.fullScreen = true;
264 if (request.params.tokbox) {
265 opts.tokbox = true;
266 }

Subscribers

People subscribed via source and target branches

to all changes: