From 205eedab7352ee9e3a292ed4b5396eed0a14577f Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 23 Sep 2014 08:29:04 +0000 Subject: [PATCH] Fixes for the OpenCCM Xinha plugin (the links part did not work, probably because since the last Xinha update). Also fixed the parts of the item search popup. Clicking on an item now closes the the window when using it Editor (did not work since a very long time). Also the FlatBrowsePane introducted some time ago did not work when the ItemSearchPopup was used from the Xinha editor. git-svn-id: https://svn.libreccm.org/ccm/trunk@2871 8810af33-2d31-482b-a856-94f89814c4df --- .../cms/ui/ItemSearchFlatBrowsePane.java | 94 ++-- .../cms/ui/ItemSearchFolderBrowser.java | 104 ++--- .../com/arsdigita/cms/ui/ItemSearchPopup.java | 52 ++- ccm-cms/web/assets/xinha/CCMcmsXinhaConfig.js | 2 +- .../assets/xinha/plugins/OpenCCM/OpenCCM.js | 12 +- .../xinha/plugins/OpenCCM/images/images.js | 2 - .../xinha/plugins/OpenCCM/links/links.js | 365 ++++++++------- .../web/assets/xinha/CCMcmsXinhaConfig.js | 52 --- .../assets/xinha/plugins/OpenCCM/OpenCCM.js | 123 ----- .../xinha/plugins/OpenCCM/images/images.html | 179 ------- .../xinha/plugins/OpenCCM/images/images.js | 441 ------------------ .../assets/xinha/plugins/OpenCCM/lang/de.js | 21 - .../assets/xinha/plugins/OpenCCM/lang/en.js | 21 - .../xinha/plugins/OpenCCM/links/links.html | 155 ------ .../xinha/plugins/OpenCCM/links/links.js | 238 ---------- .../foundry/lib/template-tags/navigation.xsl | 18 +- 16 files changed, 337 insertions(+), 1542 deletions(-) delete mode 100644 ccm-core/web/assets/xinha/CCMcmsXinhaConfig.js delete mode 100644 ccm-core/web/assets/xinha/plugins/OpenCCM/OpenCCM.js delete mode 100644 ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.html delete mode 100644 ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.js delete mode 100644 ccm-core/web/assets/xinha/plugins/OpenCCM/lang/de.js delete mode 100644 ccm-core/web/assets/xinha/plugins/OpenCCM/lang/en.js delete mode 100644 ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.html delete mode 100644 ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.js diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java index 012f8ac49..130103ea5 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java @@ -15,7 +15,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - package com.arsdigita.cms.ui; import com.arsdigita.bebop.BoxPanel; @@ -100,7 +99,6 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { // GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit")); // boxPanel.add(submit); // mainPanel.add(boxPanel); - //mainPanel.add(new FilterForm()); mainPanel.setLeft(new FilterForm()); @@ -139,7 +137,6 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { // state.setValue(queryParam, data.getParameter(QUERY_PARAM).getValue()); // } // } - // public void process(final FormSectionEvent fse) throws FormProcessException { // final FormData data = fse.getFormData(); // final PageState state = fse.getPageState(); @@ -147,11 +144,10 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { // state.setValue(queryParam, data.get(QUERY_PARAM)); // state.setValue(new StringParameter(ItemSearchPopup.QUERY), data.get(QUERY_PARAM)); // } - public void addQueryField(final String queryField) { queryFields.addQueryField(queryField); } - + void resetQueryFields() { queryFields.reset(); } @@ -170,15 +166,15 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { final TableColumnModel columnModel = getColumnModel(); columnModel.add(new TableColumn(0, GlobalizationUtil.globalize( - "cms.ui.item_search.flat.title").localize(), + "cms.ui.item_search.flat.title").localize(), TABLE_COL_TITLE)); columnModel.add(new TableColumn(1, GlobalizationUtil.globalize( - "cms.ui.item_search.flat.place").localize(), + "cms.ui.item_search.flat.place").localize(), TABLE_COL_PLACE)); columnModel.add(new TableColumn(2, GlobalizationUtil.globalize( - "cms.ui.item_search.flat.type").localize(), + "cms.ui.item_search.flat.type").localize(), TABLE_COL_TYPE)); setModelBuilder(new ResultsTableModelBuilder()); @@ -202,7 +198,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { } ((DataCollection) collection.get(state)).setRange(paginator.getFirst(state), paginator. - getLast(state) + 1); + getLast(state) + 1); return new ResultsTableModel(table, state, (DataCollection) collection.get(state)); } @@ -213,7 +209,6 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { } //((DataCollection)collection.get(state)).setRange(paginator.getFirst(state), paginator.getLast(state) + 1); - return (int) ((DataCollection) collection.get(state)).size(); } @@ -224,7 +219,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { private void query(final PageState state) { final Session session = SessionManager.getSession(); final BigDecimal typeId = (BigDecimal) state.getValue(new BigDecimalParameter( - ItemSearch.SINGLE_TYPE_PARAM)); + ItemSearch.SINGLE_TYPE_PARAM)); if (typeId == null) { collection.set(state, session.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE)); } else { @@ -237,12 +232,12 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { final String query = (String) state.getValue(queryParam); if ((query != null) && !query.isEmpty()) { final StringBuffer buffer = new StringBuffer(String.format( - "((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))", - ContentItem.NAME, query, - ContentPage.TITLE, query)); + "((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))", + ContentItem.NAME, query, + ContentPage.TITLE, query)); for (String field : queryFields.getQueryFields()) { buffer.append(String. - format(" or (lower(%s) like lower('%%%s%%'))", field, query)); + format(" or (lower(%s) like lower('%%%s%%'))", field, query)); } buffer.append(')'); @@ -282,7 +277,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { if ((collection != null) && collection.next()) { currentItem = (ContentItem) DomainObjectFactory.newInstance(collection. - getDataObject()); + getDataObject()); ret = true; } else { ret = false; @@ -355,20 +350,42 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM)); final String searchWidget = (String) state.getValue(new StringParameter( - SEARCHWIDGET_PARAM)); + SEARCHWIDGET_PARAM)); final ContentPage page = new ContentPage((BigDecimal) key); - link.setOnClick(String.format( - "window.opener.document.%s.value=\"%s\";" - + "window.opener.document.%s.value=\"%s\";" - + "self.close();" - + "return false;", - widget, - key.toString(), - searchWidget, - page.getTitle().replace("\"", "\\\""))); + final boolean useURL = "true".equals(state.getValue(new StringParameter( + ItemSearchPopup.URL_PARAM))); + final String targetValue; + if (useURL) { + targetValue = ItemSearchPopup.getItemURL(state.getRequest(), page.getOID()); + } else { + targetValue = key.toString(); + } + + final StringBuffer buffer = new StringBuffer(30); + buffer.append(String.format("window.opener.document.%s.value=\"%s\"; ", widget, + targetValue)); + if (searchWidget != null) { + buffer.append(String.format("window.opener.document.%s.value=\"%s\"; ", + searchWidget, + page.getTitle().replace("\"", "\\\""))); + } + + buffer.append("self.close(); return false;"); + + link.setOnClick(buffer.toString()); + +// link.setOnClick(String.format( +// "window.opener.document.%s.value=\"%s\";" +// + "window.opener.document.%s.value=\"%s\";" +// + "self.close();" +// + "return false;", +// widget, +// key.toString(), +// searchWidget, +// page.getTitle().replace("\"", "\\\""))); return link; } @@ -377,14 +394,13 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { // protected Submit getSubmit() { // return submit; // } - private class FilterForm extends Form implements FormInitListener, FormProcessListener { private final Submit submit; - + public FilterForm() { super("ItemSearchFlatBrowsePane"); - + add(new Label(GlobalizationUtil.globalize("cms.ui.item_search.flat.filter"))); final TextField filter = new TextField(new StringParameter(QUERY_PARAM)); add(filter); @@ -392,7 +408,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { submit = new Submit(FILTER_SUBMIT, GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit")); add(submit); - + addInitListener(this); addProcessListener(this); } @@ -405,7 +421,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { if ((query == null) || query.isEmpty()) { data.setParameter(QUERY_PARAM, new ParameterData(queryParam, state.getValue(new StringParameter( - ItemSearchPopup.QUERY)))); + ItemSearchPopup.QUERY)))); state.setValue(queryParam, data.getParameter(QUERY_PARAM).getValue()); } } @@ -419,30 +435,32 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer { } } - + private class QueryFieldsRequestLocal extends RequestLocal { - + private List queryFields = new ArrayList(); - + @Override protected Object initialValue(final PageState state) { return new ArrayList(); } - + public List getQueryFields() { return queryFields; } - + public void setQueryFields(final List queryFields) { this.queryFields = queryFields; } - + public void addQueryField(final String queryField) { queryFields.add(queryField); } - + public void reset() { queryFields = new ArrayList(); } + } + } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFolderBrowser.java b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFolderBrowser.java index be8c0542c..a4a292b95 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFolderBrowser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFolderBrowser.java @@ -59,18 +59,16 @@ import com.arsdigita.util.Assert; import java.math.BigDecimal; /** - * Browse folders and items. If the user clicks on a folder, the folder - * selection model is updated. If the user clicks on any other item, an - * separate item selection model is updated. + * Browse folders and items. If the user clicks on a folder, the folder selection model is updated. + * If the user clicks on any other item, an separate item selection model is updated. * * @author David Lutterkort * @version $Revision: #9 $ $DateTime: 2004/08/17 23:15:09 $ */ public class ItemSearchFolderBrowser extends Table { - private static final org.apache.log4j.Logger s_log = - org.apache.log4j.Logger.getLogger( - ItemSearchFolderBrowser.class); + private static final org.apache.log4j.Logger s_log = org.apache.log4j.Logger.getLogger( + ItemSearchFolderBrowser.class); private static GlobalizedMessage[] s_headers = { globalize("cms.ui.folder.name"), globalize("cms.ui.folder.title"), @@ -89,14 +87,14 @@ public class ItemSearchFolderBrowser extends Table { setModelBuilder(builder); m_paginator = new Paginator(builder, ContentSection.getConfig(). - getFolderBrowseListSize()); + getFolderBrowseListSize()); m_currentFolder = currentFolder; setClassAttr("dataTable"); getHeader().setDefaultRenderer( - new com.arsdigita.cms.ui.util.DefaultTableCellRenderer()); + new com.arsdigita.cms.ui.util.DefaultTableCellRenderer()); m_nameColumn = getColumn(0); m_nameColumn.setCellRenderer(new NameCellRenderer()); @@ -118,6 +116,7 @@ public class ItemSearchFolderBrowser extends Table { p.addComponentStateParam(this, m_currentFolder.getStateParameter()); p.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { // MP: This action listener should only be called when the // folder browser is visible. @@ -142,9 +141,10 @@ public class ItemSearchFolderBrowser extends Table { } private class FolderTableModelBuilder - extends AbstractTableModelBuilder implements PaginationModelBuilder { + extends AbstractTableModelBuilder implements PaginationModelBuilder { private RequestLocal m_size = new RequestLocal() { + @Override protected Object initialValue(PageState state) { Folder.ItemCollection itemColl = getItemCollection(state); @@ -157,6 +157,7 @@ public class ItemSearchFolderBrowser extends Table { }; private RequestLocal m_itemColl = new RequestLocal() { + @Override protected Object initialValue(PageState state) { Folder.ItemCollection itemColl = getItemCollection(state); @@ -172,7 +173,7 @@ public class ItemSearchFolderBrowser extends Table { public TableModel makeModel(Table t, PageState s) { FolderSelectionModel sel = ((ItemSearchFolderBrowser) t). - getFolderSelectionModel(); + getFolderSelectionModel(); Folder f = getCurrentFolder(s); if (s_log.isDebugEnabled()) { @@ -180,7 +181,7 @@ public class ItemSearchFolderBrowser extends Table { s_log.debug("Selected folder is null"); } else { s_log.debug("Selected folder: " + f.getLabel() + " " + f. - getOID().toString()); + getOID().toString()); } } @@ -189,7 +190,7 @@ public class ItemSearchFolderBrowser extends Table { } else { t.getRowSelectionModel().clearSelection(s); return new FolderTableModel((Folder.ItemCollection) m_itemColl. - get(s)); + get(s)); } } @@ -201,9 +202,8 @@ public class ItemSearchFolderBrowser extends Table { return null; } - BigDecimal singleTypeID = - (BigDecimal) state.getValue(new BigDecimalParameter( - ItemSearch.SINGLE_TYPE_PARAM)); + BigDecimal singleTypeID = (BigDecimal) state.getValue(new BigDecimalParameter( + ItemSearch.SINGLE_TYPE_PARAM)); if (singleTypeID != null) { @@ -215,7 +215,7 @@ public class ItemSearchFolderBrowser extends Table { // The content type must be either of the requested type or.addFilter(ff.equals(ContentItem.CONTENT_TYPE + "." - + ContentType.ID, singleTypeID)); + + ContentType.ID, singleTypeID)); // Or must be a sibling of the requested type /* @@ -260,14 +260,14 @@ public class ItemSearchFolderBrowser extends Table { final BigDecimal typeId) { final ContentType type = new ContentType(typeId); if ((type.getDescendants() == null) - || type.getDescendants().trim().isEmpty()) { + || type.getDescendants().trim().isEmpty()) { return; } else { final String[] descendantsIds = type.getDescendants().split("/"); for (String descendantId : descendantsIds) { filter.addFilter(filterFactory.equals(String.format( - ContentItem.CONTENT_TYPE + "." + ContentType.ID), + ContentItem.CONTENT_TYPE + "." + ContentType.ID), descendantId)); createSiblingFilter(filter, filterFactory, descendantId); } @@ -294,26 +294,24 @@ public class ItemSearchFolderBrowser extends Table { } /** - * Indicates whether the paginator should be visible, - * based on the visibility of the folder browser itself - * and how many items are displayed + * Indicates whether the paginator should be visible, based on the visibility of the folder + * browser itself and how many items are displayed * - * @return true if folder browser is visible and there is more - * than 1 page of items, false otherwise + * @return true if folder browser is visible and there is more than 1 page of items, false + * otherwise */ public boolean isVisible(PageState state) { int size = ((Integer) m_size.get(state)).intValue(); return ItemSearchFolderBrowser.this.isVisible(state) - && (size - > ContentSection.getConfig().getFolderBrowseListSize()); + && (size + > ContentSection.getConfig().getFolderBrowseListSize()); } } /** - * Produce links to view an item or control links for folders - * to change into the folder. + * Produce links to view an item or control links for folders to change into the folder. */ private class NameCellRenderer extends DefaultTableCellRenderer { @@ -342,27 +340,24 @@ public class ItemSearchFolderBrowser extends Table { //String url = //resolver.generateItemURL //(state, id, name, section, coll.getVersion())); - SimpleContainer container = new SimpleContainer(); - String widget = - (String) state.getValue(new StringParameter( - ItemSearchPopup.WIDGET_PARAM)); + String widget = (String) state.getValue(new StringParameter( + ItemSearchPopup.WIDGET_PARAM)); String searchWidget = (String) state.getValue( - new StringParameter("searchWidget")); - boolean useURL = - "true".equals(state.getValue(new StringParameter( - ItemSearchPopup.URL_PARAM))); + new StringParameter("searchWidget")); + boolean useURL = "true".equals(state.getValue(new StringParameter( + ItemSearchPopup.URL_PARAM))); String fillString = useURL - ? ItemSearchPopup.getItemURL( + ? ItemSearchPopup.getItemURL( state.getRequest(), coll.getDomainObject().getOID()) : id + " (" + name + ")"; String title = ((ContentPage) coll.getDomainObject()).getTitle(); Label js = new Label( - generateJSLabel(id, widget, searchWidget, fillString, title), - false); + generateJSLabel(id, widget, searchWidget, fillString, title), + false); container.add(js); String url = "#"; @@ -385,25 +380,27 @@ public class ItemSearchFolderBrowser extends Table { buffer.append(" \n" - + " "); + + " return false; \n" + + " } \n" + + " --> \n" + + " "); return buffer.toString(); } @@ -442,15 +439,15 @@ public class ItemSearchFolderBrowser extends Table { return m_itemColl.getTypeLabel(); default: throw new IndexOutOfBoundsException("Column index " - + columnIndex - + " not in table model."); + + columnIndex + + " not in table model."); } } public Object getKeyAt(int columnIndex) { // Mark folders by using their negative ID (dirty, dirty) return (m_itemColl.isFolder()) ? m_itemColl.getID().negate() - : m_itemColl.getID(); + : m_itemColl.getID(); } } @@ -479,13 +476,14 @@ public class ItemSearchFolderBrowser extends Table { * Getting the GlobalizedMessage using a CMS Class targetBundle. * * @param key The resource key + * * @pre ( key != null ) */ private static GlobalizedMessage globalize(String key) { //return FolderManipulator.globalize(key); final GlobalisationUtil util = new GlobalisationUtil( - "com.arsdigita.cms." - + "ui.folder.CMSFolderResources"); + "com.arsdigita.cms." + + "ui.folder.CMSFolderResources"); return util.globalize(key); } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPopup.java b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPopup.java index c60bcb163..82e3fcc2d 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPopup.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPopup.java @@ -22,6 +22,7 @@ import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.persistence.OID; import com.arsdigita.xml.Element; @@ -30,32 +31,32 @@ import com.arsdigita.search.Search; import com.arsdigita.search.Document; import com.arsdigita.search.ui.QueryGenerator; import com.arsdigita.search.ui.ResultsPane; +import com.arsdigita.web.Web; import java.math.BigDecimal; import javax.servlet.http.HttpServletRequest; /** - * An extension of {@link ItemSearch} for use in a popup search window. The display of results is - * altered so that selecting a result closes the window & passes the id of the selected item back - * to the opener. + * An extension of {@link ItemSearch} for use in a popup search window. The display of results is + * altered so that selecting a result closes the window & passes the id of the selected item back to + * the opener. * * @author Stanislav Freidin (sfreidin@arsdigita.com) * @version $Id: ItemSearchPopup.java 1397 2006-11-29 14:10:38Z sskracic $ */ public class ItemSearchPopup extends ItemSearch { - private static final org.apache.log4j.Logger s_log = - org.apache.log4j.Logger.getLogger(ItemSearchPopup.class); + private static final org.apache.log4j.Logger s_log = org.apache.log4j.Logger.getLogger( + ItemSearchPopup.class); public static final String WIDGET_PARAM = "widget"; public static final String URL_PARAM = "useURL"; public static final String QUERY = "query"; /** - * Construct a new - * ItemSearchPopup component + * Construct a new ItemSearchPopup component * * @param context the context for the retrieved items. Should be - * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE} + * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE} * @param limitToContentSection limit the search to the current content section */ public ItemSearchPopup(String context, boolean limitToContentSection) { @@ -98,7 +99,11 @@ public class ItemSearchPopup extends ItemSearch { //map.setParameter("oid", oid.toString()); //return URL.there(request, "/redirect/", map).toString(); // Always link directly to the live version. - return "/redirect/?oid=" + oid.toString(); + if (Web.getWebappContextPath() == null) { + return "/redirect/?oid=" + oid.toString(); + } else { + return Web.getWebappContextPath() + "/redirect/?oid=" + oid.toString(); + } } private static class PopupResultsPane extends ResultsPane { @@ -122,13 +127,13 @@ public class ItemSearchPopup extends ItemSearch { boolean useURL = "true".equals(state.getValue(new StringParameter(URL_PARAM))); String fillString = useURL - ? getItemURL(state.getRequest(), doc.getOID()) - : doc.getOID().get("id").toString(); + ? getItemURL(state.getRequest(), doc.getOID()) + : doc.getOID().get("id").toString(); String title = doc.getTitle(); Element jsLabel = Search.newElement("jsAction"); jsLabel.addAttribute("name", "fillItem" - + doc.getOID().get("id") + "()"); + + doc.getOID().get("id") + "()"); jsLabel.setText(generateJSLabel((BigDecimal) doc.getOID().get("id"), widget, searchWidget, fillString, title)); element.addContent(jsLabel); @@ -136,18 +141,21 @@ public class ItemSearchPopup extends ItemSearch { return element; } - private String generateJSLabel(BigDecimal id, String widget, String searchWidget, String fill, String title) { + private String generateJSLabel(BigDecimal id, String widget, String searchWidget, + String fill, String title) { return " "; + + " \n" + + " "; } } + } diff --git a/ccm-cms/web/assets/xinha/CCMcmsXinhaConfig.js b/ccm-cms/web/assets/xinha/CCMcmsXinhaConfig.js index 98e39ec0f..eb44db1bd 100644 --- a/ccm-cms/web/assets/xinha/CCMcmsXinhaConfig.js +++ b/ccm-cms/web/assets/xinha/CCMcmsXinhaConfig.js @@ -26,7 +26,7 @@ xinha_config=xinha_config?xinha_config():new Xinha.Config(); ["separator","subscript","superscript"], ["separator","justifyleft","justifycenter","justifyright","justifyfull"], ["separator","insertorderedlist","insertunorderedlist","outdent","indent"], - ["separator","createlink"], + ["separator","ccmcreatelink"], ["separator","undo","redo","selectall"], (Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite"]), ["separator","killword","clearfonts","removeformat"], diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js b/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js index 07d39175b..e3ae2413b 100644 --- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js +++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js @@ -23,9 +23,9 @@ function OpenCCM(editor) cfg.registerButton( { - id : "createlink", + id : "ccmcreatelink", tooltip : this._lc("OpenCCMInsertLink"), - image : ["ed_buttons_main.png", 6, 1], + image : [editor.imgURL("iconsets/Crystal/ed_buttons_main.png"), 6, 1], textMode : false, action : function(e, objname, obj) { self.showLinkDialog(self._getSelectedAnchor()); } } @@ -41,12 +41,12 @@ function OpenCCM(editor) } ); - if(this.findButton("createlink")) + if(this.findButton("ccmcreatelink")) { hasLinkButton = true; - cfg.addToolbarElement("createlink", "createlink", 0); + cfg.addToolbarElement("ccmcreatelink", "ccmcreatelink", 0); } else { - cfg.addToolbarElement("createlink", "undo", -1); + cfg.addToolbarElement("ccmcreatelink", "undo", -1); } if(this.findButton("insertimage")) @@ -56,7 +56,7 @@ function OpenCCM(editor) } else { - cfg.addToolbarElement("insertimage", "createlink", 1); + cfg.addToolbarElement("insertimage", "ccmcreatelink", 1); } if(!hasLinkButton && !hasImageButton) diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js index 309035a8b..1ea440177 100644 --- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js +++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js @@ -17,11 +17,9 @@ OpenCCM.prototype.showImageDialog = function(image) width : "", height : "", caption : "", - alignment : "", caption : "", fancybox : "", - aspect : "" }; diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js b/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js index 1a7223c24..fad19ad6a 100644 --- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js +++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js @@ -1,238 +1,247 @@ OpenCCM.prototype.showLinkDialog = function(link) { - if (!this.dialogs["links"]) - { - this.prepareLinkDialog(); - } - - if(!link && this.editor.selectionEmpty(this.editor.getSelection())) - { - alert(this._lc("You need to select some text before creating a link")); - return false; - } - - var editor = this.editor; - this.link = link; - - var data = - { - title : '', - type : 'internal', - ci_name : '', - ci_href : '', - href : '' - }; - - if(link && link.tagName.toLowerCase() == 'a') - { - var href =this.editor.fixRelativeLinks(link.getAttribute('href')); - var internal = href.match(/^(\/.*)$/); - var external = href.match(/^http(.*)$/); -/* - var mailto = href.match(/^mailto:(.*@[^?&]*)(\?(.*))?$/); - var anchor = href.match(/^#(.*)$/); -*/ - data.title = link.title; - - if(internal) + if (!this.dialogs["links"]) { - data.type = 'internal'; - data.ci_name = link.alt; - data.ci_href = href; - } - - if(external) - { - data.type = 'external'; - data.href = href; + this.prepareLinkDialog(); } - } + if (!link && this.editor.selectionEmpty(this.editor.getSelection())) + { + alert(this._lc("You need to select some text before creating a link")); + return false; + } - // now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog - this.dialogs["links"].show(data); + var editor = this.editor; + this.link = link; + + var data = + { + title: '', + type: 'internal', + ci_name: '', + ci_href: '', + href: '' + }; + + if (link && link.tagName.toLowerCase() == 'a') + { + var href = this.editor.fixRelativeLinks(link.getAttribute('href')); + var internal = href.match(/^(\/.*)$/); + var external = href.match(/^http(.*)$/); + /* + var mailto = href.match(/^mailto:(.*@[^?&]*)(\?(.*))?$/); + var anchor = href.match(/^#(.*)$/); + */ + data.title = link.title; + + if (internal) + { + data.type = 'internal'; + data.ci_name = link.alt; + data.ci_href = href; + } + + if (external) + { + data.type = 'external'; + data.href = href; + } + + } + + // now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog + this.dialogs["links"].show(data); }; // Prepare the link dialog OpenCCM.prototype.prepareLinkDialog = function() { - var self = this; - var editor = this.editor; + var self = this; + var editor = this.editor; - var dialog = this.dialogs["links"] = new Xinha.Dialog(editor, OpenCCM.linksHtml, 'Xinha',{width:400}) + var dialog = this.dialogs["links"] = new Xinha.Dialog(editor, OpenCCM.linksHtml, 'Xinha', {width: 400}) - // Connect the OK and Cancel buttons - dialog.getElementById('ok').onclick = function() { self.linkApply(); }; - dialog.getElementById('clear').onclick = function() { self.linkRemove(); }; - dialog.getElementById('cancel').onclick = function() { self.dialogs["links"].hide()}; + // Connect the OK and Cancel buttons + dialog.getElementById('ok').onclick = function() { + self.linkApply(); + }; + dialog.getElementById('clear').onclick = function() { + self.linkRemove(); + }; + dialog.getElementById('cancel').onclick = function() { + self.dialogs["links"].hide() + }; - // Connect the Browse and Search button - dialog.getElementById('ci_browse').onclick = function() { self.linkBrowse(window); }; -/* Suche deaktivert, bis eine bessere JSP / Java-Klasse vorhanden ist - dialog.getElementById('ci_search').onclick = function() { alert("Das geht auch noch nicht.");}; -*/ + // Connect the Browse and Search button + dialog.getElementById('ci_browse').onclick = function() { + self.linkBrowse(window); + }; + /* Suche deaktivert, bis eine bessere JSP / Java-Klasse vorhanden ist + dialog.getElementById('ci_search').onclick = function() { alert("Das geht auch noch nicht.");}; + */ - this.linkDialogReady = true; + this.linkDialogReady = true; }; // OpenCCM.prototype.linkApply = function() { - var values = this.dialogs["links"].hide(); - var link = this.link; - var editor = this.editor; + var values = this.dialogs["links"].hide(); + var link = this.link; + var editor = this.editor; - var linkAttr = - { - href : '', - alt : '', - title : '', - class : '' - }; + var linkAttr = + { + href: '', + alt: '', + title: '', + class: '' + }; - // Read needed form values - switch(values.type) - { - case "internal": //alert("Internal"); - linkAttr.href = values.ci_href; - /* Deaktiviert bis es eine bessere JSP / Java-Klasse gibt - linkAttr.alt = values.ci_name; - */ - linkAttr.title = values.title; - linkAttr.class = "linkInternal"; - break; - - case "external": //alert("External"); - linkAttr.href = values.href; - linkAttr.title = values.title; - linkAttr.class = "linkExternal"; - - // Make absolute url - - break; - - default: //alert("Mist"); - return false; - } - - // If not all mandatory informations are set - if(linkAttr.href == "" || linkAttr.title == "") - { - // don't do anything at all - return false; - } - - // Modify Link - if(link && link.tagName.toLowerCase() == "a") - { - - for(var i in linkAttr) + // Read needed form values + switch (values.type) { - link.setAttribute(i, linkAttr[i]); + case "internal": //alert("Internal"); + linkAttr.href = values.ci_href; + /* Deaktiviert bis es eine bessere JSP / Java-Klasse gibt + linkAttr.alt = values.ci_name; + */ + linkAttr.title = values.title; + linkAttr.class = "linkInternal"; + break; + + case "external": //alert("External"); + linkAttr.href = values.href; + linkAttr.title = values.title; + linkAttr.class = "linkExternal"; + + // Make absolute url + + break; + + default: //alert("Mist"); + return false; } -/* from Linker-Plugin - // If we change a mailto link in IE for some hitherto unknown - // reason it sets the innerHTML of the link to be the - // href of the link. Stupid IE. - if(Xinha.is_ie) + // If not all mandatory informations are set + if (linkAttr.href == "" || linkAttr.title == "") { - if(/mailto:([^?<>]*)(\?[^<]*)?$/i.test(link.innerHTML)) - { - link.innerHTML = RegExp.$1; - } + // don't do anything at all + return false; } -*/ - } - // Add Link - else - { - - // Insert a link, we let the editor do this, we figure it knows best - var tmp = Xinha.uniq("http://www.example.com/Link"); - editor._doc.execCommand("createlink", false, tmp); - - // Fix it up - var anchors = editor._doc.getElementsByTagName('a'); - for(var i = 0; i < anchors.length; i++) + // Modify Link + if (link && link.tagName.toLowerCase() == "a") { - var anchor = anchors[i]; - if(anchor.href == tmp) - { - // Found one. - if (!link) link = anchor; - for(var j in linkAttr) + + for (var i in linkAttr) { - anchor.setAttribute(j, linkAttr[j]); + link.setAttribute(i, linkAttr[i]); } - } + + /* from Linker-Plugin + // If we change a mailto link in IE for some hitherto unknown + // reason it sets the innerHTML of the link to be the + // href of the link. Stupid IE. + if(Xinha.is_ie) + { + if(/mailto:([^?<>]*)(\?[^<]*)?$/i.test(link.innerHTML)) + { + link.innerHTML = RegExp.$1; + } + } + */ + + } + // Add Link + else + { + + // Insert a link, we let the editor do this, we figure it knows best + var tmp = Xinha.uniq("http://www.example.com/Link"); + editor._doc.execCommand("createlink", false, tmp); + + // Fix it up + var anchors = editor._doc.getElementsByTagName('a'); + for (var i = 0; i < anchors.length; i++) + { + var anchor = anchors[i]; + if (anchor.href == tmp) + { + // Found one. + if (!link) + link = anchor; + for (var j in linkAttr) + { + anchor.setAttribute(j, linkAttr[j]); + } + } + } + } - } - - editor.selectNodeContents(link); - editor.updateToolbar(); + editor.selectNodeContents(link); + editor.updateToolbar(); }; // Remove a link OpenCCM.prototype.linkRemove = function() { - var values = this.dialogs["links"].hide(); - var link = this.link; - var editor = this.editor; + var values = this.dialogs["links"].hide(); + var link = this.link; + var editor = this.editor; - if(link && link.tagName.toLowerCase() == 'a') - { - if(confirm(this._lc('Are you sure you wish to remove this link?'))) + if (link && link.tagName.toLowerCase() == 'a') { - var parent = link.parentNode; - while(link.hasChildNodes()) - { - parent.insertBefore(link.removeChild(link.childNodes[0]), link); - } - - parent.removeChild(link); - editor.updateToolbar(); - return true; + if (confirm(this._lc('Are you sure you wish to remove this link?'))) + { + var parent = link.parentNode; + while (link.hasChildNodes()) + { + parent.insertBefore(link.removeChild(link.childNodes[0]), link); + } + + parent.removeChild(link); + editor.updateToolbar(); + return true; + } } - } }; OpenCCM.prototype.linkBrowse = function(window) { - var baseURL = window.location.href; - var offset = baseURL.lastIndexOf("/"); - var destURL = baseURL.slice(0, offset+1) + "search.jsp?useURL=true&widget=getElementById('" + this.dialogs["links"].id["ci_href"] + "')"; + var baseURL = window.location.href; + var offset = baseURL.lastIndexOf("/"); + var destURL = baseURL.slice(0, offset + 1) + "search.jsp?useURL=true&widget=getElementById('" + this.dialogs["links"].id["ci_href"] + "')"; // var searchDialog = new Xinha.Dialog(this.editor, destURL, '');//,{width:800, height:600}, {'closable':true}); // searchDialog.show(); - window.open(destURL, "_blank", "scrollbars=yes,directories=no,toolbar=no,width=800,height=600,status=no,menubar=no"); + window.open(destURL, "_blank", "scrollbars=yes,directories=no,toolbar=no,width=960,height=600,status=no,menubar=no"); - return false; + return false; } // Get selected anchor OpenCCM.prototype._getSelectedAnchor = function() { - var sel = this.editor.getSelection(); - var rng = this.editor.createRange(sel); - var link = this.editor.activeElement(sel); - - if(link != null && link.tagName.toLowerCase() == 'a') - { - return link; - } - else - { - link = this.editor._getFirstAncestor(sel, 'a'); - if(link != null) + var sel = this.editor.getSelection(); + var rng = this.editor.createRange(sel); + var link = this.editor.activeElement(sel); + + if (link != null && link.tagName.toLowerCase() == 'a') { - return link; + return link; } - } - return null; + else + { + link = this.editor._getFirstAncestor(sel, 'a'); + if (link != null) + { + return link; + } + } + return null; }; diff --git a/ccm-core/web/assets/xinha/CCMcmsXinhaConfig.js b/ccm-core/web/assets/xinha/CCMcmsXinhaConfig.js deleted file mode 100644 index b45784b59..000000000 --- a/ccm-core/web/assets/xinha/CCMcmsXinhaConfig.js +++ /dev/null @@ -1,52 +0,0 @@ -/* This is the OpenCCM default Xinha configuration file. It provides basic funcionality * - * which might be used by any CCM module. A module may provide its own configuration * - * file during Xinha loading or may extend com.arsdigita.bebop.form.DHTMLEditor as * - * ccm-cms does (com.arsdigita.cms.CMSDHTMLEditor) to provide extensive configuration * - * options. */ -/* It is based on the original configuration file XinhaConfig.js (compressed version) */ -/* http://svn.xinha.webfactional.com/trunk/examples/XinhaConfig.js */ -_editor_skin = "silva"; -_editor_icons = "Crystal"; -xinha_init = null; -xinha_config = null; -xinha_init = xinha_init ? xinha_init : function() { - xinha_editors = xinha_editors ? xinha_editors : ["myTextArea", "anotherOne"]; - xinha_plugins = xinha_plugins ? xinha_plugins : ["CharacterMap", "CharCounter", - "ContextMenu", "DefinitionList", "FindReplace", "ListType", "QuickTag", - "SmartReplace", "Stylist", "TableOperations", "UnFormat", "Equation", "OpenCCM"]; - if (!Xinha.loadPlugins(xinha_plugins, xinha_init)) { - return; - } - xinha_config = xinha_config ? xinha_config() : new Xinha.Config(); - //this is the standard toolbar for CCM, feel free to remove buttons as you like - xinha_config.toolbar = - [ - ["popupeditor"], - ["separator", "formatblock", "bold", "italic", "underline", "strikethrough"], - ["separator", "subscript", "superscript"], - ["separator", "justifyleft", "justifycenter", "justifyright", "justifyfull"], - ["separator", "insertorderedlist", "insertunorderedlist", "outdent", "indent"], - ["separator", "createlink"], - ["separator", "undo", "redo", "selectall"], - (Xinha.is_gecko ? [] : ["cut", "copy", "paste", "overwrite"]), - ["separator", "killword", "clearfonts", "removeformat"], - ["linebreak", "separator", "htmlmode", "showhelp", "about"] - ]; - xinha_config.formatblock = - { - "— format —": "", - "Heading 3": "h3", - "Heading 4": "h4", - "Heading 5": "h5", - "Heading 6": "h6", - "Normal": "p" - }; - - //xinha_config.pageStyleSheets = [_editor_url + "examples/full_example.css"]; - xinha_config.pageStyleSheets = [_editor_url + "ccm-xinha.css"]; - xinha_config.width = "90%"; - xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); - Xinha.startEditors(xinha_editors); -}; -Xinha.addOnloadHandler(xinha_init); - diff --git a/ccm-core/web/assets/xinha/plugins/OpenCCM/OpenCCM.js b/ccm-core/web/assets/xinha/plugins/OpenCCM/OpenCCM.js deleted file mode 100644 index 07d39175b..000000000 --- a/ccm-core/web/assets/xinha/plugins/OpenCCM/OpenCCM.js +++ /dev/null @@ -1,123 +0,0 @@ -/** xinha editor plugin for OpenCCM **/ - -OpenCCM._pluginInfo = { - name : "OpenCCM", - version : "0.3", - developer : "Sören Bernstein", - developer_url : "http://", - sponsor : "", - sponsor_url : "", - license : "htmlArea" -} - -function OpenCCM(editor) -{ - this.editor = editor; - this.dialogs = new Array(); - - var cfg = editor.config; - var self = this; - - var hasLinkButton = false; - var hasImageButton = false; - - cfg.registerButton( - { - id : "createlink", - tooltip : this._lc("OpenCCMInsertLink"), - image : ["ed_buttons_main.png", 6, 1], - textMode : false, - action : function(e, objname, obj) { self.showLinkDialog(self._getSelectedAnchor()); } - } - ); - - cfg.registerButton( - { - id : "insertimage", - tooltip : this._lc("OpenCCMInsertImage"), - image : ["ed_buttons_main.png", 6, 3], - textMode : false, - action : function(e, objname, obj) { self.showImageDialog(); } - } - ); - - if(this.findButton("createlink")) - { - hasLinkButton = true; - cfg.addToolbarElement("createlink", "createlink", 0); - } else { - cfg.addToolbarElement("createlink", "undo", -1); - } - - if(this.findButton("insertimage")) - { - hasImageButton = true; - cfg.addToolbarElement("insertimage", "insertimage", 0); - } - else - { - cfg.addToolbarElement("insertimage", "createlink", 1); - } - - if(!hasLinkButton && !hasImageButton) - { - cfg.addToolbarElement(["separator"], "insertimage", 1); - } - - if(typeof editor._insertImage == 'undefined') - { - editor._insertImage = function() { self.showImageDialog(); }; - // editor.config.btnList.insertimage[3] = function() { self.show(); } - } - - // Register double click action - cfg.dblclickList["a"][0] = function(e, target) { self.showLinkDialog(self._getSelectedAnchor()); }; -} - -OpenCCM.prototype.findButton = function(string) -{ - var toolbar = this.editor.config.toolbar; - - for(i = 0; i < toolbar.length; i++) - { - for(j = 0; j < toolbar[i].length; j++) - { - if(toolbar[i][j] == string) - { - return true; - } - } - } - - return false; -} - -OpenCCM.prototype._lc = function(string) -{ - return Xinha._lc(string, 'OpenCCM'); -} - -OpenCCM.prototype.onGenerateOnce = function () -{ - this.loadAssets(); -} - -OpenCCM.prototype.loadAssets = function() -{ - var self = OpenCCM; - - if (self.loading) - { - return; - } - self.loading = true; - - // Link - Xinha._getback(Xinha.getPluginDir("OpenCCM") + '/links/links.js', function(getback) { eval(getback); self.linksMethodsReady = true; }); - Xinha._getback(Xinha.getPluginDir("OpenCCM") + '/links/links.html', function(getback) { OpenCCM.linksHtml = getback; self.linksDialogReady = true; } ); - - // Image - Xinha._getback(Xinha.getPluginDir("OpenCCM") + '/images/images.js', function(getback) { eval(getback); self.imagesMethodsReady = true; } ); - Xinha._getback(Xinha.getPluginDir("OpenCCM") + '/images/images.html', function(getback) { OpenCCM.imagesHtml = getback; self.imagesDialogReady = true; } ); -} - diff --git a/ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.html b/ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.html deleted file mode 100644 index 36c7b51ad..000000000 --- a/ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.html +++ /dev/null @@ -1,179 +0,0 @@ - -

- Insert/Modify Image -

-
-
-
- -
- - -
- -
- -
- -
- -
- -
- - -
- - Layout - - -
- -
- -
- -
- -
- -
-
- -
- - Dimension - - -
- -
- -
- -
- -
- -
- - Preview - - -
-
-
- - - -
-
diff --git a/ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.js b/ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.js deleted file mode 100644 index bc9ea2e0c..000000000 --- a/ccm-core/web/assets/xinha/plugins/OpenCCM/images/images.js +++ /dev/null @@ -1,441 +0,0 @@ -OpenCCM.prototype.showImageDialog = function(image) -{ - if (!this.dialogs["images"]) - { - this.prepareImageDialog(); - } - - var editor = this.editor; - this.image = image; - - var data = - { - src: "", - name: "", - alt: "", - title: "", - width: "", - height: "", - caption: "", - alignment: "", - caption : "", - fancybox: "", - aspect: "" - }; - - if (typeof image == "undefined") - { - image = editor.getParentElement(); - if (image && image.tagName.toLowerCase() != "img") - { - image = null; - } - } - - this.image = image; - - if (image && image.tagName.toLowerCase() == "img") - { - data.src = this.editor.fixRelativeLinks(image.getAttribute("src")); - data.alt = image.getAttribute("alt"); - data.name = image.getAttribute("name"); - data.title = image.getAttribute("title"); - data.width = image.getAttribute("width"); - data.height = image.getAttribute("height"); - - if (image.parentNode.tagName.toLowerCase() == "div") - { - // Parent node is not a link, so there is not zoom or gallery function - alignment = image.parentNode.getAttribute("class"); - if (alignment != "image none") - { - data.alignment = alignment.substring(alignment.indexOf(" ") + 1); - } - else - { - data.alignment = "none"; - } - data.caption = (image.nextSibling.tagName.toLowerCase() == "span" && image.nextSibling.firstChild) ? image.nextSibling.firstChild.nodeValue : ""; - - data.fancybox = "none"; -// data.galleryName = ""; - } - else - { - // Parent node is a link - alignment = image.parentNode.parentNode.getAttribute("class"); - if (alignment != "image none") - { - data.alignment = alignment.substring(alignment.indexOf(" ") + 1); - } - else - { - data.alignment = "none"; - } - - data.fancybox = image.parentNode.getAttribute("class"); -// data.galleryName = (image.parentNode.getAttribute("class") == "imageGallery") ? image.parentNode.getAttribute("rel") : ""; - - data.caption = (image.parentNode.nextSibling.tagName.toLowerCase() == "span" && image.parentNode.nextSibling.firstChild) ? image.parentNode.nextSibling.firstChild.nodeValue : ""; - } - - // Calculate aspect ratio - data.aspect = data.width / data.height; - } - else - { - data.alignment = "none"; -// data.caption = ""; - data.fancybox = "none"; -// data.galleryName = ""; - } - - // now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog - this.dialogs["images"].show(data); - - // If image set, show preview - if (data.src != "") - { - this.dialogs["images"].getElementById(this.dialogs["images"].id["ipreview"]).src = data.src; - this.resizePreview(this.dialogs["images"]); - this.dialogs["images"].getElementById(this.dialogs["images"].id["preview"]).style.display = "block"; - } - else - { - // Preview dekativieren - this.dialogs["images"].getElementById(this.dialogs["images"].id["ipreview"]).src = "about:blank"; - this.dialogs["images"].getElementById(this.dialogs["images"].id["preview"]).style.display = "none"; - } - -}; - -OpenCCM.prototype.prepareImageDialog = function() -{ - var self = this; - var editor = this.editor; - - var dialog = this.dialogs["images"] = new Xinha.Dialog(editor, OpenCCM.imagesHtml, 'Xinha', {width: 410}) - - // Connect the OK and Cancel buttons - dialog.getElementById("ok").onclick = function() { - self.imageApply(); - } - dialog.getElementById("remove").onclick = function() { - self.imageRemove(); - }; - dialog.getElementById("cancel").onclick = function() { - self.dialogs["images"].hide(); - }; - - // Connect the Select button - dialog.getElementById("browse").onclick = function() { - self.imageBrowse(window); - }; - - // Connect onkeyup event handler with dimension filed to recalculate the size according to aspect ratio - dialog.getElementById("width").onkeyup = function() { - self.calcHeight(); - }; - dialog.getElementById("height").onkeyup = function() { - self.calcWidth(); - }; - - // OnResize - this.dialogs["images"].onresize = function() - { - self.resizeDialog(this); - }; - - this.imageDialogReady = true; -}; - -// Write HTML code -OpenCCM.prototype.imageApply = function() -{ - - var values = this.dialogs["images"].hide(); - var image = this.image; - var editor = this.editor; - var modifyImage = (image != null && image.tagName.toLowerCase() == "img"); - - var imgAttr = - { - src: "", - alt: "", - title: "", - name: "", - width: "", - height: "" - }; - - var spanAttr = - { - class: "caption", - style: "", - } - - var linkAttr = - { - href: "", - title: "", - rel: "", - class: "" - }; - - var divAttr = - { - class: "image" - }; - - // If not all mandatory informations are set - if (!values.src) - { - // don't do anything at all - return false; - } - - // Read form values for image - imgAttr.src = values.src; - imgAttr.alt = values.alt; - imgAttr.name = values.name; - imgAttr.title = values.title; - imgAttr.width = values.width; - imgAttr.height = values.height; - - // Read form values for caption - if (values.caption) - { - spanAttr.style = "width:" + imgAttr.width + "px"; - } - - // Read form values for link - if (values.fancybox.value == "imageZoom") - { - linkAttr.href = values.src; - linkAttr.title = values.title; - linkAttr.rel = ""; - linkAttr.class = "imageZoom"; - } - - else if (values.fancybox.value == "imageGallery") - { - linkAttr.href = values.src; - linkAttr.title = values.title; - linkAttr.rel = "imageGallery"; - linkAttr.class = "imageGallery"; - } - - // Read form values for div - if (values.alignment.value != "") - { - divAttr.class += " " + values.alignment.value; - } - - var div; - - // Modify Image - if (modifyImage) - { - // Get the parent for img node - div = image.parentNode; - - // if the tagname of div is "a" - if (div.tagName.toLowerCase() == "a") - { - // go up one level to find the real div - div = div.parentNode; - } - - // remove all childs from div.image - while (div.childNodes.length > 0) - { - div.removeChild(div.firstChild); - } - } - - // Add Image - else - { - // create new div.image - div = document.createElement("div"); - } - - // set attributes for div - for (var attr in divAttr) - { - div.setAttribute(attr, divAttr[attr]); - } - - // the folling has to be done for both cases - // insert link, if fancybox features are activated - if (values.fancybox.value != "none") - { - link = document.createElement("a"); - for (var attr in linkAttr) - { - link.setAttribute(attr, linkAttr[attr]); - } - div.appendChild(link); - } - - // insert the image, obviously - var img = document.createElement("img"); - for (var attr in imgAttr) - { - img.setAttribute(attr, imgAttr[attr]); - } - if (values.fancybox.value != "none") - { - link.appendChild(img); - } - else - { - div.appendChild(img); - } - - // insert caption if selected - if (values.caption) - { - var span = document.createElement("span"); - for (var attr in spanAttr) - { - span.setAttribute(attr, spanAttr[attr]); - } - span.appendChild(document.createTextNode(imgAttr.title)); - - div.appendChild(span); - } - - // insert new div only if we not modifying an image - if (!modifyImage) { - editor.insertNodeAtSelection(div); - } - - // set cursor after div - this.editor.selectNodeContents(div.nextSibling, 0); -}; - -OpenCCM.prototype.imageRemove = function() -{ - - // Close the dialog - this.dialogs["images"].hide(); - - // Get the parent div for img node - var div = this.image.parentNode; - - // if the tagname of div is "a" - if (div.tagName.toLowerCase() == "a") - { - // go up one level to find the real div - div = div.parentNode; - } - - // remove this div - div.parentNode.removeChild(div); - - return true; -}; - -OpenCCM.prototype.imageBrowse = function(window) -{ - var baseURL = window.location.href; - var offset = baseURL.lastIndexOf("/"); - var destURL = baseURL.slice(0, offset + 1) + "image_select.jsp"; - -// var searchDialog = new Xinha.Dialog(this.editor, destURL, '');//,{width:800, height:600}, {'closable':true}); -// searchDialog.show(); - var selectWindow = window.open(destURL, "_blank", "scrollbars=yes,directories=no,toolbar=no,width=800,height=600,status=no,menubar=no"); - window.openCCM = this; - return false; -}; - -OpenCCM.prototype.imageSet = function(imageData) -{ - var dialog = this.dialogs["images"]; - dialog.getElementById(dialog.id["src"]).value = imageData.src; - dialog.getElementById(dialog.id["ipreview"]).src = imageData.src; - dialog.getElementById(dialog.id["width"]).value = imageData.width; - dialog.getElementById(dialog.id["height"]).value = imageData.height; - dialog.getElementById(dialog.id["name"]).value = imageData.name; - dialog.getElementById(dialog.id["aspect"]).value = imageData.width / imageData.height; - - if (imageData.src != "") - { -// this.resizePreview(dialog); - dialog.getElementById(dialog.id["preview"]).style.display = "block"; - this.resizeDialog(dialog); - } else { - dialog.getElementById(dialog.id["preview"]).style.display = "none"; - } -}; - -OpenCCM.prototype._getCombinedComponentHeight = function() -{ - var dialog = this.dialogs["images"]; - return dialog.getElementById(dialog.id["h1"]).offsetHeight + - dialog.getElementById(dialog.id["common"]).offsetHeight + - dialog.getElementById(dialog.id["layout"]).offsetHeight + - dialog.getElementById(dialog.id["dimensions"]).offsetHeight + - dialog.getElementById(dialog.id["buttons"]).offsetHeight + - parseInt(dialog.rootElem.style.paddingBottom, 10) + - 10; -}; - -OpenCCM.prototype.resizeDialog = function(dialog) -{ - if (dialog.getElementById(dialog.id["preview"]).style.display == "block") - { - - - // Recalculate height of preview - dialog.getElementById(dialog.id["preview"]).style.height = Math.min(Math.max(0, dialog.height - this._getCombinedComponentHeight() - 20), Math.round((window.innerHeight * 0.8) - this._getCombinedComponentHeight())) + "px"; - // Resize preview image - this.resizePreview(dialog); - } - dialog.width = Math.min(Math.max(10, dialog.width), Math.round((window.innerWidth * 0.8))); - dialog.height = Math.min(Math.max(10, dialog.height), Math.round((window.innerHeight * 0.8))); -}; - -OpenCCM.prototype.resizePreview = function(dialog) -{ - var layoutElem = dialog.getElementById(dialog.id["layout"]); - var previewElem = dialog.getElementById(dialog.id["preview"]); - - var maxWidth = layoutElem.offsetWidth - 5; - var maxHeight = previewElem.offsetHeight && previewElem.offsetHeight - 15 < Math.round((window.innerHeight * 0.8) - this._getCombinedComponentHeight()) - ? previewElem.offsetHeight - 15 - : Math.round((window.innerHeight * 0.8) - this._getCombinedComponentHeight()); - - dialog.getElementById(dialog.id["ipreview"]).style.width = "auto"; - dialog.getElementById(dialog.id["ipreview"]).style.height = "auto"; - - var width = parseInt(dialog.getElementById(dialog.id["ipreview"]).width, 10); - var height = parseInt(dialog.getElementById(dialog.id["ipreview"]).height, 10); - -// alert("W: " + maxWidth +" "+ width + "H: " + maxHeight +" "+ height); - - var zoom = height > 0 - ? Math.min(maxWidth / width, maxHeight / height) - : maxWidth / width; - -// alert("Zoom: " + zoom); - - var w = dialog.getElementById(dialog.id["ipreview"]).style.width = Math.round(width * zoom) + "px"; - var h = dialog.getElementById(dialog.id["ipreview"]).style.height = Math.round(height * zoom) + "px"; -}; - -OpenCCM.prototype.calcWidth = function() -{ - var dialog = this.dialogs["images"]; - dialog.getElementById(dialog.id["width"]).value = - Math.round(dialog.getElementById("height").value * dialog.getElementById("aspect").value); -}; - -OpenCCM.prototype.calcHeight = function() -{ - var dialog = this.dialogs["images"]; - dialog.getElementById(dialog.id["height"]).value = - Math.round(dialog.getElementById("width").value / dialog.getElementById("aspect").value); -}; - diff --git a/ccm-core/web/assets/xinha/plugins/OpenCCM/lang/de.js b/ccm-core/web/assets/xinha/plugins/OpenCCM/lang/de.js deleted file mode 100644 index 4345bd1fa..000000000 --- a/ccm-core/web/assets/xinha/plugins/OpenCCM/lang/de.js +++ /dev/null @@ -1,21 +0,0 @@ -// I18N constants -// LANG: "de", ENCODING: UTF-8 -{ - "OpenCCMInsertLink" : "Link einfügen / bearbeiten", - "OpenCCMInsertImage" : "Bild einfügen / bearbeiten", - "Name:" : "Name:", - "Alternate:" : "Alt-Text", - "Title:" : "Titel:", - "Layout" : "Darstellung", - "Alignment:" : "Ausrichtung:", - "Center" : "zentriert", - "Show Caption:" : "Zeige Bildunterschrift:", - "Fancybox" : "Fancybox:", - "Disabled" : "Deaktiviert", - "Zoom" : "Zoom", - "Gallery" : "Gallerie", - "Dimension" : "Dimensionen", - "Width:" : "Breite:", - "Height:" : "Höhe:", - "Preview" : "Vorschau" -} diff --git a/ccm-core/web/assets/xinha/plugins/OpenCCM/lang/en.js b/ccm-core/web/assets/xinha/plugins/OpenCCM/lang/en.js deleted file mode 100644 index eb9c0ca21..000000000 --- a/ccm-core/web/assets/xinha/plugins/OpenCCM/lang/en.js +++ /dev/null @@ -1,21 +0,0 @@ -// I18N constants -// LANG: "de", ENCODING: UTF-8 -{ - "OpenCCMInsertLink" : "Create / modify link", - "OpenCCMInsertImage" : "Insert / modify image", - "Name:" : "Name:", - "Alternate:" : "Alternate", - "Title:" : "Title:", - "Layout" : "Layout", - "Alignment:" : "Alignment:", - "Center" : "zentriert", - "Show Caption:" : "Show Caption:", - "Fancybox" : "Fancybox:", - "Disabled" : "Disabled", - "Zoom" : "Zoom", - "Gallery" : "Gallery", - "Dimension" : "Dimension", - "Width:" : "Width:", - "Height:" : "Height:", - "Preview" : "Preview" -} diff --git a/ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.html b/ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.html deleted file mode 100644 index c729b6bac..000000000 --- a/ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.html +++ /dev/null @@ -1,155 +0,0 @@ - -

- Insert/Modify Link -

-
-
-
- -
- -
-
-
- - - - -
- - - - -
- -
-
- - - - -
- -
-
- - - - - -
- - - -
-
-
- - diff --git a/ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.js b/ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.js deleted file mode 100644 index 1a7223c24..000000000 --- a/ccm-core/web/assets/xinha/plugins/OpenCCM/links/links.js +++ /dev/null @@ -1,238 +0,0 @@ -OpenCCM.prototype.showLinkDialog = function(link) -{ - if (!this.dialogs["links"]) - { - this.prepareLinkDialog(); - } - - if(!link && this.editor.selectionEmpty(this.editor.getSelection())) - { - alert(this._lc("You need to select some text before creating a link")); - return false; - } - - var editor = this.editor; - this.link = link; - - var data = - { - title : '', - type : 'internal', - ci_name : '', - ci_href : '', - href : '' - }; - - if(link && link.tagName.toLowerCase() == 'a') - { - var href =this.editor.fixRelativeLinks(link.getAttribute('href')); - var internal = href.match(/^(\/.*)$/); - var external = href.match(/^http(.*)$/); -/* - var mailto = href.match(/^mailto:(.*@[^?&]*)(\?(.*))?$/); - var anchor = href.match(/^#(.*)$/); -*/ - data.title = link.title; - - if(internal) - { - data.type = 'internal'; - data.ci_name = link.alt; - data.ci_href = href; - } - - if(external) - { - data.type = 'external'; - data.href = href; - } - - } - - // now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog - this.dialogs["links"].show(data); - -}; - -// Prepare the link dialog -OpenCCM.prototype.prepareLinkDialog = function() -{ - var self = this; - var editor = this.editor; - - var dialog = this.dialogs["links"] = new Xinha.Dialog(editor, OpenCCM.linksHtml, 'Xinha',{width:400}) - - // Connect the OK and Cancel buttons - dialog.getElementById('ok').onclick = function() { self.linkApply(); }; - dialog.getElementById('clear').onclick = function() { self.linkRemove(); }; - dialog.getElementById('cancel').onclick = function() { self.dialogs["links"].hide()}; - - // Connect the Browse and Search button - dialog.getElementById('ci_browse').onclick = function() { self.linkBrowse(window); }; -/* Suche deaktivert, bis eine bessere JSP / Java-Klasse vorhanden ist - dialog.getElementById('ci_search').onclick = function() { alert("Das geht auch noch nicht.");}; -*/ - - this.linkDialogReady = true; -}; - -// -OpenCCM.prototype.linkApply = function() -{ - - var values = this.dialogs["links"].hide(); - var link = this.link; - var editor = this.editor; - - var linkAttr = - { - href : '', - alt : '', - title : '', - class : '' - }; - - // Read needed form values - switch(values.type) - { - case "internal": //alert("Internal"); - linkAttr.href = values.ci_href; - /* Deaktiviert bis es eine bessere JSP / Java-Klasse gibt - linkAttr.alt = values.ci_name; - */ - linkAttr.title = values.title; - linkAttr.class = "linkInternal"; - break; - - case "external": //alert("External"); - linkAttr.href = values.href; - linkAttr.title = values.title; - linkAttr.class = "linkExternal"; - - // Make absolute url - - break; - - default: //alert("Mist"); - return false; - } - - // If not all mandatory informations are set - if(linkAttr.href == "" || linkAttr.title == "") - { - // don't do anything at all - return false; - } - - // Modify Link - if(link && link.tagName.toLowerCase() == "a") - { - - for(var i in linkAttr) - { - link.setAttribute(i, linkAttr[i]); - } - -/* from Linker-Plugin - // If we change a mailto link in IE for some hitherto unknown - // reason it sets the innerHTML of the link to be the - // href of the link. Stupid IE. - if(Xinha.is_ie) - { - if(/mailto:([^?<>]*)(\?[^<]*)?$/i.test(link.innerHTML)) - { - link.innerHTML = RegExp.$1; - } - } -*/ - - } - // Add Link - else - { - - // Insert a link, we let the editor do this, we figure it knows best - var tmp = Xinha.uniq("http://www.example.com/Link"); - editor._doc.execCommand("createlink", false, tmp); - - // Fix it up - var anchors = editor._doc.getElementsByTagName('a'); - for(var i = 0; i < anchors.length; i++) - { - var anchor = anchors[i]; - if(anchor.href == tmp) - { - // Found one. - if (!link) link = anchor; - for(var j in linkAttr) - { - anchor.setAttribute(j, linkAttr[j]); - } - } - } - - } - - editor.selectNodeContents(link); - editor.updateToolbar(); -}; - -// Remove a link -OpenCCM.prototype.linkRemove = function() -{ - - var values = this.dialogs["links"].hide(); - var link = this.link; - var editor = this.editor; - - if(link && link.tagName.toLowerCase() == 'a') - { - if(confirm(this._lc('Are you sure you wish to remove this link?'))) - { - var parent = link.parentNode; - while(link.hasChildNodes()) - { - parent.insertBefore(link.removeChild(link.childNodes[0]), link); - } - - parent.removeChild(link); - editor.updateToolbar(); - return true; - } - } -}; - -OpenCCM.prototype.linkBrowse = function(window) -{ - var baseURL = window.location.href; - var offset = baseURL.lastIndexOf("/"); - var destURL = baseURL.slice(0, offset+1) + "search.jsp?useURL=true&widget=getElementById('" + this.dialogs["links"].id["ci_href"] + "')"; - -// var searchDialog = new Xinha.Dialog(this.editor, destURL, '');//,{width:800, height:600}, {'closable':true}); -// searchDialog.show(); - window.open(destURL, "_blank", "scrollbars=yes,directories=no,toolbar=no,width=800,height=600,status=no,menubar=no"); - - return false; -} - -// Get selected anchor -OpenCCM.prototype._getSelectedAnchor = function() -{ - var sel = this.editor.getSelection(); - var rng = this.editor.createRange(sel); - var link = this.editor.activeElement(sel); - - if(link != null && link.tagName.toLowerCase() == 'a') - { - return link; - } - else - { - link = this.editor._getFirstAncestor(sel, 'a'); - if(link != null) - { - return link; - } - } - return null; -}; diff --git a/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl b/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl index c8f5e36fc..478de4833 100644 --- a/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl +++ b/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl @@ -92,23 +92,17 @@ select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/nav:category"/> +

applied navigation-link-list with these values:

navigation-id
-
- - -
-
navigation-id
-
min-level
- - - - - - +
max-level
+
+
current-level
+
+