|
From: <die...@us...> - 2009-10-19 15:57:25
|
Revision: 1495
http://openutils.svn.sourceforge.net/openutils/?rev=1495&view=rev
Author: diego_schivo
Date: 2009-10-19 15:57:11 +0000 (Mon, 19 Oct 2009)
Log Message:
-----------
added trigger editors: media-picker, fckeditor, file-upload
Modified Paths:
--------------
trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js
Added Paths:
-----------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fckedit-trigger.gif
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fileupload-trigger.gif
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/media-trigger.gif
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java 2009-10-19 15:57:11 UTC (rev 1495)
@@ -0,0 +1,110 @@
+package net.sourceforge.openutils.mgnlcontrols.dialog;
+
+import info.magnolia.cms.beans.runtime.Document;
+import info.magnolia.cms.beans.runtime.MultipartForm;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.HierarchyManager;
+import info.magnolia.cms.core.ItemType;
+import info.magnolia.cms.core.NodeData;
+import info.magnolia.cms.core.Path;
+import info.magnolia.cms.gui.fckeditor.FCKEditorTmpFiles;
+import info.magnolia.cms.security.AccessDeniedException;
+import info.magnolia.cms.util.ContentUtil;
+import info.magnolia.cms.util.NodeDataUtil;
+import info.magnolia.context.MgnlContext;
+import info.magnolia.module.admininterface.FieldSaveHandler;
+import info.magnolia.module.admininterface.SaveHandlerImpl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Needed by file upload. Setup: assign this class name as a "saveHandler"
+ * property of the grid field's configuration node.
+ *
+ * @author dschivo
+ *
+ */
+public class DialogGridSaveHandler implements FieldSaveHandler
+{
+
+ public static Logger log = LoggerFactory.getLogger(DialogGridSaveHandler.class);
+
+ @SuppressWarnings("unchecked")
+ public void save(Content parentNode, Content configNode, String name, MultipartForm form, int type, int valueType,
+ int isRichEditValue, int encoding) throws RepositoryException, AccessDeniedException
+ {
+ HierarchyManager hm = parentNode.getHierarchyManager();
+ Content filesNode = ContentUtil.getOrCreateContent(parentNode, name + "_files", ItemType.CONTENTNODE);
+ String value = form.getParameter(name);
+ String ctx = MgnlContext.getContextPath();
+ String tmpPath = "/tmp/fckeditor/";
+ List usedFiles = new ArrayList();
+ StringBuffer sbValue = new StringBuffer(value.length());
+ StringBuffer sbLine = new StringBuffer();
+ for (String line : StringUtils.splitPreserveAllTokens(value, '\n'))
+ {
+ for (String token : StringUtils.splitPreserveAllTokens(line, '\t'))
+ {
+ if (token.startsWith(ctx))
+ {
+ String link = StringUtils.substringAfter(token, ctx);
+ if (StringUtils.startsWith(link, tmpPath))
+ {
+ String uuid = StringUtils.substringBetween(link, tmpPath, "/");
+ Document doc = FCKEditorTmpFiles.getDocument(uuid);
+ String fileNodeName = Path.getUniqueLabel(hm, filesNode.getHandle(), "file");
+ SaveHandlerImpl.saveDocument(filesNode, doc, fileNodeName, "", "");
+ link = filesNode.getHandle() + "/" + fileNodeName + "/" + doc.getFileNameWithExtension();
+ token = link;
+ doc.delete();
+ try
+ {
+ FileUtils.deleteDirectory(new java.io.File(Path.getTempDirectory() + "/fckeditor/" + uuid));
+ }
+ catch (IOException e)
+ {
+ log.error("can't delete tmp file [" + Path.getTempDirectory() + "/fckeditor/" + uuid + "]");
+ }
+ }
+ }
+ if (token.startsWith(filesNode.getHandle()))
+ {
+ String fileNodeName = StringUtils.removeStart(token, filesNode.getHandle() + "/");
+ fileNodeName = StringUtils.substringBefore(fileNodeName, "/");
+ usedFiles.add(fileNodeName);
+ }
+ if (sbLine.length() > 0)
+ {
+ sbLine.append('\t');
+ }
+ sbLine.append(token);
+ }
+ if (sbValue.length() > 0)
+ {
+ sbValue.append('\n');
+ }
+ sbValue.append(sbLine);
+ sbLine.setLength(0);
+ }
+ for (Iterator iter = filesNode.getNodeDataCollection().iterator(); iter.hasNext();)
+ {
+ NodeData fileNodeData = (NodeData) iter.next();
+ if (!usedFiles.contains(fileNodeData.getName()))
+ {
+ fileNodeData.delete();
+ }
+ }
+ NodeDataUtil.getOrCreateAndSet(parentNode, name, new String(sbValue));
+ }
+
+}
Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2009-10-19 15:29:31 UTC (rev 1494)
+++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2009-10-19 15:57:11 UTC (rev 1495)
@@ -9,6 +9,9 @@
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/LinkField.js"></script>
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/CheckColumn.js"></script>
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/PipeComboBox.js"></script>
+ <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/MediaField.js"></script>
+ <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/FckEditorField.js"></script>
+ <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/FileField.js"></script>
<script type="text/javascript">
// <![CDATA[
function gridMoveRow(grid, delta) {
@@ -127,6 +130,9 @@
sortable: false,
[#if (colmap.type?? && colmap.type = 'link')]
editor: new Ed(new LinkField({
+ [#if (colmap.repository??)]repository: '${colmap.repository}',[/#if]
+ [#if (colmap.extension??)]extension: '${colmap.extension}',[/#if]
+ dummy: undefined
}))
[#elseif (colmap.type?? && colmap.type = 'date')]
renderer: function(value) {
@@ -143,6 +149,22 @@
lazyRender: true,
listClass: 'x-combo-list-small'
}))
+ [#elseif (colmap.type?? && colmap.type = 'media')]
+ editor: new Ed(new MediaField({
+ [#if (colmap.valueType??)]valueType: '${colmap.valueType}'[/#if]
+ })),
+ renderer : function(v, p, record){
+ return v ? '<img border="0" alt="" src="${request.contextPath}/mediaObject' + v + '/resolutions/thumbnail/data.jpg"/>' : v;
+ }
+ [#elseif (colmap.type?? && colmap.type = 'fckedit')]
+ editor: new Ed(new FckEditorField({
+ }))
+ [#elseif (colmap.type?? && colmap.type = 'file')]
+ editor: new Ed(new FileField({
+ })),
+ renderer : function(v, p, record){
+ return v ? v.replace(/^.*\//, '') : v;
+ }
[#else]
editor: new Ed(new fm.TextField({
allowBlank: true
Modified: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css 2009-10-19 15:29:31 UTC (rev 1494)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css 2009-10-19 15:57:11 UTC (rev 1495)
@@ -1,4 +1,19 @@
.x-form-field-wrap .x-form-link-trigger {
background-image: url(img/link-trigger.gif);
cursor: pointer;
-}
\ No newline at end of file
+}
+
+.x-form-field-wrap .x-form-media-trigger {
+ background-image: url(img/media-trigger.gif);
+ cursor: pointer;
+}
+
+.x-form-field-wrap .x-form-fckedit-trigger {
+ background-image: url(img/fckedit-trigger.gif);
+ cursor: pointer;
+}
+
+.x-form-field-wrap .x-form-fileupload-trigger {
+ background-image: url(img/fileupload-trigger.gif);
+ cursor: pointer;
+}
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fckedit-trigger.gif
===================================================================
(Binary files differ)
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fckedit-trigger.gif
___________________________________________________________________
Added: svn:mime-type
+ image/gif
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fileupload-trigger.gif
===================================================================
(Binary files differ)
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fileupload-trigger.gif
___________________________________________________________________
Added: svn:mime-type
+ image/gif
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/media-trigger.gif
===================================================================
(Binary files differ)
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/media-trigger.gif
___________________________________________________________________
Added: svn:mime-type
+ image/gif
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html 2009-10-19 15:57:11 UTC (rev 1495)
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>FCK Editor</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <script type="text/javascript" src="../../.magnolia/pages/javascript.js"></script>
+ <script type="text/javascript" src="../../.resources/admin-js/dialogs/dialogs.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../.resources/admin-css/admin-all.css" />
+
+ <script type="text/javascript" src="../../.resources/fckeditor/fckeditor.js"></script>
+ </head>
+ <body style="padding:0;margin:0">
+ <h1 style="background-color:#F0F2E6; color:#396101; font-size:11pt; border-bottom:1px solid #999;margin:0;padding:3px 10px">FCK Editor</h1>
+ <p style="margin: 10px">
+ <script type="text/javascript">
+var sBasePath = '../../.resources/fckeditor/';
+var oFCKeditor = new FCKeditor('FCKeditor1');
+oFCKeditor.BasePath = sBasePath;
+oFCKeditor.Height = 300;
+oFCKeditor.Value = window.opener.getFckEditorValue();
+oFCKeditor.Create() ;
+ </script>
+ </p>
+ <div class="mgnlDialogTabsetSaveBar">
+ <span class="mgnlControlButton" onclick="window.opener.setFckEditorValue(FCKeditorAPI.GetInstance('FCKeditor1').GetXHTML(true)); mgnlShiftPushButtonClick(this); window.opener.focus(); window.close();" onmouseout="mgnlShiftPushButtonOut(this);"
+ onmousedown="mgnlShiftPushButtonDown(this);">
+ OK
+ </span>
+ </div>
+ </body>
+</html>
\ No newline at end of file
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html
___________________________________________________________________
Added: svn:mime-type
+ text/html
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html 2009-10-19 15:57:11 UTC (rev 1495)
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>File upload</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <script type="text/javascript" src="../../.magnolia/pages/javascript.js"></script>
+ <script type="text/javascript" src="../../.resources/admin-js/dialogs/dialogs.js"></script>
+ <script type="text/javascript">
+function OnUploadCompleted(errorNumber, fileUrl, fileName, customMsg) {
+ switch (errorNumber) {
+ case 0:
+ alert("Your file has been successfully uploaded");
+ break;
+ default:
+ alert("Error on file upload. Error number: " + errorNumber);
+ return;
+ }
+ window.opener.setFileValue(fileUrl);
+ window.opener.focus();
+ window.close();
+}
+ </script>
+ <link rel="stylesheet" type="text/css" href="../../.resources/admin-css/admin-all.css" />
+ </head>
+ <body style="padding:0;margin:0">
+ <h1
+ style="background-color:#F0F2E6; color:#396101; font-size:11pt; border-bottom:1px solid #999;margin:0;padding:3px 10px">
+ File upload
+ </h1>
+
+ <div id="divUpload">
+ <form
+ action="../../.magnolia/fckeditor/upload?repository=website&path=/temp/it/home/quick-answers&nodeCollection=main&node=0&name=text&type=file"
+ enctype="multipart/form-data" target="UploadWindow" method="post" id="frmUpload">
+ <span fcklang="DlgLnkUpload">Carica</span>
+ <br />
+ <input type="file" name="NewFile" size="40" style="width: 100%;" id="txtUploadFile" />
+ <br />
+ <br />
+ <input type="submit" fcklang="DlgLnkBtnUpload" value="Invia al Server" id="btnUpload" />
+ <script type="text/javascript">
+ // <!--
+ document.write('<iframe name="UploadWindow" style="display: none" src="javascript: void(0);"><\/iframe>');
+ // -->
+ </script>
+ </form>
+ </div>
+ </body>
+</html>
\ No newline at end of file
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html
___________________________________________________________________
Added: svn:mime-type
+ text/html
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js 2009-10-19 15:57:11 UTC (rev 1495)
@@ -0,0 +1,14 @@
+var FckEditorField = Ext.extend(Ext.form.TriggerField, {
+
+ triggerClass: 'x-form-fckedit-trigger',
+
+ onTriggerClick : function() {
+ if (this.disabled) return;
+ window.getFckEditorValue = this.getValue.createDelegate(this);
+ window.setFckEditorValue = function(value) {
+ this.setValue(value);
+ }.createDelegate(this);
+ mgnlOpenWindow('/.resources/controls/grid-fckeditor.html', 880, 380);
+ }
+
+});
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js 2009-10-19 15:57:11 UTC (rev 1495)
@@ -0,0 +1,13 @@
+var FileField = Ext.extend(Ext.form.TriggerField, {
+
+ triggerClass: 'x-form-fileupload-trigger',
+
+ onTriggerClick : function() {
+ if (this.disabled) return;
+ window.setFileValue = function(value) {
+ this.setValue(value);
+ }.createDelegate(this);
+ mgnlOpenWindow('/.resources/controls/grid-fileupload.html', 400, 150);
+ }
+
+});
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js 2009-10-19 15:29:31 UTC (rev 1494)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js 2009-10-19 15:57:11 UTC (rev 1495)
@@ -2,9 +2,13 @@
triggerClass : 'x-form-link-trigger',
+ repository: 'website',
+
+ // extension: undefined,
+
onTriggerClick : function() {
if (this.disabled) return;
- mgnlDialogLinkOpenBrowser(this.el.id, 'website', 'html');
+ mgnlDialogLinkOpenBrowser(this.el.id, this.repository, this.extension);
}
});
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js 2009-10-19 15:57:11 UTC (rev 1495)
@@ -0,0 +1,16 @@
+var MediaField = Ext.extend(Ext.form.TriggerField, {
+
+ triggerClass: 'x-form-media-trigger',
+
+ // valueType: undefined,
+
+ onTriggerClick: function(){
+ if (this.disabled) return;
+
+ window.setNewMedia = function(nodeid, uuid, file, thumb){
+ this.setValue(this.valueType == 'path' ? thumb.replace(/^.*\/mediaObject\/(.*)\/resolutions\/.*$/, '/$1') : uuid);
+ }.createDelegate(this);
+ mgnlOpenWindow('/.magnolia/pages/mediaBrowser.html?nodeid=' + name + '&selectMedia=true&mgnlCK=' + mgnlGetCacheKiller(), 800, 500);
+ }
+
+});
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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.
|
|
From: <die...@us...> - 2010-01-18 13:44:57
|
Revision: 1664
http://openutils.svn.sourceforge.net/openutils/?rev=1664&view=rev
Author: diego_schivo
Date: 2010-01-18 13:44:50 +0000 (Mon, 18 Jan 2010)
Log Message:
-----------
CONTROLS-16 Add handling for column type=uuidLink
Modified Paths:
--------------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java
trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java 2010-01-18 13:29:59 UTC (rev 1663)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java 2010-01-18 13:44:50 UTC (rev 1664)
@@ -17,6 +17,23 @@
*/
package net.sourceforge.openutils.mgnlcontrols.dialog;
+import info.magnolia.cms.beans.config.ContentRepository;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.ItemType;
+import info.magnolia.cms.util.ContentUtil;
+import info.magnolia.cms.util.NodeDataUtil;
+
+import java.util.ArrayList;
+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;
+
+
/**
* @author fgiust
* @version $Id$
@@ -24,12 +41,83 @@
public class DialogGrid extends ConfigurableFreemarkerDialog
{
+ private List colConfigs = new ArrayList();
+
/**
* {@inheritDoc}
*/
@Override
+ public void init(HttpServletRequest request, HttpServletResponse response, Content websiteNode, Content configNode)
+ throws RepositoryException
+ {
+ super.init(request, response, websiteNode, configNode);
+ if (configNode != null && configNode.hasContent("columns"))
+ {
+ colConfigs.addAll(configNode.getChildByName("columns").getChildren(ItemType.CONTENTNODE));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getPath()
{
return "dialogs/grid.ftl";
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void addToParameters(Map parameters)
+ {
+ super.addToParameters(parameters);
+ String value = getValue();
+ if (value != null)
+ {
+ StringBuffer sbValue = new StringBuffer(value.length());
+ StringBuffer sbLine = new StringBuffer();
+ for (String line : StringUtils.splitPreserveAllTokens(value, '\n'))
+ {
+ line = StringUtils.removeEnd(line, "\r");
+ int colIndex = 0;
+ for (String token : StringUtils.splitPreserveAllTokens(line, '\t'))
+ {
+ if (colIndex < colConfigs.size())
+ {
+ Content colConfig = (Content) colConfigs.get(colIndex);
+ String colType = NodeDataUtil.getString(colConfig, "type");
+ if ("uuidLink".equals(colType))
+ {
+ String repository = StringUtils.defaultIfEmpty(NodeDataUtil.getString(
+ colConfig,
+ "repository"), ContentRepository.WEBSITE);
+ Content node = ContentUtil.getContentByUUID(repository, token);
+ if (node != null)
+ {
+ token = node.getHandle();
+ }
+ }
+ }
+ if (sbLine.length() > 0)
+ {
+ sbLine.append('\t');
+ }
+ sbLine.append(token);
+ colIndex++;
+ }
+ if (sbValue.length() > 0)
+ {
+ sbValue.append('\n');
+ }
+ sbValue.append(sbLine);
+ sbLine.setLength(0);
+ }
+ value = new String(sbValue);
+ }
+ parameters.put("gridValue", value);
+ }
+
}
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java 2010-01-18 13:29:59 UTC (rev 1663)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java 2010-01-18 13:44:50 UTC (rev 1664)
@@ -1,5 +1,6 @@
package net.sourceforge.openutils.mgnlcontrols.dialog;
+import info.magnolia.cms.beans.config.ContentRepository;
import info.magnolia.cms.beans.runtime.Document;
import info.magnolia.cms.beans.runtime.MultipartForm;
import info.magnolia.cms.core.Content;
@@ -27,12 +28,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/**
- * Needed by file upload. Setup: assign this class name as a "saveHandler"
- * property of the grid field's configuration node.
- *
+ * Needed by file upload. Setup: assign this class name as a "saveHandler" property of the grid field's configuration
+ * node.
* @author dschivo
- *
*/
public class DialogGridSaveHandler implements FieldSaveHandler
{
@@ -41,8 +41,14 @@
@SuppressWarnings("unchecked")
public void save(Content parentNode, Content configNode, String name, MultipartForm form, int type, int valueType,
- int isRichEditValue, int encoding) throws RepositoryException, AccessDeniedException
+ int isRichEditValue, int encoding) throws RepositoryException, AccessDeniedException
{
+ List colConfigs = new ArrayList();
+ if (configNode != null && configNode.hasContent("columns"))
+ {
+ colConfigs.addAll(configNode.getChildByName("columns").getChildren(ItemType.CONTENTNODE));
+ }
+
HierarchyManager hm = parentNode.getHierarchyManager();
Content filesNode = ContentUtil.getOrCreateContent(parentNode, name + "_files", ItemType.CONTENTNODE);
String value = form.getParameter(name);
@@ -53,41 +59,72 @@
StringBuffer sbLine = new StringBuffer();
for (String line : StringUtils.splitPreserveAllTokens(value, '\n'))
{
+ line = StringUtils.removeEnd(line, "\r");
+ int colIndex = 0;
for (String token : StringUtils.splitPreserveAllTokens(line, '\t'))
{
- if (token.startsWith(ctx))
+ if (colIndex < colConfigs.size())
{
- String link = StringUtils.substringAfter(token, ctx);
- if (StringUtils.startsWith(link, tmpPath))
+ Content colConfig = (Content) colConfigs.get(colIndex);
+ String colType = NodeDataUtil.getString(colConfig, "type");
+ if ("file".equals(colType))
{
- String uuid = StringUtils.substringBetween(link, tmpPath, "/");
- Document doc = FCKEditorTmpFiles.getDocument(uuid);
- String fileNodeName = Path.getUniqueLabel(hm, filesNode.getHandle(), "file");
- SaveHandlerImpl.saveDocument(filesNode, doc, fileNodeName, "", "");
- link = filesNode.getHandle() + "/" + fileNodeName + "/" + doc.getFileNameWithExtension();
- token = link;
- doc.delete();
- try
+ if (token.startsWith(ctx))
{
- FileUtils.deleteDirectory(new java.io.File(Path.getTempDirectory() + "/fckeditor/" + uuid));
+ String link = StringUtils.substringAfter(token, ctx);
+ if (StringUtils.startsWith(link, tmpPath))
+ {
+ String uuid = StringUtils.substringBetween(link, tmpPath, "/");
+ Document doc = FCKEditorTmpFiles.getDocument(uuid);
+ String fileNodeName = Path.getUniqueLabel(hm, filesNode.getHandle(), "file");
+ SaveHandlerImpl.saveDocument(filesNode, doc, fileNodeName, "", "");
+ link = filesNode.getHandle()
+ + "/"
+ + fileNodeName
+ + "/"
+ + doc.getFileNameWithExtension();
+ token = link;
+ doc.delete();
+ try
+ {
+ FileUtils.deleteDirectory(new java.io.File(Path.getTempDirectory()
+ + "/fckeditor/"
+ + uuid));
+ }
+ catch (IOException e)
+ {
+ log.error("can't delete tmp file ["
+ + Path.getTempDirectory()
+ + "/fckeditor/"
+ + uuid
+ + "]");
+ }
+ }
}
- catch (IOException e)
+ if (token.startsWith(filesNode.getHandle()))
{
- log.error("can't delete tmp file [" + Path.getTempDirectory() + "/fckeditor/" + uuid + "]");
+ String fileNodeName = StringUtils.removeStart(token, filesNode.getHandle() + "/");
+ fileNodeName = StringUtils.substringBefore(fileNodeName, "/");
+ usedFiles.add(fileNodeName);
}
}
+ else if ("uuidLink".equals(colType))
+ {
+ String repository = StringUtils.defaultIfEmpty(NodeDataUtil
+ .getString(colConfig, "repository"), ContentRepository.WEBSITE);
+ Content node = ContentUtil.getContent(repository, token);
+ if (node != null)
+ {
+ token = node.getUUID();
+ }
+ }
}
- if (token.startsWith(filesNode.getHandle()))
- {
- String fileNodeName = StringUtils.removeStart(token, filesNode.getHandle() + "/");
- fileNodeName = StringUtils.substringBefore(fileNodeName, "/");
- usedFiles.add(fileNodeName);
- }
if (sbLine.length() > 0)
{
sbLine.append('\t');
}
sbLine.append(token);
+ colIndex++;
}
if (sbValue.length() > 0)
{
Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-01-18 13:29:59 UTC (rev 1663)
+++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-01-18 13:44:50 UTC (rev 1664)
@@ -70,7 +70,7 @@
[#assign key = uuid?replace("-", "")]
-<input type="hidden" id="${name}" name="${name}" value="${value?html}"/>
+<input type="hidden" id="${name}" name="${name}" value="${gridValue?html}"/>
<div id="grid-container-${name}">
<div id="grid-${name}"></div>
@@ -129,7 +129,7 @@
header: '${colmap.header}',
dataIndex: '${colmap_index}',
sortable: false,
- [#if (colmap.type?? && colmap.type = 'link')]
+ [#if (colmap.type?? && (colmap.type = 'link' || colmap.type = 'uuidLink'))]
editor: new Ed(new LinkField({
[#if (colmap.repository??)]repository: '${colmap.repository}',[/#if]
[#if (colmap.extension??)]extension: '${colmap.extension}',[/#if]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <die...@us...> - 2010-06-18 09:57:37
|
Revision: 2670
http://openutils.svn.sourceforge.net/openutils/?rev=2670&view=rev
Author: diego_schivo
Date: 2010-06-18 09:57:29 +0000 (Fri, 18 Jun 2010)
Log Message:
-----------
CONTROLS-31 fckedit column type
Modified Paths:
--------------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java
trunk/openutils-mgnlcontrols/src/main/resources/META-INF/magnolia/controls.xml
trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
Added Paths:
-----------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnType.java
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnTypeManager.java
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/lifecycle/
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/lifecycle/ControlsModule.java
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.fckedit.xml
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java 2010-06-18 09:57:29 UTC (rev 2670)
@@ -0,0 +1,54 @@
+/**
+ *
+ * Magnolia controls module (http://www.openmindlab.com/lab/products/controls.html)
+ * Copyright (C)2008 - 2010, 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.mgnlcontrols.configuration;
+
+import info.magnolia.context.MgnlContext;
+
+
+/**
+ * @author dschivo
+ * @version $Id$
+ */
+public class FckEditorGridColumnType implements GridColumnType
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getHeadSnippet()
+ {
+ return "<script type=\"text/javascript\" src=\""
+ + MgnlContext.getContextPath()
+ + "/.resources/controls/js/FckEditorField.js\"></script>";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getColumnModelSnippet()
+ {
+ return "editor: new Ed(new FckEditorField({\n"
+ + "contextPath: '"
+ + MgnlContext.getContextPath()
+ + "'\n"
+ + "}))\n";
+ }
+
+}
Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnType.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnType.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnType.java 2010-06-18 09:57:29 UTC (rev 2670)
@@ -0,0 +1,41 @@
+/**
+ *
+ * Magnolia controls module (http://www.openmindlab.com/lab/products/controls.html)
+ * Copyright (C)2008 - 2010, 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.mgnlcontrols.configuration;
+
+/**
+ * @author dschivo
+ * @version $Id$
+ */
+public interface GridColumnType
+{
+
+ /**
+ * Returns the headSnippet.
+ * @return the headSnippet
+ */
+ public String getHeadSnippet();
+
+ /**
+ * Returns the columnModelSnippet.
+ * @return the columnModelSnippet
+ */
+ public String getColumnModelSnippet();
+
+}
Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnType.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnTypeManager.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnTypeManager.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnTypeManager.java 2010-06-18 09:57:29 UTC (rev 2670)
@@ -0,0 +1,100 @@
+/**
+ *
+ * Magnolia controls module (http://www.openmindlab.com/lab/products/controls.html)
+ * Copyright (C)2008 - 2010, 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.mgnlcontrols.configuration;
+
+import info.magnolia.cms.beans.config.ObservedManager;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.util.ContentUtil;
+import info.magnolia.cms.util.NodeDataUtil;
+import info.magnolia.content2bean.Content2BeanUtil;
+import info.magnolia.objectfactory.Components;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author dschivo
+ * @version $Id$
+ */
+public class GridColumnTypeManager extends ObservedManager
+{
+
+ public static GridColumnTypeManager getInstance()
+ {
+ return Components.getSingleton(GridColumnTypeManager.class);
+ }
+
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ private final Map<String, GridColumnType> columnTypes = new HashMap<String, GridColumnType>();
+
+ /**
+ * Returns the types.
+ * @return the types
+ */
+ public Map<String, GridColumnType> getColumnTypes()
+ {
+ return columnTypes;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onClear()
+ {
+ columnTypes.clear();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void onRegister(Content node)
+ {
+ for (Iterator iter = ContentUtil.getAllChildren(node).iterator(); iter.hasNext();)
+ {
+ Content columnTypeNode = (Content) iter.next();
+
+ if (!NodeDataUtil.getBoolean(columnTypeNode, "enabled", true))
+ {
+ continue;
+ }
+
+ try
+ {
+ GridColumnType columnType = (GridColumnType) Content2BeanUtil.toBean(columnTypeNode);
+
+ columnTypes.put(columnTypeNode.getName(), columnType);
+ }
+ catch (Throwable e)
+ {
+ log.error("Error getting column type {}", columnTypeNode.getHandle(), e);
+ }
+ }
+ }
+
+}
Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/GridColumnTypeManager.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java 2010-06-18 07:28:36 UTC (rev 2669)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java 2010-06-18 09:57:29 UTC (rev 2670)
@@ -33,6 +33,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import net.sourceforge.openutils.mgnlcontrols.configuration.GridColumnTypeManager;
+
import org.apache.commons.lang.StringUtils;
@@ -79,6 +81,9 @@
protected void addToParameters(Map<String, Object> parameters)
{
super.addToParameters(parameters);
+
+ parameters.put("gridColumnTypes", GridColumnTypeManager.getInstance().getColumnTypes());
+
String value = getValue();
if (value != null)
{
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/lifecycle/ControlsModule.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/lifecycle/ControlsModule.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/lifecycle/ControlsModule.java 2010-06-18 09:57:29 UTC (rev 2670)
@@ -0,0 +1,56 @@
+/**
+ *
+ * Magnolia controls module (http://www.openmindlab.com/lab/products/controls.html)
+ * Copyright (C)2008 - 2010, 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.mgnlcontrols.lifecycle;
+
+import info.magnolia.module.ModuleLifecycle;
+import info.magnolia.module.ModuleLifecycleContext;
+import net.sourceforge.openutils.mgnlcontrols.configuration.GridColumnTypeManager;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author dschivo
+ * @version $Id$
+ */
+public class ControlsModule implements ModuleLifecycle
+{
+
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start(ModuleLifecycleContext moduleLifecycleContext)
+ {
+ log.info("Starting module controls");
+ moduleLifecycleContext.registerModuleObservingComponent("gridColumnTypes", GridColumnTypeManager.getInstance());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop(ModuleLifecycleContext moduleLifecycleContext)
+ {
+ log.info("Stopping module controls");
+ }
+
+}
Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/lifecycle/ControlsModule.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/openutils-mgnlcontrols/src/main/resources/META-INF/magnolia/controls.xml
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/META-INF/magnolia/controls.xml 2010-06-18 07:28:36 UTC (rev 2669)
+++ trunk/openutils-mgnlcontrols/src/main/resources/META-INF/magnolia/controls.xml 2010-06-18 09:57:29 UTC (rev 2670)
@@ -4,6 +4,7 @@
<name>controls</name>
<displayName>controls</displayName>
<description>openutils magnolia controls module</description>
+ <class>net.sourceforge.openutils.mgnlcontrols.lifecycle.ControlsModule</class>
<versionHandler>net.sourceforge.openutils.mgnlcontrols.setup.ControlsModuleVersionHandler</versionHandler>
<version>${project.version}</version>
<dependencies>
Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-06-18 07:28:36 UTC (rev 2669)
+++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-06-18 09:57:29 UTC (rev 2670)
@@ -10,9 +10,12 @@
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/CheckColumn.js"></script>
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/PipeComboBox.js"></script>
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/MediaField.js"></script>
- <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/FckEditorField.js"></script>
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/FileField.js"></script>
<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/ColorField.js"></script>
+ [#list gridColumnTypes?values as gct]
+ ${gct.headSnippet}
+ [/#list]
+
<script type="text/javascript">
// <![CDATA[
function gridMoveRow(grid, delta) {
@@ -163,10 +166,6 @@
renderer : function(v, p, record){
return v ? '<img border="0" alt="" src="${request.contextPath}/mediathumbnail/' + v + '" />' : v;
}
- [#elseif (colmap.type?? && colmap.type = 'fckedit')]
- editor: new Ed(new FckEditorField({
- contextPath: '${request.contextPath}'
- }))
[#elseif (colmap.type?? && colmap.type = 'file')]
editor: new Ed(new FileField({
})),
@@ -179,6 +178,8 @@
renderer : function(v, p, record){
return v ? '<em style="display: block; float: left; border: 1px solid #ACA899;"><span style="display: block; width: 10px; height: 10px; line-height: 10px; background-color: ' + v + ';"></span></em>' : '';
}
+ [#elseif (colmap.type?? && gridColumnTypes[colmap.type]??)]
+ ${gridColumnTypes[colmap.type].columnModelSnippet}
[#else]
editor: new Ed(new fm.TextField({
allowBlank: true
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.fckedit.xml
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.fckedit.xml (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.fckedit.xml 2010-06-18 09:57:29 UTC (rev 2670)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="fckedit" 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:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>78844466-b609-4854-be67-5ce80321ee38</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlcontrols.configuration.FckEditorGridColumnType</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</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:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-06-18T11:41:55.562+02:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2010-06-18T11:42:33.906+02:00</sv:value>
+ </sv:property>
+ </sv:node>
+</sv:node>
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.fckedit.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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.
|
|
From: <die...@us...> - 2010-06-21 08:23:26
|
Revision: 2694
http://openutils.svn.sourceforge.net/openutils/?rev=2694&view=rev
Author: diego_schivo
Date: 2010-06-21 08:23:17 +0000 (Mon, 21 Jun 2010)
Log Message:
-----------
CONTROLS-31 combo column type
Modified Paths:
--------------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java
trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java 2010-06-18 17:11:17 UTC (rev 2693)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java 2010-06-21 08:23:17 UTC (rev 2694)
@@ -33,9 +33,23 @@
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("unchecked")
public String drawSupportHtml(String propertyName, Map colmap)
{
- return StringUtils.EMPTY;
+ StringBuilder sb = new StringBuilder();
+ sb.append("<select id=\"combo-"
+ + propertyName
+ + "\" name=\"combo-"
+ + propertyName
+ + "\" style=\"display: none;\">");
+ Map optionMap = (Map) colmap.get("options");
+ for (Object optionValue : optionMap.values())
+ {
+ Map option = (Map) optionValue;
+ sb.append("<option value=\"" + option.get("value") + "\">" + option.get("label") + "</option>");
+ }
+ sb.append("</select>");
+ return new String(sb);
}
/**
Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-06-18 17:11:17 UTC (rev 2693)
+++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-06-21 08:23:17 UTC (rev 2694)
@@ -77,16 +77,11 @@
</div>
[#list configuration.columns?values as colmap]
- [#if (colmap.type?? && colmap.type = 'combo')]
- <select id="combo-${name}" name="combo-${name}" style="display: none;">
- [#list colmap.options?values as option]
- <option value="${option.value}">${option.label}</option>
- [/#list]
- </select>
+ [#if (colmap.type?? && gridColumnTypes[colmap.type]??)]
+ ${gridColumnTypes[colmap.type].drawSupportHtml(name, colmap)}
[/#if]
[/#list]
-
<script type="text/javascript">
// <![CDATA[
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <die...@us...> - 2010-06-21 10:59:23
|
Revision: 2700
http://openutils.svn.sourceforge.net/openutils/?rev=2700&view=rev
Author: diego_schivo
Date: 2010-06-21 10:59:17 +0000 (Mon, 21 Jun 2010)
Log Message:
-----------
CONTROLS-31 checkbox column type
Modified Paths:
--------------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/CheckboxGridColumnType.java
trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/CheckboxGridColumnType.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/CheckboxGridColumnType.java 2010-06-21 10:52:35 UTC (rev 2699)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/CheckboxGridColumnType.java 2010-06-21 10:59:17 UTC (rev 2700)
@@ -55,7 +55,7 @@
+ "',"
+ "width: 40"
+ "});\n"
- + "checkColumns.push(cc);"
+ + "plugins.push(cc);"
+ "return cc;\n"
+ "})()";
}
Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-06-21 10:52:35 UTC (rev 2699)
+++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-06-21 10:59:17 UTC (rev 2700)
@@ -108,7 +108,7 @@
// shorthand alias
var fm = Ext.form, Ed = Ext.grid.GridEditor;
- var checkColumns = [];
+ var plugins = [];
var colModel = new Ext.grid.ColumnModel([
[#list configuration.columns?values as colmap]
@@ -123,7 +123,7 @@
selModel: new Ext.grid.CellSelectionModel(),
autoSizeColumns: true,
enableColLock: false,
- plugins: checkColumns,
+ plugins: plugins,
clicksToEdit: 1,
renderTo: 'grid-${name}',
tbar: [{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2011-05-20 15:35:56
|
Revision: 3471
http://openutils.svn.sourceforge.net/openutils/?rev=3471&view=rev
Author: fgiust
Date: 2011-05-20 15:35:47 +0000 (Fri, 20 May 2011)
Log Message:
-----------
CONTROLS-36 New multi-language dialog tab
Added Paths:
-----------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nDialogTab.java
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nTabNewLocaleDialog.java
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.controls.i18nTab.xml
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.dialogs.i18nTabNewLocale.xml
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-jquery.js
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-mootools.js
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/jquery.min.js
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/mootools-1.2.4-core-yc.js
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nDialogTab.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nDialogTab.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nDialogTab.java 2011-05-20 15:35:47 UTC (rev 3471)
@@ -0,0 +1,360 @@
+/**
+ *
+ * Controls module for Magnolia CMS (http://www.openmindlab.com/lab/products/controls.html)
+ * Copyright(C) 2008-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.mgnlcontrols.dialog;
+
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.gui.dialog.DialogControlImpl;
+import info.magnolia.cms.gui.dialog.DialogTab;
+import info.magnolia.cms.i18n.I18nContentSupportFactory;
+import info.magnolia.cms.security.AccessDeniedException;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author dschivo
+ * @version $Id$
+ */
+public class I18nDialogTab extends DialogTab
+{
+
+ /**
+ * Used to make sure that the javascript files are loaded only once
+ */
+ private static final String ATTRIBUTE_MOOTOOLS_LOADED = "info.magnolia.cms.gui.dialog.mootools.loaded";
+
+ private static final String ATTRIBUTE_JQUERY_LOADED = "info.magnolia.cms.gui.dialog.jquery.loaded";
+
+ private static final String ATTRIBUTE_I18NTAB_LOADED = "info.magnolia.cms.gui.dialog.i18ntab.loaded";
+
+ private Map<String, String> mapLocales = new LinkedHashMap<String, String>();
+
+ /**
+ * Logger.
+ */
+ private static Logger log = LoggerFactory.getLogger(I18nDialogTab.class);
+
+ private Set<String> localesToRender;
+
+ private String localeSuffixSeparator;
+
+ private String visibleLocale;
+
+ private String newLocale = StringUtils.EMPTY;
+
+ private String jsFramework;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(HttpServletRequest request, HttpServletResponse response, Content storageNode, Content configNode)
+ throws RepositoryException
+ {
+ super.init(request, response, storageNode, configNode);
+ localeSuffixSeparator = getConfigValue("localeSuffixSeparator", "_");
+ newLocale = request.getParameter("mgnlI18nLocale");
+
+ setConfiguredLanguages(configNode);
+
+ if (newLocale != null)
+ {
+ localesToRender = Collections.singleton(newLocale);
+ visibleLocale = newLocale;
+ }
+ else
+ {
+ visibleLocale = getConfigValue("defaultLocale", mapLocales.keySet().iterator().next());
+ localesToRender = new HashSet<String>();
+ Content node = getStorageNode();
+ for (String locale : mapLocales.keySet())
+ {
+ if (locale.equals(visibleLocale)
+ || (node != null && !node.getNodeDataCollection('*' + localeSuffixSeparator + locale).isEmpty()))
+ {
+ localesToRender.add(locale);
+ }
+ }
+ }
+
+ jsFramework = getConfigValue("jsFramework", "jquery");
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void drawHtmlPreSubs(Writer out) throws IOException
+ {
+
+ if (newLocale != null)
+ {
+ return;
+ }
+
+ Locale fallbackLocale = I18nContentSupportFactory.getI18nSupport().getFallbackLocale();
+
+ String fallbackLocaleCode = fallbackLocale.toString();
+
+ String jsFrameworkAttributeName;
+ String jsFrameworkFilename;
+ if ("jquery".equals(jsFramework))
+ {
+ jsFrameworkAttributeName = ATTRIBUTE_JQUERY_LOADED;
+ jsFrameworkFilename = "jquery.min.js";
+ }
+ else
+ {
+ jsFrameworkAttributeName = ATTRIBUTE_MOOTOOLS_LOADED;
+ jsFrameworkFilename = "mootools-1.2.4-core-yc.js";
+ }
+
+ // load the script once: if there are multiple instances
+ if (getRequest().getAttribute(jsFrameworkAttributeName) == null)
+ {
+ out.write("<script type=\"text/javascript\" src=\""
+ + this.getRequest().getContextPath()
+ + "/.resources/controls/js/"
+ + jsFrameworkFilename
+ + "\"></script>");
+ getRequest().setAttribute(jsFrameworkAttributeName, "true");
+ }
+
+ if (getRequest().getAttribute(ATTRIBUTE_I18NTAB_LOADED) == null)
+ {
+ out.write("<script type=\"text/javascript\" src=\""
+ + getRequest().getContextPath()
+ + "/.resources/controls/js/i18ntab-"
+ + jsFramework
+ + ".js\"></script>");
+
+ // array with all locale names
+ out.write("<script type=\"text/javascript\">");
+ out.write("var i18nTabLocales = [");
+ boolean firstElement = true;
+ for (String locale : mapLocales.keySet())
+ {
+ if (!firstElement)
+ {
+ out.write(",");
+ }
+ out.write("'" + locale + "'");
+ firstElement = false;
+ }
+ out.write("];");
+ out.write("</script>");
+ getRequest().setAttribute(ATTRIBUTE_I18NTAB_LOADED, "true");
+ }
+
+ String id = getId();
+
+ out.write("<script type=\"text/javascript\">");
+ String options = "{ctx: '"
+ + getRequest().getContextPath()
+ + "', path: '"
+ + getParent().getConfigValue("path")
+ + "', nodeCollection: '"
+ + getParent().getConfigValue("nodeCollection")
+ + "', node: '"
+ + getParent().getConfigValue("node")
+ + "', dialog: '"
+ + getParent().getName()
+ + "', tab: '"
+ + getName()
+ + "'}";
+ if ("jquery".equals(jsFramework))
+ {
+ out.write("$(document).ready(function() { new $.I18nTab('" + id + "', " + options + "); });");
+ }
+ else
+ {
+ out.write("window.addEvent('domready', function() { new I18nTab('" + id + "', " + options + "); });");
+ }
+ out.write("</script>");
+
+ super.drawHtmlPreSubs(out);
+ out.write("<tr>");
+ out.write("<td class=\"mgnlDialogBoxLabel\">Locale</td>");
+ out.write("<td class=\"mgnlDialogBoxInput\">");
+ out.write("<select id=\"" + id + "_select\" class=\"mgnlDialogControlSelect\" style=\"width: 50%\">");
+ for (String locale : mapLocales.keySet())
+ {
+ addLocaleOption(out, locale, fallbackLocaleCode);
+ }
+ out.write("</select>");
+ out.write("</td>");
+ out.write("</tr>");
+ out.write("</table>");
+ }
+
+ /**
+ * @param out
+ * @param locale
+ * @param fallbackLocaleCode
+ * @throws IOException
+ */
+ private void addLocaleOption(Writer out, String locale, String fallbackLocaleCode) throws IOException
+ {
+ out.write("<option value=\"");
+ out.write(locale);
+
+ out.write("\"");
+
+ if (localesToRender.contains(locale) || (fallbackLocaleCode.equals(locale) && localesToRender.contains("")))
+ {
+ out.write(" style=\"background-color: #9DB517 !important; font-weight: bold;\"");
+ }
+
+ if (locale.equals(visibleLocale))
+ {
+ out.write(" selected=\"selected\"");
+ }
+
+ out.write(">");
+ out.write(mapLocales.get(locale));
+ if (StringUtils.isNotBlank(locale))
+ {
+ out.write(" (" + locale + ")");
+ }
+
+ if (StringUtils.equals(locale, fallbackLocaleCode))
+ {
+ out.write(" default");
+ }
+
+ out.write("</option>");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void drawSubs(Writer out) throws IOException
+ {
+ String id = getId();
+ List<String> originalSubNames = getSubNames();
+ for (String locale : mapLocales.keySet())
+ {
+ if (localesToRender.contains(locale))
+ {
+ changeSubNames(originalSubNames, locale);
+ for (Object o : getSubs())
+ {
+ ((DialogControlImpl) o).setValue(null);
+ }
+ out.write("<table id=\""
+ + id
+ + "_table_"
+ + locale
+ + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"table-layout:fixed;"
+ + (locale.equals(visibleLocale) ? "" : " display: none;")
+ + "\">");
+ out.write("<col width=\"200\" /><col />");
+ super.drawSubs(out);
+ out.write("</table>");
+ }
+ }
+ changeSubNames(originalSubNames, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void drawHtmlPostSubs(Writer out) throws IOException
+ {
+ if (newLocale != null)
+ {
+ return;
+ }
+ out.write("<div id=\"" + getId() + "_append\"></div>");
+ out.write("</td></tr></table></div>");
+ }
+
+ private List<String> getSubNames()
+ {
+ List<String> names = new ArrayList<String>(getSubs().size());
+ for (Object o : getSubs())
+ {
+ names.add(((DialogControlImpl) o).getName());
+ }
+ return names;
+ }
+
+ private void changeSubNames(List<String> names, String suffix)
+ {
+ int i = 0;
+ for (Object o : getSubs())
+ {
+ DialogControlImpl subControl = (DialogControlImpl) o;
+ subControl.setName(names.get(i)
+ + (StringUtils.isBlank(suffix) ? StringUtils.EMPTY : localeSuffixSeparator + suffix));
+ i++;
+ }
+ }
+
+ /**
+ * @param configNode
+ * @throws PathNotFoundException
+ * @throws RepositoryException
+ * @throws AccessDeniedException
+ */
+ private void setConfiguredLanguages(Content configNode) throws PathNotFoundException, RepositoryException,
+ AccessDeniedException
+ {
+
+ Locale fallbackLocale = I18nContentSupportFactory.getI18nSupport().getFallbackLocale();
+ Collection<Locale> locales = I18nContentSupportFactory.getI18nSupport().getLocales();
+ for (Locale locale : locales)
+ {
+ String code = locale.toString();
+
+ if (locale.equals(fallbackLocale))
+ {
+ mapLocales.put("", locale.getDisplayName());
+ }
+ else
+ {
+ mapLocales.put(code, locale.getDisplayName());
+ }
+ }
+
+ }
+
+}
Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nDialogTab.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nTabNewLocaleDialog.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nTabNewLocaleDialog.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nTabNewLocaleDialog.java 2011-05-20 15:35:47 UTC (rev 3471)
@@ -0,0 +1,100 @@
+/**
+ *
+ * Controls module for Magnolia CMS (http://www.openmindlab.com/lab/products/controls.html)
+ * Copyright(C) 2008-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.mgnlcontrols.dialog;
+
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.gui.dialog.Dialog;
+import info.magnolia.cms.gui.dialog.DialogControlImpl;
+import info.magnolia.module.admininterface.DialogHandlerManager;
+import info.magnolia.module.admininterface.dialogs.ConfiguredDialog;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+
+import javax.jcr.RepositoryException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author dschivo
+ * @version $Id$
+ */
+public class I18nTabNewLocaleDialog extends ConfiguredDialog
+{
+
+ private static Logger log = LoggerFactory.getLogger(I18nTabNewLocaleDialog.class);
+
+ private String dialogName = StringUtils.EMPTY;
+
+ private String tabName = StringUtils.EMPTY;
+
+ private String tabId = StringUtils.EMPTY;
+
+ public I18nTabNewLocaleDialog(
+ String name,
+ HttpServletRequest request,
+ HttpServletResponse response,
+ Content configNode)
+ {
+ super(name, request, response, configNode);
+ dialogName = params.getParameter("mgnlI18nDialog");
+ tabName = params.getParameter("mgnlI18nTab");
+ tabId = params.getParameter("mgnlI18nId");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Dialog createDialog(Content configNode, Content storageNode) throws RepositoryException
+ {
+ final Content dialogConfigNode = DialogHandlerManager.getInstance().getDialogConfigNode(dialogName);
+ return super.createDialog(dialogConfigNode, storageNode);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void renderHtml(String view) throws IOException
+ {
+ PrintWriter out = this.getResponse().getWriter();
+ if (VIEW_SHOW_DIALOG.equals(view))
+ {
+ try
+ {
+ DialogControlImpl tab = getDialog().getSub(tabName);
+ Field idField = DialogControlImpl.class.getDeclaredField("id");
+ idField.setAccessible(true);
+ idField.set(tab, tabId);
+ tab.drawHtml(out);
+ }
+ catch (Exception e)
+ {
+ log.error("Exception caught", e);
+ }
+ }
+ }
+}
Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/I18nTabNewLocaleDialog.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.controls.i18nTab.xml
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.controls.i18nTab.xml (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.controls.i18nTab.xml 2011-05-20 15:35:47 UTC (rev 3471)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="i18nTab" 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:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>aab14afe-a86d-40ac-b632-a567970d750e</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlcontrols.dialog.I18nDialogTab</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</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:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-02-04T16:42:33.187+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2010-02-23T13:48:35.705+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+</sv:node>
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.controls.i18nTab.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.dialogs.i18nTabNewLocale.xml
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.dialogs.i18nTabNewLocale.xml (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.dialogs.i18nTabNewLocale.xml 2011-05-20 15:35:47 UTC (rev 3471)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="i18nTabNewLocale" 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:content</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>9cfb1d4a-c358-413b-939a-fc4550892fc1</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlcontrols.dialog.I18nTabNewLocaleDialog</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</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:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-02-05T18:07:54.234+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2010-02-05T18:10:20.656+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+</sv:node>
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.dialogs.i18nTabNewLocale.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-jquery.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-jquery.js (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-jquery.js 2011-05-20 15:35:47 UTC (rev 3471)
@@ -0,0 +1,51 @@
+$.I18nTab = function(id, options) {
+ $('#' + id + '_select').change(handleChange);
+
+ function handleChange(e){
+ var locale = $(e.target).val();
+ jQuery.each(i18nTabLocales, function(){
+ var table = $('#' + id + '_table_' + this);
+ if (this == locale){
+ if (table.length) table.css('display', '');
+ else loadTable(locale);
+ } else if (table.length) table.css('display', 'none');
+ });
+ }
+
+ function loadTable(locale){
+ $.ajax({
+ url: options.ctx + '/.magnolia/dialogs/i18nTabNewLocale.html',
+ data: {
+ mgnlPath: options.path,
+ mgnlNodeCollection: options.nodeCollection,
+ mgnlNode: options.node,
+ mgnlI18nDialog: options.dialog,
+ mgnlI18nTab: options.tab,
+ mgnlI18nId: id,
+ mgnlI18nLocale: locale
+ },
+ success: function(r) {
+ var scripts = [];
+ r = fixFckEditor(r).replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
+ scripts.push(arguments[1]);
+ return '';
+ });
+ var div = document.createElement('div');
+ div.innerHTML = r;
+ $('#' + id + '_append').append(div.firstChild);
+ jQuery.each(scripts, function() { jQuery.globalEval(this) });
+ }
+ });
+ }
+
+ function fixFckEditor(text){
+ return text.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
+ if (arguments[1].indexOf('fckInstance.Create();') >= 0){
+ var hiddenId = 'fck_' + Math.floor(Math.random() * 1000001);
+ return '<input id="' + hiddenId + '" type="hidden" /><script>fckInstance.ToolbarSet = "MagnoliaStandard"; fckInstance._InsertHtmlBefore(fckInstance.CreateHtml(), document.getElementById("' + hiddenId + '"));</script>';
+ } else {
+ return '<script>' + arguments[1] + '</script>';
+ }
+ });
+ }
+};
\ No newline at end of file
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-jquery.js
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-mootools.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-mootools.js (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-mootools.js 2011-05-20 15:35:47 UTC (rev 3471)
@@ -0,0 +1,76 @@
+var I18nTab = new Class({
+
+ options: {
+ // ctx: undefined,
+ // path: undefined,
+ // nodeCollection: undefined,
+ // node: undefined,
+ // dialog: undefined,
+ // tab: undefined,
+ },
+
+ Implements: Options,
+
+ initialize: function(id, options){
+ this.id = id;
+ this.setOptions(options);
+ document.id(id + '_select').addEvent('change', this.handleChange.bindWithEvent(this));
+ },
+
+ handleChange: function(e){
+ var locale = document.id(e.target).get('value');
+ i18nTabLocales.each(function(item){
+ var table = document.id(this.id + '_table_' + item);
+ if (item == locale){
+ if (table) table.setStyle('display', '');
+ else this.loadTable(locale);
+ } else if (table) table.setStyle('display', 'none');
+ }, this);
+ },
+
+ loadTable: function(locale){
+ var scripts;
+ new I18nTab.Request({
+ method: 'get',
+ url: this.options.ctx + '/.magnolia/dialogs/i18nTabNewLocale.html',
+ data: {
+ mgnlPath: this.options.path,
+ mgnlNodeCollection: this.options.nodeCollection,
+ mgnlNode: this.options.node,
+ mgnlI18nDialog: this.options.dialog,
+ mgnlI18nTab: this.options.tab,
+ mgnlI18nId: this.id,
+ mgnlI18nLocale: locale
+ },
+ evalScripts: function(s) {
+ scripts = s;
+ },
+ onSuccess: function(r) {
+ new Element('div', {html: r}).getFirst().inject(this.id + '_append');
+ $exec(scripts);
+ }.bind(this)
+ }).send();
+ }
+
+});
+
+I18nTab.Request = new Class({
+
+ Extends: Request,
+
+ success: function(text, xml){
+ this.parent(this.fixFckEditor(text), xml);
+ },
+
+ fixFckEditor: function(text){
+ return text.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
+ if (arguments[1].contains('fckInstance.Create();')){
+ var hiddenId = 'fck_' + $random(0, 1000000);
+ return '<input id="' + hiddenId + '" type="hidden" /><script>fckInstance.ToolbarSet = "MagnoliaStandard"; fckInstance._InsertHtmlBefore(fckInstance.CreateHtml(), document.getElementById("' + hiddenId + '"));</script>';
+ } else {
+ return '<script>' + arguments[1] + '</script>';
+ }
+ });
+ }
+
+});
Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/i18ntab-mootools.js
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/jquery.min.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/jquery.min.js (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/jquery.min.js 2011-05-20 15:35:47 UTC (rev 3471)
@@ -0,0 +1,19 @@
+/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){brea...
[truncated message content] |
|
From: <die...@us...> - 2011-05-27 06:28:20
|
Revision: 3496
http://openutils.svn.sourceforge.net/openutils/?rev=3496&view=rev
Author: diego_schivo
Date: 2011-05-27 06:28:14 +0000 (Fri, 27 May 2011)
Log Message:
-----------
CONTROLS-37 Handle enterMode (p/br) setting for FCKEditor column on grid control
Modified Paths:
--------------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java 2011-05-27 06:25:04 UTC (rev 3495)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/FckEditorGridColumnType.java 2011-05-27 06:28:14 UTC (rev 3496)
@@ -51,6 +51,13 @@
protected void addColumnData(Map<String, String> column, String propertyName, int colIndex, Map colMap,
Messages msgs)
{
- column.put("editor", "new Ed(new FckEditorField({contextPath: '" + MgnlContext.getContextPath() + "'}))");
+ StringBuilder sb = new StringBuilder();
+ sb.append("new Ed(new FckEditorField({contextPath: '" + MgnlContext.getContextPath() + "'");
+ if (colMap.get("enterMode") != null)
+ {
+ sb.append(", enterMode: '" + String.valueOf(colMap.get("enterMode")) + "'");
+ }
+ sb.append("}))");
+ column.put("editor", sb.toString());
}
}
Modified: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html 2011-05-27 06:25:04 UTC (rev 3495)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html 2011-05-27 06:28:14 UTC (rev 3496)
@@ -11,6 +11,12 @@
</head>
<body style="padding:0;margin:0">
<script type="text/javascript">
+var urlParams={};
+var t=document.location.search.substr(1).split('&');
+for (var i=0;i<t.length;i++) {
+ var s=t[i].split('=');
+ urlParams[decodeURIComponent(s[0])]=decodeURIComponent(s[1]);
+}
if( window.MgnlFCKConfigs == null)
window.MgnlFCKConfigs = new Object();
MgnlFCKConfigs.grid = new Object();
@@ -22,7 +28,7 @@
MgnlFCKConfigs.grid.colors = '';
MgnlFCKConfigs.grid.styles = '';
MgnlFCKConfigs.grid.templates = '';
-MgnlFCKConfigs.grid.enterMode = 'p';
+MgnlFCKConfigs.grid.enterMode = urlParams['enterMode'] || 'p';
MgnlFCKConfigs.grid.shiftEnterMode = 'br';
MgnlFCKConfigs.grid.lists = true;
MgnlFCKConfigs.grid.alignment = false;
Modified: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js 2011-05-27 06:25:04 UTC (rev 3495)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js 2011-05-27 06:28:14 UTC (rev 3496)
@@ -4,6 +4,8 @@
contextPath: '',
+ enterMode: '',
+
getContextPath: function() {
return this.contextPath;
},
@@ -15,7 +17,7 @@
window.setFckEditorValue = function(value) {
this.setValue(value);
}.createDelegate(this);
- mgnlOpenWindow('/.resources/controls/grid-fckeditor.html', 880, 300);
+ mgnlOpenWindow('/.resources/controls/grid-fckeditor.html?enterMode=' + this.enterMode, 880, 300);
}
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <die...@us...> - 2011-10-01 06:10:11
|
Revision: 3671
http://openutils.svn.sourceforge.net/openutils/?rev=3671&view=rev
Author: diego_schivo
Date: 2011-10-01 06:10:03 +0000 (Sat, 01 Oct 2011)
Log Message:
-----------
CONTROLS-41 Grid: add editcode column type
Added Paths:
-----------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/EditCodeGridColumnType.java
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.editcode.xml
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-editcode.html
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/EditCodeField.js
Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/EditCodeGridColumnType.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/EditCodeGridColumnType.java (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/EditCodeGridColumnType.java 2011-10-01 06:10:03 UTC (rev 3671)
@@ -0,0 +1,36 @@
+package net.sourceforge.openutils.mgnlcontrols.configuration;
+
+import info.magnolia.cms.i18n.Messages;
+import info.magnolia.context.MgnlContext;
+
+import java.util.Map;
+
+
+/**
+ * @author diego
+ * @version $Id: $
+ */
+public class EditCodeGridColumnType extends AbstractGridColumnType
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getHeadSnippet()
+ {
+ return "<script type=\"text/javascript\" src=\""
+ + MgnlContext.getContextPath()
+ + "/.resources/controls/js/EditCodeField.js\"></script>";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void addColumnData(Map<String, String> column, String propertyName, int colIndex, Map colMap,
+ Messages msgs)
+ {
+ column.put("editor", "new Ed(new EditCodeField())");
+ }
+}
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.editcode.xml
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.editcode.xml (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-bootstrap/controls/config.modules.controls.gridColumnTypes.editcode.xml 2011-10-01 06:10:03 UTC (rev 3671)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="editcode" 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>b8f0adfd-bc15-41bb-9203-d9ce78d2425c</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlcontrols.configuration.EditCodeGridColumnType</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</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:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-06-18T11:41:55.562+02:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-10-01T06:50:31.114+02:00</sv:value>
+ </sv:property>
+ </sv:node>
+</sv:node>
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-editcode.html
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-editcode.html (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-editcode.html 2011-10-01 06:10:03 UTC (rev 3671)
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>Edit Code</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <script type="text/javascript" src="../../.magnolia/pages/javascript.js"></script>
+ <script type="text/javascript" src="../../.resources/admin-js/dialogs/dialogs.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../.resources/admin-css/admin-all.css" />
+
+ <script type="text/javascript" src="../../.resources/js/codemirror/codemirror-min.js"></script>
+ <style type="text/css">
+ .CodeMirror-line-numbers {
+ background-color: #eee;
+ text-align: right;
+ font-family: monospace;
+ font-size: 10pt;
+ color: #aaa;
+ line-height: 16px;
+ padding: .4em;
+ width: 2.2em;
+ }
+ </style>
+ <script type="text/javascript">
+var editor;
+MgnlDHTMLUtil.addOnLoad(function(){
+ document.getElementById("grid").value = window.opener.getEditCodeValue().replace(/&/g, "&").replace(/"/g, "\"").replace(/</g, "<").replace(/>/g, ">").replace(/\\(.)/g, function(all, c) {
+ switch(c){
+ case "\\":
+ return "\\";
+ case "t":
+ return "\t";
+ case "n":
+ return "\n";
+ case "r":
+ return "\r";
+ default:
+ return all;
+ }
+ });
+ editor = CodeMirror.fromTextArea("grid", {
+ path: "../../.resources/js/codemirror/",
+ textWrapping: false,
+ height: "400px",
+ basefiles: ["codemirror-base.min.js"],
+ parserfile: ["allinone.js"],
+ stylesheet: ["../../.resources/js/codemirror/css/jscolors.css","../../.resources/js/codemirror/css/csscolors.css","../../.resources/js/codemirror/css/xmlcolors.css","../../.resources/js/codemirror/css/freemarkercolors.css","../../.resources/js/codemirror/css/groovycolors.css"],
+ lineNumbers:true,
+ initCallback:function(e){
+ e.setParser('HTMLMixedParser');
+ e.focus();
+ }
+ });
+});
+function getValue() {
+ return editor.getCode().replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">").replace(/\\/g, "\\\\").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
+}
+ </script>
+ </head>
+ <body style="padding:0;margin:0">
+ <h1 style="background-color:#F0F2E6; color:#396101; font-size:11pt; border-bottom:1px solid #999;margin:0;padding:3px 10px">Edit Code</h1>
+ <div style="margin: 10px;">
+ <div class="editorWrapper" style="border: 1px solid #999; padding: 3px;">
+ <textarea class="mgnlDialogControlEdit" cols="30" rows="20" id="grid" name="grid" style="display: none;"></textarea>
+ </div>
+ </div>
+ <div class="mgnlDialogTabsetSaveBar">
+ <span class="mgnlControlButton" onclick="window.opener.setEditCodeValue(getValue()); mgnlShiftPushButtonClick(this); window.opener.focus(); window.close();" onmouseout="mgnlShiftPushButtonOut(this);"
+ onmousedown="mgnlShiftPushButtonDown(this);">
+ OK
+ </span>
+ </div>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/EditCodeField.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/EditCodeField.js (rev 0)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/EditCodeField.js 2011-10-01 06:10:03 UTC (rev 3671)
@@ -0,0 +1,14 @@
+var EditCodeField = Ext.extend(Ext.form.TriggerField, {
+
+ triggerClass: 'x-form-editcode-trigger',
+
+ onTriggerClick: function() {
+ if (this.disabled) return;
+ window.getEditCodeValue = this.getValue.createDelegate(this);
+ window.setEditCodeValue = function(value) {
+ this.setValue(value);
+ }.createDelegate(this);
+ mgnlOpenWindow('/.resources/controls/grid-editcode.html', 640, 480);
+ }
+
+});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|