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-94f89814c4dfmaster
parent
c94a9f8a2a
commit
205eedab73
|
|
@ -15,7 +15,6 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.ui;
|
package com.arsdigita.cms.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.BoxPanel;
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
|
@ -100,7 +99,6 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
// GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit"));
|
// GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit"));
|
||||||
// boxPanel.add(submit);
|
// boxPanel.add(submit);
|
||||||
// mainPanel.add(boxPanel);
|
// mainPanel.add(boxPanel);
|
||||||
|
|
||||||
//mainPanel.add(new FilterForm());
|
//mainPanel.add(new FilterForm());
|
||||||
mainPanel.setLeft(new FilterForm());
|
mainPanel.setLeft(new FilterForm());
|
||||||
|
|
||||||
|
|
@ -139,7 +137,6 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
// state.setValue(queryParam, data.getParameter(QUERY_PARAM).getValue());
|
// state.setValue(queryParam, data.getParameter(QUERY_PARAM).getValue());
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// public void process(final FormSectionEvent fse) throws FormProcessException {
|
// public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
// final FormData data = fse.getFormData();
|
// final FormData data = fse.getFormData();
|
||||||
// final PageState state = fse.getPageState();
|
// final PageState state = fse.getPageState();
|
||||||
|
|
@ -147,7 +144,6 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
// state.setValue(queryParam, data.get(QUERY_PARAM));
|
// state.setValue(queryParam, data.get(QUERY_PARAM));
|
||||||
// state.setValue(new StringParameter(ItemSearchPopup.QUERY), data.get(QUERY_PARAM));
|
// state.setValue(new StringParameter(ItemSearchPopup.QUERY), data.get(QUERY_PARAM));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void addQueryField(final String queryField) {
|
public void addQueryField(final String queryField) {
|
||||||
queryFields.addQueryField(queryField);
|
queryFields.addQueryField(queryField);
|
||||||
}
|
}
|
||||||
|
|
@ -170,15 +166,15 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
final TableColumnModel columnModel = getColumnModel();
|
final TableColumnModel columnModel = getColumnModel();
|
||||||
columnModel.add(new TableColumn(0,
|
columnModel.add(new TableColumn(0,
|
||||||
GlobalizationUtil.globalize(
|
GlobalizationUtil.globalize(
|
||||||
"cms.ui.item_search.flat.title").localize(),
|
"cms.ui.item_search.flat.title").localize(),
|
||||||
TABLE_COL_TITLE));
|
TABLE_COL_TITLE));
|
||||||
columnModel.add(new TableColumn(1,
|
columnModel.add(new TableColumn(1,
|
||||||
GlobalizationUtil.globalize(
|
GlobalizationUtil.globalize(
|
||||||
"cms.ui.item_search.flat.place").localize(),
|
"cms.ui.item_search.flat.place").localize(),
|
||||||
TABLE_COL_PLACE));
|
TABLE_COL_PLACE));
|
||||||
columnModel.add(new TableColumn(2,
|
columnModel.add(new TableColumn(2,
|
||||||
GlobalizationUtil.globalize(
|
GlobalizationUtil.globalize(
|
||||||
"cms.ui.item_search.flat.type").localize(),
|
"cms.ui.item_search.flat.type").localize(),
|
||||||
TABLE_COL_TYPE));
|
TABLE_COL_TYPE));
|
||||||
|
|
||||||
setModelBuilder(new ResultsTableModelBuilder());
|
setModelBuilder(new ResultsTableModelBuilder());
|
||||||
|
|
@ -202,7 +198,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
((DataCollection) collection.get(state)).setRange(paginator.getFirst(state), paginator.
|
((DataCollection) collection.get(state)).setRange(paginator.getFirst(state), paginator.
|
||||||
getLast(state) + 1);
|
getLast(state) + 1);
|
||||||
|
|
||||||
return new ResultsTableModel(table, state, (DataCollection) collection.get(state));
|
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);
|
//((DataCollection)collection.get(state)).setRange(paginator.getFirst(state), paginator.getLast(state) + 1);
|
||||||
|
|
||||||
return (int) ((DataCollection) collection.get(state)).size();
|
return (int) ((DataCollection) collection.get(state)).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -224,7 +219,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
private void query(final PageState state) {
|
private void query(final PageState state) {
|
||||||
final Session session = SessionManager.getSession();
|
final Session session = SessionManager.getSession();
|
||||||
final BigDecimal typeId = (BigDecimal) state.getValue(new BigDecimalParameter(
|
final BigDecimal typeId = (BigDecimal) state.getValue(new BigDecimalParameter(
|
||||||
ItemSearch.SINGLE_TYPE_PARAM));
|
ItemSearch.SINGLE_TYPE_PARAM));
|
||||||
if (typeId == null) {
|
if (typeId == null) {
|
||||||
collection.set(state, session.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE));
|
collection.set(state, session.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -237,12 +232,12 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
final String query = (String) state.getValue(queryParam);
|
final String query = (String) state.getValue(queryParam);
|
||||||
if ((query != null) && !query.isEmpty()) {
|
if ((query != null) && !query.isEmpty()) {
|
||||||
final StringBuffer buffer = new StringBuffer(String.format(
|
final StringBuffer buffer = new StringBuffer(String.format(
|
||||||
"((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
|
"((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
|
||||||
ContentItem.NAME, query,
|
ContentItem.NAME, query,
|
||||||
ContentPage.TITLE, query));
|
ContentPage.TITLE, query));
|
||||||
for (String field : queryFields.getQueryFields()) {
|
for (String field : queryFields.getQueryFields()) {
|
||||||
buffer.append(String.
|
buffer.append(String.
|
||||||
format(" or (lower(%s) like lower('%%%s%%'))", field, query));
|
format(" or (lower(%s) like lower('%%%s%%'))", field, query));
|
||||||
}
|
}
|
||||||
buffer.append(')');
|
buffer.append(')');
|
||||||
|
|
||||||
|
|
@ -282,7 +277,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
|
|
||||||
if ((collection != null) && collection.next()) {
|
if ((collection != null) && collection.next()) {
|
||||||
currentItem = (ContentItem) DomainObjectFactory.newInstance(collection.
|
currentItem = (ContentItem) DomainObjectFactory.newInstance(collection.
|
||||||
getDataObject());
|
getDataObject());
|
||||||
ret = true;
|
ret = true;
|
||||||
} else {
|
} else {
|
||||||
ret = false;
|
ret = false;
|
||||||
|
|
@ -355,20 +350,42 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
|
|
||||||
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
|
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
|
||||||
final String searchWidget = (String) state.getValue(new StringParameter(
|
final String searchWidget = (String) state.getValue(new StringParameter(
|
||||||
SEARCHWIDGET_PARAM));
|
SEARCHWIDGET_PARAM));
|
||||||
|
|
||||||
final ContentPage page = new ContentPage((BigDecimal) key);
|
final ContentPage page = new ContentPage((BigDecimal) key);
|
||||||
|
|
||||||
link.setOnClick(String.format(
|
final boolean useURL = "true".equals(state.getValue(new StringParameter(
|
||||||
"window.opener.document.%s.value=\"%s\";"
|
ItemSearchPopup.URL_PARAM)));
|
||||||
+ "window.opener.document.%s.value=\"%s\";"
|
|
||||||
+ "self.close();"
|
|
||||||
+ "return false;",
|
|
||||||
widget,
|
|
||||||
key.toString(),
|
|
||||||
searchWidget,
|
|
||||||
page.getTitle().replace("\"", "\\\"")));
|
|
||||||
|
|
||||||
|
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;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,7 +394,6 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
// protected Submit getSubmit() {
|
// protected Submit getSubmit() {
|
||||||
// return submit;
|
// return submit;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private class FilterForm extends Form implements FormInitListener, FormProcessListener {
|
private class FilterForm extends Form implements FormInitListener, FormProcessListener {
|
||||||
|
|
||||||
private final Submit submit;
|
private final Submit submit;
|
||||||
|
|
@ -405,7 +421,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
if ((query == null) || query.isEmpty()) {
|
if ((query == null) || query.isEmpty()) {
|
||||||
data.setParameter(QUERY_PARAM,
|
data.setParameter(QUERY_PARAM,
|
||||||
new ParameterData(queryParam, state.getValue(new StringParameter(
|
new ParameterData(queryParam, state.getValue(new StringParameter(
|
||||||
ItemSearchPopup.QUERY))));
|
ItemSearchPopup.QUERY))));
|
||||||
state.setValue(queryParam, data.getParameter(QUERY_PARAM).getValue());
|
state.setValue(queryParam, data.getParameter(QUERY_PARAM).getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -444,5 +460,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
public void reset() {
|
public void reset() {
|
||||||
queryFields = new ArrayList<String>();
|
queryFields = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,18 +59,16 @@ import com.arsdigita.util.Assert;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse folders and items. If the user clicks on a folder, the folder
|
* Browse folders and items. If the user clicks on a folder, the folder selection model is updated.
|
||||||
* selection model is updated. If the user clicks on any other item, an
|
* If the user clicks on any other item, an separate item selection model is updated.
|
||||||
* separate item selection model is updated.
|
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:lutter@arsdigita.com">David Lutterkort</a>
|
* @author <a href="mailto:lutter@arsdigita.com">David Lutterkort</a>
|
||||||
* @version $Revision: #9 $ $DateTime: 2004/08/17 23:15:09 $
|
* @version $Revision: #9 $ $DateTime: 2004/08/17 23:15:09 $
|
||||||
*/
|
*/
|
||||||
public class ItemSearchFolderBrowser extends Table {
|
public class ItemSearchFolderBrowser extends Table {
|
||||||
|
|
||||||
private static final org.apache.log4j.Logger s_log =
|
private static final org.apache.log4j.Logger s_log = org.apache.log4j.Logger.getLogger(
|
||||||
org.apache.log4j.Logger.getLogger(
|
ItemSearchFolderBrowser.class);
|
||||||
ItemSearchFolderBrowser.class);
|
|
||||||
private static GlobalizedMessage[] s_headers = {
|
private static GlobalizedMessage[] s_headers = {
|
||||||
globalize("cms.ui.folder.name"),
|
globalize("cms.ui.folder.name"),
|
||||||
globalize("cms.ui.folder.title"),
|
globalize("cms.ui.folder.title"),
|
||||||
|
|
@ -89,14 +87,14 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
setModelBuilder(builder);
|
setModelBuilder(builder);
|
||||||
|
|
||||||
m_paginator = new Paginator(builder, ContentSection.getConfig().
|
m_paginator = new Paginator(builder, ContentSection.getConfig().
|
||||||
getFolderBrowseListSize());
|
getFolderBrowseListSize());
|
||||||
|
|
||||||
m_currentFolder = currentFolder;
|
m_currentFolder = currentFolder;
|
||||||
|
|
||||||
setClassAttr("dataTable");
|
setClassAttr("dataTable");
|
||||||
|
|
||||||
getHeader().setDefaultRenderer(
|
getHeader().setDefaultRenderer(
|
||||||
new com.arsdigita.cms.ui.util.DefaultTableCellRenderer());
|
new com.arsdigita.cms.ui.util.DefaultTableCellRenderer());
|
||||||
m_nameColumn = getColumn(0);
|
m_nameColumn = getColumn(0);
|
||||||
m_nameColumn.setCellRenderer(new NameCellRenderer());
|
m_nameColumn.setCellRenderer(new NameCellRenderer());
|
||||||
|
|
||||||
|
|
@ -118,6 +116,7 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
p.addComponentStateParam(this, m_currentFolder.getStateParameter());
|
p.addComponentStateParam(this, m_currentFolder.getStateParameter());
|
||||||
|
|
||||||
p.addActionListener(new ActionListener() {
|
p.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
// MP: This action listener should only be called when the
|
// MP: This action listener should only be called when the
|
||||||
// folder browser is visible.
|
// folder browser is visible.
|
||||||
|
|
@ -142,9 +141,10 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FolderTableModelBuilder
|
private class FolderTableModelBuilder
|
||||||
extends AbstractTableModelBuilder implements PaginationModelBuilder {
|
extends AbstractTableModelBuilder implements PaginationModelBuilder {
|
||||||
|
|
||||||
private RequestLocal m_size = new RequestLocal() {
|
private RequestLocal m_size = new RequestLocal() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object initialValue(PageState state) {
|
protected Object initialValue(PageState state) {
|
||||||
Folder.ItemCollection itemColl = getItemCollection(state);
|
Folder.ItemCollection itemColl = getItemCollection(state);
|
||||||
|
|
@ -157,6 +157,7 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
|
|
||||||
};
|
};
|
||||||
private RequestLocal m_itemColl = new RequestLocal() {
|
private RequestLocal m_itemColl = new RequestLocal() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object initialValue(PageState state) {
|
protected Object initialValue(PageState state) {
|
||||||
Folder.ItemCollection itemColl = getItemCollection(state);
|
Folder.ItemCollection itemColl = getItemCollection(state);
|
||||||
|
|
@ -172,7 +173,7 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
|
|
||||||
public TableModel makeModel(Table t, PageState s) {
|
public TableModel makeModel(Table t, PageState s) {
|
||||||
FolderSelectionModel sel = ((ItemSearchFolderBrowser) t).
|
FolderSelectionModel sel = ((ItemSearchFolderBrowser) t).
|
||||||
getFolderSelectionModel();
|
getFolderSelectionModel();
|
||||||
Folder f = getCurrentFolder(s);
|
Folder f = getCurrentFolder(s);
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
|
|
@ -180,7 +181,7 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
s_log.debug("Selected folder is null");
|
s_log.debug("Selected folder is null");
|
||||||
} else {
|
} else {
|
||||||
s_log.debug("Selected folder: " + f.getLabel() + " " + f.
|
s_log.debug("Selected folder: " + f.getLabel() + " " + f.
|
||||||
getOID().toString());
|
getOID().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,7 +190,7 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
} else {
|
} else {
|
||||||
t.getRowSelectionModel().clearSelection(s);
|
t.getRowSelectionModel().clearSelection(s);
|
||||||
return new FolderTableModel((Folder.ItemCollection) m_itemColl.
|
return new FolderTableModel((Folder.ItemCollection) m_itemColl.
|
||||||
get(s));
|
get(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,9 +202,8 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal singleTypeID =
|
BigDecimal singleTypeID = (BigDecimal) state.getValue(new BigDecimalParameter(
|
||||||
(BigDecimal) state.getValue(new BigDecimalParameter(
|
ItemSearch.SINGLE_TYPE_PARAM));
|
||||||
ItemSearch.SINGLE_TYPE_PARAM));
|
|
||||||
|
|
||||||
if (singleTypeID != null) {
|
if (singleTypeID != null) {
|
||||||
|
|
||||||
|
|
@ -215,7 +215,7 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
|
|
||||||
// The content type must be either of the requested type
|
// The content type must be either of the requested type
|
||||||
or.addFilter(ff.equals(ContentItem.CONTENT_TYPE + "."
|
or.addFilter(ff.equals(ContentItem.CONTENT_TYPE + "."
|
||||||
+ ContentType.ID, singleTypeID));
|
+ ContentType.ID, singleTypeID));
|
||||||
|
|
||||||
// Or must be a sibling of the requested type
|
// Or must be a sibling of the requested type
|
||||||
/*
|
/*
|
||||||
|
|
@ -260,14 +260,14 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
final BigDecimal typeId) {
|
final BigDecimal typeId) {
|
||||||
final ContentType type = new ContentType(typeId);
|
final ContentType type = new ContentType(typeId);
|
||||||
if ((type.getDescendants() == null)
|
if ((type.getDescendants() == null)
|
||||||
|| type.getDescendants().trim().isEmpty()) {
|
|| type.getDescendants().trim().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
final String[] descendantsIds = type.getDescendants().split("/");
|
final String[] descendantsIds = type.getDescendants().split("/");
|
||||||
|
|
||||||
for (String descendantId : descendantsIds) {
|
for (String descendantId : descendantsIds) {
|
||||||
filter.addFilter(filterFactory.equals(String.format(
|
filter.addFilter(filterFactory.equals(String.format(
|
||||||
ContentItem.CONTENT_TYPE + "." + ContentType.ID),
|
ContentItem.CONTENT_TYPE + "." + ContentType.ID),
|
||||||
descendantId));
|
descendantId));
|
||||||
createSiblingFilter(filter, filterFactory, descendantId);
|
createSiblingFilter(filter, filterFactory, descendantId);
|
||||||
}
|
}
|
||||||
|
|
@ -294,26 +294,24 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the paginator should be visible,
|
* Indicates whether the paginator should be visible, based on the visibility of the folder
|
||||||
* based on the visibility of the folder browser itself
|
* browser itself and how many items are displayed
|
||||||
* and how many items are displayed
|
|
||||||
*
|
*
|
||||||
* @return true if folder browser is visible and there is more
|
* @return true if folder browser is visible and there is more than 1 page of items, false
|
||||||
* than 1 page of items, false otherwise
|
* otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
int size = ((Integer) m_size.get(state)).intValue();
|
int size = ((Integer) m_size.get(state)).intValue();
|
||||||
|
|
||||||
return ItemSearchFolderBrowser.this.isVisible(state)
|
return ItemSearchFolderBrowser.this.isVisible(state)
|
||||||
&& (size
|
&& (size
|
||||||
> ContentSection.getConfig().getFolderBrowseListSize());
|
> ContentSection.getConfig().getFolderBrowseListSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce links to view an item or control links for folders
|
* Produce links to view an item or control links for folders to change into the folder.
|
||||||
* to change into the folder.
|
|
||||||
*/
|
*/
|
||||||
private class NameCellRenderer extends DefaultTableCellRenderer {
|
private class NameCellRenderer extends DefaultTableCellRenderer {
|
||||||
|
|
||||||
|
|
@ -342,27 +340,24 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
//String url =
|
//String url =
|
||||||
//resolver.generateItemURL
|
//resolver.generateItemURL
|
||||||
//(state, id, name, section, coll.getVersion()));
|
//(state, id, name, section, coll.getVersion()));
|
||||||
|
|
||||||
SimpleContainer container = new SimpleContainer();
|
SimpleContainer container = new SimpleContainer();
|
||||||
|
|
||||||
String widget =
|
String widget = (String) state.getValue(new StringParameter(
|
||||||
(String) state.getValue(new StringParameter(
|
ItemSearchPopup.WIDGET_PARAM));
|
||||||
ItemSearchPopup.WIDGET_PARAM));
|
|
||||||
String searchWidget = (String) state.getValue(
|
String searchWidget = (String) state.getValue(
|
||||||
new StringParameter("searchWidget"));
|
new StringParameter("searchWidget"));
|
||||||
boolean useURL =
|
boolean useURL = "true".equals(state.getValue(new StringParameter(
|
||||||
"true".equals(state.getValue(new StringParameter(
|
ItemSearchPopup.URL_PARAM)));
|
||||||
ItemSearchPopup.URL_PARAM)));
|
|
||||||
|
|
||||||
String fillString = useURL
|
String fillString = useURL
|
||||||
? ItemSearchPopup.getItemURL(
|
? ItemSearchPopup.getItemURL(
|
||||||
state.getRequest(),
|
state.getRequest(),
|
||||||
coll.getDomainObject().getOID()) : id + " (" + name + ")";
|
coll.getDomainObject().getOID()) : id + " (" + name + ")";
|
||||||
String title = ((ContentPage) coll.getDomainObject()).getTitle();
|
String title = ((ContentPage) coll.getDomainObject()).getTitle();
|
||||||
|
|
||||||
Label js = new Label(
|
Label js = new Label(
|
||||||
generateJSLabel(id, widget, searchWidget, fillString, title),
|
generateJSLabel(id, widget, searchWidget, fillString, title),
|
||||||
false);
|
false);
|
||||||
container.add(js);
|
container.add(js);
|
||||||
|
|
||||||
String url = "#";
|
String url = "#";
|
||||||
|
|
@ -385,25 +380,27 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
buffer.append(" <!-- \n");
|
buffer.append(" <!-- \n");
|
||||||
buffer.append(" function fillItem").append(id).append("() { \n");
|
buffer.append(" function fillItem").append(id).append("() { \n");
|
||||||
buffer.append(" window.opener.document.").append(widget).append(".value=\"").
|
buffer.append(" window.opener.document.").append(widget).append(".value=\"").
|
||||||
append(fill).append("\";\n");
|
append(fill).append("\";\n");
|
||||||
buffer.append(" window.opener.document.").append(searchWidget).append(".value=\"").
|
if (searchWidget != null) {
|
||||||
|
buffer.append(" window.opener.document.").append(searchWidget).append(".value=\"").
|
||||||
append(title.
|
append(title.
|
||||||
replace("\"", "\\\"")).append("\";\n");
|
replace("\"", "\\\"")).append("\";\n");
|
||||||
|
}
|
||||||
// set protocol to 'other' in FCKEditor, else relative url prepended by http://
|
// set protocol to 'other' in FCKEditor, else relative url prepended by http://
|
||||||
if (Bebop.getConfig().getDHTMLEditor().equals(
|
if (Bebop.getConfig().getDHTMLEditor().equals(
|
||||||
BebopConstants.BEBOP_FCKEDITOR)) {
|
BebopConstants.BEBOP_FCKEDITOR)) {
|
||||||
buffer.append(
|
buffer.append(
|
||||||
" if(window.opener.document.getElementById('cmbLinkProtocol')) {\n");
|
" if(window.opener.document.getElementById('cmbLinkProtocol')) {\n");
|
||||||
buffer.append(
|
buffer.append(
|
||||||
" window.opener.document.getElementById('cmbLinkProtocol').value=\"\";\n");
|
" window.opener.document.getElementById('cmbLinkProtocol').value=\"\";\n");
|
||||||
buffer.append(" }\n");
|
buffer.append(" }\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.append(" self.close(); \n"
|
buffer.append(" self.close(); \n"
|
||||||
+ " return false; \n"
|
+ " return false; \n"
|
||||||
+ " } \n"
|
+ " } \n"
|
||||||
+ " --> \n"
|
+ " --> \n"
|
||||||
+ " </script> ");
|
+ " </script> ");
|
||||||
|
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
@ -442,15 +439,15 @@ public class ItemSearchFolderBrowser extends Table {
|
||||||
return m_itemColl.getTypeLabel();
|
return m_itemColl.getTypeLabel();
|
||||||
default:
|
default:
|
||||||
throw new IndexOutOfBoundsException("Column index "
|
throw new IndexOutOfBoundsException("Column index "
|
||||||
+ columnIndex
|
+ columnIndex
|
||||||
+ " not in table model.");
|
+ " not in table model.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getKeyAt(int columnIndex) {
|
public Object getKeyAt(int columnIndex) {
|
||||||
// Mark folders by using their negative ID (dirty, dirty)
|
// Mark folders by using their negative ID (dirty, dirty)
|
||||||
return (m_itemColl.isFolder()) ? m_itemColl.getID().negate()
|
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.
|
* Getting the GlobalizedMessage using a CMS Class targetBundle.
|
||||||
*
|
*
|
||||||
* @param key The resource key
|
* @param key The resource key
|
||||||
|
*
|
||||||
* @pre ( key != null )
|
* @pre ( key != null )
|
||||||
*/
|
*/
|
||||||
private static GlobalizedMessage globalize(String key) {
|
private static GlobalizedMessage globalize(String key) {
|
||||||
//return FolderManipulator.globalize(key);
|
//return FolderManipulator.globalize(key);
|
||||||
final GlobalisationUtil util = new GlobalisationUtil(
|
final GlobalisationUtil util = new GlobalisationUtil(
|
||||||
"com.arsdigita.cms."
|
"com.arsdigita.cms."
|
||||||
+ "ui.folder.CMSFolderResources");
|
+ "ui.folder.CMSFolderResources");
|
||||||
return util.globalize(key);
|
return util.globalize(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
@ -30,32 +31,32 @@ import com.arsdigita.search.Search;
|
||||||
import com.arsdigita.search.Document;
|
import com.arsdigita.search.Document;
|
||||||
import com.arsdigita.search.ui.QueryGenerator;
|
import com.arsdigita.search.ui.QueryGenerator;
|
||||||
import com.arsdigita.search.ui.ResultsPane;
|
import com.arsdigita.search.ui.ResultsPane;
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extension of {@link ItemSearch} for use in a popup search window. The display of results is
|
* 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
|
* altered so that selecting a result closes the window & passes the id of the selected item back to
|
||||||
* to the opener.
|
* the opener.
|
||||||
*
|
*
|
||||||
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
||||||
* @version $Id: ItemSearchPopup.java 1397 2006-11-29 14:10:38Z sskracic $
|
* @version $Id: ItemSearchPopup.java 1397 2006-11-29 14:10:38Z sskracic $
|
||||||
*/
|
*/
|
||||||
public class ItemSearchPopup extends ItemSearch {
|
public class ItemSearchPopup extends ItemSearch {
|
||||||
|
|
||||||
private static final org.apache.log4j.Logger s_log =
|
private static final org.apache.log4j.Logger s_log = org.apache.log4j.Logger.getLogger(
|
||||||
org.apache.log4j.Logger.getLogger(ItemSearchPopup.class);
|
ItemSearchPopup.class);
|
||||||
public static final String WIDGET_PARAM = "widget";
|
public static final String WIDGET_PARAM = "widget";
|
||||||
public static final String URL_PARAM = "useURL";
|
public static final String URL_PARAM = "useURL";
|
||||||
public static final String QUERY = "query";
|
public static final String QUERY = "query";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new
|
* Construct a new <code>ItemSearchPopup</code> component
|
||||||
* <code>ItemSearchPopup</code> component
|
|
||||||
*
|
*
|
||||||
* @param context the context for the retrieved items. Should be
|
* @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
|
* @param limitToContentSection limit the search to the current content section
|
||||||
*/
|
*/
|
||||||
public ItemSearchPopup(String context, boolean limitToContentSection) {
|
public ItemSearchPopup(String context, boolean limitToContentSection) {
|
||||||
|
|
@ -98,7 +99,11 @@ public class ItemSearchPopup extends ItemSearch {
|
||||||
//map.setParameter("oid", oid.toString());
|
//map.setParameter("oid", oid.toString());
|
||||||
//return URL.there(request, "/redirect/", map).toString();
|
//return URL.there(request, "/redirect/", map).toString();
|
||||||
// Always link directly to the live version.
|
// 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 {
|
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)));
|
boolean useURL = "true".equals(state.getValue(new StringParameter(URL_PARAM)));
|
||||||
|
|
||||||
String fillString = useURL
|
String fillString = useURL
|
||||||
? getItemURL(state.getRequest(), doc.getOID())
|
? getItemURL(state.getRequest(), doc.getOID())
|
||||||
: doc.getOID().get("id").toString();
|
: doc.getOID().get("id").toString();
|
||||||
String title = doc.getTitle();
|
String title = doc.getTitle();
|
||||||
|
|
||||||
Element jsLabel = Search.newElement("jsAction");
|
Element jsLabel = Search.newElement("jsAction");
|
||||||
jsLabel.addAttribute("name", "fillItem"
|
jsLabel.addAttribute("name", "fillItem"
|
||||||
+ doc.getOID().get("id") + "()");
|
+ doc.getOID().get("id") + "()");
|
||||||
jsLabel.setText(generateJSLabel((BigDecimal) doc.getOID().get("id"),
|
jsLabel.setText(generateJSLabel((BigDecimal) doc.getOID().get("id"),
|
||||||
widget, searchWidget, fillString, title));
|
widget, searchWidget, fillString, title));
|
||||||
element.addContent(jsLabel);
|
element.addContent(jsLabel);
|
||||||
|
|
@ -136,18 +141,21 @@ public class ItemSearchPopup extends ItemSearch {
|
||||||
return element;
|
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 " <script language=javascript> "
|
return " <script language=javascript> "
|
||||||
+ " <!-- \n"
|
+ " <!-- \n"
|
||||||
+ " function fillItem" + id + "() { \n"
|
+ " function fillItem" + id + "() { \n"
|
||||||
+ " window.opener.document." + widget + ".value=\"" + fill + "\";\n"
|
+ " window.opener.document." + widget + ".value=\"" + fill + "\";\n"
|
||||||
+ " window.opener.document." + searchWidget + ".value=\"" + title.replace("\"", "\\\"") + "\";\n"
|
+ " window.opener.document." + searchWidget + ".value=\"" + title.replace(
|
||||||
+ " self.close(); \n"
|
"\"", "\\\"") + "\";\n"
|
||||||
+ " return false; \n"
|
+ " self.close(); \n"
|
||||||
+ " } \n"
|
+ " return false; \n"
|
||||||
+ " --> \n"
|
+ " } \n"
|
||||||
+ " </script> ";
|
+ " --> \n"
|
||||||
|
+ " </script> ";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ xinha_config=xinha_config?xinha_config():new Xinha.Config();
|
||||||
["separator","subscript","superscript"],
|
["separator","subscript","superscript"],
|
||||||
["separator","justifyleft","justifycenter","justifyright","justifyfull"],
|
["separator","justifyleft","justifycenter","justifyright","justifyfull"],
|
||||||
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
|
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
|
||||||
["separator","createlink"],
|
["separator","ccmcreatelink"],
|
||||||
["separator","undo","redo","selectall"],
|
["separator","undo","redo","selectall"],
|
||||||
(Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite"]),
|
(Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite"]),
|
||||||
["separator","killword","clearfonts","removeformat"],
|
["separator","killword","clearfonts","removeformat"],
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ function OpenCCM(editor)
|
||||||
|
|
||||||
cfg.registerButton(
|
cfg.registerButton(
|
||||||
{
|
{
|
||||||
id : "createlink",
|
id : "ccmcreatelink",
|
||||||
tooltip : this._lc("OpenCCMInsertLink"),
|
tooltip : this._lc("OpenCCMInsertLink"),
|
||||||
image : ["ed_buttons_main.png", 6, 1],
|
image : [editor.imgURL("iconsets/Crystal/ed_buttons_main.png"), 6, 1],
|
||||||
textMode : false,
|
textMode : false,
|
||||||
action : function(e, objname, obj) { self.showLinkDialog(self._getSelectedAnchor()); }
|
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;
|
hasLinkButton = true;
|
||||||
cfg.addToolbarElement("createlink", "createlink", 0);
|
cfg.addToolbarElement("ccmcreatelink", "ccmcreatelink", 0);
|
||||||
} else {
|
} else {
|
||||||
cfg.addToolbarElement("createlink", "undo", -1);
|
cfg.addToolbarElement("ccmcreatelink", "undo", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.findButton("insertimage"))
|
if(this.findButton("insertimage"))
|
||||||
|
|
@ -56,7 +56,7 @@ function OpenCCM(editor)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cfg.addToolbarElement("insertimage", "createlink", 1);
|
cfg.addToolbarElement("insertimage", "ccmcreatelink", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!hasLinkButton && !hasImageButton)
|
if(!hasLinkButton && !hasImageButton)
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,9 @@ OpenCCM.prototype.showImageDialog = function(image)
|
||||||
width : "",
|
width : "",
|
||||||
height : "",
|
height : "",
|
||||||
caption : "",
|
caption : "",
|
||||||
|
|
||||||
alignment : "",
|
alignment : "",
|
||||||
caption : "",
|
caption : "",
|
||||||
fancybox : "",
|
fancybox : "",
|
||||||
|
|
||||||
aspect : ""
|
aspect : ""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,238 +1,247 @@
|
||||||
OpenCCM.prototype.showLinkDialog = function(link)
|
OpenCCM.prototype.showLinkDialog = function(link)
|
||||||
{
|
{
|
||||||
if (!this.dialogs["links"])
|
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';
|
this.prepareLinkDialog();
|
||||||
data.ci_name = link.alt;
|
|
||||||
data.ci_href = href;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(external)
|
if (!link && this.editor.selectionEmpty(this.editor.getSelection()))
|
||||||
{
|
{
|
||||||
data.type = 'external';
|
alert(this._lc("You need to select some text before creating a link"));
|
||||||
data.href = href;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
var editor = this.editor;
|
||||||
|
this.link = link;
|
||||||
|
|
||||||
// now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog
|
var data =
|
||||||
this.dialogs["links"].show(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
|
// Prepare the link dialog
|
||||||
OpenCCM.prototype.prepareLinkDialog = function()
|
OpenCCM.prototype.prepareLinkDialog = function()
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
var editor = this.editor;
|
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
|
// Connect the OK and Cancel buttons
|
||||||
dialog.getElementById('ok').onclick = function() { self.linkApply(); };
|
dialog.getElementById('ok').onclick = function() {
|
||||||
dialog.getElementById('clear').onclick = function() { self.linkRemove(); };
|
self.linkApply();
|
||||||
dialog.getElementById('cancel').onclick = function() { self.dialogs["links"].hide()};
|
};
|
||||||
|
dialog.getElementById('clear').onclick = function() {
|
||||||
|
self.linkRemove();
|
||||||
|
};
|
||||||
|
dialog.getElementById('cancel').onclick = function() {
|
||||||
|
self.dialogs["links"].hide()
|
||||||
|
};
|
||||||
|
|
||||||
// Connect the Browse and Search button
|
// Connect the Browse and Search button
|
||||||
dialog.getElementById('ci_browse').onclick = function() { self.linkBrowse(window); };
|
dialog.getElementById('ci_browse').onclick = function() {
|
||||||
/* Suche deaktivert, bis eine bessere JSP / Java-Klasse vorhanden ist
|
self.linkBrowse(window);
|
||||||
dialog.getElementById('ci_search').onclick = function() { alert("Das geht auch noch nicht.");};
|
};
|
||||||
*/
|
/* 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()
|
OpenCCM.prototype.linkApply = function()
|
||||||
{
|
{
|
||||||
|
|
||||||
var values = this.dialogs["links"].hide();
|
var values = this.dialogs["links"].hide();
|
||||||
var link = this.link;
|
var link = this.link;
|
||||||
var editor = this.editor;
|
var editor = this.editor;
|
||||||
|
|
||||||
var linkAttr =
|
var linkAttr =
|
||||||
{
|
{
|
||||||
href : '',
|
href: '',
|
||||||
alt : '',
|
alt: '',
|
||||||
title : '',
|
title: '',
|
||||||
class : ''
|
class: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// Read needed form values
|
// Read needed form values
|
||||||
switch(values.type)
|
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]);
|
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 not all mandatory informations are set
|
||||||
// If we change a mailto link in IE for some hitherto unknown
|
if (linkAttr.href == "" || linkAttr.title == "")
|
||||||
// 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))
|
// don't do anything at all
|
||||||
{
|
return false;
|
||||||
link.innerHTML = RegExp.$1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
// Modify Link
|
||||||
// Add Link
|
if (link && link.tagName.toLowerCase() == "a")
|
||||||
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)
|
for (var i in linkAttr)
|
||||||
{
|
|
||||||
// Found one.
|
|
||||||
if (!link) link = anchor;
|
|
||||||
for(var j 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
|
// Remove a link
|
||||||
OpenCCM.prototype.linkRemove = function()
|
OpenCCM.prototype.linkRemove = function()
|
||||||
{
|
{
|
||||||
|
|
||||||
var values = this.dialogs["links"].hide();
|
var values = this.dialogs["links"].hide();
|
||||||
var link = this.link;
|
var link = this.link;
|
||||||
var editor = this.editor;
|
var editor = this.editor;
|
||||||
|
|
||||||
if(link && link.tagName.toLowerCase() == 'a')
|
if (link && link.tagName.toLowerCase() == 'a')
|
||||||
{
|
|
||||||
if(confirm(this._lc('Are you sure you wish to remove this link?')))
|
|
||||||
{
|
{
|
||||||
var parent = link.parentNode;
|
if (confirm(this._lc('Are you sure you wish to remove this link?')))
|
||||||
while(link.hasChildNodes())
|
{
|
||||||
{
|
var parent = link.parentNode;
|
||||||
parent.insertBefore(link.removeChild(link.childNodes[0]), link);
|
while (link.hasChildNodes())
|
||||||
}
|
{
|
||||||
|
parent.insertBefore(link.removeChild(link.childNodes[0]), link);
|
||||||
|
}
|
||||||
|
|
||||||
parent.removeChild(link);
|
parent.removeChild(link);
|
||||||
editor.updateToolbar();
|
editor.updateToolbar();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
OpenCCM.prototype.linkBrowse = function(window)
|
OpenCCM.prototype.linkBrowse = function(window)
|
||||||
{
|
{
|
||||||
var baseURL = window.location.href;
|
var baseURL = window.location.href;
|
||||||
var offset = baseURL.lastIndexOf("/");
|
var offset = baseURL.lastIndexOf("/");
|
||||||
var destURL = baseURL.slice(0, offset+1) + "search.jsp?useURL=true&widget=getElementById('" + this.dialogs["links"].id["ci_href"] + "')";
|
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});
|
// var searchDialog = new Xinha.Dialog(this.editor, destURL, '');//,{width:800, height:600}, {'closable':true});
|
||||||
// searchDialog.show();
|
// 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
|
// Get selected anchor
|
||||||
OpenCCM.prototype._getSelectedAnchor = function()
|
OpenCCM.prototype._getSelectedAnchor = function()
|
||||||
{
|
{
|
||||||
var sel = this.editor.getSelection();
|
var sel = this.editor.getSelection();
|
||||||
var rng = this.editor.createRange(sel);
|
var rng = this.editor.createRange(sel);
|
||||||
var link = this.editor.activeElement(sel);
|
var link = this.editor.activeElement(sel);
|
||||||
|
|
||||||
if(link != null && link.tagName.toLowerCase() == 'a')
|
if (link != null && link.tagName.toLowerCase() == 'a')
|
||||||
{
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
link = this.editor._getFirstAncestor(sel, 'a');
|
|
||||||
if(link != null)
|
|
||||||
{
|
{
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
return null;
|
{
|
||||||
|
link = this.editor._getFirstAncestor(sel, 'a');
|
||||||
|
if (link != null)
|
||||||
|
{
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 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);
|
|
||||||
|
|
||||||
|
|
@ -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; } );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,179 +0,0 @@
|
||||||
<style>
|
|
||||||
.common {
|
|
||||||
margin: 0.4em;
|
|
||||||
}
|
|
||||||
fieldset {
|
|
||||||
margin: 0.6em 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
label.key {
|
|
||||||
clear: left;
|
|
||||||
float: left;
|
|
||||||
width: 5em;
|
|
||||||
padding: 0.25em 0.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldset label.key {
|
|
||||||
width: 8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldset.preview {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
margin-left: 5.5em;
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldset .value {
|
|
||||||
margin-left: 8.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.withButton {
|
|
||||||
margin: 0em 0.2em 0em 12em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.withButton input[type="text"] {
|
|
||||||
float: left;
|
|
||||||
margin-left: -6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.withButton input[type="button"] {
|
|
||||||
position: relative;
|
|
||||||
width: 5em !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
width: auto !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="text"] {
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
label.preview {
|
|
||||||
display: block;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.itemname {
|
|
||||||
margin: 0.1em;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0.3em;
|
|
||||||
padding: 0.2em;
|
|
||||||
font-style: italic;
|
|
||||||
color: #4a4a4a;
|
|
||||||
background-color: #dddddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttons {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview img {
|
|
||||||
display: block;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<h1 id="[h1]" class="heading">
|
|
||||||
<l10n>Insert/Modify Image</l10n>
|
|
||||||
</h1>
|
|
||||||
<div style="position:relative">
|
|
||||||
<div id="[options]">
|
|
||||||
<div class="common" id="[common]">
|
|
||||||
<label class="key" for="[name]">
|
|
||||||
<l10n>Name:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value withButton">
|
|
||||||
<input class="itemname" type="text" name="[name]" id="[name]" disabled="disabled"/>
|
|
||||||
<input type="button"" name="[browse]" id="[browse]" value="_(Browse)">
|
|
||||||
</div>
|
|
||||||
<label class="key" for="[alt]">
|
|
||||||
<l10n>Alternate:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="text" name="[alt]" id="[alt]" title="_(Insert image alternate text)" />
|
|
||||||
</div>
|
|
||||||
<label class="key" for="[title]">
|
|
||||||
<l10n>Title:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="text" name="[title]" id="[title]" title="_(Insert image title)" />
|
|
||||||
</div>
|
|
||||||
<!--
|
|
||||||
<label class="key" for="[context]">
|
|
||||||
<l10n>Caption:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="text" name="[caption]" id="[caption]" title="_(Insert caption)" />
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="[src]" id="[src]"/>
|
|
||||||
|
|
||||||
<fieldset id="[layout]">
|
|
||||||
<legend>
|
|
||||||
<l10n>Layout</l10n>
|
|
||||||
</legend>
|
|
||||||
<label class="key" for="[alignment]">
|
|
||||||
<l10n>Alignment:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<select size="1" name="[alignment]" id="[alignment]" title="_(Positioning of this image)">
|
|
||||||
<option value="none" ><l10n>Not set</l10n></option>
|
|
||||||
<option value="left" ><l10n>Left</l10n></option>
|
|
||||||
<option value="center"><l10n>Center</l10n></option>
|
|
||||||
<option value="right" ><l10n>Right</l10n></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<label class="key" for="[caption]">
|
|
||||||
<l10n>Show Caption:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="checkbox" name="[caption]" id="[caption]" title="_(Show caption)" checked="checked"/>
|
|
||||||
</div>
|
|
||||||
<label class="key" for="[fancybox]">
|
|
||||||
<l10n>Fancybox:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<select size="1" name="[fancybox]" id="[fancybox]" title="_()">
|
|
||||||
<option value="none" ><l10n>None</l10n></option>
|
|
||||||
<option value="imageZoom" ><l10n>Zoom</l10n></option>
|
|
||||||
<option value="imageGallery"><l10n>Gallery</l10n></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset id="[dimensions]">
|
|
||||||
<legend>
|
|
||||||
<l10n>Dimension</l10n>
|
|
||||||
</legend>
|
|
||||||
<label class="key" for="[width]">
|
|
||||||
<l10n>Width:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="text" name="[width]" id="[width]" title="_(Resize to width)"/>
|
|
||||||
</div>
|
|
||||||
<label class="key" for="[height]">
|
|
||||||
<l10n>Height:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="text" name="[height]" id="[height]" title="_(Resize to height)"/>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="[aspect]" id="[aspect]"/>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset id="[preview]" class="preview">
|
|
||||||
<legend>
|
|
||||||
<l10n>Preview</l10n>
|
|
||||||
</legend>
|
|
||||||
<img src="about:blank" id="[ipreview]">
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
<div class="buttons" id="[buttons]">
|
|
||||||
<input type="button" id="[ok]" value="_(OK)" />
|
|
||||||
<input type="button" id="[remove]" value="_(Remove)"/>
|
|
||||||
<input type="button" id="[cancel]" value="_(Cancel)"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -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);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -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"
|
|
||||||
}
|
|
||||||
|
|
@ -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"
|
|
||||||
}
|
|
||||||
|
|
@ -1,155 +0,0 @@
|
||||||
<style>
|
|
||||||
.common {
|
|
||||||
margin: 0.4em;
|
|
||||||
}
|
|
||||||
fieldset {
|
|
||||||
margin: 0.6em 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
label.key {
|
|
||||||
clear: left;
|
|
||||||
float: left;
|
|
||||||
width: 5em;
|
|
||||||
padding: 0.25em 0.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
margin-left: 5.5em;
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.withButton {
|
|
||||||
margin: 0em 0.2em 0em 12em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.withButton input[type="text"] {
|
|
||||||
float: left;
|
|
||||||
margin-left: -6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.withButton input[type="button"] {
|
|
||||||
position: relative;
|
|
||||||
width: 5em !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
width: auto !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="text"] {
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.itemname {
|
|
||||||
margin: 0.1em;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0.3em;
|
|
||||||
padding: 0.2em;
|
|
||||||
font-style: italic;
|
|
||||||
color: #4a4a4a;
|
|
||||||
background-color: #dddddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttons {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<h1 id="[h1]">
|
|
||||||
<l10n>Insert/Modify Link</l10n>
|
|
||||||
</h1>
|
|
||||||
<div style="position:relative">
|
|
||||||
<div id="[options]">
|
|
||||||
<div class="common">
|
|
||||||
<label class="key" for="[title]">
|
|
||||||
<l10n>Title:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="text" name="[title]" id="[title]"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<fieldset id="[fieldset_internal]">
|
|
||||||
<legend>
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="[type]" id="[type_internal]" value="internal" checked="checked"/>
|
|
||||||
<l10n>Internal Link</l10n>
|
|
||||||
</label>
|
|
||||||
</legend>
|
|
||||||
<label class="key" for="[ci_name]">
|
|
||||||
<l10n>Item:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value withButton">
|
|
||||||
<!-- Ausgeblendet, bis es eine spezielle JSP / Java-Klasse gibt.
|
|
||||||
<input class="itemname" type="text" name="[ci_name]" id="[ci_name]" disabled="disabled" value="_(No item selected)"/>
|
|
||||||
-->
|
|
||||||
<!-- Die folgende Zeile muß entfernt werden, wenn eine bessere JSP / Java-Klasse vorhanden ist -->
|
|
||||||
<input type="text" disabled="disabled" name="[ci_href]" id="[ci_href]" value=""/>
|
|
||||||
<input type="button" name="[ci_browse]" id="[ci_browse]" value="_(Browse)"/>
|
|
||||||
</div>
|
|
||||||
<!-- Ausblenden, bis es eine spezielle JSP / Java-Klasse gibt, die besser mit externen Parametern arbeitet
|
|
||||||
<div class="value withButton">
|
|
||||||
<input type="text" name="[ci_searchfield]" id="[ci_searchfield]" value=""/>
|
|
||||||
<input type="button" name="[ci_search]" id="[ci_search]" value="_(Search)"/>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="[ci_href]" id="[ci_href]" value=""/>
|
|
||||||
-->
|
|
||||||
</fieldset>
|
|
||||||
<fieldset id="[fieldset_external]">
|
|
||||||
<legend>
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="[type]" id="[type_external]" value="external"/>
|
|
||||||
<l10n>External Link</l10n>
|
|
||||||
</label>
|
|
||||||
</legend>
|
|
||||||
<label class="key" for="[href]">
|
|
||||||
<l10n>URL:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input type="text" name="[href]" id="[href]" value=""/>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<!-- Evt. für spätere Erweiteung, aber eigentlich sollten Links auf Contact-Items verwendet werden -->
|
|
||||||
<!--
|
|
||||||
<fieldset id="[fieldset_mailto]">
|
|
||||||
<legend>
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="[type]" id="[type_mailto]" value="mailto"/>
|
|
||||||
<l10n>Email Link</l10n>
|
|
||||||
</label>
|
|
||||||
</legend>
|
|
||||||
<label class="key" for="[to]">
|
|
||||||
<l10n>Email Address:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<input "type="text" name="[to]" id="[to]" value=""/>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
-->
|
|
||||||
<!-- Für spätere Erweiterung. Scanne nach Anchor und trage sie ein -->
|
|
||||||
<!--
|
|
||||||
<fieldset id="[fieldset_anchor]">
|
|
||||||
<legend>
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="[type]" id="[type_anchor]" value="anchor"/>
|
|
||||||
<l10n>Anchor Link</l10n>
|
|
||||||
</label>
|
|
||||||
</legend>
|
|
||||||
<label class="key" "for="[anchor]">
|
|
||||||
<l10n>Anchor:</l10n>
|
|
||||||
</label>
|
|
||||||
<div class="value">
|
|
||||||
<select name="[anchor]" id="[anchor]">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
-->
|
|
||||||
<div class="buttons">
|
|
||||||
<input type="button" id="[ok]" value="_(OK)" />
|
|
||||||
<input type="button" id="[clear]" value="_(Remove Link)" />
|
|
||||||
<input type="button" id="[cancel]" value="_(Cancel)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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;
|
|
||||||
};
|
|
||||||
|
|
@ -92,23 +92,17 @@
|
||||||
select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/nav:category"/>
|
select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/nav:category"/>
|
||||||
<xsl:param name="navigation-link-layout" select="."/>
|
<xsl:param name="navigation-link-layout" select="."/>
|
||||||
|
|
||||||
|
<h1>applied navigation-link-list with these values:</h1>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>navigation-id</dt>
|
<dt>navigation-id</dt>
|
||||||
<dd><xsl:value-of select="$navigation-id"/></dd>
|
<dd><xsl:value-of select="$navigation-id"/></dd>
|
||||||
</dl>
|
|
||||||
|
|
||||||
|
|
||||||
<dt>
|
|
||||||
<dt>navigation-id</dt>
|
|
||||||
<dd><xsl:value-of select="$navigation-id"/></dd>
|
|
||||||
<dt>min-level</dt>
|
<dt>min-level</dt>
|
||||||
<dd><xsl:value-of select="$min-level"/></dd>
|
<dd><xsl:value-of select="$min-level"/></dd>
|
||||||
<xsl:value-of select="concat('navigation-id = ', $navigation-id)"/>
|
<dt>max-level</dt>
|
||||||
<xsl:value-of select="concat('min-level = ', $min-level)"/>
|
<dd><xsl:value-of select="$max-level"/></dd>
|
||||||
<xsl:value-of select="concat('max-level = ', $max-level)"/>
|
<dt>current-level</dt>
|
||||||
<xsl:value-of select="concat('current-level = ', $current-level, '; ')"/>
|
<dd><xsl:value-of select="$current-level"/></dd>
|
||||||
<xsl:value-of select="count($current-level-tree)"/>
|
</dl>
|
||||||
</dt>
|
|
||||||
|
|
||||||
<xsl:if test="$current-level >= min-level">
|
<xsl:if test="$current-level >= min-level">
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue