Merge lp:~wallyworld/launchpad/use-convoy into lp:launchpad

Proposed by Ian Booth
Status: Merged
Approved by: Ian Booth
Approved revision: no longer in the source branch.
Merged at revision: 14722
Proposed branch: lp:~wallyworld/launchpad/use-convoy
Merge into: lp:launchpad
Diff against target: 3360 lines (+1088/-435)
131 files modified
Makefile (+26/-5)
buildout-templates/bin/combo-rootdir.in (+52/-0)
buildout.cfg (+20/-8)
configs/development/local-launchpad-apache (+3/-0)
lib/lp/answers/templates/question-index.pt (+1/-1)
lib/lp/answers/templates/questiontarget-portlet-answercontacts.pt (+1/-1)
lib/lp/app/doc/lazr-js-widgets.txt (+3/-3)
lib/lp/app/javascript/ajax_log.js (+1/-1)
lib/lp/app/javascript/beta-notification.js (+2/-2)
lib/lp/app/javascript/configutils.js (+1/-1)
lib/lp/app/javascript/indicator/indicator.js (+4/-5)
lib/lp/app/javascript/indicator/tests/test_indicator.js (+14/-14)
lib/lp/app/javascript/inlinehelp/inlinehelp.js (+1/-1)
lib/lp/app/javascript/listing_navigator.js (+6/-6)
lib/lp/app/javascript/multicheckbox.js (+1/-1)
lib/lp/app/javascript/ordering/ordering.js (+2/-2)
lib/lp/app/javascript/tests/test_ajax_batch_navigator.js (+1/-1)
lib/lp/app/javascript/tests/test_beta_notification.html (+1/-1)
lib/lp/app/javascript/tests/test_listing_navigator.html (+1/-1)
lib/lp/app/templates/base-layout-macros.pt (+240/-190)
lib/lp/app/templates/base-layout.pt (+2/-5)
lib/lp/app/templates/boolean-choice-widget.pt (+1/-1)
lib/lp/app/templates/enum-choice-widget.pt (+1/-1)
lib/lp/app/templates/inline-multicheckbox-widget.pt (+1/-1)
lib/lp/app/templates/inline-picker.pt (+1/-1)
lib/lp/app/templates/launchpad-databaseunavailable.pt (+1/-1)
lib/lp/app/templates/launchpad-widget-macros.pt (+12/-8)
lib/lp/app/templates/root-index.pt (+5/-3)
lib/lp/app/templates/text-area-editor.pt (+1/-1)
lib/lp/app/templates/text-line-editor.pt (+1/-1)
lib/lp/app/widgets/doc/location-widget.txt (+10/-3)
lib/lp/app/widgets/location.py (+1/-1)
lib/lp/app/widgets/templates/bugtracker-picker.pt (+1/-1)
lib/lp/app/widgets/templates/form-picker-macros.pt (+2/-2)
lib/lp/app/widgets/templates/license.pt (+1/-1)
lib/lp/blueprints/templates/specification-index.pt (+1/-1)
lib/lp/blueprints/templates/specifications-index.pt (+5/-3)
lib/lp/bugs/browser/bugalsoaffects.py (+1/-1)
lib/lp/bugs/javascript/bug_tags_entry.js (+2/-2)
lib/lp/bugs/javascript/buglisting.js (+1/-1)
lib/lp/bugs/javascript/buglisting_utils.js (+2/-2)
lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js (+1/-1)
lib/lp/bugs/javascript/bugtask_index.js (+8/-5)
lib/lp/bugs/javascript/official_bug_tags.js (+2/-2)
lib/lp/bugs/javascript/tests/test_buglisting.html (+1/-1)
lib/lp/bugs/templates/bug-portlet-subscription.pt (+1/-1)
lib/lp/bugs/templates/bug-subscription-list.pt (+1/-1)
lib/lp/bugs/templates/bug-subscription.pt (+1/-5)
lib/lp/bugs/templates/bugcomment-macros.pt (+1/-1)
lib/lp/bugs/templates/buglisting-default.pt (+16/-16)
lib/lp/bugs/templates/bugs-listing-table.pt (+1/-1)
lib/lp/bugs/templates/bugtarget-filebug-search.pt (+1/-5)
lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt (+1/-4)
lib/lp/bugs/templates/bugtarget-macros-filebug.pt (+2/-2)
lib/lp/bugs/templates/bugtarget-patches.pt (+2/-2)
lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt (+1/-1)
lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt (+1/-1)
lib/lp/bugs/templates/bugtarget-subscription-list.pt (+1/-1)
lib/lp/bugs/templates/bugtask-index.pt (+2/-3)
lib/lp/bugs/templates/bugtask-macros-tableview.pt (+1/-1)
lib/lp/bugs/templates/bugtasks-and-nominations-portal.pt (+1/-1)
lib/lp/bugs/templates/bugtracker-configure.pt (+1/-1)
lib/lp/bugs/templates/official-bug-target-manage-tags.pt (+1/-1)
lib/lp/bugs/templates/projectgroup-filebug-search.pt (+1/-4)
lib/lp/code/javascript/requestbuild_overlay.js (+3/-3)
lib/lp/code/javascript/tests/test_productseries-setbranch.html (+1/-1)
lib/lp/code/templates/bazaar-index.pt (+5/-3)
lib/lp/code/templates/branch-form-macros.pt (+1/-1)
lib/lp/code/templates/branch-import-details.pt (+1/-1)
lib/lp/code/templates/branch-index.pt (+1/-1)
lib/lp/code/templates/branch-listing.pt (+2/-2)
lib/lp/code/templates/branch-register-merge.pt (+1/-1)
lib/lp/code/templates/branch-related-bugs-specs.pt (+1/-1)
lib/lp/code/templates/branchmergeproposal-generic-listing.pt (+1/-1)
lib/lp/code/templates/branchmergeproposal-index.pt (+1/-1)
lib/lp/code/templates/daily-builds-listing.pt (+1/-1)
lib/lp/code/templates/sourcepackagerecipe-index.pt (+1/-1)
lib/lp/code/templates/sourcepackagerecipe-new.pt (+1/-1)
lib/lp/contrib/javascript/lp.mustache.js (+418/-0)
lib/lp/registry/browser/__init__.py (+1/-1)
lib/lp/registry/browser/person.py (+1/-1)
lib/lp/registry/browser/team.py (+2/-2)
lib/lp/registry/browser/tests/productrelease-views.txt (+1/-1)
lib/lp/registry/browser/tests/productseries-views.txt (+1/-1)
lib/lp/registry/templates/distribution-index.pt (+1/-1)
lib/lp/registry/templates/distributionsourcepackage-index.pt (+2/-2)
lib/lp/registry/templates/distroseries-index.pt (+1/-1)
lib/lp/registry/templates/distroseries-initialize.pt (+1/-1)
lib/lp/registry/templates/distroseries-localdifferences.pt (+3/-3)
lib/lp/registry/templates/milestone-index.pt (+1/-1)
lib/lp/registry/templates/object-timeline-graph.pt (+1/-1)
lib/lp/registry/templates/people-index.pt (+6/-3)
lib/lp/registry/templates/person-macros.pt (+1/-1)
lib/lp/registry/templates/product-index.pt (+1/-1)
lib/lp/registry/templates/product-new.pt (+1/-1)
lib/lp/registry/templates/productrelease-add-from-series.pt (+1/-1)
lib/lp/registry/templates/products-index.pt (+5/-3)
lib/lp/registry/templates/productseries-index.pt (+1/-1)
lib/lp/registry/templates/productseries-setbranch.pt (+1/-1)
lib/lp/registry/templates/project-index.pt (+1/-1)
lib/lp/registry/templates/projects-index.pt (+5/-3)
lib/lp/registry/templates/team-portlet-membership.pt (+1/-1)
lib/lp/registry/templates/teammembership-index.pt (+1/-1)
lib/lp/registry/templates/timeline-macros.pt (+1/-1)
lib/lp/scripts/runlaunchpad.py (+1/-1)
lib/lp/scripts/utilities/js/jsmin_all.py (+46/-0)
lib/lp/services/features/flags.py (+18/-2)
lib/lp/services/profile/profile.pt (+2/-2)
lib/lp/services/webapp/error.py (+9/-0)
lib/lp/services/webapp/publisher.py (+17/-0)
lib/lp/services/worlddata/javascript/languages.js (+2/-3)
lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt (+1/-1)
lib/lp/soyuz/templates/archive-edit-dependencies.pt (+1/-1)
lib/lp/soyuz/templates/archive-index.pt (+1/-1)
lib/lp/soyuz/templates/archive-macros.pt (+1/-1)
lib/lp/soyuz/templates/archive-packages.pt (+2/-2)
lib/lp/soyuz/templates/archive-subscribers.pt (+1/-1)
lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt (+1/-1)
lib/lp/soyuz/templates/distroseries-queue.pt (+1/-1)
lib/lp/translations/templates/languageset-index.pt (+2/-7)
lib/lp/translations/templates/object-templates.pt (+2/-2)
lib/lp/translations/templates/pofile-export.pt (+1/-1)
lib/lp/translations/templates/pofile-translate.pt (+1/-1)
lib/lp/translations/templates/sourcepackage-sharing-details.pt (+1/-1)
lib/lp/translations/templates/translation-import-queue-macros.pt (+1/-1)
lib/lp/translations/templates/translationimportqueueentry-index.pt (+1/-1)
lib/lp/translations/templates/translationmessage-translate.pt (+1/-1)
lib/lp/translations/templates/translations-macros.pt (+1/-1)
utilities/js-deps (+7/-0)
utilities/yui-deps.py (+1/-1)
versions.cfg (+1/-1)
To merge this branch: bzr merge lp:~wallyworld/launchpad/use-convoy
Reviewer Review Type Date Requested Status
Deryck Hodge (community) Approve
Review via email: mp+89222@code.launchpad.net

Commit message

[r=deryck][bug=918901,918993][incr] Set up a YUI combo loader for launchpad to use, behind a feature flag.

Description of the change

== Implementation ==

Add support for using a YUI combo loader. A feature flag is used so that by default, the legacy launchpad.js is loaded. The combo loader used is lp:convoy

Feature flags:
js.combo_loader.enabled : on/true = use combo loader
js.yui_version : spefic a non-default yui version for the combo loader to serve up

Key changes:
- TAL templates updated to use combo loader
- combo-rootdir script to set up the combo loader
- altered make/build scripts

Three versions of YUI are currently unpacked from tarballs in the download cache:
- 3.3.0
- 3.4.1
- 3.5 pr1

We use 3.3.0 as specified in versions.cfg. To use a different version, change the yui symlink in /var/tmp/convoy to point to a different version.

Because I did a a lot of make testing, I got so pissed off with WADL and mailman taking minutes to build that I added support in the Makefile to make things way quicker for devs:

If LP_MAKE_NO_WADL is defined (can be set as env var), the WADL make step is totally skipped.

If LP_MAKE_KEEP_MAILMAN is defined, make clean does not remove the compiled mailman and so the next make after a clean doesn't need to rebuild it.

The default make behaviour is as per normal. However, setting the above 2 variables causes the make to complete in literally seconds \o/

== Tests ==

Testing included:
- checking launchpad.js was the same on the old and new codebases
- testing all manner of pages with and without combo loader feature flag, including yui2 stuff like calendar
- quick look at js loaded, xhr requests
- running yuitests (as usual for me they thrashed my disk so much that a couple timed out but everything looks ok)

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

Ian--

Rick has told me that he and Deryck have some thoughts about this; I'm staying away from this MP for now because of that, but am leaving this comment so you know the branch isn't just languishing without anyone looking at it. I assume Deryck will leave his comments here or is emailing you or finding you on IRC.

I will say, having not really dug through the branch, that I wonder if there's any way to break this up into smaller bits for reviewing? It's my understanding that it may well all need to be landed together, but at least from a review perspective I think this may be too big to keep in one's head during a review. As an example, I suspect the WADL and MAILMAN bits could be separated.

Revision history for this message
Deryck Hodge (deryck) wrote :

Yeah, I'm claiming the review and will try to get through it before I EOD. I'd like to see this landed, if possible, during Ian and Steve's day today.

Revision history for this message
Deryck Hodge (deryck) wrote :

Ok, I made it through it! yay, me! :)

Some minor things to fix up and I think it's ready to go.

1.) Don't build all YUI versions by default.

This is waste for most people. The buildout rules make it possible to do it on demand, but there's no need to do this for every developer with every buildout run. Even when we need all versions legitimately, i.e. in deploying to convoy, we can have a wrapper make command like `make jsall` or some such which wraps the buildout commands. For now, we can do ./bin/buildout install yui-$VERSION manually if we want them all.

2.) There is inconsistency between instantiated YUI instances.

We should not be using LPS or LP_YUI. We should do YUI().use as all YUI-based sites do. I realized from talking to Rick that going to LP_YUI was an attempt to cut back on console noise, but this is the wrong way to do this. We can live with a little console noise to land this and then fix up individual logging issues ourselves. There's also "logLevel : 'error'" as a short term work around if you don't want the noise in production. If you go this route, it might be nice to base that off "devmode" so we still see the noise locally, forcing us to fix it.

Also, we should be consistent about "YUI().use" and "YUI.add" -- one is an instance, the other is not. I'd comb the diff again and fix up all those spots.

3.) We are inconsistent about renaming modules to lp.app namespace.

The diff changes lp.indicator to lp.app.indicator but not lp.ordering to lp.app.ordering, for example. I don't think we should change lp.ordering in this branch; the diff is already quite large. In fact, we probably should not have tried that kind of refactor for lp.indicator, especially when it's not relevant to the other changes. I'm fine to leave it in, but I just point out that it's inconsistent, and as we're fixing the above two items, we should not make matters worse with more unrelated drive-bys. :-)

That's it! 1 and 2 are crucial and 3 is informational. :) I'll mark this needs fixing to show my intent, but I'll check back late in my evening and review again (after my raid night in DCUO ;)). Assuming changes have been made by then. I'm anxious to see this landing, and if we could get it on the way to ec2/buildbot during your day, I could do QA during my tomorrow.

Thanks to all you guys for getting this done! Awesome days ahead!

review: Needs Fixing
Revision history for this message
Ian Booth (wallyworld) wrote :

Well done on getting through it all :-)

>> 1.) Don't build all YUI versions by default.

Done. Changed buildout.cfg

>> 2.) There is inconsistency between instantiated YUI instances.

>> Also, we should be consistent about "YUI().use" and "YUI.add" -- one is an instance, the other is not. I'd comb the diff again and fix up all those spots.

None of our new code uses YUI.use but there was some legacy stuff which did. So I changed all occurrences of YUI.use to YUI.use() and tested those bits. In so doing found a doc test location-widget.txt with an incorrect value in it. Not sure how it ever passed :-/

>> live with a little console noise to land this and then fix up individual logging issues ourselves. There's also "logLevel : 'error'" as a short term work around if you don't want the noise in production. If you go this route, it might be nice to base that off "devmode" so we still see the noise locally, forcing us to fix it.

Sadly I can find no YUI.GlobalConfig option supporting setting logLevel. The YUI docs don't list it as an option. You can go YUI({logLevel: 'error'}) but it's not globally settable from what I can see. So sadly we will have some console noise.

Revision history for this message
Ian Booth (wallyworld) wrote :

rick and I decided to simply turn off all YUI console output from Y.log() in prod. This is supported by the GlobalConfig option 'debug'.

Revision history for this message
Richard Harding (rharding) wrote :

> rick and I decided to simply turn off all YUI console output from Y.log() in
> prod. This is supported by the GlobalConfig option 'debug'.

Just to clarify, this only effects calls to Y.log() and all other console output and errors/exceptions that aren't caught still hit the console as you would expect. Since we don't do a ton of Y.log() at the moment (I only think some info is dumped through buglistings) it shouldn't effect us until we can clean up the extraneous Y.log statements.

Revision history for this message
Deryck Hodge (deryck) wrote :

Looks good now. Sorry for leading you down the wrong road with logLevel. You can indeed set this via GlobalConfig, which is just a pass through to config, but unfortunately, it only applies to YUI created consoles, not dev consoles like Firebug. But good catch on debug, which is the right one for dev consoles.

