Hello XWiki experts,
I'm having a very weird behaviour in a set of velocity files inside curriki, running xwiki 3.5.
The view code calls startpage.vm, itself having:
#template("xwikivars.vm")
which contains:
#set($GA_uacct=$xwiki.getXWiki().Param('curriki.system.GA'))
and, a few templates later, in analytics.vm, one has:
#if("$!GA_uacct" != "0" && "$!GA_uacct" != "")
.... <!-- have the setting -->
#else
.... <!-- missing -->
#end
I know I could put the #set() statement inside analytics.vm, where it was some versions ago. However, I'd like to understand.
What I have as behavior is that about half of the executions above show missing and the other half doesn't have them...
- should I never expect this variable to be defined inside analytics.vm? (there would be other settings such as the hostname that are needed and are read the same fashion)
- shouldn't this variable always be defined?
thanks for hints.
Paul
I seem to be running into an error I can't find my way around when passing the xwiki context to an eventListener. According to the error message itself (below) I appear to be passing the right objects, but I'm still getting an exception thrown.
I should point out that I'm new to both xwiki and groovy, so I may have missed something obvious, is the context not instantiated by the time it's been sent to the event handler? or should I be grabbing it anew?
thanks
-s
Error and groovy code below...
2012-07-05 21:19:59,471 [http://localhost:8080/xwiki/bin/preview/Task/look+into+CMH+%2F+TDT] ERROR .o.i.DefaultObservationManager - Failed to send event [org.xwiki.observation.event.DocumentUpdateEvent@6b193509] to listener [MailingEventListener@171aa1cb]
groovy.lang.MissingMethodException: No signature of method: static com.xpn.xwiki.plugin.mailsender.MailSenderPlugin.sendMail() is applicable for argument types: (com.xpn.xwiki.plugin.mailsender.Mail, com.xpn.xwiki.XWikiContext) values: [From [seth.redmond(a)gmail.com], To [], Subject [xwiki done some stuff, yo], Text [document TaskClass has been changed], ...]
Possible solutions: sendMail(com.xpn.xwiki.plugin.mailsender.Mail, com.xpn.xwiki.XWikiContext), sendMail(com.xpn.xwiki.plugin.mailsender.Mail, com.xpn.xwiki.plugin.mailsender.MailConfiguration, com.xpn.xwiki.XWikiContext), sendMails(java.util.Collection, com.xpn.xwiki.XWikiContext), sendMails(java.util.Collection, com.xpn.xwiki.plugin.mailsender.MailConfiguration, com.xpn.xwiki.XWikiContext), findAll()
{{groovy}}
import org.xwiki.observation.*
import org.xwiki.observation.event.*
import com.xpn.xwiki.plugin.mailsender.*
import com.xpn.xwiki.web.*
import com.xpn.xwiki.*
class MailingEventListener implements EventListener
{
def xwiki
def xwcontext
def context
def xdoc
MailingEventListener(xwiki, context)
{
this.xwiki = xwiki
this.context = context
this.xwcontext = context.getContext()
this.xdoc = context.doc
}
String getName()
{
// The unique name of this event listener
return "mailing"
}
List<Event> getEvents()
{
// The list of events this listener listens to
return Arrays.asList(new DocumentUpdateEvent())
}
// Called by the Observation Manager when an event matches the list of events returned
// by getEvents()
void onEvent(Event event, Object source, Object data)
{
def mailfrom = 'seth.redmond(a)gmail.com'
def mailto = xdoc.getStringValue('assignee')
def subject = 'xwiki done some stuff, yo'
def message = 'document '+xdoc.name+' has been changed'
def mailItem = new Mail(mailfrom, mailto, null, null, subject, message, null)
MailSenderPlugin.sendMail(mailItem, xwcontext);
}
}
// Register against the Observation Manager
def observation = Utils.getComponent(ObservationManager.class)
observation.removeListener("mailing")
def listener = new MailingEventListener(xwiki, xcontext)
observation.addListener(listener)
println "{{info}}Listener $listener.name is now registered on $listener.events{{/info}}"
println "{{info}}Context = $listener.context{{/info}}"
println "{{info}}$listener.context.doc.name{{/info}}"
{{/groovy}}
Hi devs,
Some time ago, I have written this extension:
http://extensions.xwiki.org/xwiki/bin/view/Extension/LiveTableExcelExport+M…
which is reused by some developers for their projects.
I think it's time to have this project on contrib, in order to have a JIRA
and a MAVEN repository. That will permit people to have this extension as a
dependency on their maven build. My github account is gdelhumeau.
Would you please open this project?
Regards,
Guillaume D.
Hi Thomas,
I've analyzed why Functional tests are failing in the platform, more specifically why the IRCBot one is failing
The reason is because there's no XWiki.WikiMacroClass anymore and thus the wiki macro I have in the IRCBot application is not registered when the wiki is started.
Could you look at that or tell me how to fix it?
Thanks
-Vincent
Hi Devs,
I would like to work on mock ups for Search GUI. From Google, I came across
this Balsamiq Mock Ups ( XWiki Partners -
http://www.xwiki.com/xwiki/bin/view/Partner/Balsamiq).
And Mockups for XWiki Products are hosted at
http://incubator.myxwiki.org/xwiki/bin/view/Mockups/WebHome, Is it still
active. Can you give me access to this site. I tried to login using my
dev.xwiki.org credentials, its resulting in Invalid credentials error.
Can you create an account for me with Username : "savis"
--
Thanks,
Savi
Hi devs,
I'm going to be the RM for 4.2.x and for a start I'd like to release
4.2M1 tomorrow (17th July). Note that the release was previously
planned for 9th so we're late by a week.
If you are working on something that needs to be included in 4.2M1
please reply to this mail. We currently have to blockers:
XWIKI-8057: IllegalArgumentException on annotation creation and
deletion (Edy is handling it)
XWIKI-8060: Script service installed on a wiki (not on root) is not
found by script manager (Thomas is handling it)
Any other blockers?
At the same time we have some functional/integration tests failing for
some time:
2 in xwiki-platform (
http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$xwiki-platform-in…
and http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$xwiki-platform-ir…
), failing for the past 65 builds.. Vincent, can you take a look?
2 in xwiki-enterprise-test-storage (
http://ci.xwiki.org/job/xwiki-enterprise-test-storage/org.xwiki.enterprise$…
) failing for the past 6 builds. Caleb, can you take a look?
1 flicker in xwiki-enterprise-test-selenium (I'll look at it).
Thanks,
Marius
Hi devs,
I've been sitting on this for a few months already. Basically I've implemented this git module:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Git+Module
My plan is to use it on xwiki.org to provide committer statistics.
Thus I'd like to propose to commit it in xwiki-platform (with our rule of committing there what we use for xwiki.org, similar to xwiki-platform-jira).
Of course it wouldn't be bundled by default in XE.
Here's my +1
Thanks
-Vincent
PS: The code is small: it's one class
Hello friends,
First I want to thank the community again for this wonderful opportunity. I
definitely have learned a lot and am still learning. Additionally, Thank
you for the reminder to do the midterm evaluation.
1. Please make sure that your project's page [2] is updated and that the
> *progress* field contains an up to date description of your current
> progress/status/etc. This is important for those that did not follow your
> evolution closely and it is also useful for you to better manage your
> work/time. It might also contribute to your evaluation, so please do not
> neglect it.
I also wanted to apologize at my failure to do this. I misunderstood, and
have been updating only the design page. I have since updated the gsoc
page, and it is hopefully sufficient. Please do not hesitate to let me know
any issues, or any improvement that I should make (eg. if I am being too
detailed/not detailed enough).
Finally, I want to thank specifically Jerome and Caty, who have given me
great advice and support on my project throughout the first part of gsoc.
Definitely made the experience much more comfortable. And of course to
everyone who dropped by to give their input; every single one made the
responsive skin project better.
Thank you everyone for your patience, and continual support!
Best regards,
Jonathan Solichin
Hello friends,
You could re-write the whole macro in your template (as a macro - or not).
> This way you can change it without overriding the whole macros.vm. Also
> know that you can macros.vm "empty" and override macros here selectively,
> instead over overloading everything - at least that's as far as I can
> remember.
Ah, so I only need to write in the macros i specifically need in my
macros.vm (that is, my macros.vm will not overwrite the template macros.vm,
but will load on top of it?). I tested this and deleted all the macros
except the one I changed, and it seems to be working. However, I wanted to
make sure, since macros.vm is a big file and that I am not messing anything
up. Thanks for the tip.
I realized that there is a bug in the skin that prevented some pages from
being displayed correctly, or being redirected incorrectly. Those pages
would redirect to "[correct url]?viewer=comments" and I realized it was
because of the way the commentsinline.vm is integrated into the skin. If my
attempt to solve the bug and understanding of xwiki is correct, this is a
result of the redirectIfActionNotView macro. Specifically, I think that
"#if(!$requestedByAjax && $xcontext.getAction() != 'view' &&
$xcontext.getAction() != 'get')" on line 85 of commentsinline.vm is causing
the redirect issue because the comments are no longer being requested by
ajax in my skin (it loads everything and the skin just scrolls to the
correct place). This seems to be confirmed as if I remove the ! in front of
$requestedByAjax, the document would show up correctly. However, this does
not seem to be the correct solution, since if I do this, the page won't be
refreshed if I add a comment (manually refreshing the page reveals that the
comment has been successfully added). I tried deleting $requestedByAjax and
permutting different conditions to load this correctly, but to no avail.
Can you point me in the right direction for an elegant solution at this?
Also, I am planning to make the livetables work responsively (since they
are an integral part of xwiki, and it seems to break the responsiveness of
the skin). Presently, my research is pointing me to this solution:
http://filamentgroup.com/lab/responsive_design_approach_for_complex_multico….
What are your thoughts/comments?
Finally, this was sort of brought up in the semantics thread, but I was
wondering whether I should also skin applications (eg. blog)? If I
understand correctly, the skin files do not touch upon them? Actually, I
guess the css will. Should I just skin them through css, or should I do
more?
Thank you again!
Hello XWiki Community,
I would like to propose a change in the visibility of manual testing.
The Problem:
As you know, we have a manual test report found here:
http://www.xwiki.org/xwiki/bin/view/TestReports/ManualTestReportTemplate
This report is being copied for each major, minor and intermediary
version. Performing a full manual test takes approximately 4-5 days,
on one browser. Since we support 4 browsers and 4 databases it would
take a very large amount of time to test on everything before every
release, since I'm the only one following this manual test report.
This is why most of time I perform partial testing on some browsers.
Please note that ATM, we stage only one day the artefacts before we
release them. Currently our Manual Test Reports is a huge page with a
lot of tables. This makes it a little bit hard to test because for
each test case, I have to manually add Passed/Failed or No Tested. At
the moment there is not enough visibility because we only list the
Browsers we support, but we don't give exact information on which
testcase has been ran on which browser. I'd like to encourage more
users from the community to participate in testing XWiki, and ATM this
might be hard because everything is on a single monolithic page.
In order to make it as visible as I can, I have the following proposal.
The Proposal:
Create a dedicated subwiki for QA (maybe qa.xwiki.org), which in
future could grow with other QA related things. For the moment, I
would like to break the current manual test report in several pages,
and several spaces.
Each single test would be a wiki page, which will have objects
attached to it. The space names will be the features, like WYSIWYG,
Administration Application, etc.
Also, if this proposal gets voted I'd like in the future to add a new
field so we can mark tests that are already automated. This would
again, greatly ease my work since I know what is already tested
automatically, thus reducing the work needed for manual testing.
After brainstorming this idea with Marius and Silvia, we have agreed
on the following model:
* the MTR will be organized in 2 levels
- spaces that will contain feature/testcase suites with pages that
hold the individual tests.
- pages that will contain individual testcases. Each singular test
will also have one or multiple tags attached with the features it
belongs to
* the following classes to model this:
QA.TestClass attached to each page containing a test
description (TextArea) - Tells what is the test about e.g: "Tests
that images are uploaded fine after a preview."
Note that the test name will be the wiki page name and the steps to
perform the test will be stored in the document content
QA.ExecutionClass (this will contain all information about a test execution)
platform (DBList) - linked to QA.PlatformClass
browser (DBList) - linked to QA.BrowserClass
passed (Boolean) - value to indicate if the test has passed or
failed. Absence of an object for a specific platform/browser means not
tested
jira (String) - link to JIRA issue (if any)
tester (User) - user that performed the test
date (Date) - date when test was executed
QA.PlatformClass (this will contain the version of XE that have been
tested/currently being tested)
name (String) XE
version (String) 4.1.2
QA.BrowserClass (this will contain the browser versions that we support)
name (String) Mozilla Firefox
version (String) 13
In the same manner we can have this for databases in the future.
Final result:
- If this is implemented there will be a page with a (custom)
lievtable that contains all existing tests. There will be filtering
options per feature for example.
- There will be also a tag cloud above the livetable (similar with
what we have on extensions.xwiki.org)
- Marking a test as executed would require 3 clicks maximum (AJAX)
right from the LiveTable (Similar to Document/Space Index with
Copy/Delete/Rename/Rights), thus improving the speed of manual testing
(the "fill in what you tested" part).
- Going to the page of an individual test will show all XE versions
and browsers on which this has been tested
- Easier for everybody to see what has been tested and what not
In the future, there will also be a proposal/brainstorming about how
to link this with the automated tests. I consider we could be a little
bit more visible about this too. Also, there is no visible link
between the manual tests and the automated tests. It would be nice if
everybody could see for which manual test we have an automated one.
I am waiting for your feedback since I am eager to start working on this.
Regards,
Sorin B.
Hi devs,
Right now xwiki-commons-test has a special logback configuration to
let only errors pass.
Problem is that in some tests I actually need to get warn too.
Also I don't think hidding warning is right, it usually mean there is
something wrong. If a test really expect log to be produced it's very
easy to isolate them using
org.xwiki.loggingLogManager#pushLogListener(null).
So the vote is about modifying the test logback configuration to
include warn level too.
WDYT ?
Here is my +1
--
Thomas Mortagne
Hello all,
I would like to use XWiki WebDAV for editing MSOffice documents online
To do this in read-write mode, we must configure XWiki WebDav on ROOT.
Instead of opening the document from:
http://myserver.test/xwiki/webdav/spaces/test/msoffice/Bonjour.docx
we must open it from:
http://myserver.test/spaces/test/msoffice/Bonjour.docx
This is what I did:
- I am running Tomcat 7 / XWiki Enterprise V2.6
- I renamed the ROOT context xwiki
- I changed the servlet-mapping like this
<servlet-mapping>
<servlet-name>webdav</ servlet-name>
<url-pattern>/*</ url-pattern>
</ servlet-mapping>
Now I can't even request the document
http://myserver.test/spaces/test/msoffice/Bonjour.docx
I have response:
HTTP Status 400 - Bad Request
Is there any solution XWiki WebDAV to open MSOffice in read-write mode ?
Thanks in advance
Hi devs,
in order to implement XWIKI-7927, "Create an entry point for all
available applications inside the wiki" which I plan to commit before
4.2M2 we need to agree on a strategy.
The discussions point to a panel in the right column called
"Applications" which would list all the applications. Here are my
current thoughts about it. We can:
1) Rely solely on application descriptors and list all those
applications in the panel.
- we don't have such a descriptor yet, the main reason is that what
should goes in it can be discussed over and over, even by a single
person. Thomas ? :)
- it would require an additional mechanism if we wish to be able to
edit (ordering, removal) the panel entries; and I think we will want
that
2) Implement a menu component that would allow to build dynamic menus.
I think applications should be able to plug themselves in the user UI
in a manner similar to the way they plug themselves in the
administration (ConfigurableClass).
It would:
- Be generic, we could re-use this mechanism to build both the
applications panel and the other XWiki menus (top menu, content menu)
- Allow to separate the presence of an application in the wiki with
it's presence in the user UI
- Allow applications to add entries to top and content menus
It could look like this:
XWiki.MenuEntryClass
- id: String. Technical ID of the entry
- menuId: String. ID of the menu the entry is part of
- parentMenuEntryId: String. ID of a parent menu entry (optional).
Allows to build submenus (example: top menu).
- scope: Static list. List of actions the entry should appear for:
view/edit/admin/preview.
- position: Int. Position in the menu, we could use 0 as undefined
(bottom) and order from 1 to n. Also used to position items in
submenus.
- label: String. Label of the entry. Would be evaluated (velocity ?
wiki syntax ?) to allow i18n
- target: String. Fullname of the wiki page to point to
- enabled: Boolean. Allow to remove an entry from the menu without
actual deletion
- iconAttachment: String. Name of the attachment to use as the entry
icon (optional)
Notes:
- Objects from this class would be stored in preferences documents
since they'll hold configured positions and the enabled state
- 'separator' could be a reserved entry ID
XWiki.MenuClass
- id: String. Technical ID of the menu
This class would be associated with a XWiki.MenuSheet and would
display the menu editor, which could be simple for a first version (no
drag & drop).
You might have guessed I'm more in favor of 2) even if I can't
refactor the top and content menus for the moment.
WDYT ?
Thanks,
JV.
Could be useful:
http://ocpsoft.com/prettytime/
Idea of usage: For ex we could use that to show the last modified
document dates for dates in the past week (for ex):
"Document created 2 days ago"
It's in the maven central repo and it's under LGPL
-Vincent
I'm overlooking something small...
How can I format dates with velocity?
{{velocity}}
#set($myDate = $doc.getContentUpdateDate())
Last updated at $date.format('medium',$myDate)
Last updated at $date.format('yyyy-MM-dd',$myDate)
{{/velocity}}
Both $date.format are not working!
--
View this message in context: http://xwiki.475771.n2.nabble.com/Velocity-format-date-tp7580272.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
Hi devs,
I've computed overall Release Manager stats at
http://dev.xwiki.org/xwiki/bin/view/Community/ReleaseManagerRoster
Our total # of release after 0.9 is: 173
RM ordered by # of releases:
* ThomasMortagne: 49
* jvdrean: 40
* VincentMassol: 33
* sdumitriu: 26
* mflorea: 11
* cjdelisle: 10
* marta: 2
* dgervalle: 1
* rstavro: 1
Well done Thomas and JV!
Marius and Caleb you have some catching up to do :) (Well Caleb arrived later in the project so it's not completely fair :)).
Denis, you know what you have to do too!
Andreas, when are you next?
We still need a RM for 4.2M1 and later. Any volunteer? :)
Thanks
-Vincent
Hi devs,
Short version:
I'd like to increase the allowed maximum value for the Class Fan-Out
Complexity checkstyle rule from 20 to 25, since a bare component already
uses 1 to 4 imports, and the 20 rule was set before we had components.
Long version:
The Class Fan-Out Complexity metric measures how many other classes are
used by a class. Keeping this to a small value is a good goal, since it
favors loose-coupling, small and independent classes, and makes it
harder to put more than one responsibility in a single class.
However, there are several problems:
One is that this counts utility classes and interfaces, such as
java.util.List, and a fairly complex class uses more than one such
utility class; they usually come in pairs (the interface and the
implementation). And more and more classes are using apache-commons
utilities like StringUtils or IOUtils, which are just shortcut helper
methods that could be implemented in a few lines of code, so we're
trading one import for reduced code complexity, which is a good thing,
even though apparently it's increasing the Fan-Out measure.
Another is that a bare Initializable component implementation will import:
- its component role interface
- Initializable and InitializationException
- Logger
And since good libraries also follow the "many small classes" paradigm,
barely using some of our dependencies will add a lot of imports. For
example, the LucenePlugin has 25 org.apache.lucene.* imports just for
initializing the server and sending search requests.
While the current maximum, 20, is enough for the majority of our classes
and interfaces, I've found myself often enough trying to refactor a
class to get down from 23 or even 21 imports, and usually I find myself
doing ugly tricks, keeping the actual code complexity the same or even
worse. Best case is that I extract an extra class that just contains the
non-public utility methods that were initially in the component
implementation, but that class is meaningless out of the context of its
parent class, so that is also a bad decision, IMHO.
So, I propose to increase the Fan-Out limit to 25, while keeping the
requirement that classes should be kept as small as possible.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
Hello friends,
For example a blog application could want to present a list of
> <article>. But maybe nesting <article> inside a main <article> element is
> just fine.
For a blog homepage, or the blog archive, each
> blog article should have its own <article> wrapper, though.
Yes, I think Sergiu is right in that html5 allows for nesting of articles.
Thank you for the input.
On Tue, Jul 10, 2012 at 12:14 AM, Jonathan Solichin
<j.s.solichin(a)gmail.com>wrote:
> Hello friends,
>
> For example a blog application could want to present a list of
>> <article>. But maybe nesting <article> inside a main <article> element is
>> just fine.
>
>
> For a blog homepage, or the blog archive, each
>> blog article should have its own <article> wrapper, though.
>
> Yes, I think Sergiu is right in that html5 allows for nesting of articles.
> Thank you for the input.
>
> On Sat, Jul 7, 2012 at 1:50 AM, Jonathan Solichin <jssolichin(a)gmail.com>wrote:
>
>> Hi Jerome, friends,
>>
>> > * Would it make sense to use <aside> for the right sidebar ?
>>
>> The aside is actually only for the comments, attachments, history and
>> info sections of the sidebar only. The reason behind this is that according
>> to html5 specs:
>> >
>> > The aside element represents a section of a page that consists of
>> content that is tangentially related to the content around the
>> asideelement, and which could be considered separate from that content.
>> Such sections are often represented as sidebars in printed typography. (
>> http://html5doctor.com/understanding-aside/)
>>
>> which I thought is appropriate for those sections.
>>
>> >
>> > * I've seen you've used <article> as an overall wrapper. Wouldn't
>> <section>
>> > be more appropriate, with articles implemented within the content of
>> the
>> > document ? (BTW this leads to the question of how this would translate
>> in
>> > wiki syntax. So far there is no such notion built right in - though .it
>> > could be implemented with macros).
>>
>> The reason I used article as an overall wrapper for the "main content"
>> (the stuff with the white background), according to the html5 specs:
>> >
>> > "The article element represents a component of a page that consists of
>> a self-contained composition in a document, page, application, or site and
>> that is intended to be independently distributable or reusable, e.g. in
>> syndication. This could be a forum post, a magazine or newspaper article, a
>> blog entry, a user-submitted comment, an interactive widget or gadget, or
>> any other independent item of content." (
>> http://html5doctor.com/the-article-element/)
>>
>> I thought this is appropriate since the entire "main content" is the self
>> contained part of the page that can be independent of the other parts (like
>> menu, asides, sidebars etc.)
>> The use of section I thought is appropriate because each gadgets is in a
>> way a section/part of the overall article, and of the sidebar.
>> >
>> > "The section element represents a generic document or application
>> section" (http://html5doctor.com/the-section-element/)
>>
>> These are just my thoughts on the components of a webpage of xwiki,
>> however. Do you think this is not the correct interpretation of the xwiki
>> parts?
>>
>> Thanks for looking into the code!
>> Jonathan Solichin
>>
>
>
Hi devs,
For adding additional configuration keys at build time to xwiki.cfg, we
have the $xwikiCfgAdditionalProperties velocity variable available. I would
like to propose the equivalent for xwiki.properties :
$xwikiPropertiesAdditionalProperties
WDYT ?
My +1
Jerome
--
Jérôme Velociter
Winesquare
http://www.winesquare.net/
Hello GSoC students and mentors,
I would like to remind you that this week (9-13 July) is the mid-term
evaluation where it is decided if the student is on track and if (s)he
should pass or fail. The deadline [1] is 19:00 UTC on 13 July.
= Students =
1. Please make sure that your project's page [2] is updated and that the
*progress* field contains an up to date description of your current
progress/status/etc. This is important for those that did not follow your
evolution closely and it is also useful for you to better manage your
work/time. It might also contribute to your evaluation, so please do not
neglect it.
2. Please make sure that you fill in the mid-term evaluation form on
Google's melange [3]. Google is being pretty strict about it this year, so
make sure you don`t forget to do it before the deadline.
= Mentors =
1. Please make sure that you evaluate your student's current work on
Google's melange [3].
I hope you`ve enjoyed the first part of GSoC at XWiki. Hope to see you for
the second one with shiny and successful projects ;)
Thanks,
Eduard
----------
[1] http://www.google-melange.com/gsoc/events/google/gsoc2012
[2]
http://dev.xwiki.org/xwiki/bin/view/GoogleSummerOfCode/WebHome#HSelectedPro…
[3] http://www.google-melange.com
Hi devs,
Short story:
Whenever adding new HTML content to the document, like loading the
content of a modal popup, or refreshing the Activity stream, an
'xwiki:dom:updated' event should be fired, sending the list of added
elements in the even memo. All standard behaviors should also monitor
these events and enhance the newly inserted HTML content, for example
adding support for the suggestDocuments, withTip or maximizable behavior
classnames.
Long story:
One of the good features of XWiki is that we have the notion of
"behavior classnames", CSS class names that attach a certain behavior to
the affected element. This usually works by looking for such elements
when the DOM is loaded ('xwiki:dom:loaded' event) and enhancing them
with the requested behavior.
The problem is that this behavior isn't automatically added for elements
inserted in the DOM after the initial xwiki:dom:loaded event, which
means that the code that inserted those new elements in the DOM tree
must also take extra steps to add the desired behavior, usually with
copy/paste, firing custom events or by re-sending the xwiki:dom:loaded
event (which is wrong).
I'd like to propose a new standard, the 'xwiki:dom:updated' event. This
works in two ways:
1. All the code that inserts new elements will fire such an event,
sending the list of new HTML elements in the 'elements' field of the
event memo. For example:
> document.fire('xwiki:dom:udated', {'elements': [dialog.dialogBox._x_contentPlug]});
The 'elements' field must always be a list, even if only one root
element is inserted, so that adding a set of items (<li> or <tr>
elements, for example) is well supported.
2. All code that adds behavior to classnames must also listen to this
event and enhance the sub-elements that have been inserted. For example:
> document.observe('xwiki:dom:udated', function(event) {
> event.memo.elements.each(function(element) {
> $(element).select('input.withTip').each(function(input) {
> input.observe...
> });
> });
> });
I wonder if we should also list the removed elements. In general this
would be needed to cleanup resources, but as far as I know Prototype can
take care of its own cleanup, without any manual steps needed.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
Hi devs,
Over the weekend I've brought one change to xwiki-commons-test.
Now by default when you write a unit test that extends AbstractMockingComponentTestCase there will be no component registered against the component manager except those mocked automatically by the @MockingRequirement annotation.
This has 2 advantages:
* This is the spirit of AbstractMockingComponentTestCase since they're supposed to mock all dependencies and define their behaviors
* It makes the tests up to 10 times faster
If you really need to register some components, use the {@link ComponentList} annotation and if you really really need to register all components (it takes time) then use {@link AllComponents}.
Thanks
-Vincent