Hi Caleb, This commit has broken a functional test, please see: http://bit.ly/aNzmAF
Thanks -Vincent On Tue, Feb 9, 2010 at 6:49 AM, cjdelisle <[email protected]> wrote: > Author: cjdelisle > Date: 2010-02-09 06:49:32 +0100 (Tue, 09 Feb 2010) > New Revision: 26828 > > Modified: > > platform/xwiki-applications/trunk/administration/src/main/resources/XWiki/Registration.xml > Log: > XAADMINISTRATION-103: Make registration page support lightbox so > administrator can use it to add users in admin users sheet. - Modified > registration page to be compatable with lightbox, also moved form tags and > submit button outside of generateHtml macro. > > Modified: > platform/xwiki-applications/trunk/administration/src/main/resources/XWiki/Registration.xml > =================================================================== > --- > platform/xwiki-applications/trunk/administration/src/main/resources/XWiki/Registration.xml > 2010-02-09 05:46:48 UTC (rev 26827) > +++ > platform/xwiki-applications/trunk/administration/src/main/resources/XWiki/Registration.xml > 2010-02-09 05:49:32 UTC (rev 26828) > @@ -74,6 +74,11 @@ > #set($loginPage = 'XWiki.XWikiLogin') > #set($loginAction = 'loginsubmit') > ## > +## If this is true, then assume the registration page is being viewed inside > of a lightbox > +#if($request.get('xpage')) > + #set($assumeLightbox = true) > +#end > +## > ## Use javascript based live validation see: http://www.livevalidation.com > ## Set false to stop using LiveValidation > #set($useLiveValidation = true) > @@ -457,16 +462,68 @@ > ## Then we display the registration form. > #if(!$registrationDone) > $welcomeMessage > - {{html clean=false}} > - ## I do not want to put this inside of a paragraph block so I end the > block here and > - ## start it at the end. > - </p> > + {{html clean=false wiki=false}} > + <div> > + <form id="register" action="" method="post"> > + <div> > #generateHtml($fields, $fieldMandatoryStar, $failureMessageParams) > + <span class="buttonwrapper"> > + #if($assumeLightbox) > + ## LightBox detected... > + <script type="text/javascript"> > + ## Make the X button not reload the page. (overriding LbClose) > + window.lb.lbClose = function() { > + this.lbHide(); > + this.lbClearData(); > + ##return false; > + } > + ## Post the form entry to the page and load the result. (we override > lbSaveForm) > + window.lb.lbSaveForm = function() { > + var formParams = Form.serialize(this.form); > + Form.disable(this.form); > + var ajaxRequest = new Ajax.Request(this.saveUrl, { > + parameters: formParams, > + asynchronous: false > + }); > + window.lb.lbFormDataLoaded(ajaxRequest.transport); > + } > + </script> > + ## It doesn't really matter where these are, the scripts will be > relocated to the head. > + <!-- com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin --> > + <!-- com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin --> > + ## > + <input class="button" type="submit" value="$msg.get('save')" > onclick="window.lb.lbSaveForm();"/> > + </span>#* End ButtonWrapper then start another...*#<span > class="buttonwrapper"> > + <input class="button" type="submit" value="$msg.get("cancel")" > onclick="Form.disable(window.lb.form); window.lb.lbClose();"/> > + #else > + ## Not using the LightBox > + <input type="submit" value="$msg.get('core.register.submit')" > class="button"/> > + #end > + </span>## ButtonWrapper > + </div> > + </form> > #if($useLiveValidation) > #generateJavascript($fields) > #end > - <p> > + </div> > {{/html}} > +## If the registration is done (successful) and we detect the Lightbox > simply send the user back to the original page. > +#elseif($assumeLightbox) > + {{html clean=false wiki=false}} > + <script type="text/javascript"> > + var url = window.lb.redirectUrl; > + window.lb.lbClose; > + if (url != undefined) { > + if(window.location.pathname + window.location.search == url) { > + ## Under certain circumstances (bug) Opera will not load a page > if the location is the same as the current page. > + ## In these cases, location.reload() doesn't work either, the > only solution (I could find) was to change the URL. > + window.location.href = url + "&"; > + } else { > + window.location.href = url; > + } > + } > + </script> > + {{/html}} > #end > ## > ####### The Macros (nothing below this point is run directly) ######### > @@ -608,7 +665,8 @@ > </span> > </div> > </form> > - #if($autoLogin) > + ## We don't want autoLogin if we are administrators adding users... > + #if($autoLogin && !$assumeLightbox) > <script type='text/javascript'> > document.observe('dom:loaded', function() { > document.forms['loginForm'].submit(); > @@ -632,59 +690,54 @@ > ## Put the same values back into the fields. > #getParams($fields) > ## > - <form id="register" action="" method="post"> > - <div><dl> > - ## > - #foreach($field in $fields) > - #if($field.get('name')) > - #set($fieldName = $field.get('name')) > - #if($field.get('label')) > - #set($label = $field.get('label')) > - <dt><label for="$fieldName">$label</label> > - #if($field.get('validate').get('mandatory')) > - <span > - #foreach($entry in $fieldMandatoryStar.entrySet()) > - $entry.getKey()="$entry.getValue()" > - #end > - >*</span> > + <dl> > + #foreach($field in $fields) > + #if($field.get('name')) > + #set($fieldName = $field.get('name')) > + #if($field.get('label')) > + #set($label = $field.get('label')) > + <dt><label for="$fieldName">$label</label> > + #if($field.get('validate').get('mandatory')) > + <span > + #foreach($entry in $fieldMandatoryStar.entrySet()) > + $entry.getKey()="$entry.getValue()" > #end > - </dt> > + >*</span> > #end > - ## If no tag then default tag is <input> > - #if($field.get('tag')) > - #set($tag = $field.get('tag')) > - #else > - #set($tag = 'input') > + </dt> > + #end > + ## If no tag then default tag is <input> > + #if($field.get('tag')) > + #set($tag = $field.get('tag')) > + #else > + #set($tag = 'input') > + #end > + <dd><$tag id="$fieldName" > + #set($params = $field.get('params')) > + ## If no name parameter is spacified, then we use the field name > + #if(!$params.get('name')) > + #set($discard = $params.put('name', $fieldName)) > + #end > + #foreach($entry in $params.entrySet()) > + ## If a parameter is specified as '' then we don't include it. > + #if($entry.getValue() != '') > + $entry.getKey()="$escapetool.html($entry.getValue())" > #end > - <dd><$tag id="$fieldName" > - #set($params = $field.get('params')) > - ## If no name parameter is spacified, then we use the field name > - #if(!$params.get('name')) > - #set($discard = $params.put('name', $fieldName)) > + #end > + ></$tag> > + #if($field.get('error')) > + <span > + #foreach($entry in $failureMessageParams.entrySet()) > + $entry.getKey()="$entry.getValue()" > #end > - #foreach($entry in $params.entrySet()) > - ## If a parameter is specified as '' then we don't include it. > - #if($entry.getValue() != '') > - $entry.getKey()="$escapetool.html($entry.getValue())" > - #end > - #end > - ></$tag> > - #if($field.get('error')) > - <span > - #foreach($entry in $failureMessageParams.entrySet()) > - $entry.getKey()="$entry.getValue()" > - #end > - >$field.get('error')</span> > - #end > - </dd> > - #else > - ERROR: Field with no name. > - #end##if fieldName exists > - #end > - </dl> > - <span class="buttonwrapper"><input type="submit" > value="$msg.get('core.register.submit')" class="button"/></span> > - </div> > - </form> > + >$field.get('error')</span> > + #end > + </dd> > + #else > + ERROR: Field with no name. > + #end##if fieldName exists > + #end > + </dl> > #end > ## > ## Remove newlines inside of tags because tags are generated by loops. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

