r1062 - in xwiki/trunk/src: main/java/com/xpn/xwiki main/java/com/xpn/xwiki/doc main/java/com/xpn/xwiki/objects/classes main/java/com/xpn/xwiki/render main/java/com/xpn/xwiki/web main/resources main/web/WEB-INF main/web/skins/default main/web/templates test/resources
Ludovic Dubost
ludovic at users.forge.objectweb.org
Thu May 4 14:07:24 CEST 2006
Author: ludovic
Date: 2006-05-04 14:07:23 +0200 (Thu, 04 May 2006)
New Revision: 1062
Modified:
xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java
xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java
xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BooleanClass.java
xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiMacrosMappingRenderer.java
xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditAction.java
xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditForm.java
xwiki/trunk/src/main/java/com/xpn/xwiki/web/InlineAction.java
xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropAddAction.java
xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropUpdateAction.java
xwiki/trunk/src/main/java/com/xpn/xwiki/web/XWikiAction.java
xwiki/trunk/src/main/resources/xwiki.hbm.xml
xwiki/trunk/src/main/web/WEB-INF/struts-config.xml
xwiki/trunk/src/main/web/skins/default/wiki.css
xwiki/trunk/src/main/web/templates/edit.vm
xwiki/trunk/src/main/web/templates/inline.vm
xwiki/trunk/src/test/resources/xwiki.hbm.xml
Log:
Support not using "XWiki." in getObject and getObjects functions
Support form data for the inline and edit actions (replacing PrepareEditForm with EditForm)
Added new parameters in BaseClass.java
Check for null value in BooleanClass.java
Make flushCache in MacrosMapping flush the macro config
Accept - _ and . in property names
Allow delete for admins even when we cannot load a document
Added comments custom mapping (not activated yet)
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -100,6 +100,7 @@
import java.net.URLEncoder;
import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
+import java.text.NumberFormat;
import java.util.*;
import java.util.zip.ZipOutputStream;
@@ -733,6 +734,11 @@
public XWikiDocument getDocumentFromPath(String path, XWikiContext context) throws XWikiException {
+ String fullname = getDocumentNameFromPath(path, context);
+ return getDocument(fullname, context);
+ }
+
+ public String getDocumentNameFromPath(String path, XWikiContext context) {
String web, name;
int i1 = 0;
int i2;
@@ -756,7 +762,8 @@
web = Utils.decode(web, context);
name = Utils.decode(name, context);
- return getDocument(web + "." + name, context);
+ String fullname = web + "." + name;
+ return fullname;
}
public XWikiRenderingEngine getRenderingEngine() {
@@ -1668,7 +1675,11 @@
return bclass;
bclass.setName("XWiki.XWikiComments");
-
+/* if (!"internal".equals(bclass.getCustomMapping())) {
+ needsUpdate = true;
+ bclass.setCustomMapping("internal");
+ }
+*/
needsUpdate |= bclass.addTextField("author", "Author", 30);
needsUpdate |= bclass.addTextAreaField("highlight", "Highlighted Text", 40, 2);
needsUpdate |= bclass.addNumberField("replyto", "Reply To", 5, "integer");
@@ -2626,28 +2637,51 @@
return active;
}
- public boolean prepareDocuments(XWikiRequest request, XWikiContext context, VelocityContext vcontext) throws XWikiException {
- // From there we will try to catch any exceptions and show a nice page
- XWikiDocument doc = null;
-
+ public String getDocumentName(XWikiRequest request, XWikiContext context) {
+ String docname;
if (context.getMode() == XWikiContext.MODE_PORTLET) {
if (request.getParameter("topic") != null)
- doc = getDocument(request.getParameter("topic"), context);
+ docname = request.getParameter("topic");
else
- doc = getDocument("Main.WebHome", context);
+ docname = "Main.WebHome";
} else if (context.getMode() == XWikiContext.MODE_XMLRPC) {
- doc = context.getDoc();
+ docname = context.getDoc().getFullName();
} else {
String action = context.getAction();
if ((request.getParameter("topic") != null) && (action.equals("edit") || action.equals("inline")))
- doc = getDocument(request.getParameter("topic"), context);
+ docname = request.getParameter("topic");
else
- doc = getDocumentFromPath(request.getPathInfo(), context);
+ docname = getDocumentNameFromPath(request.getPathInfo(), context);
}
+ return docname;
+ }
- context.put("doc", doc);
- vcontext.put("doc", new Document(doc, context));
- vcontext.put("cdoc", vcontext.get("doc"));
+ public boolean prepareDocuments(XWikiRequest request, XWikiContext context, VelocityContext vcontext) throws XWikiException {
+ XWikiDocument doc;
+ try {
+ doc = getDocument(getDocumentName(request, context), context);
+ context.put("doc", doc);
+ vcontext.put("doc", new Document(doc, context));
+ vcontext.put("cdoc", vcontext.get("doc"));
+ } catch (XWikiException e) {
+ doc = context.getDoc();
+ if (context.getAction().equals("delete")) {
+ if (doc==null) {
+ doc = new XWikiDocument();
+ doc.setFullName(getDocumentName(request, context));
+ doc.setElements(XWikiDocument.HAS_ATTACHMENTS | XWikiDocument.HAS_OBJECTS);
+ doc.setStore(getStore());
+ context.put("doc", doc);
+ vcontext.put("doc", new Document(doc, context));
+ vcontext.put("cdoc", vcontext.get("doc"));
+ }
+ if (!checkAccess("admin", doc, context)) {
+ throw e;
+ }
+ } else {
+ throw e;
+ }
+ }
// We need to check rights before we look for translations
// Otherwise we don't have the user language
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -41,7 +41,6 @@
import com.xpn.xwiki.util.Util;
import com.xpn.xwiki.web.EditForm;
import com.xpn.xwiki.web.ObjectAddForm;
-import com.xpn.xwiki.web.PrepareEditForm;
import com.xpn.xwiki.web.Utils;
import org.apache.commons.jrcs.diff.Diff;
import org.apache.commons.jrcs.diff.DifferentiationFailedException;
@@ -701,14 +700,20 @@
}
public Vector getObjects(String classname) {
+ if (classname.indexOf(".")==-1)
+ classname = "XWiki." + classname;
return (Vector) getxWikiObjects().get(classname);
}
public void setObjects(String classname, Vector objects) {
+ if (classname.indexOf(".")==-1)
+ classname = "XWiki." + classname;
getxWikiObjects().put(classname, objects);
}
public BaseObject getObject(String classname) {
+ if (classname.indexOf(".")==-1)
+ classname = "XWiki." + classname;
Vector objects = (Vector) getxWikiObjects().get(classname);
if (objects == null)
return null;
@@ -722,6 +727,8 @@
public BaseObject getObject(String classname, int nb) {
try {
+ if (classname.indexOf(".")==-1)
+ classname = "XWiki." + classname;
return (BaseObject) ((Vector) getxWikiObjects().get(classname)).get(nb);
} catch (Exception e) {
return null;
@@ -733,6 +740,8 @@
}
public BaseObject getObject(String classname, String key, String value, boolean failover) {
+ if (classname.indexOf(".")==-1)
+ classname = "XWiki." + classname;
try {
if (value == null) {
if (failover)
@@ -1134,7 +1143,7 @@
}
*/
- public void readFromTemplate(PrepareEditForm eform, XWikiContext context) throws XWikiException {
+ public void readFromTemplate(EditForm eform, XWikiContext context) throws XWikiException {
String template = eform.getTemplate();
readFromTemplate(template, context);
}
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BaseClass.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -50,6 +50,10 @@
private static final Log log = LogFactory.getLog(BaseClass.class);
private String customMapping;
private String customClass;
+ private String defaultWeb;
+ private String defaultViewSheet;
+ private String defaultEditSheet;
+ private String nameField;
// This insures natural ordering between properties
public void addField(String name, PropertyInterface element) {
@@ -130,6 +134,10 @@
BaseClass bclass = (BaseClass) super.clone();
bclass.setCustomClass(getCustomClass());
bclass.setCustomMapping(getCustomMapping());
+ bclass.setDefaultWeb(getDefaultWeb());
+ bclass.setDefaultViewSheet(getDefaultViewSheet());
+ bclass.setDefaultEditSheet(getDefaultEditSheet());
+ bclass.setNameField(getNameField());
return bclass;
}
@@ -145,6 +153,18 @@
if (!getCustomMapping().equals(bclass.getCustomMapping()))
return false;
+ if (!getDefaultViewSheet().equals(bclass.getDefaultViewSheet()))
+ return false;
+
+ if (!getDefaultEditSheet().equals(bclass.getDefaultEditSheet()))
+ return false;
+
+ if (!getDefaultWeb().equals(bclass.getDefaultWeb()))
+ return false;
+
+ if (!getNameField().equals(bclass.getNameField()))
+ return false;
+
return true;
}
@@ -170,6 +190,22 @@
el.addText((getCustomMapping()==null) ? "" : getCustomMapping());
cel.add(el);
+ el = new DOMElement("defaultViewSheet");
+ el.addText((getDefaultViewSheet()==null) ? "" : getDefaultViewSheet());
+ cel.add(el);
+
+ el = new DOMElement("defaultEditSheet");
+ el.addText((getDefaultEditSheet()==null) ? "" : getDefaultEditSheet());
+ cel.add(el);
+
+ el = new DOMElement("defaultWeb");
+ el.addText((getDefaultWeb()==null) ? "" : getDefaultWeb());
+ cel.add(el);
+
+ el = new DOMElement("nameField");
+ el.addText((getNameField()==null) ? "" : getNameField());
+ cel.add(el);
+
Iterator it = getFieldList().iterator();
while (it.hasNext()) {
PropertyClass bprop = (PropertyClass)it.next();
@@ -188,10 +224,30 @@
j++;
}
Element cmapel = cel.element("customMapping");
- if (cclel!=null) {
+ if (cmapel!=null) {
setCustomMapping(cmapel.getText());
j++;
}
+ Element cdvsel = cel.element("defaultViewSheet");
+ if (cdvsel!=null) {
+ setDefaultViewSheet(cdvsel.getText());
+ j++;
+ }
+ Element cdesel = cel.element("defaultEditSheet");
+ if (cdesel!=null) {
+ setDefaultViewSheet(cdesel.getText());
+ j++;
+ }
+ Element cdwel = cel.element("defaultWeb");
+ if (cdwel!=null) {
+ setDefaultWeb(cdwel.getText());
+ j++;
+ }
+ Element cnfel = cel.element("nameField");
+ if (cnfel!=null) {
+ setNameField(cnfel.getText());
+ j++;
+ }
List list = cel.elements();
for (int i=j;i<list.size();i++) {
@@ -213,11 +269,15 @@
SAXReader reader = new SAXReader();
Document domdoc;
+ if ((xml==null)||(xml.trim().equals("")))
+ return;
+
try {
StringReader in = new StringReader(xml);
domdoc = reader.read(in);
} catch (DocumentException e) {
- throw new XWikiException(XWikiException.MODULE_XWIKI_DOC, XWikiException.ERROR_DOC_XML_PARSING, "Error parsing xml", e, null);
+ Object[] args = { xml };
+ throw new XWikiException(XWikiException.MODULE_XWIKI_DOC, XWikiException.ERROR_DOC_XML_PARSING, "Error parsing xml {0}", e, args);
}
Element docel = domdoc.getRootElement();
@@ -469,4 +529,36 @@
return object;
}
}
+
+ public String getDefaultWeb() {
+ return defaultWeb;
+ }
+
+ public void setDefaultWeb(String defaultWeb) {
+ this.defaultWeb = defaultWeb;
+ }
+
+ public String getDefaultViewSheet() {
+ return defaultViewSheet;
+ }
+
+ public void setDefaultViewSheet(String defaultViewSheet) {
+ this.defaultViewSheet = defaultViewSheet;
+ }
+
+ public String getDefaultEditSheet() {
+ return defaultEditSheet;
+ }
+
+ public void setDefaultEditSheet(String defaultEditSheet) {
+ this.defaultEditSheet = defaultEditSheet;
+ }
+
+ public String getNameField() {
+ return nameField;
+ }
+
+ public void setNameField(String nameField) {
+ this.nameField = nameField;
+ }
}
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BooleanClass.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BooleanClass.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/objects/classes/BooleanClass.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -84,8 +84,11 @@
if (prop==null)
return;
- int value = ((Integer)prop.getValue()).intValue();
- buffer.append(getDisplayValue(context, value));
+ Integer iValue = (Integer)prop.getValue();
+ if (iValue!=null) {
+ int value = iValue.intValue();
+ buffer.append(getDisplayValue(context, value));
+ }
}
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiMacrosMappingRenderer.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiMacrosMappingRenderer.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiMacrosMappingRenderer.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -1,25 +1,25 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author ludovic
- * @author sdumitriu
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author ludovic
+ * @author sdumitriu
+ */
package com.xpn.xwiki.render;
@@ -38,33 +38,41 @@
public class XWikiMacrosMappingRenderer implements XWikiRenderer {
private static final Log log = LogFactory.getLog(XWikiMacrosMappingRenderer.class);
- protected HashMap macros_libraries = new HashMap();
- protected HashMap macros_mappings = new HashMap();
+ protected HashMap macros_libraries = null;
+ protected HashMap macros_mappings = null;
public XWikiMacrosMappingRenderer(XWiki xwiki, XWikiContext context) {
loadPreferences(xwiki, context);
}
public void loadPreferences(XWiki xwiki, XWikiContext context) {
- String[] macrolanguages = StringUtils.split(xwiki.getXWikiPreference("macros_languages", "velocity,groovy", context), ", ");
- for (int i=0;i<macrolanguages.length;i++) {
- String language = macrolanguages[i];
- macros_libraries.put(language, xwiki.getXWikiPreference("macros_" + language, "XWiki." + language.substring(0,1).toUpperCase() + language.substring(1) + "Macros", context));
- }
+ macros_libraries = new HashMap();
+ macros_mappings = new HashMap();
- String macrosmapping = xwiki.getXWikiPreference("macros_mapping", "", context);
- String[] mappings = StringUtils.split(macrosmapping, "\r\n");
- for (int i=0;i<mappings.length;i++) {
- try {
- XWikiVirtualMacro macro = new XWikiVirtualMacro(mappings[i]);
- macros_mappings.put(macro.getName(), macro);
- } catch (Exception e) {
- log.error("Error reading macro mapping " + mappings[i], e);
+ if ((xwiki!=null)&&(context!=null)) {
+ String[] macrolanguages = StringUtils.split(xwiki.getXWikiPreference("macros_languages", "velocity,groovy", context), ", ");
+ for (int i=0;i<macrolanguages.length;i++) {
+ String language = macrolanguages[i];
+ macros_libraries.put(language, xwiki.getXWikiPreference("macros_" + language, "XWiki." + language.substring(0,1).toUpperCase() + language.substring(1) + "Macros", context));
}
+
+ String macrosmapping = xwiki.getXWikiPreference("macros_mapping", "", context);
+ String[] mappings = StringUtils.split(macrosmapping, "\r\n");
+ for (int i=0;i<mappings.length;i++) {
+ try {
+ XWikiVirtualMacro macro = new XWikiVirtualMacro(mappings[i]);
+ macros_mappings.put(macro.getName(), macro);
+ } catch (Exception e) {
+ log.error("Error reading macro mapping " + mappings[i], e);
+ }
+ }
}
}
public String render(String content, XWikiDocument contentdoc, XWikiDocument doc, XWikiContext context) {
+ if (macros_libraries==null)
+ loadPreferences(context.getWiki(), context);
+
content = convertSingleLines(content, context);
content = convertMultiLines(content, context);
return content;
@@ -77,20 +85,20 @@
Matcher m = p.matcher(content);
int current = 0;
while (m.find()) {
- result.append(content.substring(current, m.start()));
- current = m.end();
- String macroname = m.group(1);
- String params = m.group(3);
- String allcontent = m.group(0);
+ result.append(content.substring(current, m.start()));
+ current = m.end();
+ String macroname = m.group(1);
+ String params = m.group(3);
+ String allcontent = m.group(0);
- XWikiVirtualMacro macro = (XWikiVirtualMacro) macros_mappings.get(macroname);
- if ((macro!=null)&&(macro.isSingleLine()))
- result.append(context.getWiki().getRenderingEngine().convertSingleLine(macroname, params, allcontent, macro, context));
- else
- result.append(allcontent);
+ XWikiVirtualMacro macro = (XWikiVirtualMacro) macros_mappings.get(macroname);
+ if ((macro!=null)&&(macro.isSingleLine()))
+ result.append(context.getWiki().getRenderingEngine().convertSingleLine(macroname, params, allcontent, macro, context));
+ else
+ result.append(allcontent);
}
if (current==0)
- return content;
+ return content;
result.append(content.substring(current));
return result.toString();
@@ -103,28 +111,29 @@
Matcher m = p.matcher(content);
int current = 0;
while (m.find()) {
- result.append(content.substring(current, m.start()));
- current = m.end();
- String macroname = m.group(1);
- String params = m.group(3);
- String data = m.group(4);
- String allcontent = m.group(0);
+ result.append(content.substring(current, m.start()));
+ current = m.end();
+ String macroname = m.group(1);
+ String params = m.group(3);
+ String data = m.group(4);
+ String allcontent = m.group(0);
- XWikiVirtualMacro macro = (XWikiVirtualMacro) macros_mappings.get(macroname);
- if ((macro!=null)&&(macro.isMultiLine()))
- result.append(context.getWiki().getRenderingEngine().convertMultiLine(macroname, params, data, allcontent, macro, context));
- else
- result.append(allcontent);
+ XWikiVirtualMacro macro = (XWikiVirtualMacro) macros_mappings.get(macroname);
+ if ((macro!=null)&&(macro.isMultiLine()))
+ result.append(context.getWiki().getRenderingEngine().convertMultiLine(macroname, params, data, allcontent, macro, context));
+ else
+ result.append(allcontent);
}
if (current==0)
- return content;
+ return content;
result.append(content.substring(current));
return result.toString();
}
public void flushCache() {
- //To change body of implemented methods use File | Settings | File Templates.
+ macros_libraries = null;
+ macros_mappings = null;
}
public String convertMultiLine(String macroname, String params, String data, String allcontent, XWikiVirtualMacro macro, XWikiContext context) {
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditAction.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditAction.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditAction.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -1,26 +1,26 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author namphunghai
- * @author torcq
- * @author sdumitriu
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author namphunghai
+ * @author torcq
+ * @author sdumitriu
+ */
package com.xpn.xwiki.web;
import org.apache.velocity.VelocityContext;
@@ -44,7 +44,7 @@
synchronized (doc) {
XWikiDocument tdoc = (XWikiDocument) context.get("tdoc");
- PrepareEditForm peform = (PrepareEditForm) form;
+ EditForm peform = (EditForm) form;
String parent = peform.getParent();
if (parent!=null)
doc.setParent(parent);
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditForm.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditForm.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/web/EditForm.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -1,25 +1,25 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author ludovic
- * @author torcq
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author ludovic
+ * @author torcq
+ */
@@ -46,6 +46,7 @@
private String defaultTemplate;
private String title;
private String comment;
+ private boolean lockForce;
public void readRequest() {
XWikiRequest request = getRequest();
@@ -60,6 +61,7 @@
setTitle(request.getParameter("title"));
setComment(request.getParameter("comment"));
setDefaultLanguage(request.getParameter("default_language"));
+ setLockForce("1".equals(request.getParameter("force")));
}
@@ -172,7 +174,12 @@
this.comment = comment;
}
+ public boolean isLockForce() {
+ return lockForce;
+ }
-
+ public void setLockForce(boolean lockForce) {
+ this.lockForce = lockForce;
+ }
}
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/web/InlineAction.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/web/InlineAction.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/web/InlineAction.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -44,7 +44,7 @@
VelocityContext vcontext = (VelocityContext) context.get("vcontext");
Document vdoc = (Document) vcontext.get("doc");
Document vcdoc = (Document) vcontext.get("cdoc");
- PrepareEditForm peform = (PrepareEditForm) form;
+ EditForm peform = (EditForm) form;
XWikiDocument doc2 = (XWikiDocument) doc.clone();
Document vdoc2 = new Document(doc2, context);
@@ -79,6 +79,8 @@
cdoc2.readFromTemplate(peform, context);
}
+ doc2.readFromForm((EditForm)form, context);
+
/* Setup a lock */
try {
XWikiLock lock = doc.getLock(context);
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropAddAction.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropAddAction.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropAddAction.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -42,7 +42,7 @@
XWikiDocument olddoc = (XWikiDocument) doc.clone();
String propName = ((PropAddForm) form).getPropName();
- if(propName ==null || propName.equals("") || !propName.matches("\\w+") ){
+ if(propName ==null || propName.equals("") || !propName.matches("[\\w\\.\\-\\_]+") ){
context.put("message","propertynamenotcorrect");
return true;
}
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropUpdateAction.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropUpdateAction.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/web/PropUpdateAction.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -61,7 +61,7 @@
property.getxWikiClass(context).fromMap(map, property);
String newname = property.getName();
- if(newname == null || newname.equals("") || !newname.matches("\\w+")){
+ if(newname == null || newname.equals("") || !newname.matches("[\\w\\.\\-\\_]+")){
context.put("message","propertynamenotcorrect");
return true;
}
Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/web/XWikiAction.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/web/XWikiAction.java 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/web/XWikiAction.java 2006-05-04 12:07:23 UTC (rev 1062)
@@ -78,7 +78,7 @@
HttpServletRequest req,
HttpServletResponse resp)
throws Exception, ServletException {
-// String action = mapping.getName();
+ String action = mapping.getName();
MonitorPlugin monitor = null;
FileUploadPlugin fileupload = null;
Modified: xwiki/trunk/src/main/resources/xwiki.hbm.xml
===================================================================
--- xwiki/trunk/src/main/resources/xwiki.hbm.xml 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/resources/xwiki.hbm.xml 2006-05-04 12:07:23 UTC (rev 1062)
@@ -674,6 +674,29 @@
</property>
</class>
+ <!-- XWikiComments custom mapping -->
+ <class entity-name="XWiki.XWikiComments" table="xwikicomments">
+ <id name="id" type="integer" unsaved-value="any">
+ <column name="XWC_ID" not-null="true" />
+ <generator class="assigned" />
+ </id>
+ <property name="author" type="string">
+ <column name="XWC_AUTHOR" length="255"/>
+ </property>
+ <property name="highlight" type="string">
+ <column name="XWC_HIGHLIGHT" length="60000" />
+ </property>
+ <property name="comment" type="string">
+ <column name="XWC_COMMENT" length="60000" />
+ </property>
+ <property name="replyto" type="integer">
+ <column name="XWP_REPLYTO" />
+ </property>
+ <property name="date" type="timestamp">
+ <column name="XWP_DATE" />
+ </property>
+ </class>
+
<!-- XWikiPreferences custom mapping -->
<!--
<class entity-name="XWiki.XWikiUsers" table="xwikiusers">
Modified: xwiki/trunk/src/main/web/WEB-INF/struts-config.xml
===================================================================
--- xwiki/trunk/src/main/web/WEB-INF/struts-config.xml 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/web/WEB-INF/struts-config.xml 2006-05-04 12:07:23 UTC (rev 1062)
@@ -27,9 +27,9 @@
<form-beans>
<!-- XWiki Struts Application -->
<form-bean name="edit"
- type="com.xpn.xwiki.web.PrepareEditForm"/>
+ type="com.xpn.xwiki.web.EditForm"/>
<form-bean name="inline"
- type="com.xpn.xwiki.web.PrepareEditForm"/>
+ type="com.xpn.xwiki.web.EditForm"/>
<form-bean name="lock"
type="com.xpn.xwiki.web.EditForm"/>
<form-bean name="preview"
Modified: xwiki/trunk/src/main/web/skins/default/wiki.css
===================================================================
--- xwiki/trunk/src/main/web/skins/default/wiki.css 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/web/skins/default/wiki.css 2006-05-04 12:07:23 UTC (rev 1062)
@@ -96,18 +96,26 @@
margin: auto;
empty-cells: show;
width: 80%;
- border-left: 1px solid #5b5b5b;
- border-right: 1px solid #5b5b5b;
- border-bottom: 1px solid #5b5b5b;
+ font-size:100%;
+ text-align:left;
+ border: 1px solid #5b5b5b;
+ border-width: 1px;
+ border-style: outset;
+ border-collapse: collapse;
}
.wiki-table td {
- border-top: 1px solid #5b5b5b;
+ border: 1px solid #5b5b5b;
+ border-width: 1px;
+ border-style: inset;
padding: 2px;
+ text-align:left;
}
.wiki-table th {
- border-top: 1px solid #5b5b5b;
+ border: 1px solid #5b5b5b;
+ border-width: 1px;
+ border-style: inset;
text-align: left;
color: inherit;
font-weight: bold;
Modified: xwiki/trunk/src/main/web/templates/edit.vm
===================================================================
--- xwiki/trunk/src/main/web/templates/edit.vm 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/web/templates/edit.vm 2006-05-04 12:07:23 UTC (rev 1062)
@@ -34,9 +34,9 @@
#set($force = $!request.get("force"))
#if (($tdoc.getLocked()==true)&&(!$force))
<p>
-$msg.get("doclockedby"): $xwiki.getLocalUserName($doc.getLockingUser()).
+$msg.get("doclockedby") $xwiki.getLocalUserName($doc.getLockingUser()).
<br />
-<a href="$doc.getURL("edit", "template=$!request.template&xredirect=$!xredirect&language=$!tdoc.language&force=1")">$msg.get("forcelock")</a>
+<a href="$doc.getURL("edit", "$!request.getQueryString()&force=1")">$msg.get("forcelock")</a>
</p>
#else
#set( $pages = $tdoc.includedPages)
Modified: xwiki/trunk/src/main/web/templates/inline.vm
===================================================================
--- xwiki/trunk/src/main/web/templates/inline.vm 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/main/web/templates/inline.vm 2006-05-04 12:07:23 UTC (rev 1062)
@@ -16,9 +16,9 @@
#set($force = $!request.get("force"))
#if (($doc.getLocked()==true)&&(!$force))
<p>
-$msg.get("doclockedby"): $xwiki.getLocalUserName($doc.getLockingUser()).
+$msg.get("doclockedby") $xwiki.getLocalUserName($doc.getLockingUser()).
<br />
-<a href="$doc.getURL("inline", "template=$!request.template&xredirect=$!xredirect&language=$!doc.language&force=1")">$msg.get("forcelock")</a>
+<a href="$doc.getURL("inline", "$!request.getQueryString()&force=1")">$msg.get("forcelock")</a>
</p>
#else
#foreach($class in $doc.xWikiClasses)
Modified: xwiki/trunk/src/test/resources/xwiki.hbm.xml
===================================================================
--- xwiki/trunk/src/test/resources/xwiki.hbm.xml 2006-05-03 15:12:12 UTC (rev 1061)
+++ xwiki/trunk/src/test/resources/xwiki.hbm.xml 2006-05-04 12:07:23 UTC (rev 1062)
@@ -600,6 +600,9 @@
<property name="authenticate_view" type="integer">
<column name="XWP_AUTHENTICATE_VIEW" />
</property>
+ <property name="auth_active_check" type="integer">
+ <column name="XWP_AUTH_ACTIVE_CHECK" />
+ </property>
<property name="backlinks" type="integer">
<column name="XWP_BACKLINKS" />
</property>
@@ -666,8 +669,34 @@
<property name="macros_mapping" type="string">
<column name="XWP_MACROS_MAPPING" length="60000" />
</property>
+ <property name="notification_pages" type="string">
+ <column name="XWP_NOTIFICATION_PAGES" length="255" />
+ </property>
</class>
+ <!-- XWikiComments custom mapping -->
+ <class entity-name="XWiki.XWikiComments" table="xwikicomments">
+ <id name="id" type="integer" unsaved-value="any">
+ <column name="XWC_ID" not-null="true" />
+ <generator class="assigned" />
+ </id>
+ <property name="author" type="string">
+ <column name="XWC_AUTHOR" length="255"/>
+ </property>
+ <property name="highlight" type="string">
+ <column name="XWC_HIGHLIGHT" length="60000" />
+ </property>
+ <property name="comment" type="string">
+ <column name="XWC_COMMENT" length="60000" />
+ </property>
+ <property name="replyto" type="integer">
+ <column name="XWP_REPLYTO" />
+ </property>
+ <property name="date" type="timestamp">
+ <column name="XWP_DATE" />
+ </property>
+ </class>
+
<!-- XWikiPreferences custom mapping -->
<!--
<class entity-name="XWiki.XWikiUsers" table="xwikiusers">
More information about the Xwiki-notifications
mailing list