From: <fg...@us...> - 2011-05-20 16:17:40
|
Revision: 3477 http://openutils.svn.sourceforge.net/openutils/?rev=3477&view=rev Author: fgiust Date: 2011-05-20 16:17:33 +0000 (Fri, 20 May 2011) Log Message: ----------- REPOTOOLS-2 New feature: tool for fixing links in a jcr tree Modified Paths: -------------- trunk/openutils-mgnlrepoutils/pom.xml trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/RepositoryUtilsPage.java trunk/openutils-mgnlrepoutils/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexUtils.java Added Paths: ----------- trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/Linkfix.java trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.java trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.adminInterface.config.menu.tools.linkfix.xml trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.repoutils.pages.linkfix.xml trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/ trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/ trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/ trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/frame-bottom.png trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/frame-top.png trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/ico-warning.png trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/openmindlab.css trunk/openutils-mgnlrepoutils/src/main/resources/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.html Modified: trunk/openutils-mgnlrepoutils/pom.xml =================================================================== --- trunk/openutils-mgnlrepoutils/pom.xml 2011-05-20 16:10:54 UTC (rev 3476) +++ trunk/openutils-mgnlrepoutils/pom.xml 2011-05-20 16:17:33 UTC (rev 3477) @@ -74,6 +74,11 @@ <version>${magnolia.version}</version> </dependency> <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-mgnlcriteria</artifactId> + <version>3.3.1</version> + </dependency> + <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <classifier>jdk15</classifier> @@ -87,19 +92,6 @@ </exclusions> </dependency> </dependencies> - <repositories> - <repository> - <id>repository.magnolia.info</id> - <name>magnolia repository</name> - <url>http://nexus.magnolia-cms.com/content/groups/public</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> <properties> <magnolia.version>4.4.1</magnolia.version> </properties> Added: trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/Linkfix.java =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/Linkfix.java (rev 0) +++ trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/Linkfix.java 2011-05-20 16:17:33 UTC (rev 3477) @@ -0,0 +1,403 @@ +/** + * + * Repository tools for Magnolia CMS (http://www.openmindlab.com/lab/products/repotools.html) + * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sourceforge.openutils.mgnlrepoutils; + +import info.magnolia.cms.core.Content; +import info.magnolia.cms.core.Content.ContentFilter; +import info.magnolia.cms.core.ItemType; +import info.magnolia.cms.core.NodeData; +import info.magnolia.context.MgnlContext; + +import java.io.StringWriter; +import java.util.Collection; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.jcr.PropertyType; +import javax.jcr.RepositoryException; +import javax.jcr.Value; + +import net.sourceforge.openutils.mgnlcriteria.jcr.query.AdvancedResultItem; +import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRCriteriaFactory; +import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Restrictions; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * @author fgiust + * @version $Id$ + */ +public class Linkfix +{ + + private static final Pattern UUID_PATTERN = Pattern + .compile("([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})"); + + private static final ContentFilter ACCEPTALL_CONTENTFILTER = new ContentFilter() + { + + public boolean accept(Content content) + { + try + { + return !ItemType.NT_METADATA.equals(content.getNodeTypeName()); + } + catch (RepositoryException e) + { + return true; + } + } + }; + + private Map<String, String> replacements; + + private Collection<String> sourceRepositoriesAndPaths; + + private Collection<String> targetRepositories; + + private int nodesCount; + + private int matchesCount; + + private int substitutionsCount; + + private StringWriter fullLog = new StringWriter(); + + /** + * Logger. + */ + private Logger log = LoggerFactory.getLogger(Linkfix.class); + + /** + * @param replacements + * @param sourceRepositoriesAndPaths + * @param targetRepositories + */ + public Linkfix( + Map<String, String> replacements, + Collection<String> sourceRepositoriesAndPaths, + Collection<String> targetRepositories) + { + super(); + this.replacements = replacements; + this.sourceRepositoriesAndPaths = sourceRepositoriesAndPaths; + this.targetRepositories = targetRepositories; + } + + /** + * Returns the matchesCount. + * @return the matchesCount + */ + public int getMatchesCount() + { + return matchesCount; + } + + /** + * Returns the nodesCount. + * @return the nodesCount + */ + public int getNodesCount() + { + return nodesCount; + } + + /** + * Returns the substitutionsCount. + * @return the substitutionsCount + */ + public int getSubstitutionsCount() + { + return substitutionsCount; + } + + public String getFullLog() + { + return fullLog.toString(); + } + + public void process() throws RepositoryException + { + + log.info("Starting"); + for (String source : sourceRepositoriesAndPaths) + { + String repo = StringUtils.substringBefore(source, ":"); + String path = StringUtils.substringAfter(source, ":"); + if (StringUtils.isEmpty(repo) || StringUtils.isEmpty(path)) + { + log.error("Skipping entry {}, must be in \"repo:path\" format", source); + continue; + } + + log.info("Processing {}", source); + + Content node = MgnlContext.getHierarchyManager(repo).getContent(path); + processNode(node); + } + + log.info("Everything done"); + + } + + /** + * @param node + * @throws RepositoryException + */ + private void processNode(Content node) throws RepositoryException + { + log.debug("Processing {}", node.getHandle()); + nodesCount++; + + Collection<NodeData> nodedatas = node.getNodeDataCollection(); + + boolean nodeUpdated = false; + for (NodeData nodedata : nodedatas) + { + nodeUpdated = processNodedata(nodedata) || nodeUpdated; + } + + if (nodeUpdated) + { + node.updateMetaData(); + } + + Collection<Content> children = node.getChildren(ACCEPTALL_CONTENTFILTER); + for (Content child : children) + { + processNode(child); + } + + } + + /** + * @param nodedata + * @throws RepositoryException + */ + private boolean processNodedata(NodeData data) throws RepositoryException + { + if (data.isMultiValue() == NodeData.MULTIVALUE_TRUE) + { + return processMultiValue(data); + } + else if (data.getType() == PropertyType.STRING) + { + return processString(data); + } + + return false; + + } + + /** + * @param data + * @throws RepositoryException + */ + private boolean processString(NodeData data) throws RepositoryException + { + String dataAsString = data.getString(); + if (StringUtils.isEmpty(dataAsString)) + { + // quick skip + return false; + } + + boolean gotMatches = false; + Matcher matcher = UUID_PATTERN.matcher(dataAsString); + StringBuffer sb = new StringBuffer(); + while (matcher.find()) + { + matchesCount++; + final String uuid = matcher.group(0); + + String newuuid = findAndReplaceUuid(uuid); + if (newuuid != null) + { + log.debug("Replacing UUID {} with {}", uuid, newuuid); + + fullLog.append(String.format( + "%s:%s\n", + data.getHierarchyManager().getWorkspace().getName(), + data.getHandle())); + + gotMatches = true; + substitutionsCount++; + matcher.appendReplacement(sb, newuuid); + } + + } + + matcher.appendTail(sb); + String newString = sb.toString(); + + // replace hardcoded path + for (Map.Entry<String, String> repl : replacements.entrySet()) + { + Pattern pattern = Pattern.compile(repl.getKey()); + + matcher = pattern.matcher(newString); + sb = new StringBuffer(); + while (matcher.find()) + { + matchesCount++; + final String plainpath = matcher.group(0); + + log.debug("Replacing text {} with {}", plainpath, repl.getValue()); + + fullLog.append(String.format( + "%s:%s\n", + data.getHierarchyManager().getWorkspace().getName(), + data.getHandle())); + + gotMatches = true; + substitutionsCount++; + matcher.appendReplacement(sb, repl.getValue()); + + } + + matcher.appendTail(sb); + newString = sb.toString(); + } + + if (gotMatches) + { + data.setValue(newString); + data.save(); + return true; + } + + return false; + + } + + /** + * @param uuid + * @return + */ + private String findAndReplaceUuid(String uuid) + { + for (String repo : targetRepositories) + { + AdvancedResultItem result = JCRCriteriaFactory + .createCriteria() + .setWorkspace(repo) + .add(Restrictions.eq("jcr:uuid", uuid)) + .execute() + .getFirstResult(); + + if (result != null) + { + + String handle = result.getHandle(); + + log.debug("Found uuid {} in repo {} with handle {}", new Object[]{uuid, repo, handle }); + + for (Map.Entry<String, String> replacement : replacements.entrySet()) + { + if (StringUtils.contains(handle, replacement.getKey())) + { + String newhandle = StringUtils.replace(handle, replacement.getKey(), replacement.getValue()); + try + { + Content newcontent = MgnlContext.getHierarchyManager(repo).getContent(newhandle); + return newcontent.getUUID(); + } + catch (RepositoryException e) + { + // not existing at the expected path, go on + } + } + } + } + + } + return null; + } + + /** + * @param data + * @throws RepositoryException + */ + private boolean processMultiValue(NodeData data) throws RepositoryException + { + Value[] values = data.getValues(); + + boolean gotMatches = false; + + for (int j = 0; j < values.length; j++) + { + Value value = values[j]; + String dataAsString = value.getString(); + + boolean gotValueMatches = false; + Matcher matcher = UUID_PATTERN.matcher(dataAsString); + StringBuffer sb = new StringBuffer(); + while (matcher.find()) + { + matchesCount++; + final String uuid = matcher.group(0); + + String newuuid = findAndReplaceUuid(uuid); + if (newuuid != null) + { + log.debug("Replacing UUID {} with {} (multivalue)", uuid, newuuid); + gotMatches = true; + gotValueMatches = true; + substitutionsCount++; + matcher.appendReplacement(sb, newuuid); + } + else + { + matcher.appendTail(sb); + } + } + if (gotValueMatches) + { + matcher.appendTail(sb); + String newString = sb.toString(); + log.info("Creating value {}", newString); + + values[j] = data + .getHierarchyManager() + .getWorkspace() + .getSession() + .getValueFactory() + .createValue(newString); + + } + } + + if (gotMatches) + { + + log.debug("Setting value {} {}", values.length, values); + + data.setValue(values); + data.save(); + return true; + } + + return false; + } +} Property changes on: trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/Linkfix.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.java =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.java (rev 0) +++ trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.java 2011-05-20 16:17:33 UTC (rev 3477) @@ -0,0 +1,206 @@ +/** + * + * Repository tools for Magnolia CMS (http://www.openmindlab.com/lab/products/repotools.html) + * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sourceforge.openutils.mgnlrepoutils; + +import info.magnolia.cms.util.AlertUtil; +import info.magnolia.context.MgnlContext; +import info.magnolia.module.admininterface.TemplatedMVCHandler; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.jcr.RepositoryException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DurationFormatUtils; +import org.apache.commons.lang.time.StopWatch; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * @author fgiust + * @version $Id$ + */ +public class LinkfixPage extends TemplatedMVCHandler +{ + + private static Logger log = LoggerFactory.getLogger(LinkfixPage.class); + + private static final String SUCCESS = "success"; + + private String replacements; + + private String sourceRepositoriesAndPaths; + + private String targetRepositories; + + public LinkfixPage(String name, HttpServletRequest request, HttpServletResponse response) + { + super(name, request, response); + } + + /** + * Sets the replacements. + * @param replacements the replacements to set + */ + public void setReplacements(String replacements) + { + this.replacements = replacements; + } + + /** + * Sets the sourceRepositoriesAndPaths. + * @param sourceRepositoriesAndPaths the sourceRepositoriesAndPaths to set + */ + public void setSourceRepositoriesAndPaths(String sourceRepositoriesAndPaths) + { + this.sourceRepositoriesAndPaths = sourceRepositoriesAndPaths; + } + + /** + * Sets the targetRepositories. + * @param targetRepositories the targetRepositories to set + */ + public void setTargetRepositories(String targetRepositories) + { + this.targetRepositories = targetRepositories; + } + + /** + * Returns the replacements. + * @return the replacements + */ + public String getReplacements() + { + return replacements; + } + + /** + * Returns the sourceRepositoriesAndPaths. + * @return the sourceRepositoriesAndPaths + */ + public String getSourceRepositoriesAndPaths() + { + return sourceRepositoriesAndPaths; + } + + /** + * Returns the targetRepositories. + * @return the targetRepositories + */ + public String getTargetRepositories() + { + return targetRepositories; + } + + public String execute() throws RepositoryException + { + + String[] replacementsSplit = StringUtils.split(replacements, "\n"); + Map<String, String> replacementsMap = new LinkedHashMap<String, String>(); + for (String string : replacementsSplit) + { + String[] split = StringUtils.split(StringUtils.trim(string), "="); + if (split != null & split.length > 1) + { + replacementsMap.put(split[0], split[1]); + } + } + + String[] sourceRepositoriesAndPathsArray = StringUtils + .split(StringUtils.trim(sourceRepositoriesAndPaths), "\n"); + List<String> sourceRepositoriesAndPathList = new ArrayList<String>(); + for (String string : sourceRepositoriesAndPathsArray) + { + if (StringUtils.contains(string, ":")) + { + sourceRepositoriesAndPathList.add(StringUtils.trim(string)); + } + else + { + log.error("Invalid path: {}", string); + } + } + + String[] repoArray = StringUtils.split(targetRepositories); + List<String> reposAsList = new ArrayList<String>(); + for (String string : repoArray) + { + String repo = StringUtils.trim(string); + if (StringUtils.isNotEmpty(repo)) + { + + // test it + try + { + MgnlContext.getHierarchyManager(repo); + } + catch (IllegalArgumentException e) + { + log.error(e.getMessage(), e); + AlertUtil.setMessage(String.format("Invalid repository: %s", repo)); + return SUCCESS; + } + reposAsList.add(repo); + } + } + + StopWatch sw = new StopWatch(); + sw.start(); + + Linkfix linkfix = new Linkfix(replacementsMap, sourceRepositoriesAndPathList, reposAsList); + + try + { + + linkfix.process(); + + } + catch (Throwable e) + { + log.error(e.getMessage(), e); + AlertUtil.setMessage(e.getClass().getName() + + ": " + + StringUtils.defaultIfEmpty(e.getMessage(), "(no message)")); + return SUCCESS; + } + + sw.stop(); + long time = sw.getTime(); + + AlertUtil + .setMessage(String + .format( + "Fix done in %s, %s nodes processed, %s matches and %s substitutions applied. Full list of modified properties:\n%s", + DurationFormatUtils.formatDurationWords(time, true, false), + linkfix.getNodesCount(), + linkfix.getMatchesCount(), + linkfix.getSubstitutionsCount(), + StringUtils.defaultIfEmpty(linkfix.getFullLog(), "(none)"))); + + return SUCCESS; + } + +} Property changes on: trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/RepositoryUtilsPage.java =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/RepositoryUtilsPage.java 2011-05-20 16:10:54 UTC (rev 3476) +++ trunk/openutils-mgnlrepoutils/src/main/java/net/sourceforge/openutils/mgnlrepoutils/RepositoryUtilsPage.java 2011-05-20 16:17:33 UTC (rev 3477) @@ -1,7 +1,7 @@ /** * * Repository tools for Magnolia CMS (http://www.openmindlab.com/lab/products/repotools.html) - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/openutils-mgnlrepoutils/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexUtils.java =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexUtils.java 2011-05-20 16:10:54 UTC (rev 3476) +++ trunk/openutils-mgnlrepoutils/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexUtils.java 2011-05-20 16:17:33 UTC (rev 3477) @@ -1,7 +1,7 @@ /** * * Repository tools for Magnolia CMS (http://www.openmindlab.com/lab/products/repotools.html) - * Copyright(C) ${project.inceptionYear}-2011, Openmind S.r.l. http://www.openmindonline.it + * Copyright(C) 2009-2011, Openmind S.r.l. http://www.openmindonline.it * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Added: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.adminInterface.config.menu.tools.linkfix.xml =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.adminInterface.config.menu.tools.linkfix.xml (rev 0) +++ trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.adminInterface.config.menu.tools.linkfix.xml 2011-05-20 16:17:33 UTC (rev 3477) @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<sv:node sv:name="linkfix" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>63a87f96-def9-4b24-911f-35d7612ec1d9</sv:value> + </sv:property> + <sv:property sv:name="icon" sv:type="String"> + <sv:value>/.resources/pirellimedia/img/ico16-linkfix.png</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="label" sv:type="String"> + <sv:value>Fix links</sv:value> + </sv:property> + <sv:property sv:name="onclick" sv:type="String"> + <sv:value>MgnlAdminCentral.showContent('/.magnolia/pages/linkfix.html');</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:Data" sv:type="String"> + <sv:value>MetaData</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activated" sv:type="Boolean"> + <sv:value>false</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activatorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2005-05-16T20:46:43.549+02:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastaction" sv:type="Date"> + <sv:value>2006-05-31T14:57:07.972+02:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2011-01-31T12:18:09.250+01:00</sv:value> + </sv:property> + </sv:node> +</sv:node> Property changes on: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.adminInterface.config.menu.tools.linkfix.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.repoutils.pages.linkfix.xml =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.repoutils.pages.linkfix.xml (rev 0) +++ trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.repoutils.pages.linkfix.xml 2011-05-20 16:17:33 UTC (rev 3477) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<sv:node sv:name="linkfix" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>7cc6213e-106c-45d3-8532-36d5517ce8f6</sv:value> + </sv:property> + <sv:property sv:name="class" sv:type="String"> + <sv:value>net.sourceforge.openutils.mgnlrepoutils.LinkfixPage</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="replacements" sv:type="String"> + <sv:value>tyre/ww/en/=tyre/NEWPATH/en/</sv:value> + </sv:property> + <sv:property sv:name="sourceRepositoriesAndPaths" sv:type="String"> + <sv:value>website:/tyre/NEWPATH/en/car +products:/pirellityre/NEWPATH/en/car</sv:value> + </sv:property> + <sv:property sv:name="targetRepositories" sv:type="String"> + <sv:value>website +media +products +dms +playlists</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activated" sv:type="Boolean"> + <sv:value>false</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activatorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2008-06-18T15:49:04.038Z</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastaction" sv:type="Date"> + <sv:value>2008-06-18T16:32:03.891Z</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2011-01-31T12:17:33.825+01:00</sv:value> + </sv:property> + </sv:node> +</sv:node> Property changes on: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-bootstrap/repoutils/config.modules.repoutils.pages.linkfix.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/frame-bottom.png =================================================================== (Binary files differ) Property changes on: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/frame-bottom.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/frame-top.png =================================================================== (Binary files differ) Property changes on: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/frame-top.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/ico-warning.png =================================================================== (Binary files differ) Property changes on: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/images/ico-warning.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/openmindlab.css =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/openmindlab.css (rev 0) +++ trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/openmindlab.css 2011-05-20 16:17:33 UTC (rev 3477) @@ -0,0 +1,124 @@ +body { + background-color: #333; + padding: 10px; + margin: 0; +} + +div,span,p,input,select,pre,textarea { + font-size: 13px; + font-family: georgia, sans-serif; +} + +form { + padding: 0; + margin: 0; +} + +.ma-frame { + background-color: #fff; + padding: 0; + margin: 0; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + +.ma-frame h1 { + height: 59px; + background-image: url("images/frame-top.png"); + background-position: top; + background-repeat: repeat-x; + -webkit-border-top-left-radius: 6px; + -webkit-border-top-right-radius: 6px; + -moz-border-radius-topleft: 6px; + -moz-border-radius-topright: 6px; + border-top-left-radius: 6px; + border-top-right-radius: 6px; + font-weight: lighter; + font-size: 22px; + line-height: 55px; + color: #fff; + background-repeat: repeat-x; + padding: 0 30px 0 30px; + text-shadow: #ddd 1px 1px 1px; +} + +.ma-framecenter { + padding: 10px 30px 10px 30px; +} + +.footer { + height: 60px; + background-image: url("images/frame-bottom.png"); + background-position: bottom; + background-repeat: repeat-x; + -webkit-border-bottom-right-radius: 6px; + -webkit-border-bottom-left-radius: 6px; + -moz-border-radius-bottomright: 6px; + -moz-border-radius-bottomleft: 6px; + border-bottom-right-radius: 6px; + border-bottom-left-radius: 6px; + -webkit-border-bottom-right-radius: 6px; + padding: 0 30px 0 30px; +} + +.warning { + border: 2px solid #FFD324; + padding: 10px 11px 8px 38px; + background: #FFF8BF url(images/ico-warning.png) no-repeat scroll 13px 12px; + color: #B35F00; +} + +input,textarea { + width: 600px; + padding: 5px; + border: solid 1px #E5E5E5; + outline: 0; + font: normal 13px/100% Verdana, Tahoma, sans-serif; + background: #FFFFFF url('bg_form.png') left top repeat-x; + background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #EEEEEE), to(#FFFFFF) ); + background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px); + box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px; + -webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px; + padding: 9px; +} + +textarea { + max-width: 500px; + height: 150px; + line-height: 150%; +} + +input:hover,textarea:hover,input:focus,textarea:focus { + border-color: #C9C9C9; + -webkit-box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 8px; +} + +label { + color: #666; + display: block; + text-decoration: underline; + margin: 10px 0 5px 0; +} + +.submit input { + width: auto; + padding: 9px 15px; + background: #666; + border: 0; + font-size: 14px; + color: #FFFFFF; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + float: right; + cursor: pointer; +} + +small { + color: red; +} + +#buttonContainer { + padding-top: 10px; +} \ No newline at end of file Property changes on: trunk/openutils-mgnlrepoutils/src/main/resources/mgnl-resources/adminstyle/css/openmindlab.css ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/openutils-mgnlrepoutils/src/main/resources/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.html =================================================================== --- trunk/openutils-mgnlrepoutils/src/main/resources/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.html (rev 0) +++ trunk/openutils-mgnlrepoutils/src/main/resources/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.html 2011-05-20 16:17:33 UTC (rev 3477) @@ -0,0 +1,74 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head> + <title>Linkfix util</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <link href="${this.request.contextPath}/.resources/adminstyle/css/openmindlab.css" type="text/css" rel="stylesheet" /> + </head> + <body> + <div class="ma-frame"> + <form id="settingsForm" method="post" action=""> + <h1>Linkfix</h1> + <div class="ma-framecenter"> + [#if message?exists] + <pre class="warning">${message}</pre> + [/#if] + <div> + <p> + This tool will help you fixing internal links in copied pages/sections. + <br /> + After copying a whole website tree from /OLD to /NEW for example all the links in pages below /NEW will + still keep as a target pages in /OLD, since links are generated by using the UUID of pages. This tool will + seach for pages in the new path and will update any link found. + </p> + <label for="sourceRepositoriesAndPaths"> + <small>1)</small> + Source repositories/path + </label> + <p> + The list of path where the substitution will be performed. This is the list of + <strong>new</strong> + paths, copied from the original tree. + <br /> + You may add multiple repositories/path here, separated by a newline. + </p> + <textarea name="sourceRepositoriesAndPaths" style="width: 300px; height:120px">${this.sourceRepositoriesAndPaths!}</textarea> + </div> + <div> + <label for="targetRepositories"> + <small>2)</small> + Target Repositories + </label> + <p> + The list of repositories where link + <strong>target</strong> + will be searched. Content into repositories listed here will not be affected, since they are only used for + references. + </p> + <textarea name="targetRepositories" style="width: 300px; height:120px">${this.targetRepositories!}</textarea> + </div> + <div> + <label for="replacements"> + <small>3)</small> + Replacements + </label> + <p> + Multiple old=new paths to use for replacement. + <br /> + An entry "/OLD=/NEW" means for example that when a reference is resolved with a path "/OLD/mynode", the + tool will look for the existence of a resource with the path "/NEW/mynode". If such content exists, the + link will be updated. + </p> + <textarea name="replacements" style="width: 300px; height:120px">${this.replacements!}</textarea> + </div> + </div> + <div class="footer"> + <div id="buttonContainer" class="submit"> + <input type="hidden" id="command" name="command" value="execute" /> + <input id="button" class="button" type="submit" value="Start replacement" /> + </div> + </div> + </form> + </div> + </body> +</html> \ No newline at end of file Property changes on: trunk/openutils-mgnlrepoutils/src/main/resources/net/sourceforge/openutils/mgnlrepoutils/LinkfixPage.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |