3) APIs are the most sensitive part of any
application and need
to be handled with care as it's almost impossible to undo them
as they're set in stone and used by end users. As such I think
we really need to discuss any API change on the list before we
go ahead with changes on them. I'd like that we take this habit
of doing so because otherwise:
3.1) API proliferates and goes out of control (as shown in
XWiki/Document/Context)
3.2) All developers are not aware of the new API, why they
are there, they may not agree on the names, locations, etc
3.3) More heads is better to really make sure the API is
needed and thus open it up as it's an almost irreversible
modification
WDYT?
Thanks
-Vincent
On Apr 16, 2007, at 1:17 AM, Ludovic Dubost wrote:
> Author: ludovic
> Date: 2007-04-16 01:17:41 +0200 (Mon, 16 Apr 2007)
> New Revision: 2824
>
> Modified:
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> XWiki.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> api/XWiki.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> objects/classes/BaseClass.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/DefaultQuery.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/HibernateQuery.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/IQuery.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/JcrQuery.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/SecHibernateQuery.java
> xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/XWikiQuery.java
> xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> albatross/registerinline.vm
> xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> dodo/register.vm
> xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> finch/register.vm
> xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/
> templates/registerinline.vm
> Log:
> XWIKI-985 Allow register to work even if wiki is completely
> protected but register right is given to anonymous users.
> Update all register page for older skins.
> XWIKI-1090 Added displaySearchOrder API for Query Plugin
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/XWiki.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> XWiki.java 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> XWiki.java 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -3697,23 +3697,30 @@
> }
>
> public boolean prepareDocuments(XWikiRequest request,
> XWikiContext context,
> - VelocityContext vcontext) throws XWikiException
> + VelocityContext vcontext)
> throws XWikiException
> {
> XWikiDocument doc;
> String docName = getDocumentName(request, context);
> - try {
> - doc = getDocument(docName, context);
> - } catch (XWikiException e) {
> - doc = context.getDoc();
> - if (context.getAction().equals("delete")) {
> - if (doc == null) {
> - setPhonyDocument(docName, context, vcontext);
> - }
> - if (!checkAccess("admin", doc, context)) {
> + if (context.getAction().equals("register")) {
> + setPhonyDocument(docName, context, vcontext);
> + context.getWiki().prepareResources(context);
> + doc = context.getDoc();
> + } else {
> +
> + try {
> + doc = getDocument(docName, context);
> + } catch (XWikiException e) {
> + doc = context.getDoc();
> + if (context.getAction().equals("delete")) {
> + if (doc == null) {
> + setPhonyDocument(docName, context,
> vcontext);
> + }
> + if (!checkAccess("admin", doc, context)) {
> + throw e;
> + }
> + } else {
> throw e;
> }
> - } else {
> - throw e;
> }
> }
>
> @@ -3723,19 +3730,21 @@
> Object[] args = {doc.getFullName(), context.getUser
> ()};
> setPhonyDocument(docName, context, vcontext);
> throw new XWikiException
> (XWikiException.MODULE_XWIKI_ACCESS,
> - XWikiException.ERROR_XWIKI_ACCESS_DENIED,
> - "Access to document {0} has been denied to
> user {1}",
> - null,
> - args);
> + XWikiException.ERROR_XWIKI_ACCESS_DENIED,
> + "Access to document {0} has been denied to
> user {1}",
> + null,
> + args);
> } else if (checkActive(context) == 0) {
> Object[] args = {context.getUser()};
> setPhonyDocument(docName, context, vcontext);
> throw new XWikiException
> (XWikiException.MODULE_XWIKI_USER,
> - XWikiException.ERROR_XWIKI_USER_INACTIVE,
> - "User {0} account is inactive",
> - null,
> - args);
> + XWikiException.ERROR_XWIKI_USER_INACTIVE,
> + "User {0} account is inactive",
> + null,
> + args);
> }
> +
> +
> context.put("doc", doc);
> vcontext.put("doc", doc.newDocument(context));
> vcontext.put("cdoc", vcontext.get("doc"));
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/api/XWiki.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> api/XWiki.java 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> api/XWiki.java 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -2351,6 +2351,37 @@
> }
>
> /**
> + * API to display a select box for the list of available
> field for a specific class This field
> + * data can then be used to generate the order element of
> an XWiki Query showing a table with the relevant data
> + *
> + * @param className XWiki Class Name to display the list
> of columns for
> + * @param query Query to pre-select the currently selected
> columns
> + * @return text of the select field
> + * @throws XWikiException exception is a failure occured
> + */
> + public String displaySearchOrder(String className,
> XWikiQuery query) throws XWikiException
> + {
> + return xwiki.displaySearchOrder(className, "", query,
> getXWikiContext());
> + }
> +
> + /**
> + * API to display a select box for the list of available
> field for a specific class, optionally
> + * adding a prefix This field data can then be used to
> generate the order element of an XWiki Query showing a table
> + * with the relevant data
> + *
> + * @param className XWiki Class Name to display the list
> of columns for
> + * @param prefix Prefix to add to the field name
> + * @param query Query to pre-select the currently selected
> columns
> + * @return text of the select field
> + * @throws XWikiException exception is a failure occured
> + */
> + public String displaySearchOrder(String className, String
> prefix, XWikiQuery query)
> + throws XWikiException
> + {
> + return xwiki.displaySearchOrder(className, prefix,
> query, getXWikiContext());
> + }
> +
> + /**
> * API to display a field in search mode for a specific
> class without preselected values This
> * field data can then be used to generate an XWiki Query
> showing a table with the relevant data
> *
> @@ -2535,4 +2566,17 @@
> public String clearAccents(String text) {
> return Util.noaccents(text);
> }
> +
> + /**
> + * Get a Class
> + *
> + * @return class object
> + * @throws XWikiException
> + */
> + public Class getClass(String name) throws XWikiException
> + {
> + return new Class(xwiki.getDocument(name,
> context).getxWikiClass(), context);
> + }
> +
> +
> }
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/objects/classes/BaseClass.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> objects/classes/BaseClass.java 2007-04-15 23:14:37 UTC (rev
> 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> objects/classes/BaseClass.java 2007-04-15 23:17:41 UTC (rev
> 2824)
> @@ -49,6 +49,7 @@
> import com.xpn.xwiki.objects.PropertyInterface;
> import com.xpn.xwiki.plugin.query.XWikiCriteria;
> import com.xpn.xwiki.plugin.query.XWikiQuery;
> +import com.xpn.xwiki.plugin.query.OrderClause;
> import com.xpn.xwiki.validation.XWikiValidationInterface;
> import com.xpn.xwiki.validation.XWikiValidationStatus;
>
> @@ -686,6 +687,39 @@
> return select.toString();
> }
>
> + public String displaySearchOrder(String prefix, XWikiQuery
> query, XWikiContext context) {
> + select select = new select(prefix + "searchorder", 5);
> + select.setMultiple(true);
> + select.setName(prefix + "searchorder");
> + select.setID(prefix + "searchorder");
> +
> + List list = Arrays.asList(getPropertyNames());
> + Map prettynamesmap = new HashMap();
> + for (int i=0;i<list.size();i++) {
> + String propname = (String) list.get(i);
> + list.set(i, prefix + propname);
> + prettynamesmap.put(prefix + propname,
> ((PropertyClass)get(propname)).getPrettyName());
> + }
> +
> + OrderClause order = null;
> + if ((query!=null)&&(query.getOrderProperties()!=null)&&
> (query.getOrderProperties().size()>0))
> + order = (OrderClause) query.getOrderProperties
> ().get(0);
> +
> + // Add options from Set
> + for (Iterator it=list.iterator();it.hasNext();) {
> + String value = it.next().toString();
> + String displayValue = (String) prettynamesmap.get
> (value);
> + option option = new option(displayValue,
> displayValue);
> + option.addElement(displayValue);
> + option.setValue(value);
> + if ((order!=null)&&(value.equals(order.getProperty
> ())))
> + option.setSelected(true);
> + select.addElement(option);
> + }
> +
> + return select.toString();
> + }
> +
> public void setValidationScript(String validationScript) {
> this.validationScript = validationScript;
> }
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/plugin/query/DefaultQuery.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/DefaultQuery.java 2007-04-15 23:14:37 UTC (rev
> 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/DefaultQuery.java 2007-04-15 23:17:41 UTC (rev
> 2824)
> @@ -42,7 +42,11 @@
> return null;
> }
>
> - protected int _fetchSize=-1;
> + public String getNativeQuery() {
> + return null;
> + }
> +
> + protected int _fetchSize=-1;
> protected int _firstResult=-1;
> protected boolean _isdistinct=false;
> public IQuery setMaxResults(int fs) { _fetchSize =
> fs; return this; }
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/plugin/query/HibernateQuery.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/HibernateQuery.java 2007-04-15 23:14:37 UTC
> (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/HibernateQuery.java 2007-04-15 23:17:41 UTC
> (rev 2824)
> @@ -88,28 +88,34 @@
> }
> return true;
> }
> - public List list() throws XWikiException {
> - if (translator==null)
> - translator = new XWikiHibernateQueryTranslator
> ( getQueryTree() );
> - StringBuffer _result = new StringBuffer();
> - if (_select.length()>0)
> - _result.append("select ").append(_select);
> - _result.append(" from ").append(_from);
> - - constructWhere(_result);
> - - if (_order.length()>0)
> - _result.append(" order by ").append(_order);
> - - String hql = _result.toString();
> - - if (log.isDebugEnabled())
> - log.debug("hql: "+hql);
> - +
> + public List list() throws XWikiException {
> + String hql = getNativeQuery();
> return hqlexec(hql, _hqlparams, _fetchSize,
> _firstResult);
> }
> - - protected SepStringBuffer _select = new
> SepStringBuffer(",");
> +
> + public String getNativeQuery() {
> + if (translator==null)
> + translator = new XWikiHibernateQueryTranslator
> ( getQueryTree() );
> + StringBuffer _result = new StringBuffer();
> + if (_select.length()>0)
> + _result.append("select ").append(_select);
> + _result.append(" from ").append(_from);
> +
> + constructWhere(_result);
> +
> + if (_order.length()>0)
> + _result.append(" order by ").append(_order);
> +
> + String hql = _result.toString();
> +
> + if (log.isDebugEnabled())
> + log.debug("hql: "+hql);
> +
> + return hql;
> + }
> +
> + protected SepStringBuffer _select = new
> SepStringBuffer(",");
> protected SepStringBuffer _from = new
> SepStringBuffer(",");
> protected SepStringBuffer _where = new
> SepStringBuffer(" and ");
> protected SepStringBuffer _userwhere = new
> SepStringBuffer(" and ");
> @@ -807,8 +813,8 @@
> translator = null;
> return super.setDistinct(d);
> }
> - - Map _hqlparams = new HashMap();
> +
> + Map _hqlparams = new HashMap();
> protected void _addHqlParam(String pn, Object v) {
> _hqlparams.put(pn, v);
> }
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/plugin/query/IQuery.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/IQuery.java 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/IQuery.java 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -33,4 +33,5 @@
> public IQuery setMaxResults(int fs);
> public IQuery setFirstResult(int fr);
> public IQuery setDistinct(boolean d);
> + public String getNativeQuery();
> }
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/plugin/query/JcrQuery.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/JcrQuery.java 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/JcrQuery.java 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -28,12 +28,16 @@
> return (XWikiJcrStore) ((XWikiJcrBaseStore)
> qf.getContext().getWiki().getNotCacheStore());
> }
>
> - public List list() throws XWikiException {
> + public String getNativeQuery() {
> + return "store"+query;
> + }
> +
> + public List list() throws XWikiException {
> final List result = new ArrayList();
> try {
> getStore().executeRead(qf.getContext(), new
> JcrCallBack() {
> public Object doInJcr(XWikiJcrSession session)
> throws Exception {
> - Query q = session.getQueryManager
> ().createQuery("store"+query, language);
> + Query q = session.getQueryManager
> ().createQuery(getNativeQuery(), language);
> QueryResult qr = q.execute();
> RowIterator ri = qr.getRows();
> if (ri!=null) {
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/plugin/query/SecHibernateQuery.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/SecHibernateQuery.java 2007-04-15 23:14:37 UTC
> (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/SecHibernateQuery.java 2007-04-15 23:17:41 UTC
> (rev 2824)
> @@ -94,8 +94,28 @@
> if (PasswordClass.class.equals(class1))
> isAllow = false;
> }
> - - public List list() throws XWikiException {
> +
> + public String getNativeQuery() {
> + _allowdocs.clear();
> + String docname = translator.getLastNameClass
> (qn_xwiki_document);
> + if (docname==null) {
> + QName lclass = translator.getLastQNClass();
> + if (qn_xwiki_object.equals(lclass)) {
> + final String objname =
> translator.getLastNameClass(lclass);
> + docname = translator.newXWikiObj
> (qn_xwiki_document);
> + _where.appendWithSep(docname).append
> (".fullName=").append(objname).append(".name");
> + } else if (qn_xwiki_attachment.equals(lclass)) {
> + final String attname =
> translator.getLastNameClass(lclass);
> + docname = translator.newXWikiObj
> (qn_xwiki_document);
> + _where.appendWithSep(docname).append
> (".id=").append(attname).append(".docId");
> + } else
> + throw new TranslateException("Class not exist");
> + }
> + _select = new SepStringBuffer(docname+".id,"+docname
> +".fullName", null);
> + return super.getNativeQuery();
> + }
> +
> + public List list() throws XWikiException {
> if (translator==null)
> translator = new XWikiHibernateQueryTranslator
> (getQueryTree());
> if (!isAllowed())
> @@ -106,23 +126,6 @@
> final SepStringBuffer _real_select =
> _select; try {
> - _allowdocs.clear();
> - String docname = translator.getLastNameClass
> (qn_xwiki_document);
> - if (docname==null) {
> - QName lclass = translator.getLastQNClass();
> - if (qn_xwiki_object.equals(lclass)) {
> - final String objname =
> translator.getLastNameClass(lclass);
> - docname = translator.newXWikiObj
> (qn_xwiki_document);
> - _where.appendWithSep(docname).append
> (".fullName=").append(objname).append(".name");
> - } else if (qn_xwiki_attachment.equals(lclass)) {
> - final String attname =
> translator.getLastNameClass(lclass);
> - docname = translator.newXWikiObj
> (qn_xwiki_document);
> - _where.appendWithSep(docname).append
> (".id=").append(attname).append(".docId");
> - } else
> - throw new TranslateException("Class not
> exist");
> - }
> - _select = new SepStringBuffer(docname
> +".id,"+docname+".fullName", null);
> - security = false;
> int fr = _firstResult; _firstResult = -1;
> int fs = _fetchSize; _fetchSize = -1;
>
> Modified: xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/
> xwiki/plugin/query/XWikiQuery.java
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/XWikiQuery.java 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/core/src/main/java/com/xpn/xwiki/
> plugin/query/XWikiQuery.java 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -31,6 +31,8 @@
> super();
> String[] columns = request.getParameterValues
> (className + "_" + "searchcolumns");
> setDisplayProperties(columns);
> + String[] order = request.getParameterValues(className
> + "_" + "searchorder");
> + setOrderProperties(order);
> BaseClass bclass = context.getWiki().getDocument
> (className, context).getxWikiClass();
> Set properties = bclass.getPropertyList();
> Iterator propid = properties.iterator();
> @@ -41,6 +43,16 @@
> }
> }
>
> + private void setOrderProperties(String[] order) {
> + orderProperties.clear();
> + if (order!=null) {
> + for (int i=0;i<order.length;i++) {
> + OrderClause oclause = new OrderClause(order[i],
> OrderClause.ASC);
> + orderProperties.add(oclause);
> + }
> + }
> + }
> +
> public void reset() {
> displayProperties = new ArrayList();
> addProperties = new ArrayList();
>
> Modified: xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/
> skins/albatross/registerinline.vm
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> albatross/registerinline.vm 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> albatross/registerinline.vm 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -1,4 +1,4 @@
> -#if($xwiki.getDocument("XWiki.Registration").isNew())
> +#if(!$xwiki.hasAccessLevel("view","XWiki.Registration")||
> $xwiki.getDocument("XWiki.Registration").isNew())
> <h1>$msg.get("Registration")</h1>
> #if(!$reg||$reg<0 )
> <p>$msg.get("registerwelcome")</p>
> @@ -22,8 +22,7 @@
> <div>
> <input type="hidden" name="template"
> value="XWiki.XWikiUserTemplate" />
> <input type="hidden" name="register"
value="1">
> - #set( $class = $xwiki.getDocument
> ("XWiki.XWikiUsers").xWikiClass)
> - #set( $serverclass = $xwiki.getDocument
> ("XWiki.XWikiServerClass").xWikiClass)
> + #set( $class = $xwiki.getClass("XWiki.XWikiUsers"))
> #set( $obj = $class.newObject() )
> #set( $serverobj = $class.newObject() )
> #set( $ok = $doc.use("XWiki.XWikiUsers"))
>
> Modified: xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/
> skins/dodo/register.vm
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> dodo/register.vm 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> dodo/register.vm 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -1,78 +1 @@
> -#set ($register = $request.getParameter("register"))
> -#if ($register)
> -Registration of *$request.getParameter("register_first_name")
> $request.getParameter("register_last_name")*
> -
> -#set( $reg= $xwiki.createUser(false))
> -#if ($reg>0)
> -The user [$request.getParameter("xwikiname")] has been
> registered.
> -#else
> -An error occured during the registration.
> -#end
> -#else
> -#set($reg=0)
> -#end
> -
> -#if ($reg<=0)
> -Welcome to the registration form. This will allow you to edit
> pages, once the admin gives you appropriate rights
> -
> -1.1 Register
> -
> -<form id="register" name="register" action=""
method="post">
> -#includeTopic("xwiki:XWiki.RegisterJS")
> -<p>
> -<input type="hidden" name="template"
> value="XWiki.XWikiUserTemplate" />
> -<input type="hidden" name="register" value="1">
> -#set( $class = $xwiki.getDocument("XWiki.XWikiUsers").xWikiClass)
> -#set( $serverclass = $xwiki.getDocument
> ("XWiki.XWikiServerClass").xWikiClass)
> -#set( $obj = $class.newObject() )
> -#set( $serverobj = $class.newObject() )
> -</p>
> -<table class="block" cellspacing="5px">
> - <tbody>
> - <tr>
> -#set($prop = $class.first_name)
> - <td>First name
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> -#set($prop = $class.last_name)
> - <td>Last name
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - </tr>
> -<tr>
> -#set($prop = $class.email)
> - <td>e-Mail Address
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - </tr>
> -<tr>
> -</tr>
> -<td></td>
> - <tr>
> -#set($prop = $class.password)
> - <td>Password
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - <td>Password (again)
> - </td>
> - <td>$doc.displayEdit($prop, "register2_", $obj)
> - </td>
> - </tr>
> -<tr><td></td></tr>
> - <tr>
> - <td>Wiki username</td>
> - <td>
> - <input name="xwikiname" type="text" size="20"
onfocus="
> prepareName(document.forms.register);" />
> - </td>
> - </tr>
> - </tbody>
> - </table>
> -<center>
> -<input type="submit" value="Register me">
> -</center>
> -</form>
> -#end
> \ No newline at end of file
> +#template("registerinline.vm")
> \ No newline at end of file
>
> Modified: xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/
> skins/finch/register.vm
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> finch/register.vm 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/skins/
> finch/register.vm 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -1,78 +1 @@
> -#set ($register = $request.getParameter("register"))
> -#if ($register)
> -Registration of *$request.getParameter("register_first_name")
> $request.getParameter("register_last_name")*
> -
> -#set( $reg= $xwiki.createUser(false))
> -#if ($reg>0)
> -The user [$request.getParameter("xwikiname")] has been
> registered.
> -#else
> -An error occured during the registration.
> -#end
> -#else
> -#set($reg=0)
> -#end
> -
> -#if ($reg<=0)
> -Welcome to the registration form. This will allow you to edit
> pages, once the admin gives you appropriate rights
> -
> -1.1 Register
> -
> -<form id="register" name="register" action=""
method="post">
> -#includeTopic("xwiki:XWiki.RegisterJS")
> -<p>
> -<input type="hidden" name="template"
> value="XWiki.XWikiUserTemplate" />
> -<input type="hidden" name="register" value="1">
> -#set( $class = $xwiki.getDocument("XWiki.XWikiUsers").xWikiClass)
> -#set( $serverclass = $xwiki.getDocument
> ("XWiki.XWikiServerClass").xWikiClass)
> -#set( $obj = $class.newObject() )
> -#set( $serverobj = $class.newObject() )
> -</p>
> -<table class="block" cellspacing="5px">
> - <tbody>
> - <tr>
> -#set($prop = $class.first_name)
> - <td>First name
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> -#set($prop = $class.last_name)
> - <td>Last name
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - </tr>
> -<tr>
> -#set($prop = $class.email)
> - <td>e-Mail Address
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - </tr>
> -<tr>
> -</tr>
> -<td></td>
> - <tr>
> -#set($prop = $class.password)
> - <td>Password
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - <td>Password (again)
> - </td>
> - <td>$doc.displayEdit($prop, "register2_", $obj)
> - </td>
> - </tr>
> -<tr><td></td></tr>
> - <tr>
> - <td>Wiki username</td>
> - <td>
> - <input name="xwikiname" type="text" size="20"
onfocus="
> prepareName(document.forms.register);" />
> - </td>
> - </tr>
> - </tbody>
> - </table>
> -<center>
> -<input type="submit" value="Register me">
> -</center>
> -</form>
> -#end
> \ No newline at end of file
> +#template("registerinline.vm")
> \ No newline at end of file
>
> Modified: xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/
> templates/registerinline.vm
> ==================================================================
> =
> --- xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/
> templates/registerinline.vm 2007-04-15 23:14:37 UTC (rev 2823)
> +++ xwiki/branches/XWIKI_1_0/web/standard/src/main/webapp/
> templates/registerinline.vm 2007-04-15 23:17:41 UTC (rev 2824)
> @@ -1,83 +1,62 @@
> -<h1>$msg.get("Registration")</h1>
> -#if(!$reg||$reg<0 )
> -$msg.get("registerwelcome")
> -<br /><br />
> -#end
> -#if($reg<=0)
> -<span class="registrationerror" style="color: red">
> -#if($reg==-2)
> -$msg.get("passwordmismatch")
> -#elseif($reg==-3)
> -$msg.get("useralreadyexists")
> +#if(!$xwiki.hasAccessLevel("view","XWiki.Registration")||
> $xwiki.getDocument("XWiki.Registration").isNew())
> + <h1>$msg.get("Registration")</h1>
> + #if(!$reg||$reg<0 )
> + <p>$msg.get("registerwelcome")</p>
> + #end
> + #if($reg && $reg<=0)
> + #if($reg==-2)
> + #error("$msg.get('passwordmismatch').")
> + #elseif($reg==-3)
> + #error("$msg.get('useralreadyexists').")
> + #elseif($reg==-4)
> + #error("$msg.get('invalidusername').")
> + #else
> + #error("$msg.get('registerfailed') ($msg.get
> ('registerfailedcode') $reg).")
> + #end
> + #elseif($reg)
> + #set($xwname = "XWiki.${request.xwikiname}")
> + #info("$xwiki.getUserName($xwname) ($request.xwikiname):
> $msg.get('registersuccessful').")
> + #end
> + #if(!$reg||$reg<0 )
> + <form id="register" name="register" action=""
action=""
> method="post">
> + <div>
> + <input type="hidden" name="template"
> value="XWiki.XWikiUserTemplate" />
> + <input type="hidden" name="register"
value="1">
> + #set( $class = $xwiki.getClass("XWiki.XWikiUsers"))
> + #set( $obj = $class.newObject() )
> + #set( $serverobj = $class.newObject() )
> + #set( $ok = $doc.use("XWiki.XWikiUsers"))
> + #if($request.register_first_name)
> + $doc.set("first_name", $request.register_first_name)
> + #end
> + #if($request.register_last_name)
> + $doc.set("last_name", $request.register_last_name)
> + #end
> + <dl>
> + #set($prop = $class.first_name)
> + <dt>$msg.get("firstname"):</dt>
> + <dd>$doc.displayEdit($prop, "register_",
$obj)</dd>
> +
> + #set($prop = $class.last_name)
> + <dt>$msg.get("lastname"):</dt>
> + <dd>$doc.displayEdit($prop, "register_",
$obj)</dd>
> + <dt>$msg.get("loginid"):</dt>
> + <dd><input name="xwikiname" type="text"
size="20"
> onfocus=" prepareName(document.forms.register);" /></dd>
> +
> + #set($prop = $class.password)
> + <dt>$msg.get("password"):</dt>
> + <dd>$doc.displayEdit($prop, "register_",
$obj)</dd>
> + <dt>$msg.get("passwordrepeat"):</dt>
> + <dd>$doc.displayEdit($prop, "register2_",
$obj)</dd>
> +
> + #set($prop = $class.email)
> + <dt>$msg.get("email"):</dt>
> + <dd>$doc.displayEdit($prop, "register_",
$obj)</dd>
> + </dl>
> + <span class="buttonwrapper"><input
type="submit"
> value="$msg.get("iregister")"></span>
> + </div>
> + </form>
> + #end
> #else
> -$msg.get("registerfailed") ($msg.get("registerfailedcode) $reg)
> -#end
> -<br /><br />
> -</span>
> -#elseif($reg)
> -$msg.get("registersuccessful")
> -#end
> -#if(!$reg||$reg<0 )
> -<form id="register" name="register" action=""
action=""
> method="post">
> -<p>
> -<input type="hidden" name="template"
> value="XWiki.XWikiUserTemplate" />
> -<input type="hidden" name="register" value="1">
> -#set( $class = $xwiki.getDocument("XWiki.XWikiUsers").xWikiClass)
> -#set( $serverclass = $xwiki.getDocument
> ("XWiki.XWikiServerClass").xWikiClass)
> -#set( $obj = $class.newObject() )
> -#set( $serverobj = $class.newObject() )
> -#set( $ok = $doc.use("XWiki.XWikiUsers"))
> -#if($request.register_first_name)
> -$doc.set("first_name", $request.register_first_name)
> -#end
> -#if($request.register_last_name)
> -$doc.set("last_name", $request.register_last_name)
> -#end
> -</p>
> -<table class="block" cellspacing="5px">
> - <tbody>
> - <tr>
> -#set($prop = $class.first_name)
> - <td>$msg.get("firstname")
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> -#set($prop = $class.last_name)
> - <td>$msg.get("lastname")
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - </tr>
> -<tr>
> -#set($prop = $class.email)
> - <td>$msg.get("email")
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - </tr>
> -<tr>
> -</tr>
> -<td></td>
> - <tr>
> -#set($prop = $class.password)
> - <td>$msg.get("password")
> - </td>
> - <td>$doc.displayEdit($prop, "register_", $obj)
> - </td>
> - <td>$msg.get("passwordrepeat")
> - </td>
> - <td>$doc.displayEdit($prop, "register2_", $obj)
> - </td>
> - </tr>
> -<tr><td></td></tr>
> - <tr>
> - <td>$msg.get("loginid")</td>
> - <td>
> - <input name="xwikiname" type="text" size="20"
onfocus="
> prepareName(document.forms.register);" />
> - </td>
> - </tr>
> - </tbody>
> - </table>
> -<input type="submit"
value="$msg.get("iregister")">
> -</form>
> + $xwiki.getDocument
> ("XWiki.Registration").getTranslatedDocument
> ().getRenderedContent()
> #end
> \ No newline at end of file
>
>
>
> --You receive this message as a subscriber of the xwiki-
> commits(a)objectweb.org mailing list.
> To unsubscribe: mailto:xwiki-commits-unsubscribe@objectweb.org
> For general help: mailto:sympa@objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://
>
www.objectweb.org/wws