Consider this approved! Oh happy day! Let's land it! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-01-18 21:46:42 +0000
3+++ Makefile 2012-01-25 04:26:29 +0000
4@@ -42,6 +42,8 @@
5
6 CODEHOSTING_ROOT=/var/tmp/bazaar.launchpad.dev
7
8+CONVOY_ROOT=/var/tmp/convoy
9+
10 BZR_VERSION_INFO = bzr-version-info.py
11
12 APIDOC_DIR = lib/canonical/launchpad/apidoc
13@@ -86,7 +88,12 @@
14 --force "$(APIDOC_TMPDIR)"
15 mv $(APIDOC_TMPDIR) $(APIDOC_DIR)
16
17-apidoc: compile $(API_INDEX)
18+apidoc:
19+ifdef LP_MAKE_NO_WADL
20+ @echo "Skipping WADL generation."
21+else
22+ $(MAKE) compile $(API_INDEX)
23+endif
24
25 # Used to generate HTML developer documentation for Launchpad.
26 doc:
27@@ -180,6 +187,10 @@
28 endif
29
30 jsbuild: $(PY) $(JS_OUT)
31+ mkdir -p $(CONVOY_ROOT)
32+ bin/combo-rootdir $(CONVOY_ROOT)
33+ rm -f $(ICING)/yui
34+ ln -sf $(CONVOY_ROOT)/yui $(ICING)/yui
35
36 eggs:
37 # Usually this is linked via link-external-sourcecode, but in
38@@ -348,21 +359,31 @@
39
40 clean_js:
41 $(RM) $(JS_OUT)
42- $(RM) -r $(LAZR_BUILT_JS_ROOT)
43+ $(RM) -r $(ICING)/yui
44+ $(RM) -r $(CONVOY_ROOT)
45
46 clean_buildout:
47 $(RM) -r bin
48 $(RM) -r parts
49 $(RM) -r develop-eggs
50 $(RM) .installed.cfg
51- $(RM) -r build
52 $(RM) _pythonpath.py
53 $(RM) -r yui/*
54
55 clean_logs:
56 $(RM) logs/thread*.request
57
58-clean: clean_js clean_buildout clean_logs
59+clean_mailman:
60+ $(RM) -r \
61+ /var/tmp/mailman \
62+ /var/tmp/mailman-xmlrpc.test
63+ifdef LP_MAKE_KEEP_MAILMAN
64+ @echo "Keeping previously built mailman."
65+else
66+ $(RM) -r lib/mailman
67+endif
68+
69+clean: clean_js clean_mailman clean_buildout clean_logs
70 $(MAKE) -C sourcecode/pygettextpo clean
71 # XXX gary 2009-11-16 bug 483782
72 # The pygettextpo Makefile should have this next line in it for its make
73@@ -375,11 +396,11 @@
74 -type f \( -name '*.o' -o -name '*.so' -o -name '*.la' -o \
75 -name '*.lo' -o -name '*.py[co]' -o -name '*.dll' \) \
76 -print0 | xargs -r0 $(RM)
77- $(RM) -r lib/mailman
78 $(RM) -r $(LP_BUILT_JS_ROOT)/*
79 $(RM) -r $(CODEHOSTING_ROOT)
80 $(RM) -r $(APIDOC_DIR)
81 $(RM) -r $(APIDOC_DIR).tmp
82+ $(RM) -r build
83 $(RM) $(BZR_VERSION_INFO)
84 $(RM) +config-overrides.zcml
85 $(RM) -r \
86
87=== added file 'buildout-templates/bin/combo-rootdir.in'
88--- buildout-templates/bin/combo-rootdir.in 1970-01-01 00:00:00 +0000
89+++ buildout-templates/bin/combo-rootdir.in 2012-01-25 04:26:29 +0000
90@@ -0,0 +1,52 @@
91+#!/bin/sh
92+
93+set -e
94+
95+if [ -z "$1" ]; then
96+ echo "$0: Need root combo loader directory as an argument."
97+ exit 1
98+fi
99+
100+BUILD_DIR=$1
101+rm -rf $BUILD_DIR/*
102+
103+# Populate YUI.
104+mkdir $BUILD_DIR/yui-${versions:yui}
105+cp -a ${buildout:yui-directory}/yui-${versions:yui}/* $BUILD_DIR/yui-${versions:yui}
106+ln -sf $BUILD_DIR/yui-${versions:yui} $BUILD_DIR/yui
107+
108+# And YUI 2, for now.
109+cp -a lib/canonical/launchpad/icing/yui_2.7.0b/build $BUILD_DIR/yui2
110+
111+# Copy in our modules.
112+mkdir $BUILD_DIR/lp
113+for jsdir in lib/lp/*/javascript ; do
114+ app=$(echo $jsdir | sed -e 's,lib/lp/\(.*\)/javascript,\1,')
115+ cp -a $jsdir $BUILD_DIR/lp/$app
116+done
117+# ... and delete tests.
118+find $BUILD_DIR -name 'tests' -type d | xargs rm -rf
119+
120+# We have to move some modules around.
121+cp lib/lp/contrib/javascript/lp.mustache.js $BUILD_DIR/lp
122+rm $BUILD_DIR/lp/contrib/mustache.js
123+rm $BUILD_DIR/lp/app/worlddata
124+cp lib/lp/services/worlddata/javascript/languages.js $BUILD_DIR/lp
125+cp lib/lp/app/longpoll/javascript/longpoll.js $BUILD_DIR/lp
126+
127+# Build the LP module definition file.
128+utilities/js-deps -n LP_MODULES -s $BUILD_DIR/lp -o $BUILD_DIR/lp/meta.js >/dev/null
129+
130+# Minify our JS.
131+bin/py -m lp.scripts.utilities.js.jsmin_all $BUILD_DIR/lp
132+
133+# Check if any JS modules are missing.
134+error=0
135+for mod in $(grep ' LP' $BUILD_DIR/lp/meta.js | tr -s ' ' | cut -d\ -f2) ; do
136+ if ! grep -q "modules\[$mod\]" $BUILD_DIR/lp/meta.js ; then
137+ echo "ERROR: $mod is not mentioned in the meta file"
138+ error=1
139+ fi
140+done
141+
142+exit $error
143
144=== modified file 'buildout.cfg'
145--- buildout.cfg 2012-01-13 08:34:16 +0000
146+++ buildout.cfg 2012-01-25 04:26:29 +0000
147@@ -3,7 +3,7 @@
148
149 [buildout]
150 parts =
151- yui
152+ yui-default
153 scripts
154 filetemplates
155 tags
156@@ -13,7 +13,7 @@
157 unzip = true
158 eggs-directory = eggs
159 download-cache = download-cache
160-yui-directory = yui
161+yui-directory = build/js/yui
162 relative-paths = true
163
164 # Disable this option temporarily if you want buildout to find software
165@@ -39,12 +39,24 @@
166 [yui]
167 recipe = plone.recipe.command
168 command =
169- mkdir -p ${buildout:yui-directory}/yui-${versions:yui}
170- rm -rf ${buildout:yui-directory}/yui-${versions:yui}/*
171- tar -zxf download-cache/dist/yui-${versions:yui}.tar.gz \
172- -C ${buildout:yui-directory}/yui-${versions:yui}
173- ln -sf ../../../../${buildout:yui-directory}/yui-${versions:yui} \
174- lib/canonical/launchpad/icing/yui
175+ mkdir -p ${buildout:yui-directory}/yui-${:yui_version}
176+ rm -rf ${buildout:yui-directory}/yui-${:yui_version}/*
177+ tar -zxf download-cache/dist/yui-${:yui_version}.tar.gz \
178+ --wildcards --strip-components 2 \
179+ -C ${buildout:yui-directory}/yui-${:yui_version} \
180+ '*/build'
181+
182+[yui-default]
183+<= yui
184+yui_version = ${versions:yui}
185+
186+[yui-3.4]
187+<= yui
188+yui_version = 3.4.1
189+
190+[yui-3.5]
191+<=yui
192+yui_version = 3.5.0pr1
193
194 [filetemplates]
195 recipe = z3c.recipe.filetemplate
196
197=== modified file 'configs/development/local-launchpad-apache'
198--- configs/development/local-launchpad-apache 2011-09-30 11:14:23 +0000
199+++ configs/development/local-launchpad-apache 2012-01-25 04:26:29 +0000
200@@ -138,6 +138,7 @@
201
202 ProxyPreserveHost on
203 ProxyPass /+longpoll/ http://localhost:22435/ retry=1
204+ ProxyPass /+combo !
205 ProxyPass / http://localhost:8086/ retry=1
206
207 <Location />
208@@ -153,6 +154,8 @@
209 SetEnvIfNoCase Request_URI ^/@@/.*\.js$ !no-gzip !dont-vary
210 </Location>
211
212+ WSGIScriptAlias /+combo /usr/share/convoy/convoy.wsgi
213+
214 </VirtualHost>
215
216 <VirtualHost 127.0.0.88:80>
217
218=== modified file 'lib/lp/answers/templates/question-index.pt'
219--- lib/lp/answers/templates/question-index.pt 2011-08-20 14:14:26 +0000
220+++ lib/lp/answers/templates/question-index.pt 2012-01-25 04:26:29 +0000
221@@ -17,7 +17,7 @@
222 }
223 </style>
224 <script type="text/javascript">
225- LPS.use('base', 'node', 'event',
226+ YUI().use('base', 'node', 'event',
227 'lp.comments.hide', 'lp.answers.subscribers',
228 function(Y) {
229 Y.on('domready', function() {
230
231=== modified file 'lib/lp/answers/templates/questiontarget-portlet-answercontacts.pt'
232--- lib/lp/answers/templates/questiontarget-portlet-answercontacts.pt 2011-08-15 03:42:02 +0000
233+++ lib/lp/answers/templates/questiontarget-portlet-answercontacts.pt 2012-01-25 04:26:29 +0000
234@@ -7,7 +7,7 @@
235 <tal:script
236 replace="structure
237 string:&lt;script id='milestone-script' type='text/javascript'&gt;" />
238- LPS.use('base', 'node', 'event',
239+ YUI().use('base', 'node', 'event',
240 'lp.comments.hide', 'lp.answers.answercontacts',
241 function(Y) {
242 Y.on('domready', function() {
243
244=== modified file 'lib/lp/app/doc/lazr-js-widgets.txt'
245--- lib/lp/app/doc/lazr-js-widgets.txt 2011-06-28 15:09:26 +0000
246+++ lib/lp/app/doc/lazr-js-widgets.txt 2012-01-25 04:26:29 +0000
247@@ -331,7 +331,7 @@
248 </span>
249 </span>
250 <script>
251- LPS.use('lp.app.choice', function(Y) {
252+ YUI().use('lp.app.choice', function(Y) {
253 ...
254 </script>
255
256@@ -390,7 +390,7 @@
257 </span>
258 </span>
259 <script>
260- LPS.use('lp.app.choice', function(Y) {
261+ YUI().use('lp.app.choice', function(Y) {
262 ...
263 </script>
264
265@@ -478,7 +478,7 @@
266 <div class="yui3-activator-message-box yui3-activator-hidden" />
267 </span>
268 <script>
269- LPS.use('lp.app.multicheckbox', function(Y) {
270+ YUI().use('lp.app.multicheckbox', function(Y) {
271 ...
272 </script>
273
274
275=== modified file 'lib/lp/app/javascript/ajax_log.js'
276--- lib/lp/app/javascript/ajax_log.js 2011-08-09 14:18:02 +0000
277+++ lib/lp/app/javascript/ajax_log.js 2012-01-25 04:26:29 +0000
278@@ -5,7 +5,7 @@
279 */
280 var AJAX_OK_TIME = 1;
281
282- LPS.use('node', 'lp.anim', function(Y) {
283+ YUI().use('node', 'lp.anim', function(Y) {
284 Y.on('contentready', function() {
285 var node = Y.one('#ajax-time-list');
286 var ajax_request_times = {};
287
288=== modified file 'lib/lp/app/javascript/beta-notification.js'
289--- lib/lp/app/javascript/beta-notification.js 2011-11-22 21:38:36 +0000
290+++ lib/lp/app/javascript/beta-notification.js 2012-01-25 04:26:29 +0000
291@@ -18,7 +18,7 @@
292 * This should be called after the page has loaded e.g. on 'domready'.
293 */
294 function display_beta_notification() {
295- var notifications = Mustache.to_html([
296+ var notifications = Y.lp.mustache.to_html([
297 '{{#features}}{{#is_beta}}',
298 '<span class="beta-feature"> {{title}}',
299 '{{#url}}',
300@@ -78,4 +78,4 @@
301 }
302 namespace.display_beta_notification = display_beta_notification;
303
304-}, "0.1", {"requires": ["base", "node", "anim"]});
305+}, '0.1', {'requires': ['base', 'node', 'anim', 'lp.mustache']});
306
307=== modified file 'lib/lp/app/javascript/configutils.js'
308--- lib/lp/app/javascript/configutils.js 2012-01-13 16:46:46 +0000
309+++ lib/lp/app/javascript/configutils.js 2012-01-25 04:26:29 +0000
310@@ -1,6 +1,6 @@
311 /* Copyright (c) 2011, Canonical Ltd. All rights reserved. */
312
313-YUI().add('lp.configutils', function(Y) {
314+YUI.add('lp.configutils', function(Y) {
315 /**
316 * The configutils module provides objects for managing the config
317 * or settings of a web page or widget.
318
319=== modified file 'lib/lp/app/javascript/indicator/indicator.js'
320--- lib/lp/app/javascript/indicator/indicator.js 2012-01-13 16:46:46 +0000
321+++ lib/lp/app/javascript/indicator/indicator.js 2012-01-25 04:26:29 +0000
322@@ -3,16 +3,15 @@
323 *
324 * Large indicator of pending operations.
325 *
326- * @module lp.indicator
327+ * @module lp.app.indicator
328 *
329 * Usage:
330- * lp.indicator.OverlayIndicator({
331+ * lp.app.indicator.OverlayIndicator({
332 * target: Y.one('#id')
333 * });
334 *
335 */
336-YUI().add('lp.indicator', function (Y) {
337-
338+YUI.add('lp.app.indicator', function (Y) {
339 var props = {
340 ATTRS: {
341 /**
342@@ -201,7 +200,7 @@
343 }
344 };
345
346- var indicator = Y.namespace('lp.indicator');
347+ var indicator = Y.namespace('lp.app.indicator');
348 indicator.OverlayIndicator = OverlayIndicator;
349 indicator.actions = actions;
350
351
352=== modified file 'lib/lp/app/javascript/indicator/tests/test_indicator.js'
353--- lib/lp/app/javascript/indicator/tests/test_indicator.js 2011-12-02 21:54:11 +0000
354+++ lib/lp/app/javascript/indicator/tests/test_indicator.js 2012-01-25 04:26:29 +0000
355@@ -33,7 +33,7 @@
356 test_target_attribute: function () {
357 // Constrain attribute should be set from passing in target.
358 var test_node = Y.one('#' + this.div_id);
359- this.indicator = new Y.lp.indicator.OverlayIndicator({
360+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
361 target: test_node
362 });
363 this.indicator.render();
364@@ -47,7 +47,7 @@
365 // We need to create some nesting to really ensure
366 // the test is good.
367 this.div.appendChild(child_div);
368- this.indicator = new Y.lp.indicator.OverlayIndicator({
369+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
370 target: child_div
371 });
372 this.indicator.render();
373@@ -60,7 +60,7 @@
374 test_indicator_has_loading_icon: function () {
375 // The indicator should have a loading image added
376 // to the contentBox.
377- this.indicator = new Y.lp.indicator.OverlayIndicator({
378+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
379 target: this.div
380 });
381 this.indicator.render();
382@@ -72,7 +72,7 @@
383
384 test_indiciator_starts_invisible: function () {
385 // Indicator widgets should start hidden.
386- this.indicator = new Y.lp.indicator.OverlayIndicator({
387+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
388 target: this.div
389 });
390 this.indicator.render();
391@@ -83,7 +83,7 @@
392
393 test_set_busy_shows_overlay: function() {
394 // setBusy should show the overlay.
395- this.indicator = new Y.lp.indicator.OverlayIndicator({
396+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
397 target: this.div
398 });
399 this.indicator.render();
400@@ -95,7 +95,7 @@
401
402 test_size_matches_on_set_busy: function() {
403 // Indicator should always resize when target changes size.
404- this.indicator = new Y.lp.indicator.OverlayIndicator({
405+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
406 target: this.div
407 });
408 this.indicator.render();
409@@ -121,7 +121,7 @@
410
411 test_position_matches_on_set_busy: function() {
412 // Indicator should always reposition itself before setBusy.
413- this.indicator = new Y.lp.indicator.OverlayIndicator({
414+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
415 target: this.div
416 });
417 this.indicator.render();
418@@ -140,7 +140,7 @@
419
420 test_success_hides_overlay: function() {
421 // Calling success should hide the overlay.
422- this.indicator = new Y.lp.indicator.OverlayIndicator({
423+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
424 target: this.div
425 });
426 this.indicator.render();
427@@ -157,7 +157,7 @@
428 var callback = function() {
429 called = true;
430 };
431- this.indicator = new Y.lp.indicator.OverlayIndicator({
432+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
433 target: this.div,
434 success_action: callback
435 });
436@@ -171,9 +171,9 @@
437 var viewport = Y.DOM.viewportRegion();
438 this.div.set('offsetWidth', viewport.right + 1000);
439 this.div.set('offsetHeight', viewport.bottom + 1000);
440- this.indicator = new Y.lp.indicator.OverlayIndicator({
441+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
442 target: this.div,
443- success_action: Y.lp.indicator.actions.scroll_to_target
444+ success_action: Y.lp.app.indicator.actions.scroll_to_target
445 });
446 this.indicator.render();
447 window.scrollTo(1000, 1000);
448@@ -188,7 +188,7 @@
449
450 test_error_hides_overlay: function () {
451 // Calling error should hide the overlay.
452- this.indicator = new Y.lp.indicator.OverlayIndicator({
453+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
454 target: this.div
455 });
456 this.indicator.render();
457@@ -205,7 +205,7 @@
458 var callback = function() {
459 called = true;
460 };
461- this.indicator = new Y.lp.indicator.OverlayIndicator({
462+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
463 target: this.div,
464 error_action: callback
465 });
466@@ -217,4 +217,4 @@
467
468 large_indicator.suite = suite;
469
470-}, '0.1', {'requires': ['test', 'lp.indicator']});
471+}, '0.1', {'requires': ['test', 'lp.app.indicator']});
472
473=== modified file 'lib/lp/app/javascript/inlinehelp/inlinehelp.js'
474--- lib/lp/app/javascript/inlinehelp/inlinehelp.js 2012-01-06 12:34:37 +0000
475+++ lib/lp/app/javascript/inlinehelp/inlinehelp.js 2012-01-25 04:26:29 +0000
476@@ -129,4 +129,4 @@
477 }
478 );
479
480-}, "0.1", { "requires": ['lazr.overlay', 'io', 'log'] });
481+}, "0.1", { "requires": ['lazr.overlay', 'io'] });
482
483=== modified file 'lib/lp/app/javascript/listing_navigator.js'
484--- lib/lp/app/javascript/listing_navigator.js 2012-01-06 13:17:34 +0000
485+++ lib/lp/app/javascript/listing_navigator.js 2012-01-25 04:26:29 +0000
486@@ -11,7 +11,6 @@
487
488 var module = Y.namespace('lp.app.listing_navigator');
489
490-
491 function empty_nodelist() {
492 return new Y.NodeList([]);
493 }
494@@ -72,9 +71,9 @@
495
496 // init the indicator plugin on the target
497 // it defaults to invisible, so safe init
498- this.indicator = new Y.lp.indicator.OverlayIndicator({
499+ this.indicator = new Y.lp.app.indicator.OverlayIndicator({
500 target: config.target.get('parentNode'),
501- success_action: Y.lp.indicator.actions.scroll_to_target
502+ success_action: Y.lp.app.indicator.actions.scroll_to_target
503 });
504
505 this.indicator.render();
506@@ -174,13 +173,13 @@
507 */
508 render: function() {
509 var current_batch = this.get_current_batch();
510- var batch_info = Mustache.to_html(this.get('batch_info_template'), {
511+ var batch_info = Y.lp.mustache.to_html(this.get('batch_info_template'), {
512 start: current_batch.start + 1,
513 end: current_batch.start +
514 current_batch.mustache_model.items.length,
515 total: current_batch.total
516 });
517- var content = Mustache.to_html(
518+ var content = Y.lp.mustache.to_html(
519 this.get('template'), this.get_render_model(current_batch));
520 this.get('target').setContent(content);
521
522@@ -518,6 +517,7 @@
523
524 }, "0.1", {
525 "requires": [
526- "node", 'lp.client', 'lp.app.errors', 'lp.indicator'
527+ "node", 'lp.client', 'lp.app.errors', 'lp.app.indicator',
528+ 'lp.mustache'
529 ]
530 });
531
532=== modified file 'lib/lp/app/javascript/multicheckbox.js'
533--- lib/lp/app/javascript/multicheckbox.js 2011-04-13 05:56:12 +0000
534+++ lib/lp/app/javascript/multicheckbox.js 2012-01-25 04:26:29 +0000
535@@ -147,7 +147,7 @@
536 var checked_html = '';
537 if (data.checked)
538 checked_html = 'checked="checked"';
539- var checkbox_html = Y.Lang.substitute(
540+ var checkbox_html = Y.Lang.sub(
541 CHECKBOX_TEMPLATE,
542 {field_name: "field."+attribute_name, field_index:i,
543 field_value: data.token, field_text: Y.Escape.html(data.name),
544
545=== modified file 'lib/lp/app/javascript/ordering/ordering.js'
546--- lib/lp/app/javascript/ordering/ordering.js 2012-01-13 16:46:46 +0000
547+++ lib/lp/app/javascript/ordering/ordering.js 2012-01-25 04:26:29 +0000
548@@ -1,6 +1,6 @@
549 /* Copyright (c) 2011, Canonical Ltd. All rights reserved. */
550
551-YUI().add('lp.ordering', function(Y) {
552+YUI.add('lp.ordering', function(Y) {
553 /**
554 * A menu bar for quickly reordering a list of items on a page.
555 * This widget is used for managing the bar, it's buttons, and
556@@ -341,7 +341,7 @@
557 for (i=0; i<len; i++) {
558 id = keys[i][0];
559 label = keys[i][1];
560- li_html = Y.Lang.substitute(
561+ li_html = Y.Lang.sub(
562 this.constructor.LI_TEMPLATE,
563 {li_id: 'sort-' + id, li_label: label});
564 li_node = Y.Node.create(li_html);
565
566=== modified file 'lib/lp/app/javascript/tests/test_ajax_batch_navigator.js'
567--- lib/lp/app/javascript/tests/test_ajax_batch_navigator.js 2011-10-14 02:12:06 +0000
568+++ lib/lp/app/javascript/tests/test_ajax_batch_navigator.js 2012-01-25 04:26:29 +0000
569@@ -33,7 +33,7 @@
570
571 makeNode: function(node_type, id, css_class) {
572 var node = Y.Node.create(
573- Y.Lang.substitute(
574+ Y.Lang.sub(
575 '<{node_type}></{node_type}>',
576 {node_type: node_type}));
577 if (id !== undefined) {
578
579=== modified file 'lib/lp/app/javascript/tests/test_beta_notification.html'
580--- lib/lp/app/javascript/tests/test_beta_notification.html 2011-11-17 20:21:03 +0000
581+++ lib/lp/app/javascript/tests/test_beta_notification.html 2012-01-25 04:26:29 +0000
582@@ -10,7 +10,7 @@
583 <script type="text/javascript"
584 src="../../../app/javascript/testing/testrunner.js"></script>
585 <script type="text/javascript"
586- src="../../../contrib/javascript/mustache.js"></script>
587+ src="../../../contrib/javascript/lp.mustache.js"></script>
588
589 <!-- The module under test. -->
590 <script type="text/javascript" src="../beta-notification.js"></script>
591
592=== modified file 'lib/lp/app/javascript/tests/test_listing_navigator.html'
593--- lib/lp/app/javascript/tests/test_listing_navigator.html 2011-12-15 17:09:48 +0000
594+++ lib/lp/app/javascript/tests/test_listing_navigator.html 2012-01-25 04:26:29 +0000
595@@ -27,7 +27,7 @@
596 src="../../../app/javascript/lp.js"></script>
597
598 <script type="text/javascript"
599- src="../../../contrib/javascript/mustache.js"></script>
600+ src="../../../contrib/javascript/lp.mustache.js"></script>
601 <script type="text/javascript"
602 src="../../../app/javascript/overlay/overlay.js"></script>
603 <script type="text/javascript"
604
605=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
606--- lib/lp/app/templates/base-layout-macros.pt 2012-01-13 09:17:11 +0000
607+++ lib/lp/app/templates/base-layout-macros.pt 2012-01-25 04:26:29 +0000
608@@ -38,9 +38,8 @@
609 revno modules/lp.app.versioninfo/revno | string:unknown;
610 icingroot string:/+icing/rev${revno};
611 devmode modules/lp.services.config/config/devmode;
612- yui string:${icingroot}/yui;
613- lazr_js string:${icingroot}/lazr/build;
614- lp_js string:${icingroot}/build"
615+ yui_version view/yui_version;
616+ yui_console_debug view/yui_console_debug;"
617 >
618 <tal:comment replace="nothing">
619 This macro just loads javascript files. It doesn't
620@@ -62,23 +61,72 @@
621 links: {}
622 };
623 </script>
624- <script type="text/javascript"
625+ <tal:js-legacy condition="not: request/features/js.combo_loader.enabled">
626+ <script type="text/javascript"
627 tal:attributes="src string:${icingroot}/build/launchpad.js"></script>
628+ <script type="text/javascript" tal:content="string:
629+ YUI.GlobalConfig = {
630+ debug: ${yui_console_debug},
631+ fetchCSS: false,
632+ timeout: 50
633+ }
634+ ">
635+ </script>
636+ </tal:js-legacy>
637
638 <script type="text/javascript"
639 tal:content="string:var cookie_scope = '${request/lp:cookie_scope}';"></script>
640- <script type="text/javascript">
641- // Define a global YUI sandbox that should be used by everyone.
642- var LPS = YUI({
643- // Don't try to fetch CSS files.
644- fetchCSS: false,
645- // For paranoia, set a low timeout to not wait on loading a resource.
646- timeout: 50
647- });
648- </script>
649+
650+ <tal:js-loader condition="request/features/js.combo_loader.enabled">
651+ <script
652+ src="/+combo/?yui/yui/yui-min.js&lp/meta.js&yui/loader/loader-min.js"></script>
653+ <script type="text/javascript" tal:content="string:
654+ YUI.GlobalConfig = {
655+ combine: true,
656+ comboBase: '/+combo/?',
657+ root: 'yui/',
658+ debug: ${yui_console_debug},
659+ fetchCSS: false,
660+ groups: {
661+ lp: {
662+ combine: true,
663+ base: '/+combo/?lp/',
664+ comboBase: '/+combo/?',
665+ root: 'lp/',
666+ // comes from including lp/meta.js
667+ modules: LP_MODULES,
668+ fetchCSS: false
669+ },
670+ yui2: {
671+ combine: true,
672+ base: '/+combo/?yui2/',
673+ comboBase: '/+combo/?',
674+ root: 'yui2/',
675+ fetchCSS: false,
676+ modules: {
677+ 'yui2-yahoo': {
678+ path: 'yahoo/yahoo.js'
679+ },
680+ 'yui2-event': {
681+ path: 'event/event.js'
682+ },
683+ 'yui2-dom': {
684+ path: 'dom/dom.js'
685+ },
686+ 'yui2-calendar': {
687+ path: 'calendar/calendar.js'
688+ },
689+ 'yui2-dom-event': {
690+ path: 'yahoo-dom-event/yahoo-dom-event.js'
691+ }
692+ }
693+ }
694+ }
695+ }">
696+ </script>
697+ </tal:js-loader>
698 </metal:load-javascript>
699
700-
701 <metal:page-javascript define-macro="page-javascript"
702 tal:define="
703 revno modules/lp.app.versioninfo/revno | string:unknown;
704@@ -91,182 +139,184 @@
705 <metal:load-lavascript use-macro="context/@@+base-layout-macros/load-javascript" />
706
707 <script id="base-layout-load-scripts" type="text/javascript">
708- LPS.use('base', 'node', 'oop', 'event', 'lp.app.beta_features',
709- 'lp.bugs.bugtask_index', 'lp.bugs.subscribers',
710- 'lp.code.branchmergeproposal.diff', 'lp.comments.hide',
711- function(Y) {
712- Y.on("domready", function () {
713- if (Y.one(document.body).hasClass('private')) {
714- Y.lp.app.privacy.setup_privacy_notification();
715- Y.lp.app.privacy.display_privacy_notification();
716- }
717- Y.lp.app.beta_features.display_beta_notification();
718- });
719- });
720-
721- LPS.use('node', 'event-delegate', 'lp', 'lp.app.foldables', 'lp.app.links',
722- 'lp.app.longpoll', 'lp.app.inlinehelp', 'lp.app.sorttable', function(Y) {
723- Y.on('load', function(e) {
724- Y.lp.app.sorttable.SortTable.init();
725- Y.lp.app.inlinehelp.init_help();
726- Y.lp.activate_collapsibles();
727- Y.lp.app.foldables.activate();
728- Y.lp.app.links.check_valid_lp_links();
729- // Longpolling will only start if
730- // LP.cache.longpoll is populated.
731- // We use Y.later to work around a Safari/Chrome 'feature':
732- // The mouse cursor stays 'busy' until all the requests started during
733- // page load are finished. Hence we want the long poll request to start
734- // right *after* the page has loaded.
735- Y.later(0, Y.lp.app.longpoll, Y.lp.app.longpoll.setupLongPollManager);
736- }, window);
737-
738- Y.on('lp:context:web_link:changed', function(e) {
739- window.location = e.new_value;
740- });
741- });
742-
743- // This code is pulled from lp.js that needs to be available on every
744- // request. Pulling here to get it outside the scope of the YUI block.
745- // Lint-safe scripting URL.
746- var VOID_URL = '_:void(0);'.replace('_', 'javascript');
747-
748- function registerLaunchpadFunction(func) {
749- // registers a function to fire onload.
750- // Use this for initilaizing any javascript that should fire once the page
751- // has been loaded.
752- LPS.use('node', function(Y) {
753- Y.on('load', function(e) {
754- func();
755- }, window);
756- });
757- }
758-
759- // Enable or disable the beta.launchpad.net redirect
760- function setBetaRedirect(enable) {
761- var expire = new Date();
762- if (enable) {
763- expire.setTime(expire.getTime() + 1000);
764- document.cookie = ('inhibit_beta_redirect=0; Expires=' +
765- expire.toGMTString() + cookie_scope);
766- alert('Redirection to the beta site has been enabled');
767- } else {
768- expire.setTime(expire.getTime() + 2 * 60 * 60 * 1000);
769- document.cookie = ('inhibit_beta_redirect=1; Expires=' +
770- expire.toGMTString() + cookie_scope);
771- alert('You will not be redirected to the beta site for 2 hours');
772- }
773- return false;
774- }
775-
776- function setFocusByName(name) {
777- // Focus the first element matching the given name which can be focused.
778- var nodes = document.getElementsByName(name);
779- var i, node;
780- for (i = 0; i < nodes.length; i++) {
781- node = nodes[i];
782- if (node.focus) {
783- try {
784- // Trying to focus a hidden element throws an error in IE8.
785- if (node.offsetHeight !== 0) {
786- node.focus();
787- }
788- } catch (e) {
789- LPS.use('console', function(Y) {
790- Y.log('In setFocusByName(<' +
791- node.tagName + ' type=' + node.type + '>): ' + e);
792- });
793- }
794- break;
795- }
796- }
797- }
798-
799- function popup_window(url, name, width, height) {
800- var iframe = document.getElementById('popup_iframe_' + name);
801- if (!iframe.src || iframe.src === VOID_URL) {
802- // The first time this handler runs the window may not have been
803- // set up yet; sort that out.
804- iframe.style.width = width + 'px';
805- iframe.style.height = height + 'px';
806- iframe.style.position = 'absolute';
807- iframe.style.background = 'white';
808- iframe.src = url;
809- }
810- iframe.style.display = 'inline';
811- // I haven't found a way of making the search form focus again when
812- // the popup window is redisplayed. I tried doing an
813- // iframe.contentDocument.searchform.search.focus()
814- // but nothing happens.. -- kiko, 2007-03-12
815- }
816-
817- function selectWidget(widget_name, event) {
818- if (event && (event.keyCode === 9 || event.keyCode === 13)) {
819- // Avoid firing if user is tabbing through or simply pressing
820- // enter to submit the form.
821- return;
822- }
823- document.getElementById(widget_name).checked = true;
824- }
825-
826- function switchBugBranchFormAndWhiteboard(id) {
827- var div = document.getElementById('bugbranch' + id);
828- var wb = document.getElementById('bugbranch' + id + '-wb');
829-
830- if (div.style.display === "none") {
831- /* Expanding the form */
832- if (wb !== null) {
833- wb.style.display = "none";
834- }
835- div.style.display = "block";
836- /* Use two focus calls to get the browser to scroll to the end of the
837- * form first, then focus back to the first field of the form.
838- */
839- document.getElementById('field'+id+'.actions.update').focus();
840- document.getElementById('field'+id+'.whiteboard').focus();
841- } else {
842- if (wb !== null) {
843- wb.style.display = "block";
844- }
845- div.style.display = "none";
846- }
847- return false;
848- }
849-
850- function switchSpecBranchFormAndSummary(id) {
851- /* The document has two identifiable elements for each
852- * spec-branch link:
853- * 'specbranchX' which is the div containing the edit form
854- * 'specbranchX-summary' which is the div contining the sumary
855- * where X is the database id of the link.
856- */
857- var div = document.getElementById('specbranch' + id);
858- var wb = document.getElementById('specbranch' + id + '-summary');
859-
860- if (div.style.display === "none") {
861- /* Expanding the form */
862- if (wb !== null) {
863- wb.style.display = "none";
864- }
865- div.style.display = "block";
866- /* Use two focus calls to get the browser to scroll to the end of the
867- * form first, then focus back to the first field of the form.
868- */
869- document.getElementById('field' + id + '.actions.change').focus();
870- document.getElementById('field' + id + '.summary').focus();
871- } else {
872- if (wb !== null) {
873- wb.style.display = "block";
874- }
875- div.style.display = "none";
876- }
877- return false;
878- }
879-
880- function updateField(field, enabled)
881- {
882- field.disabled = !enabled;
883- }
884+ YUI().use('base', 'node', 'console', 'event',
885+ 'oop', 'lp', 'lp.app.privacy',
886+ 'lp.app.beta_features', 'lp.app.foldables','lp.app.sorttable',
887+ 'lp.app.inlinehelp', 'lp.app.links', 'lp.app.longpoll',
888+ 'lp.bugs.bugtask_index', 'lp.bugs.subscribers',
889+ 'lp.code.branchmergeproposal.diff', 'lp.comments.hide',
890+ function(Y) {
891+
892+ Y.on("domready", function () {
893+ if (Y.one(document.body).hasClass('private')) {
894+ Y.lp.app.privacy.setup_privacy_notification();
895+ Y.lp.app.privacy.display_privacy_notification();
896+ }
897+ Y.lp.app.beta_features.display_beta_notification();
898+ Y.lp.app.sorttable.SortTable.init();
899+ Y.lp.app.inlinehelp.init_help();
900+ Y.lp.activate_collapsibles();
901+ Y.lp.app.foldables.activate();
902+ Y.lp.app.links.check_valid_lp_links();
903+ // Longpolling will only start if
904+ // LP.cache.longpoll is populated.
905+ // We use Y.later to work around a Safari/Chrome 'feature':
906+ // The mouse cursor stays 'busy' until all the requests started during
907+ // page load are finished. Hence we want the long poll request to start
908+ // right *after* the page has loaded.
909+ Y.later(0, Y.lp.app.longpoll, Y.lp.app.longpoll.setupLongPollManager);
910+
911+ });
912+
913+ Y.on('lp:context:web_link:changed', function(e) {
914+ window.location = e.new_value;
915+ });
916+ });
917+ </script>
918+ <script id="base-helper-functions" type="text/javascript">
919+ //<![CDATA[
920+ // This code is pulled from lp.js that needs to be available on every
921+ // request. Pulling here to get it outside the scope of the YUI block.
922+ // Lint-safe scripting URL.
923+ var VOID_URL = '_:void(0);'.replace('_', 'javascript');
924+
925+ function registerLaunchpadFunction(func) {
926+ // registers a function to fire onload.
927+ // Use this for initilaizing any javascript that should fire once the page
928+ // has been loaded.
929+ YUI().use('node', function(Y) {
930+ Y.on('load', function(e) {
931+ func();
932+ }, window);
933+ });
934+ }
935+
936+ // Enable or disable the beta.launchpad.net redirect
937+ function setBetaRedirect(enable) {
938+ var expire = new Date();
939+ if (enable) {
940+ expire.setTime(expire.getTime() + 1000);
941+ document.cookie = ('inhibit_beta_redirect=0; Expires=' +
942+ expire.toGMTString() + cookie_scope);
943+ alert('Redirection to the beta site has been enabled');
944+ } else {
945+ expire.setTime(expire.getTime() + 2 * 60 * 60 * 1000);
946+ document.cookie = ('inhibit_beta_redirect=1; Expires=' +
947+ expire.toGMTString() + cookie_scope);
948+ alert('You will not be redirected to the beta site for 2 hours');
949+ }
950+ return false;
951+ }
952+
953+ function setFocusByName(name) {
954+ // Focus the first element matching the given name which can be focused.
955+ var nodes = document.getElementsByName(name);
956+ var i, node;
957+ for (i = 0; i < nodes.length; i++) {
958+ node = nodes[i];
959+ if (node.focus) {
960+ try {
961+ // Trying to focus a hidden element throws an error in IE8.
962+ if (node.offsetHeight !== 0) {
963+ node.focus();
964+ }
965+ } catch (e) {
966+ YUI().use('console', function(Y) {
967+ Y.log('In setFocusByName(<' +
968+ node.tagName + ' type=' + node.type + '>): ' + e);
969+ });
970+ }
971+ break;
972+ }
973+ }
974+ }
975+
976+ function popup_window(url, name, width, height) {
977+ var iframe = document.getElementById('popup_iframe_' + name);
978+ if (!iframe.src || iframe.src === VOID_URL) {
979+ // The first time this handler runs the window may not have been
980+ // set up yet; sort that out.
981+ iframe.style.width = width + 'px';
982+ iframe.style.height = height + 'px';
983+ iframe.style.position = 'absolute';
984+ iframe.style.background = 'white';
985+ iframe.src = url;
986+ }
987+ iframe.style.display = 'inline';
988+ // I haven't found a way of making the search form focus again when
989+ // the popup window is redisplayed. I tried doing an
990+ // iframe.contentDocument.searchform.search.focus()
991+ // but nothing happens.. -- kiko, 2007-03-12
992+ }
993+
994+ function selectWidget(widget_name, event) {
995+ if (event && (event.keyCode === 9 || event.keyCode === 13)) {
996+ // Avoid firing if user is tabbing through or simply pressing
997+ // enter to submit the form.
998+ return;
999+ }
1000+ document.getElementById(widget_name).checked = true;
1001+ }
1002+
1003+ function switchBugBranchFormAndWhiteboard(id) {
1004+ var div = document.getElementById('bugbranch' + id);
1005+ var wb = document.getElementById('bugbranch' + id + '-wb');
1006+
1007+ if (div.style.display === "none") {
1008+ /* Expanding the form */
1009+ if (wb !== null) {
1010+ wb.style.display = "none";
1011+ }
1012+ div.style.display = "block";
1013+ /* Use two focus calls to get the browser to scroll to the end of the
1014+ * form first, then focus back to the first field of the form.
1015+ */
1016+ document.getElementById('field'+id+'.actions.update').focus();
1017+ document.getElementById('field'+id+'.whiteboard').focus();
1018+ } else {
1019+ if (wb !== null) {
1020+ wb.style.display = "block";
1021+ }
1022+ div.style.display = "none";
1023+ }
1024+ return false;
1025+ }
1026+
1027+ function switchSpecBranchFormAndSummary(id) {
1028+ /* The document has two identifiable elements for each
1029+ * spec-branch link:
1030+ * 'specbranchX' which is the div containing the edit form
1031+ * 'specbranchX-summary' which is the div contining the sumary
1032+ * where X is the database id of the link.
1033+ */
1034+ var div = document.getElementById('specbranch' + id);
1035+ var wb = document.getElementById('specbranch' + id + '-summary');
1036+
1037+ if (div.style.display === "none") {
1038+ /* Expanding the form */
1039+ if (wb !== null) {
1040+ wb.style.display = "none";
1041+ }
1042+ div.style.display = "block";
1043+ /* Use two focus calls to get the browser to scroll to the end of the
1044+ * form first, then focus back to the first field of the form.
1045+ */
1046+ document.getElementById('field' + id + '.actions.change').focus();
1047+ document.getElementById('field' + id + '.summary').focus();
1048+ } else {
1049+ if (wb !== null) {
1050+ wb.style.display = "block";
1051+ }
1052+ div.style.display = "none";
1053+ }
1054+ return false;
1055+ }
1056+
1057+ function updateField(field, enabled)
1058+ {
1059+ field.disabled = !enabled;
1060+ }
1061+ //]]>
1062 </script>
1063 </metal:page-javascript>
1064
1065
1066=== modified file 'lib/lp/app/templates/base-layout.pt'
1067--- lib/lp/app/templates/base-layout.pt 2011-12-29 05:29:36 +0000
1068+++ lib/lp/app/templates/base-layout.pt 2012-01-25 04:26:29 +0000
1069@@ -21,10 +21,7 @@
1070 xmlns:metal="http://xml.zope.org/namespaces/metal"
1071 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
1072 xml:lang="en" lang="en" dir="ltr">
1073- <head tal:define="
1074- yui string:${icingroot}/yui/current/build;
1075- lazr_js string:${icingroot}/lazr/build;
1076- lp_js string:${icingroot}/build">
1077+ <head>
1078 <title tal:content="view/fmt:pagetitle">Page Title</title>
1079 <link rel="shortcut icon" href="/@@/launchpad.png" />
1080 <link
1081@@ -209,7 +206,7 @@
1082 replace='structure string:&lt;script type="text/javascript"&gt;
1083 start_ajax_logging();
1084 var render_time = "${render_time}";
1085- LPS.use("node", function(Y) {
1086+ YUI().use("node", function(Y) {
1087 Y.on("domready", function() {
1088 var node = Y.one("#rendertime");
1089 node.set("innerHTML", render_time);
1090
1091=== modified file 'lib/lp/app/templates/boolean-choice-widget.pt'
1092--- lib/lp/app/templates/boolean-choice-widget.pt 2011-03-10 00:40:15 +0000
1093+++ lib/lp/app/templates/boolean-choice-widget.pt 2012-01-25 04:26:29 +0000
1094@@ -10,7 +10,7 @@
1095
1096 <script tal:condition="view/can_write"
1097 tal:content="structure string:
1098-LPS.use('lp.app.choice', function(Y) {
1099+YUI().use('lp.app.choice', function(Y) {
1100 Y.lp.app.choice.addBinaryChoice(
1101 ${view/json_config},
1102 ${view/json_resource_uri},
1103
1104=== modified file 'lib/lp/app/templates/enum-choice-widget.pt'
1105--- lib/lp/app/templates/enum-choice-widget.pt 2011-03-10 00:40:15 +0000
1106+++ lib/lp/app/templates/enum-choice-widget.pt 2012-01-25 04:26:29 +0000
1107@@ -9,7 +9,7 @@
1108 </span>
1109 <script tal:condition="view/can_write"
1110 tal:content="structure string:
1111-LPS.use('lp.app.choice', function(Y) {
1112+YUI().use('lp.app.choice', function(Y) {
1113 Y.lp.app.choice.addEnumChoice(
1114 ${view/json_config},
1115 ${view/json_resource_uri},
1116
1117=== modified file 'lib/lp/app/templates/inline-multicheckbox-widget.pt'
1118--- lib/lp/app/templates/inline-multicheckbox-widget.pt 2011-04-25 18:16:19 +0000
1119+++ lib/lp/app/templates/inline-multicheckbox-widget.pt 2012-01-25 04:26:29 +0000
1120@@ -31,7 +31,7 @@
1121 </span>
1122 <script tal:condition="view/can_write"
1123 tal:content="string:
1124-LPS.use('lp.app.multicheckbox', function(Y) {
1125+YUI().use('lp.app.multicheckbox', function(Y) {
1126 if (Y.UA.ie) {
1127 return;
1128 }
1129
1130=== modified file 'lib/lp/app/templates/inline-picker.pt'
1131--- lib/lp/app/templates/inline-picker.pt 2011-12-15 16:09:03 +0000
1132+++ lib/lp/app/templates/inline-picker.pt 2012-01-25 04:26:29 +0000
1133@@ -29,7 +29,7 @@
1134
1135 <script tal:condition="view/can_write"
1136 tal:content="structure string:
1137-LPS.use('lp.app.picker', 'lp.client', function(Y) {
1138+YUI().use('lp.app.picker', 'lp.client', function(Y) {
1139 if (Y.UA.ie) {
1140 return;
1141 }
1142
1143=== modified file 'lib/lp/app/templates/launchpad-databaseunavailable.pt'
1144--- lib/lp/app/templates/launchpad-databaseunavailable.pt 2011-12-07 04:57:36 +0000
1145+++ lib/lp/app/templates/launchpad-databaseunavailable.pt 2012-01-25 04:26:29 +0000
1146@@ -159,7 +159,7 @@
1147 "
1148 ></script>
1149 <script id="load-status" type="text/javascript">
1150-LPS.use('node', 'io-xdr', 'json-parse', 'datatype-date', function(Y) {
1151+YUI().use('node', 'io-xdr', 'json-parse', 'datatype-date', function(Y) {
1152 var tag = function(name) {
1153 return Y.Node.create('<'+name+'/>');
1154 }
1155
1156=== modified file 'lib/lp/app/templates/launchpad-widget-macros.pt'
1157--- lib/lp/app/templates/launchpad-widget-macros.pt 2010-11-10 15:33:47 +0000
1158+++ lib/lp/app/templates/launchpad-widget-macros.pt 2012-01-25 04:26:29 +0000
1159@@ -91,6 +91,17 @@
1160 <tal:yui2resources
1161 tal:define="yui2 string:${icingroot}/yui_2.7.0b/build;">
1162
1163+ <script type="text/javascript">
1164+ YUI().use(
1165+ 'lang', 'node', 'lp.app.calendar', 'yui2-yahoo',
1166+ 'yui2-event', 'yui2-dom', 'yui2-calendar', 'yui2-dom-event',
1167+ function(Y) {
1168+ Y.lp.app.calendar.setup_calendar_widgets();
1169+ }
1170+ );
1171+ </script>
1172+
1173+ <tal:js-legacy condition="not: features/js.combo_loader.enabled">
1174 <tal:devmode condition="devmode">
1175 <script type="text/javascript"
1176 tal:attributes="src string:${yui2}/yahoo/yahoo.js"></script>
1177@@ -100,8 +111,6 @@
1178 tal:attributes="src string:${yui2}/dom/dom.js"></script>
1179 <script type="text/javascript"
1180 tal:attributes="src string:${yui2}/calendar/calendar.js"></script>
1181- <script type="text/javascript"
1182- tal:attributes="src string:${lp_js}/app/calendar.js"></script>
1183 </tal:devmode>
1184 <tal:nondevmode condition="not: devmode">
1185 <script type="text/javascript"
1186@@ -109,17 +118,12 @@
1187 <script type="text/javascript"
1188 tal:attributes="src string:${yui2}/calendar/calendar-min.js"></script>
1189 </tal:nondevmode>
1190-
1191+ </tal:js-legacy>
1192 <link rel="stylesheet" type="text/css"
1193 tal:attributes="href
1194 string:${yui2}/calendar/assets/skins/sam/calendar.css" />
1195 </tal:yui2resources>
1196
1197- <script type="text/javascript">
1198- LPS.use('node', 'lp.app.calendar', function(Y) {
1199- Y.lp.app.calendar.setup_calendar_widgets();
1200- });
1201- </script>
1202 </metal:yui2calendar-dependencies>
1203
1204 </tal:root>
1205
1206=== modified file 'lib/lp/app/templates/root-index.pt'
1207--- lib/lp/app/templates/root-index.pt 2011-03-04 00:08:20 +0000
1208+++ lib/lp/app/templates/root-index.pt 2012-01-25 04:26:29 +0000
1209@@ -146,9 +146,11 @@
1210 <input id="text" type="text" name="field.text" size="25%" />
1211 <input id="search" type="submit" value="Search Launchpad" />
1212 </form>
1213- <script type="text/javascript"><!--
1214- setFocusByName('field.text');
1215- // --></script>
1216+ <script type="text/javascript">
1217+ YUI().use('lp', function () {
1218+ setFocusByName('field.text');
1219+ });
1220+ </script>
1221 <div id="homepage-stats" tal:content="cache:public, 1 hour">
1222 <strong
1223 tal:content="view/project_count/fmt:intcomma">123</strong>&nbsp;projects,
1224
1225=== modified file 'lib/lp/app/templates/text-area-editor.pt'
1226--- lib/lp/app/templates/text-area-editor.pt 2011-03-10 00:40:15 +0000
1227+++ lib/lp/app/templates/text-area-editor.pt 2012-01-25 04:26:29 +0000
1228@@ -16,7 +16,7 @@
1229 tal:content="structure view/value">some text</div>
1230 <script tal:condition="view/can_write"
1231 tal:content="structure string:
1232- LPS.use('lazr.editor', 'lp.client.plugins', function (Y) {
1233+ YUI().use('lazr.editor', 'lp.client.plugins', function (Y) {
1234 var widget = new Y.EditableText({
1235 contentBox: ${view/widget_css_selector},
1236 accept_empty: ${view/accept_empty},
1237
1238=== modified file 'lib/lp/app/templates/text-line-editor.pt'
1239--- lib/lp/app/templates/text-line-editor.pt 2011-03-10 00:40:15 +0000
1240+++ lib/lp/app/templates/text-line-editor.pt 2012-01-25 04:26:29 +0000
1241@@ -8,7 +8,7 @@
1242
1243 <script tal:condition="view/can_write"
1244 tal:content="structure string:
1245- LPS.use('lazr.editor', 'lp.client.plugins', function (Y) {
1246+ YUI().use('lazr.editor', 'lp.client.plugins', function (Y) {
1247 var widget = new Y.EditableText({
1248 contentBox: ${view/widget_css_selector},
1249 accept_empty: ${view/accept_empty},
1250
1251=== modified file 'lib/lp/app/widgets/doc/location-widget.txt'
1252--- lib/lp/app/widgets/doc/location-widget.txt 2011-12-29 05:29:36 +0000
1253+++ lib/lp/app/widgets/doc/location-widget.txt 2012-01-25 04:26:29 +0000
1254@@ -62,8 +62,15 @@
1255 9
1256 >>> widget.center_lat
1257 52...
1258- >>> widget.center_lng
1259- 0.29...
1260+
1261+This next test fails in ec2 but passes locally. On ec2, the printed value
1262+was 0.2999999. The round() should have fixed that. Testing shows that
1263+round() is broken in Python 2.6 and works in 2.7
1264+We'll disable this for now and fix in a cleanup branch.
1265+
1266+round(widget.center_lng, 5)
1267+0.3...
1268+
1269 >>> widget.show_marker
1270 1
1271
1272@@ -166,7 +173,7 @@
1273 >>> print widget.map_javascript
1274 <BLANKLINE>
1275 <script type="text/javascript">
1276- LPS.use('node', 'lp.app.mapping', function(Y) {
1277+ YUI().use('node', 'lp.app.mapping', function(Y) {
1278 function renderMap() {
1279 Y.lp.app.mapping.renderPersonMap(
1280 52.2, 0.3, "Colin Watson",
1281
1282=== modified file 'lib/lp/app/widgets/location.py'
1283--- lib/lp/app/widgets/location.py 2012-01-01 02:58:52 +0000
1284+++ lib/lp/app/widgets/location.py 2012-01-25 04:26:29 +0000
1285@@ -132,7 +132,7 @@
1286 show_marker=self.show_marker)
1287 return """
1288 <script type="text/javascript">
1289- LPS.use('node', 'lp.app.mapping', function(Y) {
1290+ YUI().use('node', 'lp.app.mapping', function(Y) {
1291 function renderMap() {
1292 Y.lp.app.mapping.renderPersonMap(
1293 %(center_lat)s, %(center_lng)s, %(displayname)s,
1294
1295=== modified file 'lib/lp/app/widgets/templates/bugtracker-picker.pt'
1296--- lib/lp/app/widgets/templates/bugtracker-picker.pt 2011-04-16 00:52:07 +0000
1297+++ lib/lp/app/widgets/templates/bugtracker-picker.pt 2012-01-25 04:26:29 +0000
1298@@ -5,7 +5,7 @@
1299
1300 <metal:form-picker use-macro="context/@@form-picker-macros/form-picker"/>
1301 <script tal:content="structure string:
1302-LPS.use('lp.bugs.bugtracker_overlay', function(Y) {
1303+YUI().use('lp.bugs.bugtracker_overlay', function(Y) {
1304 if (Y.UA.ie) {
1305 return;
1306 }
1307
1308=== modified file 'lib/lp/app/widgets/templates/form-picker-macros.pt'
1309--- lib/lp/app/widgets/templates/form-picker-macros.pt 2011-10-31 08:09:56 +0000
1310+++ lib/lp/app/widgets/templates/form-picker-macros.pt 2012-01-25 04:26:29 +0000
1311@@ -19,7 +19,7 @@
1312 />
1313 </select>
1314 <script type="text/javascript" tal:content="string:
1315- LPS.use('node', 'lp.app.picker', function(Y) {
1316+ YUI().use('node', 'lp.app.picker', function(Y) {
1317 var text_input = Y.DOM.byId('${view/name}');
1318 var select_menu = Y.DOM.byId('${suggestion_id}');
1319 Y.lp.app.picker.connect_select_menu(
1320@@ -30,7 +30,7 @@
1321
1322 <tal:chooseLink replace="structure view/chooseLink" />
1323 <script tal:content="structure string:
1324- LPS.use('node', 'lp.app.picker', function(Y) {
1325+ YUI().use('node', 'lp.app.picker', function(Y) {
1326 if (Y.UA.ie) {
1327 return;
1328 }
1329
1330=== modified file 'lib/lp/app/widgets/templates/license.pt'
1331--- lib/lp/app/widgets/templates/license.pt 2011-12-29 05:29:36 +0000
1332+++ lib/lp/app/widgets/templates/license.pt 2012-01-25 04:26:29 +0000
1333@@ -26,7 +26,7 @@
1334 // and breaks with every YUI/lazr-js upgrade.
1335 // Tread carefully, or else please make this better
1336 // and add tests, too (preferably in reverse order there.)
1337-LPS.use('node', 'lazr.effects', function(Y) {
1338+YUI().use('node', 'lazr.effects', function(Y) {
1339 Y.on('domready', function() {
1340 function make_slider(cfg) {
1341 var table_name = '#' + cfg.which;
1342
1343=== modified file 'lib/lp/blueprints/templates/specification-index.pt'
1344--- lib/lp/blueprints/templates/specification-index.pt 2011-08-25 06:32:24 +0000
1345+++ lib/lp/blueprints/templates/specification-index.pt 2012-01-25 04:26:29 +0000
1346@@ -320,7 +320,7 @@
1347 </div>
1348
1349 <script type="text/javascript">
1350- LPS.use('lp.anim', 'lp.ui', function(Y) {
1351+ YUI().use('lp.anim', 'lp.ui', function(Y) {
1352
1353 Y.on('lp:context:implementation_status:changed', function(e) {
1354 var icon = Y.one('#informational-icon');
1355
1356=== modified file 'lib/lp/blueprints/templates/specifications-index.pt'
1357--- lib/lp/blueprints/templates/specifications-index.pt 2011-05-26 22:01:35 +0000
1358+++ lib/lp/blueprints/templates/specifications-index.pt 2012-01-25 04:26:29 +0000
1359@@ -64,9 +64,11 @@
1360 </tbody>
1361 </table>
1362 </form>
1363- <script type="text/javascript"><!--
1364- setFocusByName('field.search_text');
1365- // --></script>
1366+ <script type="text/javascript">
1367+ YUI().use('lp', function (Y) {
1368+ setFocusByName('field.search_text');
1369+ });
1370+ </script>
1371
1372 <tal:searchresults condition="view/searchrequested"
1373 define="specs view/specs" >
1374
1375=== modified file 'lib/lp/bugs/browser/bugalsoaffects.py'
1376--- lib/lp/bugs/browser/bugalsoaffects.py 2012-01-03 00:28:55 +0000
1377+++ lib/lp/bugs/browser/bugalsoaffects.py 2012-01-25 04:26:29 +0000
1378@@ -193,7 +193,7 @@
1379 structured("""
1380 There is no project in Launchpad named "%s". Please
1381 <a href="/projects"
1382- onclick="LPS.use('event').Event.simulate(
1383+ onclick="YUI().use('event').Event.simulate(
1384 document.getElementById('%s'), 'click');
1385 return false;"
1386 >search for it</a> as it may be
1387
1388=== modified file 'lib/lp/bugs/javascript/bug_tags_entry.js'
1389--- lib/lp/bugs/javascript/bug_tags_entry.js 2012-01-05 18:25:04 +0000
1390+++ lib/lp/bugs/javascript/bug_tags_entry.js 2012-01-25 04:26:29 +0000
1391@@ -97,11 +97,11 @@
1392 official_tags.sort();
1393 unofficial_tags.sort();
1394 var tags_html = Y.Array(official_tags).map(function(tag) {
1395- return Y.Lang.substitute(
1396+ return Y.Lang.sub(
1397 '<a href="{tag_url}" class="official-tag">{tag}</a>',
1398 {tag_url: base_url + tag, tag: tag});
1399 }).join(' ') + ' ' + Y.Array(unofficial_tags).map(function(tag) {
1400- return Y.Lang.substitute(
1401+ return Y.Lang.sub(
1402 '<a href="{tag_url}" class="unofficial-tag">{tag}</a>',
1403 {tag_url: base_url + tag, tag: tag});
1404 }).join(' ');
1405
1406=== modified file 'lib/lp/bugs/javascript/buglisting.js'
1407--- lib/lp/bugs/javascript/buglisting.js 2011-12-23 16:34:48 +0000
1408+++ lib/lp/bugs/javascript/buglisting.js 2012-01-25 04:26:29 +0000
1409@@ -224,5 +224,5 @@
1410
1411 }, "0.1", {
1412 "requires": [
1413- "history", "node", 'lp.app.listing_navigator', 'lp.app.inlinehelp']
1414+ "history", "node", 'lp.app.listing_navigator', 'lp.app.inlinehelp', 'lp.app.indicator']
1415 });
1416
1417=== modified file 'lib/lp/bugs/javascript/buglisting_utils.js'
1418--- lib/lp/bugs/javascript/buglisting_utils.js 2012-01-13 16:46:46 +0000
1419+++ lib/lp/bugs/javascript/buglisting_utils.js 2012-01-25 04:26:29 +0000
1420@@ -1,6 +1,6 @@
1421 /* Copyright (c) 2011, Canonical Ltd. All rights reserved. */
1422
1423-YUI().add('lp.buglisting_utils', function(Y) {
1424+YUI.add('lp.buglisting_utils', function(Y) {
1425 /**
1426 * A utility for configuring the display of bug listings.
1427 *
1428@@ -154,7 +154,7 @@
1429 } else {
1430 checked = '';
1431 }
1432- input_html = Y.Lang.substitute(
1433+ input_html = Y.Lang.sub(
1434 this.constructor.INPUT_TEMPLATE,
1435 {name: name, display_name: display_name,
1436 checked: checked});
1437
1438=== modified file 'lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js'
1439--- lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js 2011-12-21 08:26:19 +0000
1440+++ lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js 2012-01-25 04:26:29 +0000
1441@@ -73,4 +73,4 @@
1442 }
1443 };
1444
1445-}, "0.1", {"requires": ["node", 'io-base']});
1446+}, "0.1", {"requires": ["node", 'io-base', 'lp.client']});
1447
1448=== modified file 'lib/lp/bugs/javascript/bugtask_index.js'
1449--- lib/lp/bugs/javascript/bugtask_index.js 2012-01-10 17:01:38 +0000
1450+++ lib/lp/bugs/javascript/bugtask_index.js 2012-01-25 04:26:29 +0000
1451@@ -147,7 +147,10 @@
1452 // XXX Abel Deuring 2009-04-23, bug 365462
1453 // Y.one('#field.private') returns null.
1454 // Seems that YUI does not like IDs containing a '.'
1455- document.getElementById('field.private').focus();
1456+ var field_private = document.getElementById('field.private');
1457+ if (field_private !== null) {
1458+ field_private.focus();
1459+ }
1460 }
1461 });
1462 privacy_link.addClass('js-action');
1463@@ -740,7 +743,7 @@
1464 ' <strong>Please confirm you really want to do this.</strong>',
1465 '</p>'
1466 ].join('');
1467- var delete_text = Y.Lang.substitute(delete_text_template,
1468+ var delete_text = Y.Lang.sub(delete_text_template,
1469 {bug: conf.bug_title, target: conf.targetname});
1470 var co = new Y.lp.app.confirmationoverlay.ConfirmationOverlay({
1471 submit_fn: function() {
1472@@ -788,10 +791,10 @@
1473 // be 404. In this case, we remove the affected row and display a
1474 // informational message to the user.
1475 if( response.status === 404) {
1476- var message = Y.Lang.substitute(
1477+ var message = Y.Lang.sub(
1478 "Bug task affecting {targetname} has already been deleted.",
1479 {targetname: LP.cache.bugtask_data[bugtask_id].targetname});
1480- var notification = Y.Lang.substitute(
1481+ var notification = Y.Lang.sub(
1482 '[[20, "{message}"]]', {message: message});
1483 Y.lp.client.display_notifications(notification);
1484 animate_deletion(function() {
1485@@ -1095,7 +1098,7 @@
1486 "assigned bugs in {pillar}.</p>" +
1487 "<p>Do you really want to assign them to this bug?"+
1488 "</p>";
1489- var yesno_content = Y.Lang.substitute(
1490+ var yesno_content = Y.Lang.sub(
1491 yesno_content_template,
1492 {person_name: person, pillar: pillar});
1493 Y.lp.app.picker.yesno_save_confirmation(
1494
1495=== modified file 'lib/lp/bugs/javascript/official_bug_tags.js'
1496--- lib/lp/bugs/javascript/official_bug_tags.js 2010-12-09 16:20:20 +0000
1497+++ lib/lp/bugs/javascript/official_bug_tags.js 2012-01-25 04:26:29 +0000
1498@@ -164,7 +164,7 @@
1499 item.count = '';
1500 }
1501 item._tag_id = mangle_id(item.tag);
1502- var li_html = Y.Lang.substitute([
1503+ var li_html = Y.Lang.sub([
1504 '<li id="tag-{_tag_id}">',
1505 ' <input type="checkbox" id="tag-checkbox-{_tag_id}" />',
1506 ' <label for="tag-checkbox-{_tag_id}">',
1507@@ -353,7 +353,7 @@
1508 var overlay = new Y.lazr.PrettyOverlay({
1509 headerContent: '<span class="official-tag-error-message-header">' +
1510 '<img src="/@@/error" />&nbsp;Invalid Tag</span>',
1511- bodyContent: Y.Lang.substitute(ERROR_MSG, {new_tag: new_tag}),
1512+ bodyContent: Y.Lang.sub(ERROR_MSG, {new_tag: new_tag}),
1513 align: {
1514 points: [Y.WidgetPositionAlign.CC, Y.WidgetPositionAlign.CC]
1515 },
1516
1517=== modified file 'lib/lp/bugs/javascript/tests/test_buglisting.html'
1518--- lib/lp/bugs/javascript/tests/test_buglisting.html 2012-01-05 21:13:29 +0000
1519+++ lib/lp/bugs/javascript/tests/test_buglisting.html 2012-01-25 04:26:29 +0000
1520@@ -28,7 +28,7 @@
1521 src="../../../app/javascript/lp.js"></script>
1522
1523 <script type="text/javascript"
1524- src="../../../contrib/javascript/mustache.js"></script>
1525+ src="../../../contrib/javascript/lp.mustache.js"></script>
1526 <script type="text/javascript"
1527 src="../../../app/javascript/overlay/overlay.js"></script>
1528 <script type="text/javascript"
1529
1530=== modified file 'lib/lp/bugs/templates/bug-portlet-subscription.pt'
1531--- lib/lp/bugs/templates/bug-portlet-subscription.pt 2011-11-26 04:03:29 +0000
1532+++ lib/lp/bugs/templates/bug-portlet-subscription.pt 2012-01-25 04:26:29 +0000
1533@@ -51,7 +51,7 @@
1534 </ul>
1535 </div>
1536 <script type="text/javascript">
1537- LPS.use('io-base', 'node',
1538+ YUI().use('io-base', 'node',
1539 'lp.bugs.bugtask_index.portlets.subscription', function(Y) {
1540 // Must be done inline here to ensure the load event fires.
1541 // This is a work around for a YUI3 issue with event handling.
1542
1543=== modified file 'lib/lp/bugs/templates/bug-subscription-list.pt'
1544--- lib/lp/bugs/templates/bug-subscription-list.pt 2011-06-16 13:50:58 +0000
1545+++ lib/lp/bugs/templates/bug-subscription-list.pt 2012-01-25 04:26:29 +0000
1546@@ -13,7 +13,7 @@
1547 <head>
1548 <tal:head-epilogue metal:fill-slot="head_epilogue">
1549 <script type="text/javascript">
1550- LPS.use('lp.registry.structural_subscription', 'lp.bugs.subscription',
1551+ YUI().use('lp.registry.structural_subscription', 'lp.bugs.subscription',
1552 function(Y) {
1553 var ss_module = Y.lp.registry.structural_subscription;
1554 var info_module = Y.lp.bugs.subscription;
1555
1556=== modified file 'lib/lp/bugs/templates/bug-subscription.pt'
1557--- lib/lp/bugs/templates/bug-subscription.pt 2011-06-01 22:38:01 +0000
1558+++ lib/lp/bugs/templates/bug-subscription.pt 2012-01-25 04:26:29 +0000
1559@@ -11,12 +11,8 @@
1560 >
1561
1562 <metal:block fill-slot="head_epilogue">
1563- <script type="text/javascript"
1564- tal:condition="devmode"
1565- tal:content="string:var yui_base='${yui}';"></script>
1566-
1567 <script type="text/javascript">
1568- LPS.use('base', 'node', 'oop', 'event',
1569+ YUI().use('base', 'node', 'oop', 'event',
1570 'lp.bugs.bug_notification_level',
1571 function(Y) {
1572 Y.on('domready', function () {
1573
1574=== modified file 'lib/lp/bugs/templates/bugcomment-macros.pt'
1575--- lib/lp/bugs/templates/bugcomment-macros.pt 2011-11-14 04:07:15 +0000
1576+++ lib/lp/bugs/templates/bugcomment-macros.pt 2012-01-25 04:26:29 +0000
1577@@ -116,7 +116,7 @@
1578 comment_form/actions/field.actions.save/render" />
1579 </form>
1580 <script type="text/javascript">
1581- LPS.use('lp.app.comment', function(Y) {
1582+ YUI().use('lp.app.comment', function(Y) {
1583 var comment = new Y.lp.app.comment.Comment();
1584 comment.render();
1585 });
1586
1587=== modified file 'lib/lp/bugs/templates/buglisting-default.pt'
1588--- lib/lp/bugs/templates/buglisting-default.pt 2011-12-08 13:23:00 +0000
1589+++ lib/lp/bugs/templates/buglisting-default.pt 2012-01-25 04:26:29 +0000
1590@@ -1,24 +1,24 @@
1591 <html
1592- xmlns="http://www.w3.org/1999/xhtml"
1593- xmlns:tal="http://xml.zope.org/namespaces/tal"
1594- xmlns:metal="http://xml.zope.org/namespaces/metal"
1595- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
1596- metal:use-macro="view/macro:page/main_side"
1597- i18n:domain="malone"
1598+xmlns="http://www.w3.org/1999/xhtml"
1599+xmlns:tal="http://xml.zope.org/namespaces/tal"
1600+xmlns:metal="http://xml.zope.org/namespaces/metal"
1601+xmlns:i18n="http://xml.zope.org/namespaces/i18n"
1602+metal:use-macro="view/macro:page/main_side"
1603+i18n:domain="malone"
1604 >
1605
1606 <metal:block fill-slot="head_epilogue">
1607- <meta condition="not: view/should_show_bug_information"
1608- name="robots" content="noindex,nofollow" />
1609+<meta condition="not: view/should_show_bug_information"
1610+ name="robots" content="noindex,nofollow" />
1611
1612- <tal:comment replace="nothing">
1613- The javascript below should only be executed (or indeed even exist)
1614- when the bug subscription links exist. They don't exist on the
1615- advanced search form, so we don't show the js for that case.
1616- </tal:comment>
1617- <script type="text/javascript"
1618- tal:condition="not: view/shouldShowAdvancedForm">
1619- LPS.use('lp.registry.structural_subscription', function(Y) {
1620+<tal:comment replace="nothing">
1621+ The javascript below should only be executed (or indeed even exist)
1622+ when the bug subscription links exist. They don't exist on the
1623+ advanced search form, so we don't show the js for that case.
1624+</tal:comment>
1625+<script type="text/javascript"
1626+ tal:condition="not: view/shouldShowAdvancedForm">
1627+ YUI().use('lp.registry.structural_subscription', function(Y) {
1628 Y.on('domready', function() {
1629 Y.lp.registry.structural_subscription.setup(
1630 {content_box: "#structural-subscription-content-box"});
1631
1632=== modified file 'lib/lp/bugs/templates/bugs-listing-table.pt'
1633--- lib/lp/bugs/templates/bugs-listing-table.pt 2011-11-02 19:15:59 +0000
1634+++ lib/lp/bugs/templates/bugs-listing-table.pt 2012-01-25 04:26:29 +0000
1635@@ -33,7 +33,7 @@
1636 <tal:comment
1637 tal:condition="request/features/ajax.batch_navigator.enabled"
1638 replace='structure string:&lt;script type="text/javascript"&gt;
1639- LPS.use("lp.app.batchnavigator",
1640+ YUI().use("lp.app.batchnavigator",
1641 function(Y) {
1642 Y.on("domready", function () {
1643 var config = {
1644
1645=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-search.pt'
1646--- lib/lp/bugs/templates/bugtarget-filebug-search.pt 2011-11-30 16:55:21 +0000
1647+++ lib/lp/bugs/templates/bugtarget-filebug-search.pt 2012-01-25 04:26:29 +0000
1648@@ -7,12 +7,8 @@
1649
1650 <metal:block fill-slot="head_epilogue">
1651 <script type="text/javascript"
1652- tal:condition="devmode"
1653- tal:content="string:var yui_base='${yui}';"></script>
1654-
1655- <script type="text/javascript"
1656 tal:condition="context/enable_bugfiling_duplicate_search">
1657- LPS.use(
1658+ YUI().use(
1659 'base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
1660 function(Y) {
1661 Y.lp.bugs.filebug_dupefinder.setup_dupe_finder();
1662
1663=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt'
1664--- lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt 2011-11-30 16:55:21 +0000
1665+++ lib/lp/bugs/templates/bugtarget-filebug-submit-bug.pt 2012-01-25 04:26:29 +0000
1666@@ -6,11 +6,8 @@
1667 metal:use-macro="view/macro:page/main_only">
1668
1669 <metal:block fill-slot="head_epilogue">
1670- <script type="text/javascript"
1671- tal:condition="devmode"
1672- tal:content="string:var yui_base='${yui}';"></script>
1673 <script type="text/javascript">
1674- LPS.use('base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
1675+ YUI().use('base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
1676 function(Y) {
1677 Y.on('domready', function() {
1678 Y.lp.bugs.filebug_dupefinder.setup_dupes();
1679
1680=== modified file 'lib/lp/bugs/templates/bugtarget-macros-filebug.pt'
1681--- lib/lp/bugs/templates/bugtarget-macros-filebug.pt 2011-12-01 16:58:16 +0000
1682+++ lib/lp/bugs/templates/bugtarget-macros-filebug.pt 2012-01-25 04:26:29 +0000
1683@@ -330,7 +330,7 @@
1684 <metal:privacy define-macro="bug-reporting-privacy">
1685 <tal:private condition="view/isPrivate">
1686 <script type="text/javascript">
1687- LPS.use('lp.app.privacy', function(Y) {
1688+ YUI().use('lp.app.privacy', function(Y) {
1689 Y.on('domready', function() {
1690 var cfg = {
1691 notification_text: "This report will be private. "
1692@@ -344,7 +344,7 @@
1693 </tal:private>
1694 <tal:not-private condition="not:view/isPrivate">
1695 <script type="text/javascript">
1696- LPS.use('lp.app.privacy', 'lp.bugs.filebug_dupefinder', function(Y) {
1697+ YUI().use('lp.app.privacy', 'lp.bugs.filebug_dupefinder', function(Y) {
1698 Y.on('domready', function() {
1699 var cfg = {
1700 notification_text: "This report will be private "
1701
1702=== modified file 'lib/lp/bugs/templates/bugtarget-patches.pt'
1703--- lib/lp/bugs/templates/bugtarget-patches.pt 2011-07-01 11:39:14 +0000
1704+++ lib/lp/bugs/templates/bugtarget-patches.pt 2012-01-25 04:26:29 +0000
1705@@ -20,7 +20,7 @@
1706 tal:attributes="action string:${context/fmt:url}/+patches">
1707
1708 <script type="text/javascript">
1709- LPS.use('base', 'node', 'event', function(Y) {
1710+ YUI().use('base', 'node', 'event', function(Y) {
1711 Y.on('domready', function(e) {
1712 Y.one('#sort-button').setStyle('display', 'none');
1713 Y.one('#orderby').on('change', function(e) {
1714@@ -87,7 +87,7 @@
1715 <p tal:content="string:${patch/title}"></p>
1716 </div>
1717 <script type="text/javascript" tal:content="string:
1718- LPS.use('base', 'node', 'event', function(Y) {
1719+ YUI().use('base', 'node', 'event', function(Y) {
1720 Y.on('domready', function(e) {
1721 var cell_id = '#patch-cell-${repeat/patch_task/index}';
1722 var target_id = '#patch-popup-${repeat/patch_task/index}';
1723
1724=== modified file 'lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt'
1725--- lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt 2011-06-16 13:50:58 +0000
1726+++ lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt 2012-01-25 04:26:29 +0000
1727@@ -55,7 +55,7 @@
1728 </tbody>
1729 </table>
1730 <script type="text/javascript">
1731- LPS.use('io-base', 'node', function(Y) {
1732+ YUI().use('io-base', 'node', function(Y) {
1733 Y.on('domready', function() {
1734 var url = Y.one('#bugtarget-bugfilters-link').getAttribute('href');
1735 var handlers = {
1736
1737=== modified file 'lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt'
1738--- lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt 2011-11-10 04:10:32 +0000
1739+++ lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt 2012-01-25 04:26:29 +0000
1740@@ -9,7 +9,7 @@
1741 <a id="tags-content-link"
1742 tal:attributes="href context/fmt:url/+bugtarget-portlet-tags-content"></a>
1743 <script type="text/javascript">
1744- LPS.use('lp.bugs.bugtask.taglist', function(Y) {
1745+ YUI().use('lp.bugs.bugtask.taglist', function(Y) {
1746 Y.on('domready', function() {
1747 Y.lp.bugs.bugtask.taglist.setup_taglist();
1748 });
1749
1750=== modified file 'lib/lp/bugs/templates/bugtarget-subscription-list.pt'
1751--- lib/lp/bugs/templates/bugtarget-subscription-list.pt 2011-06-16 13:50:58 +0000
1752+++ lib/lp/bugs/templates/bugtarget-subscription-list.pt 2012-01-25 04:26:29 +0000
1753@@ -13,7 +13,7 @@
1754 <head>
1755 <tal:head-epilogue metal:fill-slot="head_epilogue">
1756 <script type="text/javascript">
1757- LPS.use('lp.registry.structural_subscription', function(Y) {
1758+ YUI().use('lp.registry.structural_subscription', function(Y) {
1759 var module = Y.lp.registry.structural_subscription;
1760 var config = {
1761 content_box: "#structural-subscription-content-box",
1762
1763=== modified file 'lib/lp/bugs/templates/bugtask-index.pt'
1764--- lib/lp/bugs/templates/bugtask-index.pt 2012-01-20 00:13:13 +0000
1765+++ lib/lp/bugs/templates/bugtask-index.pt 2012-01-25 04:26:29 +0000
1766@@ -7,11 +7,10 @@
1767 >
1768 <body>
1769 <metal:block fill-slot="head_epilogue">
1770- <script type='text/javascript' tal:content="string:var yui_base='${yui}';" />
1771 <script type='text/javascript' id='available-official-tags-js'
1772 tal:content="view/available_official_tags_js" />
1773 <script type="text/javascript">
1774- LPS.use('base', 'node', 'oop', 'event', 'lp.bugs.bugtask_index',
1775+ YUI().use('base', 'node', 'oop', 'event', 'lp.bugs.bugtask_index',
1776 'lp.bugs.subscribers',
1777 'lp.code.branchmergeproposal.diff', 'lp.comments.hide',
1778 function(Y) {
1779@@ -159,7 +158,7 @@
1780 <img src="/@@/spinner" id="tags-edit-spinner" class="hidden"/>
1781 <a href="+edit" title="Edit tags" id="edit-tags-trigger" class="sprite edit"></a>
1782 <script type="text/javascript">
1783- LPS.use('event', 'node', 'lp.bugs.bug_tags_entry', function(Y) {
1784+ YUI().use('event', 'node', 'lp.bugs.bug_tags_entry', function(Y) {
1785 // XXX intellectronica 2009-04-16 bug #362309:
1786 // The load event fires very late on bug pages that take a
1787 // long time to render, but we prefer to use it since the
1788
1789=== modified file 'lib/lp/bugs/templates/bugtask-macros-tableview.pt'
1790--- lib/lp/bugs/templates/bugtask-macros-tableview.pt 2011-12-23 03:10:11 +0000
1791+++ lib/lp/bugs/templates/bugtask-macros-tableview.pt 2012-01-25 04:26:29 +0000
1792@@ -655,7 +655,7 @@
1793 show_new_listings request/features/bugs.dynamic_bug_listings.enabled;
1794 advanced_search view/shouldShowAdvancedForm"
1795 tal:condition="python: show_new_listings and not advanced_search">
1796- LPS.use('lp.bugs.buglisting', 'lp.ordering', 'lp.buglisting_utils',
1797+ YUI().use('lp.bugs.buglisting', 'lp.ordering', 'lp.buglisting_utils',
1798 function(Y) {
1799 Y.on('domready', function() {
1800 var navigator = Y.lp.bugs.buglisting.BugListingNavigator
1801
1802=== modified file 'lib/lp/bugs/templates/bugtasks-and-nominations-portal.pt'
1803--- lib/lp/bugs/templates/bugtasks-and-nominations-portal.pt 2011-11-26 04:03:29 +0000
1804+++ lib/lp/bugs/templates/bugtasks-and-nominations-portal.pt 2012-01-25 04:26:29 +0000
1805@@ -37,7 +37,7 @@
1806 </a>
1807 </span>
1808 <script type="text/javascript" tal:content="string:
1809- LPS.use('event', 'lp.bugs.bugtask_index', function(Y) {
1810+ YUI().use('event', 'lp.bugs.bugtask_index', function(Y) {
1811 Y.on('load', function(e) {
1812 Y.lp.bugs.bugtask_index.setup_me_too(
1813 ${view/current_user_affected_js_status},
1814
1815=== modified file 'lib/lp/bugs/templates/bugtracker-configure.pt'
1816--- lib/lp/bugs/templates/bugtracker-configure.pt 2012-01-11 07:16:10 +0000
1817+++ lib/lp/bugs/templates/bugtracker-configure.pt 2012-01-25 04:26:29 +0000
1818@@ -8,7 +8,7 @@
1819
1820 <metal:block fill-slot="head_epilogue">
1821 <script type="text/javascript">
1822- LPS.use('node', 'lang', function(Y) {
1823+ YUI().use('node', 'lang', function(Y) {
1824 // Constrain enable_bug_expiration to the Launchpad Bugs radio input.
1825 // The Launchpad bug tracker is either the first item in a product's
1826 // bugtracker field, or it is a distribution's official_malone field.
1827
1828=== modified file 'lib/lp/bugs/templates/official-bug-target-manage-tags.pt'
1829--- lib/lp/bugs/templates/official-bug-target-manage-tags.pt 2011-11-14 04:07:15 +0000
1830+++ lib/lp/bugs/templates/official-bug-target-manage-tags.pt 2012-01-25 04:26:29 +0000
1831@@ -23,7 +23,7 @@
1832
1833 <script tal:replace="structure view/tags_js_data" />
1834 <script type="text/javascript">
1835- LPS.use('event', 'lp.bugs.official_bug_tags', function(Y) {
1836+ YUI().use('event', 'lp.bugs.official_bug_tags', function(Y) {
1837 Y.on('domready', function(e) {
1838 Y.lp.bugs.official_bug_tags.setup_official_bug_tag_management();
1839 });
1840
1841=== modified file 'lib/lp/bugs/templates/projectgroup-filebug-search.pt'
1842--- lib/lp/bugs/templates/projectgroup-filebug-search.pt 2011-11-30 16:55:21 +0000
1843+++ lib/lp/bugs/templates/projectgroup-filebug-search.pt 2012-01-25 04:26:29 +0000
1844@@ -6,11 +6,8 @@
1845 metal:use-macro="view/macro:page/main_only">
1846
1847 <metal:block fill-slot="head_epilogue">
1848- <script type="text/javascript"
1849- tal:condition="devmode"
1850- tal:content="string:var yui_base='${yui}';"></script>
1851 <script type="text/javascript">
1852- LPS.use('base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
1853+ YUI().use('base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
1854 function(Y) {
1855 Y.on('domready', function() {
1856 Y.lp.bugs.filebug_dupefinder.setup_dupes();
1857
1858=== modified file 'lib/lp/code/javascript/requestbuild_overlay.js'
1859--- lib/lp/code/javascript/requestbuild_overlay.js 2011-08-31 11:03:56 +0000
1860+++ lib/lp/code/javascript/requestbuild_overlay.js 2012-01-25 04:26:29 +0000
1861@@ -169,7 +169,7 @@
1862 break;
1863 default:
1864 new_builds_message =
1865- Y.Lang.substitute(
1866+ Y.Lang.sub(
1867 MANY_BUILDS_MESSAGE,
1868 {nr_new: nr_new});
1869 }
1870@@ -254,7 +254,7 @@
1871 }
1872 nr_new = display_build_records(build_html, current_builds);
1873 if (nr_new > 1) {
1874- return Y.Lang.substitute(MANY_BUILDS_MESSAGE, {nr_new: nr_new});
1875+ return Y.Lang.sub(MANY_BUILDS_MESSAGE, {nr_new: nr_new});
1876 }
1877 return ONE_BUILD_MESSAGE;
1878 };
1879@@ -457,7 +457,7 @@
1880 if (distro === distroarchive[0]) {
1881 nr_matches += 1;
1882 escaped_distro = Y.Escape.html(distro);
1883- disabled_checkbox_html = Y.Lang.substitute(
1884+ disabled_checkbox_html = Y.Lang.sub(
1885 DISABLED_DISTROSERIES_CHECKBOX_HTML,
1886 {distro: escaped_distro});
1887 distroseries_node.set("innerHTML", disabled_checkbox_html);
1888
1889=== modified file 'lib/lp/code/javascript/tests/test_productseries-setbranch.html'
1890--- lib/lp/code/javascript/tests/test_productseries-setbranch.html 2011-07-08 06:21:11 +0000
1891+++ lib/lp/code/javascript/tests/test_productseries-setbranch.html 2012-01-25 04:26:29 +0000
1892@@ -17,7 +17,7 @@
1893 <!-- The module under test -->
1894 <script type="text/javascript" src="../productseries-setbranch.js"></script>
1895 <script type="text/javascript">
1896- LPS.use('lp.code.productseries_setbranch', function(Y) {
1897+ YUI().use('lp.code.productseries_setbranch', function(Y) {
1898 Y.on('domready', Y.lp.code.productseries_setbranch.setup);
1899 });
1900 </script>
1901
1902=== modified file 'lib/lp/code/templates/bazaar-index.pt'
1903--- lib/lp/code/templates/bazaar-index.pt 2010-12-20 20:17:42 +0000
1904+++ lib/lp/code/templates/bazaar-index.pt 2012-01-25 04:26:29 +0000
1905@@ -38,9 +38,11 @@
1906 <input id="text" type="text" name="text" size="50" />
1907 <input type="submit" value="Find a Project" />
1908 </form>
1909- <script type="text/javascript"><!--
1910- setFocusByName('text');
1911- // --></script>
1912+ <script type="text/javascript">
1913+ YUI().use('lp', function (Y) {
1914+ setFocusByName('text');
1915+ });
1916+ </script>
1917
1918 <p id="application-summary">
1919 Launchpad can host your project&#8217;s source code
1920
1921=== modified file 'lib/lp/code/templates/branch-form-macros.pt'
1922--- lib/lp/code/templates/branch-form-macros.pt 2012-01-17 07:06:43 +0000
1923+++ lib/lp/code/templates/branch-form-macros.pt 2012-01-25 04:26:29 +0000
1924@@ -17,7 +17,7 @@
1925
1926 <script type="text/javascript">
1927 //<![CDATA[
1928-LPS.use('lp.code.util', function(Y) {
1929+YUI().use('lp.code.util', function(Y) {
1930 Y.on('domready', function(e) {
1931 Y.lp.code.util.hookUpBranchFieldFunctions(Y);
1932 }, window);
1933
1934=== modified file 'lib/lp/code/templates/branch-import-details.pt'
1935--- lib/lp/code/templates/branch-import-details.pt 2011-12-29 05:29:36 +0000
1936+++ lib/lp/code/templates/branch-import-details.pt 2012-01-25 04:26:29 +0000
1937@@ -32,7 +32,7 @@
1938 Try again
1939 </a>
1940 <script type="text/javascript">
1941- LPS.use('event', 'node', function(Y) {
1942+ YUI().use('event', 'node', function(Y) {
1943 Y.on("domready", function () { Y.one('#tryagainlink').setStyle('display', 'inline') });
1944 });
1945 </script>
1946
1947=== modified file 'lib/lp/code/templates/branch-index.pt'
1948--- lib/lp/code/templates/branch-index.pt 2011-08-24 08:57:25 +0000
1949+++ lib/lp/code/templates/branch-index.pt 2012-01-25 04:26:29 +0000
1950@@ -30,7 +30,7 @@
1951 </style>
1952 <script type="text/javascript"
1953 tal:content="string:
1954- LPS.use('node', 'event', 'widget', 'plugin', 'overlay',
1955+ YUI().use('node', 'event', 'widget', 'plugin', 'overlay',
1956 'lazr.choiceedit',
1957 'lp.code.branch.status',
1958 'lp.code.branchmergeproposal.diff',
1959
1960=== modified file 'lib/lp/code/templates/branch-listing.pt'
1961--- lib/lp/code/templates/branch-listing.pt 2012-01-17 07:06:43 +0000
1962+++ lib/lp/code/templates/branch-listing.pt 2012-01-25 04:26:29 +0000
1963@@ -35,7 +35,7 @@
1964 <tal:comment
1965 tal:condition="not: request/features/ajax.batch_navigator.enabled"
1966 replace='structure string:&lt;script type="text/javascript"&gt;
1967- LPS.use("lp.code.util", function(Y) {
1968+ YUI().use("lp.code.util", function(Y) {
1969 Y.on("domready", function(e) {
1970 Y.lp.code.util.hookUpBranchFilterSubmission(Y);
1971 }, window);
1972@@ -191,7 +191,7 @@
1973 <tal:comment
1974 tal:condition="request/features/ajax.batch_navigator.enabled"
1975 replace='structure string:&lt;script type="text/javascript"&gt;
1976- LPS.use("lp.app.batchnavigator",
1977+ YUI().use("lp.app.batchnavigator",
1978 function(Y) {
1979 Y.on("domready", function () {
1980 var config = {
1981
1982=== modified file 'lib/lp/code/templates/branch-register-merge.pt'
1983--- lib/lp/code/templates/branch-register-merge.pt 2011-07-07 12:03:52 +0000
1984+++ lib/lp/code/templates/branch-register-merge.pt 2012-01-25 04:26:29 +0000
1985@@ -65,7 +65,7 @@
1986 -->
1987 <tal:script>
1988 <script type="text/javascript" tal:content="string:
1989- LPS.use('node', 'event', function(Y) {
1990+ YUI().use('node', 'event', function(Y) {
1991 function reviewer_changed(value) {
1992 reviewer = Y.Lang.trim(value);
1993 review_type = document.getElementById('field.review_type');
1994
1995=== modified file 'lib/lp/code/templates/branch-related-bugs-specs.pt'
1996--- lib/lp/code/templates/branch-related-bugs-specs.pt 2011-02-27 19:45:44 +0000
1997+++ lib/lp/code/templates/branch-related-bugs-specs.pt 2012-01-25 04:26:29 +0000
1998@@ -73,7 +73,7 @@
1999 string:&lt;script id='branchlink-script' type='text/javascript'&gt;" />
2000 <!--
2001
2002- LPS.use('io-base', 'lp.code.branch.bugspeclinks', function(Y) {
2003+ YUI().use('io-base', 'lp.code.branch.bugspeclinks', function(Y) {
2004
2005 if(Y.UA.ie) {
2006 return;
2007
2008=== modified file 'lib/lp/code/templates/branchmergeproposal-generic-listing.pt'
2009--- lib/lp/code/templates/branchmergeproposal-generic-listing.pt 2009-12-03 18:33:22 +0000
2010+++ lib/lp/code/templates/branchmergeproposal-generic-listing.pt 2012-01-25 04:26:29 +0000
2011@@ -24,7 +24,7 @@
2012 </form>
2013 <script type="text/javascript">
2014
2015-LPS.use('node', function(Y) {
2016+YUI().use('node', function(Y) {
2017
2018 function submit_filter() {
2019 Y.one('#filter_form').submit();
2020
2021=== modified file 'lib/lp/code/templates/branchmergeproposal-index.pt'
2022--- lib/lp/code/templates/branchmergeproposal-index.pt 2012-01-03 15:38:19 +0000
2023+++ lib/lp/code/templates/branchmergeproposal-index.pt 2012-01-25 04:26:29 +0000
2024@@ -206,7 +206,7 @@
2025 string:&lt;script id='codereview-script' type='text/javascript'&gt;" />
2026 conf = <tal:status-config replace="view/status_config" />
2027 <!--
2028- LPS.use('io-base', 'lp.code.branchmergeproposal.reviewcomment',
2029+ YUI().use('io-base', 'lp.code.branchmergeproposal.reviewcomment',
2030 'lp.code.branchmergeproposal.status', 'lp.app.comment',
2031 'lp.code.branchmergeproposal.updater', 'lp.app.widgets.expander',
2032 'lp.code.branch.revisionexpander', function(Y) {
2033
2034=== modified file 'lib/lp/code/templates/daily-builds-listing.pt'
2035--- lib/lp/code/templates/daily-builds-listing.pt 2012-01-17 07:06:43 +0000
2036+++ lib/lp/code/templates/daily-builds-listing.pt 2012-01-25 04:26:29 +0000
2037@@ -29,7 +29,7 @@
2038 </form>
2039
2040 <script type="text/javascript">
2041- LPS.use("lp.code.util", function(Y) {
2042+ YUI().use("lp.code.util", function(Y) {
2043 Y.on("domready", function(e) {
2044 Y.lp.code.util.hookUpDailyBuildsFilterSubmission(Y);
2045 }, window);
2046
2047=== modified file 'lib/lp/code/templates/sourcepackagerecipe-index.pt'
2048--- lib/lp/code/templates/sourcepackagerecipe-index.pt 2011-12-07 04:57:36 +0000
2049+++ lib/lp/code/templates/sourcepackagerecipe-index.pt 2012-01-25 04:26:29 +0000
2050@@ -149,7 +149,7 @@
2051 </div>
2052
2053 <script type="text/javascript">
2054- LPS.use('io-base', 'lp.ui', 'lp.code.requestbuild_overlay', function(Y) {
2055+ YUI().use('io-base', 'lp.ui', 'lp.code.requestbuild_overlay', function(Y) {
2056
2057 Y.on('lp:context:deb_version_template:changed', function(e) {
2058 Y.lp.ui.update_field('#debian-version dd', e.new_value);
2059
2060=== modified file 'lib/lp/code/templates/sourcepackagerecipe-new.pt'
2061--- lib/lp/code/templates/sourcepackagerecipe-new.pt 2011-11-26 04:03:29 +0000
2062+++ lib/lp/code/templates/sourcepackagerecipe-new.pt 2012-01-25 04:26:29 +0000
2063@@ -86,7 +86,7 @@
2064 </tr>
2065
2066 <script type="text/javascript">
2067- LPS.use('lp.code.sourcepackagerecipe.new', function(Y) {
2068+ YUI().use('lp.code.sourcepackagerecipe.new', function(Y) {
2069 Y.on('domready', Y.lp.code.sourcepackagerecipe.new.setup);
2070 });
2071 </script>
2072
2073=== added file 'lib/lp/contrib/javascript/lp.mustache.js'
2074--- lib/lp/contrib/javascript/lp.mustache.js 1970-01-01 00:00:00 +0000
2075+++ lib/lp/contrib/javascript/lp.mustache.js 2012-01-25 04:26:29 +0000
2076@@ -0,0 +1,418 @@
2077+/* Copyright 2011 Canonical Ltd. This software is licensed under the
2078+ * GNU Affero General Public License version 3 (see the file LICENSE).
2079+ *
2080+ * Mustache.js pulled into the lp namespace for our purposes.
2081+ *
2082+ * @module lp.mustache
2083+ */
2084+
2085+YUI.add('lp.mustache', function(Y) {
2086+
2087+ /**
2088+ * The Mustache code is simply copied and dropped into here. At the
2089+ * bottom of the file we'll create the lp.mustache namespace and set
2090+ * things up to work from there.
2091+ */
2092+ var Mustache = function() {
2093+ var regexCache = {};
2094+ var Renderer = function() {};
2095+
2096+ Renderer.prototype = {
2097+ otag: "{{",
2098+ ctag: "}}",
2099+ pragmas: {},
2100+ buffer: [],
2101+ pragmas_implemented: {
2102+ "IMPLICIT-ITERATOR": true
2103+ },
2104+ context: {},
2105+
2106+ render: function(template, context, partials, in_recursion) {
2107+ // reset buffer & set context
2108+ if(!in_recursion) {
2109+ this.context = context;
2110+ this.buffer = []; // TODO: make this non-lazy
2111+ }
2112+
2113+ // fail fast
2114+ if(!this.includes("", template)) {
2115+ if(in_recursion) {
2116+ return template;
2117+ } else {
2118+ this.send(template);
2119+ return;
2120+ }
2121+ }
2122+
2123+ // get the pragmas together
2124+ template = this.render_pragmas(template);
2125+
2126+ // render the template
2127+ var html = this.render_section(template, context, partials);
2128+
2129+ // render_section did not find any sections, we still need to render the tags
2130+ if (html === false) {
2131+ html = this.render_tags(template, context, partials, in_recursion);
2132+ }
2133+
2134+ if (in_recursion) {
2135+ return html;
2136+ } else {
2137+ this.sendLines(html);
2138+ }
2139+ },
2140+
2141+ /*
2142+ Sends parsed lines
2143+ */
2144+ send: function(line) {
2145+ if(line !== "") {
2146+ this.buffer.push(line);
2147+ }
2148+ },
2149+
2150+ sendLines: function(text) {
2151+ if (text) {
2152+ var lines = text.split("\n");
2153+ for (var i = 0; i < lines.length; i++) {
2154+ this.send(lines[i]);
2155+ }
2156+ }
2157+ },
2158+
2159+ /*
2160+ Looks for %PRAGMAS
2161+ */
2162+ render_pragmas: function(template) {
2163+ // no pragmas
2164+ if(!this.includes("%", template)) {
2165+ return template;
2166+ }
2167+
2168+ var that = this;
2169+ var regex = this.getCachedRegex("render_pragmas", function(otag, ctag) {
2170+ return new RegExp(otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + ctag, "g");
2171+ });
2172+
2173+ return template.replace(regex, function(match, pragma, options) {
2174+ if(!that.pragmas_implemented[pragma]) {
2175+ throw({message:
2176+ "This implementation of mustache doesn't understand the '" +
2177+ pragma + "' pragma"});
2178+ }
2179+ that.pragmas[pragma] = {};
2180+ if(options) {
2181+ var opts = options.split("=");
2182+ that.pragmas[pragma][opts[0]] = opts[1];
2183+ }
2184+ return "";
2185+ // ignore unknown pragmas silently
2186+ });
2187+ },
2188+
2189+ /*
2190+ Tries to find a partial in the curent scope and render it
2191+ */
2192+ render_partial: function(name, context, partials) {
2193+ name = this.trim(name);
2194+ if(!partials || partials[name] === undefined) {
2195+ throw({message: "unknown_partial '" + name + "'"});
2196+ }
2197+ if(typeof(context[name]) != "object") {
2198+ return this.render(partials[name], context, partials, true);
2199+ }
2200+ return this.render(partials[name], context[name], partials, true);
2201+ },
2202+
2203+ /*
2204+ Renders inverted (^) and normal (#) sections
2205+ */
2206+ render_section: function(template, context, partials) {
2207+ if(!this.includes("#", template) && !this.includes("^", template)) {
2208+ // did not render anything, there were no sections
2209+ return false;
2210+ }
2211+
2212+ var that = this;
2213+
2214+ var regex = this.getCachedRegex("render_section", function(otag, ctag) {
2215+ // This regex matches _the first_ section ({{#foo}}{{/foo}}), and captures the remainder
2216+ return new RegExp(
2217+ "^([\\s\\S]*?)" + // all the crap at the beginning that is not {{*}} ($1)
2218+
2219+ otag + // {{
2220+ "(\\^|\\#)\\s*(.+)\\s*" + // #foo (# == $2, foo == $3)
2221+ ctag + // }}
2222+
2223+ "\n*([\\s\\S]*?)" + // between the tag ($2). leading newlines are dropped
2224+
2225+ otag + // {{
2226+ "\\/\\s*\\3\\s*" + // /foo (backreference to the opening tag).
2227+ ctag + // }}
2228+
2229+ "\\s*([\\s\\S]*)$", // everything else in the string ($4). leading whitespace is dropped.
2230+
2231+ "g");
2232+ });
2233+
2234+
2235+ // for each {{#foo}}{{/foo}} section do...
2236+ return template.replace(regex, function(match, before, type, name, content, after) {
2237+ // before contains only tags, no sections
2238+ var renderedBefore = before ? that.render_tags(before, context, partials, true) : "",
2239+
2240+ // after may contain both sections and tags, so use full rendering function
2241+ renderedAfter = after ? that.render(after, context, partials, true) : "",
2242+
2243+ // will be computed below
2244+ renderedContent,
2245+
2246+ value = that.find(name, context);
2247+
2248+ if (type === "^") { // inverted section
2249+ if (!value || that.is_array(value) && value.length === 0) {
2250+ // false or empty list, render it
2251+ renderedContent = that.render(content, context, partials, true);
2252+ } else {
2253+ renderedContent = "";
2254+ }
2255+ } else if (type === "#") { // normal section
2256+ if (that.is_array(value)) { // Enumerable, Let's loop!
2257+ renderedContent = that.map(value, function(row) {
2258+ return that.render(content, that.create_context(row), partials, true);
2259+ }).join("");
2260+ } else if (that.is_object(value)) { // Object, Use it as subcontext!
2261+ renderedContent = that.render(content, that.create_context(value),
2262+ partials, true);
2263+ } else if (typeof value === "function") {
2264+ // higher order section
2265+ renderedContent = value.call(context, content, function(text) {
2266+ return that.render(text, context, partials, true);
2267+ });
2268+ } else if (value) { // boolean section
2269+ renderedContent = that.render(content, context, partials, true);
2270+ } else {
2271+ renderedContent = "";
2272+ }
2273+ }
2274+
2275+ return renderedBefore + renderedContent + renderedAfter;
2276+ });
2277+ },
2278+
2279+ /*
2280+ Replace {{foo}} and friends with values from our view
2281+ */
2282+ render_tags: function(template, context, partials, in_recursion) {
2283+ // tit for tat
2284+ var that = this;
2285+
2286+
2287+
2288+ var new_regex = function() {
2289+ return that.getCachedRegex("render_tags", function(otag, ctag) {
2290+ return new RegExp(otag + "(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?" + ctag + "+", "g");
2291+ });
2292+ };
2293+
2294+ var regex = new_regex();
2295+ var tag_replace_callback = function(match, operator, name) {
2296+ switch(operator) {
2297+ case "!": // ignore comments
2298+ return "";
2299+ case "=": // set new delimiters, rebuild the replace regexp
2300+ that.set_delimiters(name);
2301+ regex = new_regex();
2302+ return "";
2303+ case ">": // render partial
2304+ return that.render_partial(name, context, partials);
2305+ case "{": // the triple mustache is unescaped
2306+ return that.find(name, context);
2307+ default: // escape the value
2308+ return that.escape(that.find(name, context));
2309+ }
2310+ };
2311+ var lines = template.split("\n");
2312+ for(var i = 0; i < lines.length; i++) {
2313+ lines[i] = lines[i].replace(regex, tag_replace_callback, this);
2314+ if(!in_recursion) {
2315+ this.send(lines[i]);
2316+ }
2317+ }
2318+
2319+ if(in_recursion) {
2320+ return lines.join("\n");
2321+ }
2322+ },
2323+
2324+ set_delimiters: function(delimiters) {
2325+ var dels = delimiters.split(" ");
2326+ this.otag = this.escape_regex(dels[0]);
2327+ this.ctag = this.escape_regex(dels[1]);
2328+ },
2329+
2330+ escape_regex: function(text) {
2331+ // thank you Simon Willison
2332+ if(!arguments.callee.sRE) {
2333+ var specials = [
2334+ '/', '.', '*', '+', '?', '|',
2335+ '(', ')', '[', ']', '{', '}', '\\'
2336+ ];
2337+ arguments.callee.sRE = new RegExp(
2338+ '(\\' + specials.join('|\\') + ')', 'g'
2339+ );
2340+ }
2341+ return text.replace(arguments.callee.sRE, '\\$1');
2342+ },
2343+
2344+ /*
2345+ find `name` in current `context`. That is find me a value
2346+ from the view object
2347+ */
2348+ find: function(name, context) {
2349+ name = this.trim(name);
2350+
2351+ // Checks whether a value is thruthy or false or 0
2352+ function is_kinda_truthy(bool) {
2353+ return bool === false || bool === 0 || bool;
2354+ }
2355+
2356+ var value;
2357+ if(is_kinda_truthy(context[name])) {
2358+ value = context[name];
2359+ } else if(is_kinda_truthy(this.context[name])) {
2360+ value = this.context[name];
2361+ }
2362+
2363+ if(typeof value === "function") {
2364+ return value.apply(context);
2365+ }
2366+ if(value !== undefined) {
2367+ return value;
2368+ }
2369+ // silently ignore unkown variables
2370+ return "";
2371+ },
2372+
2373+ // Utility methods
2374+
2375+ /* includes tag */
2376+ includes: function(needle, haystack) {
2377+ return haystack.indexOf(this.otag + needle) != -1;
2378+ },
2379+
2380+ /*
2381+ Does away with nasty characters
2382+ */
2383+ escape: function(s) {
2384+ s = String(s === null ? "" : s);
2385+ return s.replace(/&(?!\w+;)|["'<>\\]/g, function(s) {
2386+ switch(s) {
2387+ case "&": return "&amp;";
2388+ case '"': return '&quot;';
2389+ case "'": return '&#39;';
2390+ case "<": return "&lt;";
2391+ case ">": return "&gt;";
2392+ default: return s;
2393+ }
2394+ });
2395+ },
2396+
2397+ // by @langalex, support for arrays of strings
2398+ create_context: function(_context) {
2399+ if(this.is_object(_context)) {
2400+ return _context;
2401+ } else {
2402+ var iterator = ".";
2403+ if(this.pragmas["IMPLICIT-ITERATOR"]) {
2404+ iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator;
2405+ }
2406+ var ctx = {};
2407+ ctx[iterator] = _context;
2408+ return ctx;
2409+ }
2410+ },
2411+
2412+ is_object: function(a) {
2413+ return a && typeof a == "object";
2414+ },
2415+
2416+ is_array: function(a) {
2417+ return Object.prototype.toString.call(a) === '[object Array]';
2418+ },
2419+
2420+ /*
2421+ Gets rid of leading and trailing whitespace
2422+ */
2423+ trim: function(s) {
2424+ return s.replace(/^\s*|\s*$/g, "");
2425+ },
2426+
2427+ /*
2428+ Why, why, why? Because IE. Cry, cry cry.
2429+ */
2430+ map: function(array, fn) {
2431+ if (typeof array.map == "function") {
2432+ return array.map(fn);
2433+ } else {
2434+ var r = [];
2435+ var l = array.length;
2436+ for(var i = 0; i < l; i++) {
2437+ r.push(fn(array[i]));
2438+ }
2439+ return r;
2440+ }
2441+ },
2442+
2443+ getCachedRegex: function(name, generator) {
2444+ var byOtag = regexCache[this.otag];
2445+ if (!byOtag) {
2446+ byOtag = regexCache[this.otag] = {};
2447+ }
2448+
2449+ var byCtag = byOtag[this.ctag];
2450+ if (!byCtag) {
2451+ byCtag = byOtag[this.ctag] = {};
2452+ }
2453+
2454+ var regex = byCtag[name];
2455+ if (!regex) {
2456+ regex = byCtag[name] = generator(this.otag, this.ctag);
2457+ }
2458+
2459+ return regex;
2460+ }
2461+ };
2462+
2463+ return({
2464+ name: "mustache.js",
2465+ version: "0.4.0-dev",
2466+
2467+ /*
2468+ Turns a template and view into HTML
2469+ */
2470+ to_html: function(template, view, partials, send_fun) {
2471+ var renderer = new Renderer();
2472+ if(send_fun) {
2473+ renderer.send = send_fun;
2474+ }
2475+ renderer.render(template, view || {}, partials);
2476+ if(!send_fun) {
2477+ return renderer.buffer.join("\n");
2478+ }
2479+ }
2480+ });
2481+ }();
2482+
2483+
2484+ /**
2485+ * END COPY OF MUSTACHE INTO MODULE.
2486+ */
2487+
2488+ var module = Y.namespace('lp.mustache');
2489+ module.name = Mustache.name;
2490+ module.version = Mustache.version;
2491+ module.to_html = Mustache.to_html;
2492+
2493+}, "0.4-dev", { "requires": [] });
2494+
2495
2496=== modified file 'lib/lp/registry/browser/__init__.py'
2497--- lib/lp/registry/browser/__init__.py 2012-01-05 20:11:40 +0000
2498+++ lib/lp/registry/browser/__init__.py 2012-01-25 04:26:29 +0000
2499@@ -118,7 +118,7 @@
2500 'milestone_row_uri': self.milestone_row_uri_template,
2501 }
2502 return """
2503- LPS.use(
2504+ YUI().use(
2505 'node', 'lp.registry.milestoneoverlay',
2506 'lp.registry.milestonetable',
2507 function (Y) {
2508
2509=== modified file 'lib/lp/registry/browser/person.py'
2510--- lib/lp/registry/browser/person.py 2012-01-23 22:28:29 +0000
2511+++ lib/lp/registry/browser/person.py 2012-01-25 04:26:29 +0000
2512@@ -3007,7 +3007,7 @@
2513 'center_lng': self.context.longitude}
2514 return u"""
2515 <script type="text/javascript">
2516- LPS.use('node', 'lp.app.mapping', function(Y) {
2517+ YUI().use('node', 'lp.app.mapping', function(Y) {
2518 function renderMap() {
2519 Y.lp.app.mapping.renderPersonMapSmall(
2520 %(center_lat)s, %(center_lng)s);
2521
2522=== modified file 'lib/lp/registry/browser/team.py'
2523--- lib/lp/registry/browser/team.py 2012-01-23 18:15:34 +0000
2524+++ lib/lp/registry/browser/team.py 2012-01-25 04:26:29 +0000
2525@@ -1235,7 +1235,7 @@
2526 """HTML which shows the map with location of the team's members."""
2527 return """
2528 <script type="text/javascript">
2529- LPS.use('node', 'lp.app.mapping', function(Y) {
2530+ YUI().use('node', 'lp.app.mapping', function(Y) {
2531 function renderMap() {
2532 Y.lp.app.mapping.renderTeamMap(
2533 %(min_lat)s, %(max_lat)s, %(min_lng)s,
2534@@ -1250,7 +1250,7 @@
2535 """The HTML which shows a small version of the team's map."""
2536 return """
2537 <script type="text/javascript">
2538- LPS.use('node', 'lp.app.mapping', function(Y) {
2539+ YUI().use('node', 'lp.app.mapping', function(Y) {
2540 function renderMap() {
2541 Y.lp.app.mapping.renderTeamMapSmall(
2542 %(center_lat)s, %(center_lng)s);
2543
2544=== modified file 'lib/lp/registry/browser/tests/productrelease-views.txt'
2545--- lib/lp/registry/browser/tests/productrelease-views.txt 2011-12-22 05:09:10 +0000
2546+++ lib/lp/registry/browser/tests/productrelease-views.txt 2012-01-25 04:26:29 +0000
2547@@ -125,7 +125,7 @@
2548 >>> script = find_tag_by_id(view.render(), 'milestone-script')
2549 >>> print script
2550 <script id="milestone-script" type="text/javascript">
2551- LPS.use(... 'lp.registry.milestoneoverlay'...
2552+ YUI().use(... 'lp.registry.milestoneoverlay'...
2553 var milestone_form_uri = '.../app/simple/+addmilestone/++form++';
2554 var series_uri = '/app/simple';
2555 ...
2556
2557=== modified file 'lib/lp/registry/browser/tests/productseries-views.txt'
2558--- lib/lp/registry/browser/tests/productseries-views.txt 2011-12-24 17:49:30 +0000
2559+++ lib/lp/registry/browser/tests/productseries-views.txt 2012-01-25 04:26:29 +0000
2560@@ -82,7 +82,7 @@
2561 >>> script = find_tag_by_id(view.render(), 'milestone-script')
2562 >>> print script
2563 <script id="milestone-script" type="text/javascript">
2564- LPS.use(... 'lp.registry.milestoneoverlay',
2565+ YUI().use(... 'lp.registry.milestoneoverlay',
2566 'lp.registry.milestonetable'...
2567 var series_uri = '/app/simple';
2568 var milestone_form_uri = '.../app/simple/+addmilestone/++form++';
2569
2570=== modified file 'lib/lp/registry/templates/distribution-index.pt'
2571--- lib/lp/registry/templates/distribution-index.pt 2011-11-29 20:50:18 +0000
2572+++ lib/lp/registry/templates/distribution-index.pt 2012-01-25 04:26:29 +0000
2573@@ -11,7 +11,7 @@
2574 <tal:uses_launchpad_bugtracker
2575 condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD">
2576 <script type="text/javascript">
2577- LPS.use('lp.registry.structural_subscription', function(Y) {
2578+ YUI().use('lp.registry.structural_subscription', function(Y) {
2579 var module = Y.lp.registry.structural_subscription;
2580 Y.on('domready', function() {
2581 module.setup({content_box: "#structural-subscription-content-box"});
2582
2583=== modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt'
2584--- lib/lp/registry/templates/distributionsourcepackage-index.pt 2011-08-03 04:49:15 +0000
2585+++ lib/lp/registry/templates/distributionsourcepackage-index.pt 2012-01-25 04:26:29 +0000
2586@@ -13,7 +13,7 @@
2587 <tal:uses_launchpad_bugtracker
2588 condition="context/distribution/bug_tracking_usage/enumvalue:LAUNCHPAD">
2589 <script type="text/javascript">
2590- LPS.use('lp.registry.structural_subscription', function(Y) {
2591+ YUI().use('lp.registry.structural_subscription', function(Y) {
2592 var module = Y.lp.registry.structural_subscription;
2593 Y.on('domready', function() {
2594 module.setup({content_box: "#structural-subscription-content-box"});
2595@@ -236,7 +236,7 @@
2596 </p>
2597 </div>
2598 <script type="text/javascript">
2599-LPS.use('node', 'event', 'lp.app.widgets.expander', function(Y) {
2600+YUI().use('node', 'event', 'lp.app.widgets.expander', function(Y) {
2601
2602 // XXX Michael Nelson 20090702 bug=340497 This slider
2603 // needs an integration test.
2604
2605=== modified file 'lib/lp/registry/templates/distroseries-index.pt'
2606--- lib/lp/registry/templates/distroseries-index.pt 2011-07-06 14:42:11 +0000
2607+++ lib/lp/registry/templates/distroseries-index.pt 2012-01-25 04:26:29 +0000
2608@@ -16,7 +16,7 @@
2609 <tal:uses_launchpad_bugtracker
2610 condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD">
2611 <script type="text/javascript">
2612- LPS.use('lp.registry.structural_subscription', function(Y) {
2613+ YUI().use('lp.registry.structural_subscription', function(Y) {
2614 var module = Y.lp.registry.structural_subscription;
2615 Y.on('domready', function() {
2616 module.setup({content_box: "#structural-subscription-content-box"});
2617
2618=== modified file 'lib/lp/registry/templates/distroseries-initialize.pt'
2619--- lib/lp/registry/templates/distroseries-initialize.pt 2011-11-26 04:03:29 +0000
2620+++ lib/lp/registry/templates/distroseries-initialize.pt 2012-01-25 04:26:29 +0000
2621@@ -30,7 +30,7 @@
2622 <metal:form use-macro="context/@@launchpad_form/form" />
2623 </div>
2624 <script type="text/javascript">
2625- LPS.use('lp.registry.distroseries.initseries', function(Y) {
2626+ YUI().use('lp.registry.distroseries.initseries', function(Y) {
2627 Y.on('domready', Y.lp.registry.distroseries.initseries.setup);
2628 });
2629 </script>
2630
2631=== modified file 'lib/lp/registry/templates/distroseries-localdifferences.pt'
2632--- lib/lp/registry/templates/distroseries-localdifferences.pt 2011-12-19 15:31:31 +0000
2633+++ lib/lp/registry/templates/distroseries-localdifferences.pt 2012-01-25 04:26:29 +0000
2634@@ -60,7 +60,7 @@
2635 </span>
2636 <div metal:fill-slot="buttons">
2637 <script type="text/javascript">
2638- LPS.use(
2639+ YUI().use(
2640 'node', 'event', 'lp.registry.distroseriesdifferences_details',
2641 'lp.app.confirmationoverlay',function(Y) {
2642 Y.on('domready', function() {
2643@@ -295,14 +295,14 @@
2644 </div>
2645 </div>
2646 <script type="text/javascript">
2647-LPS.use('lp.registry.distroseriesdifferences_details', function(Y) {
2648+YUI().use('lp.registry.distroseriesdifferences_details', function(Y) {
2649 Y.on('domready', function() {
2650 Y.lp.registry.distroseriesdifferences_details.setup();
2651 });
2652 });
2653 </script>
2654 <script type="text/javascript">
2655- LPS.use("lp.registry.distroseries.differences", function(Y) {
2656+ YUI().use("lp.registry.distroseries.differences", function(Y) {
2657 Y.on("domready", function() {
2658 var form = Y.one("form#distroseries-localdiff-search-filter");
2659 var differences = Y.lp.registry.distroseries.differences;
2660
2661=== modified file 'lib/lp/registry/templates/milestone-index.pt'
2662--- lib/lp/registry/templates/milestone-index.pt 2011-12-23 16:40:51 +0000
2663+++ lib/lp/registry/templates/milestone-index.pt 2012-01-25 04:26:29 +0000
2664@@ -17,7 +17,7 @@
2665 <tal:uses_launchpad_bugtracker
2666 condition="context/target/bug_tracking_usage/enumvalue:LAUNCHPAD">
2667 <script type="text/javascript">
2668- LPS.use('lp.registry.structural_subscription', function(Y) {
2669+ YUI().use('lp.registry.structural_subscription', function(Y) {
2670 var module = Y.lp.registry.structural_subscription;
2671 Y.on('domready', function() {
2672 module.setup({content_box: "#structural-subscription-content-box"});
2673
2674=== modified file 'lib/lp/registry/templates/object-timeline-graph.pt'
2675--- lib/lp/registry/templates/object-timeline-graph.pt 2011-02-24 00:23:04 +0000
2676+++ lib/lp/registry/templates/object-timeline-graph.pt 2012-01-25 04:26:29 +0000
2677@@ -47,7 +47,7 @@
2678 get_timeline_config.size = size;
2679 }
2680
2681- LPS.use('lp.registry.timeline', 'node', 'lp.app.dragscroll', 'lp.client',
2682+ YUI().use('lp.registry.timeline', 'node', 'lp.app.dragscroll', 'lp.client',
2683 function(Y) {
2684 Y.on('domready', function(e) {
2685 if (Y.UA.ie) {
2686
2687=== modified file 'lib/lp/registry/templates/people-index.pt'
2688--- lib/lp/registry/templates/people-index.pt 2011-03-04 00:08:20 +0000
2689+++ lib/lp/registry/templates/people-index.pt 2012-01-25 04:26:29 +0000
2690@@ -105,9 +105,12 @@
2691 </tr>
2692 </table>
2693 </form>
2694- <script type="text/javascript"><!--
2695- setFocusByName('name');
2696- // --></script>
2697+ <script type="text/javascript">
2698+ YUI().use('lp', function (Y) {
2699+ setFocusByName('name');
2700+ });
2701+ </script>
2702+
2703 </div>
2704
2705 <tal:block condition="not: batch">
2706
2707=== modified file 'lib/lp/registry/templates/person-macros.pt'
2708--- lib/lp/registry/templates/person-macros.pt 2011-12-13 04:32:49 +0000
2709+++ lib/lp/registry/templates/person-macros.pt 2012-01-25 04:26:29 +0000
2710@@ -253,7 +253,7 @@
2711 condition="private_prefix">
2712 <script type="text/javascript"
2713 tal:content="string:
2714- LPS.use('node', 'event', function(Y) {
2715+ YUI().use('node', 'event', function(Y) {
2716 // Prepend/remove 'private-' from team name based on visibility
2717 // setting. User can choose to edit it back out, if they wish.
2718 function visibility_on_change(e) {
2719
2720=== modified file 'lib/lp/registry/templates/product-index.pt'
2721--- lib/lp/registry/templates/product-index.pt 2011-12-09 15:04:53 +0000
2722+++ lib/lp/registry/templates/product-index.pt 2012-01-25 04:26:29 +0000
2723@@ -34,7 +34,7 @@
2724 <tal:uses_launchpad_bugtracker
2725 condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD">
2726 <script type="text/javascript">
2727- LPS.use('lp.registry.structural_subscription', function(Y) {
2728+ YUI().use('lp.registry.structural_subscription', function(Y) {
2729 var module = Y.lp.registry.structural_subscription;
2730 Y.on('domready', function() {
2731 module.setup({content_box: "#structural-subscription-content-box"});
2732
2733=== modified file 'lib/lp/registry/templates/product-new.pt'
2734--- lib/lp/registry/templates/product-new.pt 2010-11-10 22:04:20 +0000
2735+++ lib/lp/registry/templates/product-new.pt 2012-01-25 04:26:29 +0000
2736@@ -14,7 +14,7 @@
2737 * details widgets until the user states that the project they are
2738 * registering is not a duplicate.
2739 */
2740-LPS.use('node', 'lazr.effects', function(Y) {
2741+YUI().use('node', 'lazr.effects', function(Y) {
2742 Y.on('domready', function() {
2743 /* These two regexps serve slightly different purposes. The first
2744 * finds the leftmost run of valid url characters for the autofill
2745
2746=== modified file 'lib/lp/registry/templates/productrelease-add-from-series.pt'
2747--- lib/lp/registry/templates/productrelease-add-from-series.pt 2011-08-09 14:18:02 +0000
2748+++ lib/lp/registry/templates/productrelease-add-from-series.pt 2012-01-25 04:26:29 +0000
2749@@ -14,7 +14,7 @@
2750 <tal:script
2751 replace="structure
2752 string:&lt;script id='milestone-script' type='text/javascript'&gt;" />
2753- LPS.use('node', 'lp.registry.milestoneoverlay', function (Y) {
2754+ YUI().use('node', 'lp.registry.milestoneoverlay', function (Y) {
2755
2756 // This is a value for the SELECT OPTION which is passed with
2757 // the SELECT's "change" event. It includes some symbols that are not
2758
2759=== modified file 'lib/lp/registry/templates/products-index.pt'
2760--- lib/lp/registry/templates/products-index.pt 2011-03-04 00:08:20 +0000
2761+++ lib/lp/registry/templates/products-index.pt 2012-01-25 04:26:29 +0000
2762@@ -46,9 +46,11 @@
2763 value="Search projects"
2764 />
2765 </form>
2766- <script type="text/javascript"><!--
2767- setFocusByName('text');
2768- // --></script>
2769+ <script type="text/javascript">
2770+ YUI().use('lp', function (Y) {
2771+ setFocusByName('text');
2772+ });
2773+ </script>
2774
2775 <tal:searching condition="view/search_requested">
2776
2777
2778=== modified file 'lib/lp/registry/templates/productseries-index.pt'
2779--- lib/lp/registry/templates/productseries-index.pt 2011-06-16 13:50:58 +0000
2780+++ lib/lp/registry/templates/productseries-index.pt 2012-01-25 04:26:29 +0000
2781@@ -17,7 +17,7 @@
2782 <tal:uses_launchpad_bugtracker
2783 condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD">
2784 <script type="text/javascript">
2785- LPS.use('lp.registry.structural_subscription', function(Y) {
2786+ YUI().use('lp.registry.structural_subscription', function(Y) {
2787 var module = Y.lp.registry.structural_subscription;
2788 Y.on('domready', function() {
2789 module.setup({content_box: "#structural-subscription-content-box"});
2790
2791=== modified file 'lib/lp/registry/templates/productseries-setbranch.pt'
2792--- lib/lp/registry/templates/productseries-setbranch.pt 2010-11-10 15:33:47 +0000
2793+++ lib/lp/registry/templates/productseries-setbranch.pt 2012-01-25 04:26:29 +0000
2794@@ -119,7 +119,7 @@
2795 </div>
2796
2797 <script type="text/javascript">
2798- LPS.use('lp.code.productseries_setbranch', function(Y) {
2799+ YUI().use('lp.code.productseries_setbranch', function(Y) {
2800 Y.on('domready', Y.lp.code.productseries_setbranch.setup);
2801 });
2802 </script>
2803
2804=== modified file 'lib/lp/registry/templates/project-index.pt'
2805--- lib/lp/registry/templates/project-index.pt 2012-01-05 18:00:32 +0000
2806+++ lib/lp/registry/templates/project-index.pt 2012-01-25 04:26:29 +0000
2807@@ -12,7 +12,7 @@
2808 <tal:uses_launchpad_bugtracker
2809 condition="context/bug_tracking_usage/enumvalue:LAUNCHPAD">
2810 <script type="text/javascript">
2811- LPS.use('lp.registry.structural_subscription', function(Y) {
2812+ YUI().use('lp.registry.structural_subscription', function(Y) {
2813 var module = Y.lp.registry.structural_subscription;
2814 Y.on('domready', function() {
2815 module.setup({content_box: "#structural-subscription-content-box"});
2816
2817=== modified file 'lib/lp/registry/templates/projects-index.pt'
2818--- lib/lp/registry/templates/projects-index.pt 2011-03-04 00:08:20 +0000
2819+++ lib/lp/registry/templates/projects-index.pt 2012-01-25 04:26:29 +0000
2820@@ -32,9 +32,11 @@
2821 tal:condition="not: view/search_requested"
2822 type="submit" value="Search project groups" />
2823 </form>
2824- <script type="text/javascript"><!--
2825- setFocusByName('text');
2826- // --></script>
2827+ <script type="text/javascript">
2828+ YUI().use('lp', function (Y) {
2829+ setFocusByName('text');
2830+ });
2831+ </script>
2832
2833 <div tal:condition="view/search_requested">
2834 <tal:searching condition="view/search_results">
2835
2836=== modified file 'lib/lp/registry/templates/team-portlet-membership.pt'
2837--- lib/lp/registry/templates/team-portlet-membership.pt 2011-03-04 00:55:49 +0000
2838+++ lib/lp/registry/templates/team-portlet-membership.pt 2012-01-25 04:26:29 +0000
2839@@ -105,7 +105,7 @@
2840 tal:condition="link/enabled">
2841 <script type="text/javascript"
2842 tal:content="string:
2843- LPS.use('lp.registry.team', function(Y) {
2844+ YUI().use('lp.registry.team', function(Y) {
2845 Y.on('load',
2846 function(e) {
2847 Y.lp.registry.team.setup_add_member_handler(
2848
2849=== modified file 'lib/lp/registry/templates/teammembership-index.pt'
2850--- lib/lp/registry/templates/teammembership-index.pt 2011-12-06 05:52:07 +0000
2851+++ lib/lp/registry/templates/teammembership-index.pt 2012-01-25 04:26:29 +0000
2852@@ -20,7 +20,7 @@
2853 use-macro="context/@@launchpad_widget_macros/yui2calendar-dependencies" />
2854
2855 <script type="text/javascript">
2856- LPS.use('node', 'lp.app.calendar', function(Y) {
2857+ YUI().use('node', 'lp.app.calendar', function(Y) {
2858 // Ensure that when the picker is used the radio button switches
2859 // from 'Never' to 'On' and the expiry field is enabled.
2860 Y.on("available", function(e) {
2861
2862=== modified file 'lib/lp/registry/templates/timeline-macros.pt'
2863--- lib/lp/registry/templates/timeline-macros.pt 2011-11-14 04:07:15 +0000
2864+++ lib/lp/registry/templates/timeline-macros.pt 2012-01-25 04:26:29 +0000
2865@@ -45,7 +45,7 @@
2866 if (size != NaN && size >= 1) {
2867 timeline_url += "size=" + size + "&";
2868 }
2869- LPS.use('node', function(Y) {
2870+ YUI().use('node', function(Y) {
2871 if (Y.UA.ie) {
2872 return;
2873 }
2874
2875=== modified file 'lib/lp/scripts/runlaunchpad.py'
2876--- lib/lp/scripts/runlaunchpad.py 2011-12-30 08:13:14 +0000
2877+++ lib/lp/scripts/runlaunchpad.py 2012-01-25 04:26:29 +0000
2878@@ -1,4 +1,4 @@
2879-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2880+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
2881 # GNU Affero General Public License version 3 (see the file LICENSE).
2882
2883 # pylint: disable-msg=W0603
2884
2885=== added file 'lib/lp/scripts/utilities/js/jsmin_all.py'
2886--- lib/lp/scripts/utilities/js/jsmin_all.py 1970-01-01 00:00:00 +0000
2887+++ lib/lp/scripts/utilities/js/jsmin_all.py 2012-01-25 04:26:29 +0000
2888@@ -0,0 +1,46 @@
2889+#!/usr/bin/env python
2890+
2891+"""Handle minifying all javascript files in the build directory by walking
2892+
2893+$ jsmin_all.py $lp_js_root
2894+
2895+"""
2896+import os
2897+import re
2898+import sys
2899+from jsmin import JavascriptMinify
2900+
2901+
2902+def dirwalk(dir):
2903+ "walk a directory tree, using a generator"
2904+ for f in os.listdir(dir):
2905+ fullpath = os.path.join(dir,f)
2906+ if os.path.isdir(fullpath) and not os.path.islink(fullpath):
2907+ for x in dirwalk(fullpath): # recurse into subdir
2908+ yield x
2909+ else:
2910+ yield fullpath
2911+
2912+
2913+def is_min(filename):
2914+ """Check if this file is alrady a minified file"""
2915+ return re.search("^(min).js$", filename)
2916+
2917+def minify(filename):
2918+ """Given a filename, handle minifying it as -min.js"""
2919+ if not is_min(filename):
2920+ new_filename = re.sub(".js$", "-min.js", filename)
2921+
2922+ with open(filename) as shrink_me:
2923+ with open(new_filename, 'w') as tobemin:
2924+ jsm = JavascriptMinify()
2925+ jsm.minify(shrink_me, tobemin)
2926+
2927+
2928+if __name__ == '__main__':
2929+ root = sys.argv[1]
2930+
2931+ if os.path.isfile(root):
2932+ minify(root)
2933+ else:
2934+ [minify(f) for f in dirwalk(root)]
2935
2936=== modified file 'lib/lp/services/features/flags.py'
2937--- lib/lp/services/features/flags.py 2011-12-22 22:20:19 +0000
2938+++ lib/lp/services/features/flags.py 2012-01-25 04:26:29 +0000
2939@@ -37,8 +37,12 @@
2940 # Data for generating web-visible feature flag documentation.
2941 #
2942 # Entries for each flag are:
2943-# flag name, value domain, prose documentation, default behaviour, title,
2944-# URL to a page with more information about the feature.
2945+# 1. flag name
2946+# 2. value domain
2947+# 3. prose documentation
2948+# 4. default behaviour
2949+# 5. title
2950+# 6. URL to a page with more information about the feature.
2951 #
2952 # Value domain as in value_domain_info above.
2953 #
2954@@ -105,6 +109,18 @@
2955 '',
2956 '',
2957 ''),
2958+ ('js.combo_loader.enabled',
2959+ 'boolean',
2960+ 'Determines if we use a js combo loader or not.',
2961+ '',
2962+ '',
2963+ ''),
2964+ ('js.yui-version',
2965+ 'space delimited',
2966+ 'Allows us to change the YUI version we run against, e.g. yui-3.4.',
2967+ 'As speficied in versions.cfg',
2968+ '',
2969+ ''),
2970 ('mail.dkim_authentication.disabled',
2971 'boolean',
2972 'Disable DKIM authentication checks on incoming mail.',
2973
2974=== modified file 'lib/lp/services/profile/profile.pt'
2975--- lib/lp/services/profile/profile.pt 2011-09-01 22:13:33 +0000
2976+++ lib/lp/services/profile/profile.pt 2012-01-25 04:26:29 +0000
2977@@ -347,7 +347,7 @@
2978 </tal:block>
2979 </div>
2980 <script>
2981-LPS.use('node', 'lp', 'transition', function (Y) {
2982+YUI().use('node', 'lp', 'transition', function (Y) {
2983 Y.one('div#reveal_profiling').on('click', function (e) {
2984 Y.one('div#profiling_info').setStyle('display', 'block');
2985 e.preventDefault();
2986@@ -359,7 +359,7 @@
2987 });
2988 </script>
2989 <script tal:condition="not:options/sql_traceback_none|nothing">
2990-LPS.use('node', 'lp', 'transition', function (Y) {
2991+YUI().use('node', 'lp', 'transition', function (Y) {
2992 function slideIn(target) {
2993 target.transition({
2994 easing: 'ease-in',
2995
2996=== modified file 'lib/lp/services/webapp/error.py'
2997--- lib/lp/services/webapp/error.py 2012-01-01 02:58:52 +0000
2998+++ lib/lp/services/webapp/error.py 2012-01-25 04:26:29 +0000
2999@@ -25,7 +25,9 @@
3000 from zope.interface import implements
3001
3002 import lp.layers
3003+from lp.services import features
3004 from lp.services.config import config
3005+from lp.services.features.flags import NullFeatureController
3006 from lp.services.propertycache import cachedproperty
3007 from lp.services.webapp.interfaces import ILaunchBag
3008 from lp.services.webapp.publisher import LaunchpadView
3009@@ -70,6 +72,13 @@
3010 if getattr(self.request, 'oopsid') is not None:
3011 self.request.response.addHeader(
3012 'X-Lazr-OopsId', self.request.oopsid)
3013+
3014+ # Need to neuter the feature flags on error output. The base template
3015+ # checks for a feature flag, but they depend on db access which might
3016+ # not have been setup yet.
3017+ request.features = NullFeatureController()
3018+ features.install_feature_controller(request.features)
3019+
3020 self.computeDebugOutput()
3021 if config.canonical.show_tracebacks:
3022 self.show_tracebacks = True
3023
3024=== modified file 'lib/lp/services/webapp/publisher.py'
3025--- lib/lp/services/webapp/publisher.py 2012-01-01 02:58:52 +0000
3026+++ lib/lp/services/webapp/publisher.py 2012-01-25 04:26:29 +0000
3027@@ -311,6 +311,23 @@
3028 """The page's template, if configured in zcml."""
3029 return self.index
3030
3031+ @property
3032+ def yui_version(self):
3033+ """The version of YUI we are using."""
3034+ value = getFeatureFlag('js.yui_version')
3035+ if not value:
3036+ return 'yui'
3037+ else:
3038+ return value
3039+
3040+ @property
3041+ def yui_console_debug(self):
3042+ """Hide console debug messages in production."""
3043+ # We need to import here otherwise sitecustomize can't get imported,
3044+ # likely due to some non-obvious circular import issues.
3045+ from lp.services.config import config
3046+ return 'true' if config.devmode else 'false'
3047+
3048 def render(self):
3049 """Return the body of the response.
3050
3051
3052=== modified file 'lib/lp/services/worlddata/javascript/languages.js'
3053--- lib/lp/services/worlddata/javascript/languages.js 2011-02-03 20:55:58 +0000
3054+++ lib/lp/services/worlddata/javascript/languages.js 2012-01-25 04:26:29 +0000
3055@@ -5,9 +5,9 @@
3056 * @requires oop, event, node
3057 */
3058
3059-YUI.add('languages', function(Y) {
3060+YUI.add('lp.languages', function(Y) {
3061
3062-var languages = Y.namespace('languages');
3063+var languages = Y.namespace('lp.languages');
3064
3065 /* Prefilled in initialize_language_page. */
3066 var all_languages;
3067@@ -57,7 +57,6 @@
3068
3069 languages.initialize_languages_page = function(Y) {
3070 init_filter_form();
3071-
3072 };
3073
3074
3075
3076=== modified file 'lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt'
3077--- lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt 2012-01-23 22:28:29 +0000
3078+++ lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt 2012-01-25 04:26:29 +0000
3079@@ -54,7 +54,7 @@
3080 >>> print extract_all_script_and_style_links(cprov_browser.contents)
3081 /...
3082 ...
3083- http://launchpad.dev/+icing/.../build/app/calendar.js
3084+ http://launchpad.dev/+icing/.../build/calendar/calendar.js
3085 http://launchpad.dev/+icing/.../yui_2.7.0b/build/calendar/assets/skins/sam/calendar.css
3086
3087 Initially there are no subscriptions for a newly privatized PPA (although,
3088
3089=== modified file 'lib/lp/soyuz/templates/archive-edit-dependencies.pt'
3090--- lib/lp/soyuz/templates/archive-edit-dependencies.pt 2009-12-03 18:33:22 +0000
3091+++ lib/lp/soyuz/templates/archive-edit-dependencies.pt 2012-01-25 04:26:29 +0000
3092@@ -62,7 +62,7 @@
3093 </div> <!-- launchpad_form -->
3094
3095 <script type="text/javascript">
3096- LPS.use("node", function(Y) {
3097+ YUI().use("node", function(Y) {
3098
3099 // Highlight (setting bold font-weight) the label for the
3100 // selected option in a given NodesList. Assumes the input is
3101
3102=== modified file 'lib/lp/soyuz/templates/archive-index.pt'
3103--- lib/lp/soyuz/templates/archive-index.pt 2011-11-29 20:49:15 +0000
3104+++ lib/lp/soyuz/templates/archive-index.pt 2012-01-25 04:26:29 +0000
3105@@ -148,7 +148,7 @@
3106 >Celso Providelo</a>.</p>
3107
3108 <script type="text/javascript">
3109- LPS.use('lp.app.widgets.expander', function(Y) {
3110+ YUI().use('lp.app.widgets.expander', function(Y) {
3111 var widget_header = Y.one('#ppa-install .widget-header');
3112 var content = Y.one('.widget-body');
3113 var expander = new Y.lp.app.widgets.expander.Expander(
3114
3115=== modified file 'lib/lp/soyuz/templates/archive-macros.pt'
3116--- lib/lp/soyuz/templates/archive-macros.pt 2011-12-08 22:41:00 +0000
3117+++ lib/lp/soyuz/templates/archive-macros.pt 2012-01-25 04:26:29 +0000
3118@@ -10,7 +10,7 @@
3119 </tal:comment>
3120
3121 <script type="text/javascript">
3122-LPS.use('node', 'io-base', 'lp.anim', 'lp.soyuz.base',
3123+YUI().use('node', 'io-base', 'lp.anim', 'lp.soyuz.base',
3124 'lp.app.widgets.expander', function(Y) {
3125
3126
3127
3128=== modified file 'lib/lp/soyuz/templates/archive-packages.pt'
3129--- lib/lp/soyuz/templates/archive-packages.pt 2012-01-10 10:32:59 +0000
3130+++ lib/lp/soyuz/templates/archive-packages.pt 2012-01-25 04:26:29 +0000
3131@@ -27,7 +27,7 @@
3132
3133 <script type="text/javascript" id="repository-size-update"
3134 tal:condition="view/archive_url">
3135-LPS.use('io-base', 'lp.anim', 'node', 'lp.soyuz.base',
3136+YUI().use('io-base', 'lp.anim', 'node', 'lp.soyuz.base',
3137 'lp.soyuz.update_archive_build_statuses', function(Y) {
3138
3139
3140@@ -92,7 +92,7 @@
3141 });
3142 </script>
3143 <script type="text/javascript" id="repository-size-update">
3144-LPS.use('lp.soyuz.archive_packages',
3145+YUI().use('lp.soyuz.archive_packages',
3146 'lp.app.widgets.expander.Expander', function(Y) {
3147
3148 Y.on('domready', function() {
3149
3150=== modified file 'lib/lp/soyuz/templates/archive-subscribers.pt'
3151--- lib/lp/soyuz/templates/archive-subscribers.pt 2010-10-10 21:54:16 +0000
3152+++ lib/lp/soyuz/templates/archive-subscribers.pt 2012-01-25 04:26:29 +0000
3153@@ -93,7 +93,7 @@
3154 </form>
3155 </div><!-- class="portlet" -->
3156 <script type="text/javascript" id="setup-archivesubscribers-index">
3157- LPS.use('lp.soyuz.archivesubscribers_index', function(Y) {
3158+ YUI().use('lp.soyuz.archivesubscribers_index', function(Y) {
3159 Y.lp.soyuz.archivesubscribers_index.setup_archivesubscribers_index();
3160 });
3161 </script>
3162
3163=== modified file 'lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt'
3164--- lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt 2011-07-18 09:23:10 +0000
3165+++ lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt 2012-01-25 04:26:29 +0000
3166@@ -11,7 +11,7 @@
3167
3168 <div metal:fill-slot="head_epilogue">
3169 <script type="text/javascript">
3170- LPS.use('node', 'lp.app.widgets.expander', function(Y) {
3171+ YUI().use('node', 'lp.app.widgets.expander', function(Y) {
3172 Y.on('domready', function() {
3173 var all_expanders = Y.all('.expander-icon');
3174 all_expanders.each(function(icon) {
3175
3176=== modified file 'lib/lp/soyuz/templates/distroseries-queue.pt'
3177--- lib/lp/soyuz/templates/distroseries-queue.pt 2011-07-28 07:59:23 +0000
3178+++ lib/lp/soyuz/templates/distroseries-queue.pt 2012-01-25 04:26:29 +0000
3179@@ -11,7 +11,7 @@
3180
3181 <div metal:fill-slot="head_epilogue">
3182 <script type="text/javascript">
3183- LPS.use('node', 'lp.app.widgets.expander', function(Y) {
3184+ YUI().use('node', 'lp.app.widgets.expander', function(Y) {
3185 Y.on('domready', function() {
3186 var all_expanders = Y.all('.expander-link');
3187 all_expanders.each(function(link) {
3188
3189=== modified file 'lib/lp/translations/templates/languageset-index.pt'
3190--- lib/lp/translations/templates/languageset-index.pt 2010-11-10 15:33:47 +0000
3191+++ lib/lp/translations/templates/languageset-index.pt 2012-01-25 04:26:29 +0000
3192@@ -8,15 +8,10 @@
3193
3194 <body>
3195 <div metal:fill-slot="head_epilogue">
3196- <script
3197- type="text/javascript"
3198- tal:condition="devmode"
3199- tal:attributes="src string:${icingroot}/build/worlddata/languages.js">
3200- </script>
3201 <script type="text/javascript">
3202- LPS.use('languages', 'event', function(Y) {
3203+ YUI().use('lp.languages', 'event', function(Y) {
3204 Y.on('domready', function(e) {
3205- Y.languages.initialize_languages_page(Y);
3206+ Y.lp.languages.initialize_languages_page(Y);
3207 });
3208 });
3209 </script>
3210
3211=== modified file 'lib/lp/translations/templates/object-templates.pt'
3212--- lib/lp/translations/templates/object-templates.pt 2011-07-26 18:29:40 +0000
3213+++ lib/lp/translations/templates/object-templates.pt 2012-01-25 04:26:29 +0000
3214@@ -7,7 +7,7 @@
3215 <body>
3216 <tal:head_epilogue metal:fill-slot="head_epilogue">
3217 <script type="text/javascript">
3218- LPS.use('lp.translations.sourcepackage_sharing_details', function(Y) {
3219+ YUI().use('lp.translations.sourcepackage_sharing_details', function(Y) {
3220 Y.on('domready', function() {
3221 Y.lp.translations.sourcepackage_sharing_details.prepare(
3222 LP.cache);
3223@@ -45,7 +45,7 @@
3224 }
3225 </style>
3226 <script language="JavaScript" type="text/javascript">
3227- LPS.use('node-base', 'event-delegate', function(Y) {
3228+ YUI().use('node-base', 'event-delegate', function(Y) {
3229 Y.on('domready', function(e) {
3230 Y.all('#templates_table .template_links').addClass(
3231 'inactive_links');
3232
3233=== modified file 'lib/lp/translations/templates/pofile-export.pt'
3234--- lib/lp/translations/templates/pofile-export.pt 2011-06-09 10:50:25 +0000
3235+++ lib/lp/translations/templates/pofile-export.pt 2012-01-25 04:26:29 +0000
3236@@ -13,7 +13,7 @@
3237 }
3238 </style>
3239 <script type="text/javascript">
3240- LPS.use('node', 'event', function(Y){
3241+ YUI().use('node', 'event', function(Y){
3242 Y.on('domready', function(){
3243 // The pochanged option is only available for the PO format.
3244 var formatlist = Y.one('#div_format select');
3245
3246=== modified file 'lib/lp/translations/templates/pofile-translate.pt'
3247--- lib/lp/translations/templates/pofile-translate.pt 2012-01-10 21:11:08 +0000
3248+++ lib/lp/translations/templates/pofile-translate.pt 2012-01-25 04:26:29 +0000
3249@@ -15,7 +15,7 @@
3250 </style>
3251
3252 <script type="text/javascript">
3253- LPS.use('lp.translations.pofile', function(Y) {
3254+ YUI().use('lp.translations.pofile', function(Y) {
3255 Y.on('domready', Y.lp.translations.pofile.initializePOFile);
3256 });
3257
3258
3259=== modified file 'lib/lp/translations/templates/sourcepackage-sharing-details.pt'
3260--- lib/lp/translations/templates/sourcepackage-sharing-details.pt 2011-04-14 20:33:00 +0000
3261+++ lib/lp/translations/templates/sourcepackage-sharing-details.pt 2012-01-25 04:26:29 +0000
3262@@ -9,7 +9,7 @@
3263 <body>
3264 <metal:block fill-slot="head_epilogue">
3265 <script type="text/javascript">
3266- LPS.use('lp.translations.sourcepackage_sharing_details', function(Y) {
3267+ YUI().use('lp.translations.sourcepackage_sharing_details', function(Y) {
3268 Y.on('domready', function() {
3269 Y.lp.translations.sourcepackage_sharing_details.prepare(
3270 LP.cache);
3271
3272=== modified file 'lib/lp/translations/templates/translation-import-queue-macros.pt'
3273--- lib/lp/translations/templates/translation-import-queue-macros.pt 2011-11-14 04:07:15 +0000
3274+++ lib/lp/translations/templates/translation-import-queue-macros.pt 2012-01-25 04:26:29 +0000
3275@@ -13,7 +13,7 @@
3276 <script type="text/javascript" tal:content="view/choice_confs_js" />
3277
3278 <script type="text/javascript">
3279- LPS.use('lp.translations.importqueue', 'event', function(Y) {
3280+ YUI().use('lp.translations.importqueue', 'event', function(Y) {
3281 Y.on('domready', function(e) {
3282 Y.lp.translations.importqueue.initialize_import_queue_page(Y);
3283 });
3284
3285=== modified file 'lib/lp/translations/templates/translationimportqueueentry-index.pt'
3286--- lib/lp/translations/templates/translationimportqueueentry-index.pt 2010-07-08 14:29:36 +0000
3287+++ lib/lp/translations/templates/translationimportqueueentry-index.pt 2012-01-25 04:26:29 +0000
3288@@ -19,7 +19,7 @@
3289 var template_domains = {'name1': 'domain1', 'name2': 'domain2'};
3290 </script>
3291 <script type="text/javascript">
3292- LPS.use('node', 'lp.translations.importqueueentry',
3293+ YUI().use('node', 'lp.translations.importqueueentry',
3294 function (Y) {
3295 Y.on('domready', Y.lp.translations.importqueueentry.setup_page);
3296 });
3297
3298=== modified file 'lib/lp/translations/templates/translationmessage-translate.pt'
3299--- lib/lp/translations/templates/translationmessage-translate.pt 2010-08-31 12:42:29 +0000
3300+++ lib/lp/translations/templates/translationmessage-translate.pt 2012-01-25 04:26:29 +0000
3301@@ -14,7 +14,7 @@
3302 }
3303 </style>
3304 <script type="text/javascript">
3305- LPS.use('lp.translations.pofile', function(Y) {
3306+ YUI().use('lp.translations.pofile', function(Y) {
3307 Y.on('domready', Y.lp.translations.pofile.initializeTranslationMessage);
3308 });
3309 </script>
3310
3311=== modified file 'lib/lp/translations/templates/translations-macros.pt'
3312--- lib/lp/translations/templates/translations-macros.pt 2012-01-10 20:52:40 +0000
3313+++ lib/lp/translations/templates/translations-macros.pt 2012-01-25 04:26:29 +0000
3314@@ -150,7 +150,7 @@
3315
3316 <metal:languages-table-js define-macro="languages-table-js">
3317 <script type="text/javascript">
3318- LPS.use('lp.translations.languages', 'event', function(Y) {
3319+ YUI().use('lp.translations.languages', 'event', function(Y) {
3320 Y.on("click", function(e) {
3321 Y.lp.translations.languages.toggle_languages_visibility(e);
3322 }, "#toggle-languages-visibility");
3323
3324=== added file 'utilities/js-deps'
3325--- utilities/js-deps 1970-01-01 00:00:00 +0000
3326+++ utilities/js-deps 2012-01-25 04:26:29 +0000
3327@@ -0,0 +1,7 @@
3328+#!bin/py
3329+
3330+import _pythonpath
3331+from convoy.meta import main
3332+
3333+main()
3334+
3335
3336=== modified file 'utilities/yui-deps.py'
3337--- utilities/yui-deps.py 2011-03-11 11:15:31 +0000
3338+++ utilities/yui-deps.py 2012-01-25 04:26:29 +0000
3339@@ -8,7 +8,7 @@
3340 from sys import argv
3341
3342
3343-yui_root = 'lib/canonical/launchpad/icing/yui'
3344+yui_root = 'build/js/yui/yui-3.3.0'
3345 yui_deps = [
3346 'yui/yui',
3347 'oop/oop',
3348
3349=== modified file 'versions.cfg'
3350--- versions.cfg 2012-01-11 05:54:50 +0000
3351+++ versions.cfg 2012-01-25 04:26:29 +0000
3352@@ -114,7 +114,7 @@
3353 wsgi-jsonrpc = 0.2.8
3354 wsgi-xmlrpc = 0.2.7
3355 wsgiref = 0.1.2
3356-yui = 3.3
3357+yui = 3.3.0
3358 z3c.coverage = 1.1.2
3359 z3c.csvvocabulary = 1.0.0
3360 z3c.etestbrowser = 1.0.4