The images attached to a ContentItem are now shown in a table.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2696 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
03f920d8c6
commit
ba8419d8b2
|
|
@ -7,3 +7,5 @@ cms.contentassets.ui.image_step.move_attached_image_down=Move down
|
||||||
cms.contentassets.ui.image_step.move_attached_image_up=Move up
|
cms.contentassets.ui.image_step.move_attached_image_up=Move up
|
||||||
cms.contentassets.ui.image_step.edit_attached_image=Edit caption
|
cms.contentassets.ui.image_step.edit_attached_image=Edit caption
|
||||||
cms.contentassets.ui.image_step.caption=Caption
|
cms.contentassets.ui.image_step.caption=Caption
|
||||||
|
cms.contentassets.ui.image_step.image_table.thumbnail=Thumbnail
|
||||||
|
cms.contentassets.ui.image_step.remove_attached_image.confirm=Are you sure to remove this attached image?
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,5 @@ cms.contentassets.ui.image_step.move_attached_image_down=Nach unten verschieben
|
||||||
cms.contentassets.ui.image_step.move_attached_image_up=Nach oben verschieben
|
cms.contentassets.ui.image_step.move_attached_image_up=Nach oben verschieben
|
||||||
cms.contentassets.ui.image_step.edit_attached_image=Bildunterschrift editieren
|
cms.contentassets.ui.image_step.edit_attached_image=Bildunterschrift editieren
|
||||||
cms.contentassets.ui.image_step.caption=Bildunterschrift
|
cms.contentassets.ui.image_step.caption=Bildunterschrift
|
||||||
|
cms.contentassets.ui.image_step.image_table.thumbnail=Vorschau
|
||||||
|
cms.contentassets.ui.image_step.remove_attached_image.confirm=Sind Sie sicher das Sie die Zuordnung dieses Bildes entfernen m\u00f6chten?
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,5 @@ cms.contentassets.ui.image_step.move_attached_image_down=Move down
|
||||||
cms.contentassets.ui.image_step.move_attached_image_up=Move up
|
cms.contentassets.ui.image_step.move_attached_image_up=Move up
|
||||||
cms.contentassets.ui.image_step.edit_attached_image=Edit caption
|
cms.contentassets.ui.image_step.edit_attached_image=Edit caption
|
||||||
cms.contentassets.ui.image_step.caption=Caption
|
cms.contentassets.ui.image_step.caption=Caption
|
||||||
|
cms.contentassets.ui.image_step.image_table.thumbnail=Thumbnail
|
||||||
|
cms.contentassets.ui.image_step.remove_attached_image.confirm=cms.contentassets.ui.image_step.remove_attached_image.confirm
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ public class ImageStep extends SecurityPropertyEditor {
|
||||||
private final ItemSelectionModel m_itemSelection;
|
private final ItemSelectionModel m_itemSelection;
|
||||||
private final AttachmentSelectionModel m_attachmentSelection;
|
private final AttachmentSelectionModel m_attachmentSelection;
|
||||||
private final AuthoringKitWizard m_parent;
|
private final AuthoringKitWizard m_parent;
|
||||||
private final ImageStepDisplay m_display;
|
//private final ImageStepDisplay m_display;
|
||||||
|
private final ImageStepDisplayTable m_display;
|
||||||
private final ImageStepEdit m_add;
|
private final ImageStepEdit m_add;
|
||||||
private final OIDParameter m_attachmentOID;
|
private final OIDParameter m_attachmentOID;
|
||||||
|
|
||||||
|
|
@ -84,7 +85,8 @@ public class ImageStep extends SecurityPropertyEditor {
|
||||||
new ImageAttachmentEditForm(this));
|
new ImageAttachmentEditForm(this));
|
||||||
|
|
||||||
/* ImageDisplayStep to display all already attached images */
|
/* ImageDisplayStep to display all already attached images */
|
||||||
m_display = new ImageStepDisplay(this); // Component to display
|
//m_display = new ImageStepDisplay(this); // Component to display
|
||||||
|
m_display = new ImageStepDisplayTable(this);
|
||||||
setDisplayComponent(m_display); // all attached images.
|
setDisplayComponent(m_display); // all attached images.
|
||||||
|
|
||||||
Iterator imageComponents = m_add.getImageComponents();
|
Iterator imageComponents = m_add.getImageComponents();
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
|
|
||||||
m_listModelBuilder = new ImageListModelBuilder();
|
m_listModelBuilder = new ImageListModelBuilder();
|
||||||
List imageList = new List(m_listModelBuilder) {
|
List imageList = new List(m_listModelBuilder) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void respond(PageState ps) throws ServletException {
|
public void respond(PageState ps) throws ServletException {
|
||||||
if (DELETE.equals(ps.getControlEventName())) {
|
if (DELETE.equals(ps.getControlEventName())) {
|
||||||
|
|
@ -146,13 +147,13 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
|
|
||||||
DataCollection attachments = ItemImageAttachment.getImageAttachments(item);
|
DataCollection attachments = ItemImageAttachment.getImageAttachments(item);
|
||||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||||
+ ReusableImageAsset.ID);
|
+ ReusableImageAsset.ID);
|
||||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||||
+ ReusableImageAsset.OBJECT_TYPE);
|
+ ReusableImageAsset.OBJECT_TYPE);
|
||||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||||
+ ReusableImageAsset.HEIGHT);
|
+ ReusableImageAsset.HEIGHT);
|
||||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||||
+ ReusableImageAsset.WIDTH);
|
+ ReusableImageAsset.WIDTH);
|
||||||
|
|
||||||
m_listModel = new ImageListModel(attachments);
|
m_listModel = new ImageListModel(attachments);
|
||||||
return m_listModel;
|
return m_listModel;
|
||||||
|
|
@ -243,7 +244,7 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
int newSortKey = Math.max(1,
|
int newSortKey = Math.max(1,
|
||||||
Math.min((int) attachments.size(),
|
Math.min((int) attachments.size(),
|
||||||
((ItemImageAttachment) sortDomainObject).
|
((ItemImageAttachment) sortDomainObject).
|
||||||
getSortKey() + move));
|
getSortKey() + move));
|
||||||
((ItemImageAttachment) sortDomainObject).setSortKey(newSortKey);
|
((ItemImageAttachment) sortDomainObject).setSortKey(newSortKey);
|
||||||
((ItemImageAttachment) sortDomainObject).save();
|
((ItemImageAttachment) sortDomainObject).save();
|
||||||
|
|
||||||
|
|
@ -338,6 +339,7 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
// Add CMS ImageDisplay element to BoxPanel container an overwrite
|
// Add CMS ImageDisplay element to BoxPanel container an overwrite
|
||||||
// generateImagePropertiesXM to add attachment's meta data.
|
// generateImagePropertiesXM to add attachment's meta data.
|
||||||
container.add(new ImageDisplay(null) {
|
container.add(new ImageDisplay(null) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateImagePropertiesXML(ImageAsset image,
|
protected void generateImagePropertiesXML(ImageAsset image,
|
||||||
PageState state,
|
PageState state,
|
||||||
|
|
@ -368,18 +370,18 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
element.addAttribute("caption_label", (String) GlobalizationUtil.globalize(
|
element.addAttribute("caption_label", (String) GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.caption")
|
"cms.contentasset.image.ui.caption")
|
||||||
.localize());
|
.localize());
|
||||||
element.addAttribute("caption", attachment.getCaption());
|
element.addAttribute("caption", attachment.getCaption());
|
||||||
|
|
||||||
element.addAttribute("context_label", (String) GlobalizationUtil.globalize(
|
element.addAttribute("context_label", (String) GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.use_context")
|
"cms.contentasset.image.ui.use_context")
|
||||||
.localize());
|
.localize());
|
||||||
String useContext = attachment.getUseContext();
|
String useContext = attachment.getUseContext();
|
||||||
if (null == useContext) {
|
if (null == useContext) {
|
||||||
element.addAttribute("context", (String) GlobalizationUtil.globalize(
|
element.addAttribute("context", (String) GlobalizationUtil.globalize(
|
||||||
"cms.ui.unknown")
|
"cms.ui.unknown")
|
||||||
.localize());
|
.localize());
|
||||||
} else {
|
} else {
|
||||||
element.addAttribute("context", useContext);
|
element.addAttribute("context", useContext);
|
||||||
}
|
}
|
||||||
|
|
@ -398,6 +400,7 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
ControlLink moveUpLink = new ControlLink(new Label(
|
ControlLink moveUpLink = new ControlLink(new Label(
|
||||||
ImageStepGlobalizationUtil.globalize(
|
ImageStepGlobalizationUtil.globalize(
|
||||||
"cms.contentassets.ui.image_step.move_attached_image_up"))) {
|
"cms.contentassets.ui.image_step.move_attached_image_up"))) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setControlEvent(PageState ps) {
|
public void setControlEvent(PageState ps) {
|
||||||
String oid = ps.getControlEventValue();
|
String oid = ps.getControlEventValue();
|
||||||
|
|
@ -424,6 +427,7 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
ControlLink moveDownLink = new ControlLink(new Label(
|
ControlLink moveDownLink = new ControlLink(new Label(
|
||||||
ImageStepGlobalizationUtil.globalize(
|
ImageStepGlobalizationUtil.globalize(
|
||||||
"cms.contentassets.ui.image_step.move_attached_image_down"))) {
|
"cms.contentassets.ui.image_step.move_attached_image_down"))) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setControlEvent(PageState ps) {
|
public void setControlEvent(PageState ps) {
|
||||||
String oid = ps.getControlEventValue();
|
String oid = ps.getControlEventValue();
|
||||||
|
|
@ -500,4 +504,5 @@ public class ImageStepDisplay extends SimpleContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,571 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.ImageAsset;
|
||||||
|
import com.arsdigita.cms.Service;
|
||||||
|
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
||||||
|
import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.ui.ImageDisplay;
|
||||||
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import com.arsdigita.web.URL;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
*/
|
||||||
|
public class ImageStepDisplayTable extends Table {
|
||||||
|
|
||||||
|
private final static String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final static String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private final static String TABLE_COL_UP = "table_col_up";
|
||||||
|
private final static String TABLE_COL_DOWN = "table_col_down";
|
||||||
|
private final static int TABLE_COL_INDEX_THUMBNAIL = 0;
|
||||||
|
private final static int TABLE_COL_INDEX_NAME = 1;
|
||||||
|
private final static int TABLE_COL_INDEX_DIMENSIONS = 2;
|
||||||
|
private final static int TABLE_COL_INDEX_TYPE = 3;
|
||||||
|
private final static int TABLE_COL_INDEX_CAPTION = 4;
|
||||||
|
private final static int TABLE_COL_INDEX_EDIT = 5;
|
||||||
|
private final static int TABLE_COL_INDEX_UP = 6;
|
||||||
|
private final static int TABLE_COL_INDEX_DOWN = 7;
|
||||||
|
private final static int TABLE_COL_INDEX_DEL = 8;
|
||||||
|
private final static int UP = -1;
|
||||||
|
private final static int DOWN = 1;
|
||||||
|
|
||||||
|
private final ImageStep imageStep;
|
||||||
|
|
||||||
|
public ImageStepDisplayTable(final ImageStep imageStep) {
|
||||||
|
super();
|
||||||
|
this.imageStep = imageStep;
|
||||||
|
setEmptyView(new Label(ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.no_image_attached")));
|
||||||
|
|
||||||
|
final TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_THUMBNAIL,
|
||||||
|
ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.image_table.thumbnail")));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_NAME,
|
||||||
|
GlobalizationUtil.globalize(
|
||||||
|
"cms.contentasset.image.ui.display.name")));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_DIMENSIONS,
|
||||||
|
GlobalizationUtil.globalize("cms.contentasset.image.ui.display.dimensions")));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_TYPE,
|
||||||
|
GlobalizationUtil.globalize(
|
||||||
|
"cms.contentasset.image.ui.display.type")));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_CAPTION,
|
||||||
|
GlobalizationUtil.globalize("cms.contentasset.image.ui.caption")));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_EDIT,
|
||||||
|
ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.edit_attached_image"),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_UP,
|
||||||
|
ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.move_attached_image_up"),
|
||||||
|
TABLE_COL_UP));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_DOWN,
|
||||||
|
ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.move_attached_image_down"),
|
||||||
|
TABLE_COL_DOWN));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
TABLE_COL_INDEX_DEL,
|
||||||
|
ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.remove_attached_image"),
|
||||||
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new ImageTableModelBuilder(imageStep));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new ThumbnailCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new NameCellRenderer());
|
||||||
|
columnModel.get(2).setCellRenderer(new DimensionsCellRenderer());
|
||||||
|
columnModel.get(3).setCellRenderer(new TypeCellRenderer());
|
||||||
|
columnModel.get(4).setCellRenderer(new CaptionCellRenderer());
|
||||||
|
columnModel.get(5).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(6).setCellRenderer(new UpCellRenderer());
|
||||||
|
columnModel.get(7).setCellRenderer(new DownCellRenderer());
|
||||||
|
columnModel.get(8).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(new ImageStepTableActionListener());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ImageTableModelBuilder extends LockableImpl implements TableModelBuilder {
|
||||||
|
|
||||||
|
private final ImageStep imageStep;
|
||||||
|
|
||||||
|
public ImageTableModelBuilder(final ImageStep imageStep) {
|
||||||
|
this.imageStep = imageStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableModel makeModel(final Table table,
|
||||||
|
final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
return new ImageTableModel(table, state, imageStep.getItem(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ImageTableModel implements TableModel {
|
||||||
|
|
||||||
|
private final Table table;
|
||||||
|
private final ContentItem item;
|
||||||
|
private final DataCollection images;
|
||||||
|
|
||||||
|
public ImageTableModel(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final ContentItem item) {
|
||||||
|
this.table = table;
|
||||||
|
this.item = item;
|
||||||
|
images = ItemImageAttachment.getImageAttachments(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextRow() {
|
||||||
|
if (images == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return images.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElementAt(final int columnIndex) {
|
||||||
|
final ItemImageAttachment image = (ItemImageAttachment) DomainObjectFactory.newInstance(
|
||||||
|
images.getDataObject());
|
||||||
|
|
||||||
|
switch (columnIndex) {
|
||||||
|
case TABLE_COL_INDEX_THUMBNAIL:
|
||||||
|
return image;
|
||||||
|
case TABLE_COL_INDEX_NAME:
|
||||||
|
return image.getImage().getName();
|
||||||
|
case TABLE_COL_INDEX_DIMENSIONS:
|
||||||
|
return String.format("%sx%s px", image.getImage().getWidth().toString(),
|
||||||
|
image.getImage().getHeight().toString());
|
||||||
|
case TABLE_COL_INDEX_TYPE:
|
||||||
|
return image.getImage().getMimeType().getLabel();
|
||||||
|
case TABLE_COL_INDEX_CAPTION:
|
||||||
|
return image.getCaption();
|
||||||
|
case TABLE_COL_INDEX_EDIT:
|
||||||
|
return ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.edit_attached_image");
|
||||||
|
case TABLE_COL_INDEX_UP:
|
||||||
|
return ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.move_attached_image_up");
|
||||||
|
case TABLE_COL_INDEX_DOWN:
|
||||||
|
return ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.move_attached_image_down");
|
||||||
|
case TABLE_COL_INDEX_DEL:
|
||||||
|
return ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.remove_attached_image");
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getKeyAt(final int columnIndex) {
|
||||||
|
return images.getDataObject().getOID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ThumbnailCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final ItemImageAttachment image = (ItemImageAttachment) value;
|
||||||
|
|
||||||
|
return new ImageStepImageDisplay(image.getImage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ImageStepImageDisplay extends ImageDisplay {
|
||||||
|
|
||||||
|
private final ImageAsset image;
|
||||||
|
|
||||||
|
public ImageStepImageDisplay(final ImageAsset image) {
|
||||||
|
super(null);
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ImageAsset getImageAsset(final PageState state) {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void generateImagePropertiesXML(final ImageAsset image,
|
||||||
|
final PageState state,
|
||||||
|
final Element element) {
|
||||||
|
element.addAttribute("name", image.getName());
|
||||||
|
element.addAttribute("src", URL.getDispatcherPath()
|
||||||
|
+ Service.getImageURL(image));
|
||||||
|
final BigDecimal width = image.getWidth();
|
||||||
|
if (width != null) {
|
||||||
|
element.addAttribute("width", width.toString());
|
||||||
|
}
|
||||||
|
final BigDecimal height = image.getHeight();
|
||||||
|
if (height != null) {
|
||||||
|
element.addAttribute("height", height.toString());
|
||||||
|
}
|
||||||
|
element.addAttribute("plain", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class NameCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
return new Label((String) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DimensionsCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
return new Label((String) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TypeCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
return new Label((String) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CaptionCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
return new Label((String) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final ContentItem item = imageStep.getItem(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
item);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
return new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
} else {
|
||||||
|
return new Label("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UpCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
if (0 == row) {
|
||||||
|
//First row, don't show up link
|
||||||
|
return new Label("");
|
||||||
|
} else {
|
||||||
|
return new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DownCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final ContentItem item = imageStep.getItem(state);
|
||||||
|
final DataCollection images = ItemImageAttachment.getImageAttachments(item);
|
||||||
|
|
||||||
|
if ((images.size() - 1) == row) {
|
||||||
|
//Last row in table, don't show down link
|
||||||
|
return new Label("");
|
||||||
|
} else {
|
||||||
|
return new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final ContentItem item = imageStep.getItem(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
item);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
link.setConfirmation(ImageStepGlobalizationUtil.globalize(
|
||||||
|
"cms.contentassets.ui.image_step.remove_attached_image.confirm"));
|
||||||
|
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
return new Label("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ImageStepTableActionListener implements TableActionListener {
|
||||||
|
|
||||||
|
public ImageStepTableActionListener() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
imageStep.setAttachment(state, ItemImageAttachment.retrieve(OID.valueOf(event
|
||||||
|
.getRowKey().toString())));
|
||||||
|
imageStep.showComponent(state, "edit");
|
||||||
|
} else if (TABLE_COL_UP.equals(column.getHeaderKey().toString())) {
|
||||||
|
move(OID.valueOf(event.getRowKey().toString()), UP, state);
|
||||||
|
} else if (TABLE_COL_DOWN.equals(column.getHeaderKey().toString())) {
|
||||||
|
move(OID.valueOf(event.getRowKey().toString()), DOWN, state);
|
||||||
|
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
DomainObjectFactory.newInstance(OID.valueOf(event.getRowKey().toString())).delete();
|
||||||
|
regenSortKeys(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do here.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void regenSortKeys(final PageState state) {
|
||||||
|
final ContentItem item = imageStep.getItem(state);
|
||||||
|
final DataCollection images = ItemImageAttachment.getImageAttachments(item);
|
||||||
|
|
||||||
|
int pos = 0;
|
||||||
|
while (images.next()) {
|
||||||
|
pos++;
|
||||||
|
final DomainObject domainObject = DomainObjectFactory
|
||||||
|
.newInstance(images.getDataObject());
|
||||||
|
|
||||||
|
if (domainObject instanceof ItemImageAttachment) {
|
||||||
|
final ItemImageAttachment image = (ItemImageAttachment) domainObject;
|
||||||
|
if (image.getSortKey() != pos) {
|
||||||
|
image.setSortKey(pos);
|
||||||
|
image.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void move(final OID imageOid, final int direction, final PageState state) {
|
||||||
|
final ContentItem item = imageStep.getItem(state);
|
||||||
|
final DataCollection images = ItemImageAttachment.getImageAttachments(item);
|
||||||
|
|
||||||
|
if (imageOid == null) {
|
||||||
|
throw new IllegalArgumentException("OID of ImageAttachment must not be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// No move, nothing to do
|
||||||
|
if (direction == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the image in the collection
|
||||||
|
while (images.next()) {
|
||||||
|
if (images.getDataObject().getOID().equals(imageOid)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Throw an {@link IllegalArgumentxception} if the imageOid was not found
|
||||||
|
if (!images.getDataObject().getOID().equals(imageOid)) {
|
||||||
|
throw new IllegalArgumentException("OID " + imageOid + " is not in collection");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the image to move and test if it is really an ItemImageAttachment
|
||||||
|
final DomainObject sortDomainObject = DomainObjectFactory
|
||||||
|
.newInstance(images.getDataObject());
|
||||||
|
int move = direction;
|
||||||
|
if (sortDomainObject instanceof ItemImageAttachment) {
|
||||||
|
|
||||||
|
// Change the sortKey of the ItemImageAttachment to the desired
|
||||||
|
// value but respect bounds of the current list
|
||||||
|
final int newSortKey = Math.max(1,
|
||||||
|
Math.min((int) images.size(),
|
||||||
|
((ItemImageAttachment) sortDomainObject).
|
||||||
|
getSortKey() + move));
|
||||||
|
((ItemImageAttachment) sortDomainObject).setSortKey(newSortKey);
|
||||||
|
sortDomainObject.save();
|
||||||
|
|
||||||
|
// Now, move all the object between the original position and the
|
||||||
|
// new postition one step in the nessecary direction
|
||||||
|
if (move < 0) {
|
||||||
|
while (images.previous() && move < 0) {
|
||||||
|
final DomainObject domainObject = DomainObjectFactory.newInstance(images.
|
||||||
|
getDataObject());
|
||||||
|
if (domainObject instanceof ItemImageAttachment) {
|
||||||
|
((ItemImageAttachment) domainObject).setSortKey(
|
||||||
|
((ItemImageAttachment) domainObject).getSortKey() + 1);
|
||||||
|
domainObject.save();
|
||||||
|
move++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (move > 0) {
|
||||||
|
while (images.next() && move > 0) {
|
||||||
|
final DomainObject domainObject = DomainObjectFactory.newInstance(images.
|
||||||
|
getDataObject());
|
||||||
|
if (domainObject instanceof ItemImageAttachment) {
|
||||||
|
((ItemImageAttachment) domainObject).setSortKey(
|
||||||
|
((ItemImageAttachment) domainObject).getSortKey() - 1);
|
||||||
|
domainObject.save();
|
||||||
|
move--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// close the collection manually to avimageOid warnings because the list
|
||||||
|
// will not be closed automatically
|
||||||
|
images.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -32,8 +32,7 @@ import com.arsdigita.xml.Element;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a single ImageAsset, showing its image, width, height, name and
|
* Displays a single ImageAsset, showing its image, width, height, name and mime-type.
|
||||||
* mime-type.
|
|
||||||
*
|
*
|
||||||
* @author Michael Pih (pihman@arsdigita.com)
|
* @author Michael Pih (pihman@arsdigita.com)
|
||||||
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
||||||
|
|
@ -41,117 +40,119 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public class ImageDisplay extends SimpleComponent {
|
public class ImageDisplay extends SimpleComponent {
|
||||||
|
|
||||||
private final ItemSelectionModel m_item;
|
private final ItemSelectionModel m_item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new ImageDisplay
|
* Construct a new ImageDisplay
|
||||||
*
|
*
|
||||||
* @param m The {@link ItemSelectionModel} which will supply this component
|
* @param m The {@link ItemSelectionModel} which will supply this component with the
|
||||||
* with the {@link ImageAsset}
|
* {@link ImageAsset}
|
||||||
*/
|
*/
|
||||||
public ImageDisplay(ItemSelectionModel m) {
|
public ImageDisplay(ItemSelectionModel m) {
|
||||||
super();
|
super();
|
||||||
m_item = m;
|
m_item = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the {@link ItemSelectionModel} which supplies this component with
|
* @return the {@link ItemSelectionModel} which supplies this component with the
|
||||||
* the {@link ImageAsset}
|
* {@link ImageAsset}
|
||||||
*/
|
*/
|
||||||
public final ItemSelectionModel getImageSelectionModel() {
|
public final ItemSelectionModel getImageSelectionModel() {
|
||||||
return m_item;
|
return m_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
if (isVisible(state)) {
|
if (isVisible(state)) {
|
||||||
|
|
||||||
ImageAsset image = getImageAsset(state);
|
ImageAsset image = getImageAsset(state);
|
||||||
|
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Element element = new Element("cms:imageDisplay", CMS.CMS_XML_NS);
|
Element element = new Element("cms:imageDisplay", CMS.CMS_XML_NS);
|
||||||
|
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
generateImagePropertiesXML(image, state, element);
|
generateImagePropertiesXML(image, state, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
exportAttributes(element);
|
exportAttributes(element);
|
||||||
parent.addContent(element);
|
parent.addContent(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the property xml.
|
* Generates the property xml.
|
||||||
*
|
*
|
||||||
* @param image
|
* @param image
|
||||||
* @param state
|
* @param state
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
protected void generateImagePropertiesXML(ImageAsset image,
|
protected void generateImagePropertiesXML(ImageAsset image,
|
||||||
PageState state,
|
PageState state,
|
||||||
Element element) {
|
Element element) {
|
||||||
|
|
||||||
element.addAttribute("name_label", (String) GlobalizationUtil.globalize(
|
element.addAttribute("name_label", (String) GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.display.name")
|
"cms.contentasset.image.ui.display.name")
|
||||||
.localize());
|
.localize());
|
||||||
element.addAttribute("name", image.getName());
|
element.addAttribute("name", image.getName());
|
||||||
element.addAttribute("src", URL.getDispatcherPath()
|
element.addAttribute("src", URL.getDispatcherPath()
|
||||||
+ Service.getImageURL(image));
|
+ Service.getImageURL(image));
|
||||||
|
|
||||||
element.addAttribute("mime_type_label", (String) GlobalizationUtil.globalize(
|
element.addAttribute("mime_type_label", (String) GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.display.type")
|
"cms.contentasset.image.ui.display.type")
|
||||||
.localize());
|
.localize());
|
||||||
MimeType mimeType = image.getMimeType();
|
MimeType mimeType = image.getMimeType();
|
||||||
if (mimeType != null) {
|
if (mimeType != null) {
|
||||||
element.addAttribute("mime_type", mimeType.getLabel());
|
element.addAttribute("mime_type", mimeType.getLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
element.addAttribute("width_label", (String) GlobalizationUtil.globalize(
|
element.addAttribute("width_label", (String) GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.display.width")
|
"cms.contentasset.image.ui.display.width")
|
||||||
.localize());
|
.localize());
|
||||||
BigDecimal width = image.getWidth();
|
BigDecimal width = image.getWidth();
|
||||||
if (width != null) {
|
if (width != null) {
|
||||||
element.addAttribute("width", width.toString());
|
element.addAttribute("width", width.toString());
|
||||||
} else {
|
} else {
|
||||||
element.addAttribute("width", (String) GlobalizationUtil.globalize(
|
element.addAttribute("width", (String) GlobalizationUtil.globalize(
|
||||||
"cms.ui.unknown")
|
"cms.ui.unknown")
|
||||||
.localize());
|
.localize());
|
||||||
}
|
}
|
||||||
|
|
||||||
element.addAttribute("height_label", (String) GlobalizationUtil.globalize(
|
element.addAttribute("height_label", (String) GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.display.height")
|
"cms.contentasset.image.ui.display.height")
|
||||||
.localize());
|
.localize());
|
||||||
BigDecimal height = image.getHeight();
|
BigDecimal height = image.getHeight();
|
||||||
if (height != null) {
|
if (height != null) {
|
||||||
element.addAttribute("height", height.toString());
|
element.addAttribute("height", height.toString());
|
||||||
} else {
|
} else {
|
||||||
element.addAttribute("height", (String) GlobalizationUtil.globalize(
|
element.addAttribute("height", (String) GlobalizationUtil.globalize(
|
||||||
"cms.ui.unknown")
|
"cms.ui.unknown")
|
||||||
.localize());
|
.localize());
|
||||||
}
|
}
|
||||||
|
|
||||||
element.addAttribute("dimension_label", (String) GlobalizationUtil.globalize(
|
element.addAttribute("dimension_label", (String) GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.display.dimensions")
|
"cms.contentasset.image.ui.display.dimensions")
|
||||||
.localize());
|
.localize());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected ImageAsset getImageAsset(PageState state) {
|
||||||
|
ImageAsset image = (ImageAsset) m_item.getSelectedObject(state);
|
||||||
|
Assert.exists(image, "Image asset");
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param state
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected ImageAsset getImageAsset(PageState state) {
|
|
||||||
ImageAsset image = (ImageAsset) m_item.getSelectedObject(state);
|
|
||||||
Assert.exists(image, "Image asset");
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,65 +25,64 @@ import java.io.IOException;
|
||||||
/**
|
/**
|
||||||
* An image upload component.
|
* An image upload component.
|
||||||
*
|
*
|
||||||
* This component can be used in different places to add image upload
|
* This component can be used in different places to add image upload capabilities in a convinient
|
||||||
* capabilities in a convinient way. This class uses a listener class which
|
* way. This class uses a listener class which should be extended from
|
||||||
* should be extended from {@link ImageComponentAbstractListener}.
|
* {@link ImageComponentAbstractListener}.
|
||||||
*
|
*
|
||||||
* @author unknown
|
* @author unknown
|
||||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||||
*/
|
*/
|
||||||
public class ImageUploadComponent extends Form implements ImageComponent {
|
public class ImageUploadComponent extends Form implements ImageComponent {
|
||||||
|
|
||||||
private final FileUploadSection m_imageFile;
|
private final FileUploadSection m_imageFile;
|
||||||
private final TextField m_caption;
|
private final TextField m_caption;
|
||||||
private final TextField m_title;
|
private final TextField m_title;
|
||||||
private final TextArea m_description;
|
private final TextArea m_description;
|
||||||
private final TextField m_useContext;
|
private final TextField m_useContext;
|
||||||
private final SaveCancelSection m_saveCancel;
|
private final SaveCancelSection m_saveCancel;
|
||||||
private int m_mode;
|
private int m_mode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an ImageUploadComponent in attach mode.
|
* Creates an ImageUploadComponent in attach mode.
|
||||||
*/
|
*/
|
||||||
public ImageUploadComponent() {
|
public ImageUploadComponent() {
|
||||||
this(ImageComponent.ATTACH_IMAGE);
|
this(ImageComponent.ATTACH_IMAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an ImageUploadComponent with the selected mode.
|
* Creates an ImageUploadComponent with the selected mode.
|
||||||
*
|
*
|
||||||
* @param mode The operation mode (see {@link ImageComponent)
|
* @param mode The operation mode (see {@link ImageComponent)
|
||||||
*/
|
*/
|
||||||
public ImageUploadComponent(int mode) {
|
public ImageUploadComponent(int mode) {
|
||||||
super("imageUploadComponent", new ColumnPanel(2));
|
super("imageUploadComponent", new ColumnPanel(2));
|
||||||
m_mode = mode;
|
m_mode = mode;
|
||||||
setEncType("multipart/form-data");
|
setEncType("multipart/form-data");
|
||||||
m_imageFile = new FileUploadSection(GlobalizationUtil.globalize(
|
m_imageFile = new FileUploadSection(GlobalizationUtil.globalize(
|
||||||
"cms.contentasset.image.ui.type"),
|
"cms.contentasset.image.ui.type"),
|
||||||
"image",
|
"image",
|
||||||
ImageAsset.MIME_JPEG);
|
ImageAsset.MIME_JPEG);
|
||||||
m_imageFile.getFileUploadWidget()
|
m_imageFile.getFileUploadWidget()
|
||||||
.addValidationListener(new NotNullValidationListener());
|
.addValidationListener(new NotNullValidationListener());
|
||||||
add(m_imageFile, ColumnPanel.FULL_WIDTH);
|
add(m_imageFile, ColumnPanel.FULL_WIDTH);
|
||||||
|
|
||||||
// Initialize all widgets
|
// Initialize all widgets
|
||||||
m_caption = new TextField("caption");
|
m_caption = new TextField("caption");
|
||||||
m_title = new TextField("title");
|
m_title = new TextField("title");
|
||||||
m_description = new TextArea("description");
|
m_description = new TextArea("description");
|
||||||
m_useContext = new TextField("useContext");
|
m_useContext = new TextField("useContext");
|
||||||
|
|
||||||
// add widget only if we are in attach mode
|
// add widget only if we are in attach mode
|
||||||
if (m_mode == ImageComponent.ATTACH_IMAGE) {
|
if (m_mode == ImageComponent.ATTACH_IMAGE) {
|
||||||
add(new Label(GlobalizationUtil
|
add(new Label(GlobalizationUtil
|
||||||
.globalize("cms.contentasset.image.ui.caption")));
|
.globalize("cms.contentasset.image.ui.caption")));
|
||||||
m_caption.addValidationListener(new NotNullValidationListener());
|
m_caption.addValidationListener(new NotNullValidationListener());
|
||||||
m_caption.addValidationListener(new StringLengthValidationListener(40));
|
m_caption.addValidationListener(new StringLengthValidationListener(40));
|
||||||
m_caption.setSize(40);
|
m_caption.setSize(40);
|
||||||
add(m_caption);
|
add(m_caption);
|
||||||
|
|
||||||
// We only show the title and description fields in the case where
|
|
||||||
// getIsImageStepDescriptionAndTitleShown is false.
|
|
||||||
|
|
||||||
|
// We only show the title and description fields in the case where
|
||||||
|
// getIsImageStepDescriptionAndTitleShown is false.
|
||||||
// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
|
// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
|
||||||
// add(new Label("Title"));
|
// add(new Label("Title"));
|
||||||
// m_title.addValidationListener(new NotNullValidationListener());
|
// m_title.addValidationListener(new NotNullValidationListener());
|
||||||
|
|
@ -99,79 +98,79 @@ public class ImageUploadComponent extends Form implements ImageComponent {
|
||||||
// add(m_description);
|
// add(m_description);
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
add(new Label(GlobalizationUtil
|
||||||
|
.globalize("cms.contentasset.image.ui.use_context")));
|
||||||
|
m_useContext.setSize(40);
|
||||||
|
add(m_useContext);
|
||||||
|
}
|
||||||
|
m_saveCancel = new SaveCancelSection();
|
||||||
|
add(m_saveCancel);
|
||||||
|
|
||||||
add(new Label(GlobalizationUtil
|
/*
|
||||||
.globalize("cms.contentasset.image.ui.use_context")));
|
* Removed by Quasimodo: Changed editing workflow, so that library comes
|
||||||
m_useContext.setSize(40);
|
* first Also, library mode has now a link to upload images which will
|
||||||
add(m_useContext);
|
* link to this form. Consequently, this link will create a loop, which
|
||||||
}
|
* isn't fatal but confusing.
|
||||||
m_saveCancel = new SaveCancelSection();
|
*
|
||||||
add(m_saveCancel);
|
* ActionLink library = new ActionLink("Select an existing image" );
|
||||||
|
* library.addActionListener( new ActionListener() {
|
||||||
|
* public void actionPerformed( ActionEvent ev ) {
|
||||||
|
* setImageComponent( ev.getPageState(), LIBRARY );
|
||||||
|
* }
|
||||||
|
* } );
|
||||||
|
* add( library, ColumnPanel.FULL_WIDTH );
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* Removed by Quasimodo: Changed editing workflow, so that library comes
|
public SaveCancelSection getSaveCancelSection() {
|
||||||
* first Also, library mode has now a link to upload images which will
|
return m_saveCancel;
|
||||||
* link to this form. Consequently, this link will create a loop, which
|
}
|
||||||
* isn't fatal but confusing.
|
|
||||||
*
|
|
||||||
* ActionLink library = new ActionLink("Select an existing image" );
|
|
||||||
* library.addActionListener( new ActionListener() {
|
|
||||||
* public void actionPerformed( ActionEvent ev ) {
|
|
||||||
* setImageComponent( ev.getPageState(), LIBRARY );
|
|
||||||
* }
|
|
||||||
* } );
|
|
||||||
* add( library, ColumnPanel.FULL_WIDTH );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SaveCancelSection getSaveCancelSection() {
|
public ReusableImageAsset getImage(FormSectionEvent event)
|
||||||
return m_saveCancel;
|
throws FormProcessException {
|
||||||
}
|
PageState ps = event.getPageState();
|
||||||
|
String filename = (String) m_imageFile.getFileName(event);
|
||||||
@Override
|
File imageFile = m_imageFile.getFile(event);
|
||||||
public ReusableImageAsset getImage(FormSectionEvent event)
|
try {
|
||||||
throws FormProcessException {
|
ReusableImageAsset image = new ReusableImageAsset();
|
||||||
PageState ps = event.getPageState();
|
image.loadFromFile(filename, imageFile, ImageAsset.MIME_JPEG);
|
||||||
String filename = (String) m_imageFile.getFileName(event);
|
|
||||||
File imageFile = m_imageFile.getFile(event);
|
|
||||||
try {
|
|
||||||
ReusableImageAsset image = new ReusableImageAsset();
|
|
||||||
image.loadFromFile(filename, imageFile, ImageAsset.MIME_JPEG);
|
|
||||||
// image.setDescription((String) m_caption.getValue(ps));
|
// image.setDescription((String) m_caption.getValue(ps));
|
||||||
return image;
|
return image;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ImagesPane.S_LOG.error("Error loading image from file", ex);
|
ImagesPane.S_LOG.error("Error loading image from file", ex);
|
||||||
throw new FormProcessException(ex.getMessage());
|
throw new FormProcessException(ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCaption(FormSectionEvent event) {
|
public String getCaption(FormSectionEvent event) {
|
||||||
PageState ps = event.getPageState();
|
PageState ps = event.getPageState();
|
||||||
return (String) m_caption.getValue(ps);
|
return (String) m_caption.getValue(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription(FormSectionEvent event) {
|
public String getDescription(FormSectionEvent event) {
|
||||||
PageState ps = event.getPageState();
|
PageState ps = event.getPageState();
|
||||||
return (String) m_description.getValue(ps);
|
return (String) m_description.getValue(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle(FormSectionEvent event) {
|
public String getTitle(FormSectionEvent event) {
|
||||||
PageState ps = event.getPageState();
|
PageState ps = event.getPageState();
|
||||||
return (String) m_title.getValue(ps);
|
return (String) m_title.getValue(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUseContext(FormSectionEvent event) {
|
public String getUseContext(FormSectionEvent event) {
|
||||||
PageState ps = event.getPageState();
|
PageState ps = event.getPageState();
|
||||||
return (String) m_useContext.getValue(ps);
|
return (String) m_useContext.getValue(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Form getForm() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Form getForm() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
name="ScientificCMS"
|
name="ScientificCMS"
|
||||||
prettyName="Scientific CMS"
|
prettyName="Scientific CMS"
|
||||||
version="2.3.0"
|
version="2.3.0"
|
||||||
release="devel-SNAPSHOT-r2664"
|
release="devel-SNAPSHOT-r2691"
|
||||||
webxml="sci-web.xml"
|
webxml="sci-web.xml"
|
||||||
portletxml="sci-portlet.xml"
|
portletxml="sci-portlet.xml"
|
||||||
webapp="libreccm"
|
webapp="libreccm"
|
||||||
|
|
|
||||||
|
|
@ -31,121 +31,129 @@
|
||||||
<!-- Autor: Sören Bernstein -->
|
<!-- Autor: Sören Bernstein -->
|
||||||
|
|
||||||
<xsl:stylesheet
|
<xsl:stylesheet
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
|
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
|
||||||
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
||||||
xmlns:nav="http://ccm.redhat.com/navigation"
|
xmlns:nav="http://ccm.redhat.com/navigation"
|
||||||
xmlns:mandalay="http://mandalay.quasiweb.de"
|
xmlns:mandalay="http://mandalay.quasiweb.de"
|
||||||
exclude-result-prefixes="xsl bebop cms nav mandalay"
|
exclude-result-prefixes="xsl bebop cms nav mandalay"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
<xsl:template match="cms:imageDisplay">
|
<xsl:template match="cms:imageDisplay">
|
||||||
<xsl:variable name="setImageName">
|
<xsl:variable name="setImageName">
|
||||||
<xsl:call-template name="mandalay:getSetting">
|
<xsl:call-template name="mandalay:getSetting">
|
||||||
<xsl:with-param name="module" select="'cms'"/>
|
<xsl:with-param name="module" select="'cms'"/>
|
||||||
<xsl:with-param name="setting" select="'imageDisplay/setImageName'"/>
|
<xsl:with-param name="setting" select="'imageDisplay/setImageName'"/>
|
||||||
<xsl:with-param name="default" select="'true'"/>
|
<xsl:with-param name="default" select="'true'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="setMimeType">
|
<xsl:variable name="setMimeType">
|
||||||
<xsl:call-template name="mandalay:getSetting">
|
<xsl:call-template name="mandalay:getSetting">
|
||||||
<xsl:with-param name="module" select="'cms'"/>
|
<xsl:with-param name="module" select="'cms'"/>
|
||||||
<xsl:with-param name="setting" select="'imageDisplay/setMimeType'"/>
|
<xsl:with-param name="setting" select="'imageDisplay/setMimeType'"/>
|
||||||
<xsl:with-param name="default" select="'true'"/>
|
<xsl:with-param name="default" select="'true'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="setDimensions">
|
<xsl:variable name="setDimensions">
|
||||||
<xsl:call-template name="mandalay:getSetting">
|
<xsl:call-template name="mandalay:getSetting">
|
||||||
<xsl:with-param name="module" select="'cms'"/>
|
<xsl:with-param name="module" select="'cms'"/>
|
||||||
<xsl:with-param name="setting" select="'imageDisplay/setDimensions'"/>
|
<xsl:with-param name="setting" select="'imageDisplay/setDimensions'"/>
|
||||||
<xsl:with-param name="default" select="'true'"/>
|
<xsl:with-param name="default" select="'true'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="setCaption">
|
<xsl:variable name="setCaption">
|
||||||
<xsl:call-template name="mandalay:getSetting">
|
<xsl:call-template name="mandalay:getSetting">
|
||||||
<xsl:with-param name="module" select="'cms'"/>
|
<xsl:with-param name="module" select="'cms'"/>
|
||||||
<xsl:with-param name="setting" select="'imageDisplay/setCaption'"/>
|
<xsl:with-param name="setting" select="'imageDisplay/setCaption'"/>
|
||||||
<xsl:with-param name="default" select="'true'"/>
|
<xsl:with-param name="default" select="'true'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="setContext">
|
<xsl:variable name="setContext">
|
||||||
<xsl:call-template name="mandalay:getSetting">
|
<xsl:call-template name="mandalay:getSetting">
|
||||||
<xsl:with-param name="module" select="'cms'"/>
|
<xsl:with-param name="module" select="'cms'"/>
|
||||||
<xsl:with-param name="setting" select="'imageDisplay/setContext'"/>
|
<xsl:with-param name="setting" select="'imageDisplay/setContext'"/>
|
||||||
<xsl:with-param name="default" select="'true'"/>
|
<xsl:with-param name="default" select="'true'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<img class="cmsImageDisplay">
|
<img class="cmsImageDisplay">
|
||||||
<xsl:attribute name="src">
|
<xsl:attribute name="src">
|
||||||
<xsl:value-of select="@src"/>
|
<xsl:value-of select="@src"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:attribute name="alt">
|
<xsl:attribute name="alt">
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:if test="@width">
|
<xsl:if test="@width">
|
||||||
<xsl:attribute name="width">
|
<xsl:attribute name="width">
|
||||||
<xsl:value-of select="@width"/>
|
<xsl:value-of select="@width"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="@height">
|
<xsl:if test="@height">
|
||||||
<xsl:attribute name="height">
|
<xsl:attribute name="height">
|
||||||
<xsl:value-of select="@height"/>
|
<xsl:value-of select="@height"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<div class="cmsImageInfoOverlay">
|
<xsl:if test="@plain != 'true'">
|
||||||
<xsl:if test="$setImageName = 'true'">
|
<div class="cmsImageInfoOverlay">
|
||||||
<span class="key">
|
<xsl:if test="$setImageName = 'true'">
|
||||||
<xsl:value-of select="@name_label"/>
|
<span class="key">
|
||||||
</span>
|
<xsl:value-of select="@name_label"/>
|
||||||
<span class="value"><xsl:value-of select="@name"/></span>
|
</span>
|
||||||
<br/>
|
<span class="value">
|
||||||
</xsl:if>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:if test="$setMimeType = 'true'">
|
</span>
|
||||||
<span class="key">
|
<br/>
|
||||||
<xsl:value-of select="@mime_type_label"/>
|
</xsl:if>
|
||||||
</span>
|
<xsl:if test="$setMimeType = 'true'">
|
||||||
<span class="value">
|
<span class="key">
|
||||||
<xsl:choose>
|
<xsl:value-of select="@mime_type_label"/>
|
||||||
<xsl:when test="@mime_type">
|
</span>
|
||||||
<xsl:value-of select="@mime_type"/>
|
<span class="value">
|
||||||
</xsl:when>
|
<xsl:choose>
|
||||||
<xsl:otherwise>
|
<xsl:when test="@mime_type">
|
||||||
<em>
|
<xsl:value-of select="@mime_type"/>
|
||||||
<xsl:call-template name="mandalay:getStaticText">
|
</xsl:when>
|
||||||
<xsl:with-param name="module" select="'cms'"/>
|
<xsl:otherwise>
|
||||||
<xsl:with-param name="id" select="'imageDisplay/infoOverlay/typeUnknown'"/>
|
<em>
|
||||||
</xsl:call-template>
|
<xsl:call-template name="mandalay:getStaticText">
|
||||||
</em>
|
<xsl:with-param name="module" select="'cms'"/>
|
||||||
</xsl:otherwise>
|
<xsl:with-param name="id" select="'imageDisplay/infoOverlay/typeUnknown'"/>
|
||||||
</xsl:choose>
|
</xsl:call-template>
|
||||||
</span>
|
</em>
|
||||||
<br/>
|
</xsl:otherwise>
|
||||||
</xsl:if>
|
</xsl:choose>
|
||||||
<xsl:if test="$setDimensions = 'true'">
|
</span>
|
||||||
<span class="key">
|
<br/>
|
||||||
<xsl:value-of select="@dimension_label"/>
|
</xsl:if>
|
||||||
</span>
|
<xsl:if test="$setDimensions = 'true'">
|
||||||
<span class="value"><xsl:value-of select="@width"/> x <xsl:value-of select="@height"/></span>
|
<span class="key">
|
||||||
<br/>
|
<xsl:value-of select="@dimension_label"/>
|
||||||
</xsl:if>
|
</span>
|
||||||
<xsl:if test="$setContext = 'true'">
|
<span class="value">
|
||||||
<span class="key">
|
<xsl:value-of select="@width"/> x <xsl:value-of select="@height"/>
|
||||||
<xsl:value-of select="@context_label"/>
|
</span>
|
||||||
</span>
|
<br/>
|
||||||
<span class="value"><xsl:value-of select="@context"/></span>
|
</xsl:if>
|
||||||
<br/>
|
<xsl:if test="$setContext = 'true'">
|
||||||
</xsl:if>
|
<span class="key">
|
||||||
<xsl:if test="$setCaption = 'true'">
|
<xsl:value-of select="@context_label"/>
|
||||||
<span class="key">
|
</span>
|
||||||
<xsl:value-of select="@caption_label"/>
|
<span class="value">
|
||||||
</span>
|
<xsl:value-of select="@context"/>
|
||||||
<span class="value">
|
</span>
|
||||||
<xsl:value-of select="@caption"/>
|
<br/>
|
||||||
</span>
|
</xsl:if>
|
||||||
</xsl:if>
|
<xsl:if test="$setCaption = 'true'">
|
||||||
</div>
|
<span class="key">
|
||||||
</img>
|
<xsl:value-of select="@caption_label"/>
|
||||||
</xsl:template>
|
</span>
|
||||||
|
<span class="value">
|
||||||
|
<xsl:value-of select="@caption"/>
|
||||||
|
</span>
|
||||||
|
</xsl:if>
|
||||||
|
</div>
|
||||||
|
</xsl:if>
|
||||||
|
</img>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
<!--
|
<!--
|
||||||
<xsl:if test="count($resultTree//cms:item/image | $resultTree//cms:item/imageAttachments/image) > 1">
|
<xsl:if test="count($resultTree//cms:item/image | $resultTree//cms:item/imageAttachments/image) > 1">
|
||||||
-->
|
-->
|
||||||
<script type="text/javascript" src="/assets/fancybox2/source/jquery.fancybox.pack.js"/>
|
<!--<script type="text/javascript" src="/assets/fancybox2/source/jquery.fancybox.pack.js"/>-->
|
||||||
<!--script type="text/javascript" src="/assets/fancybox/jquery.easing.pack.js"/-->
|
<!--script type="text/javascript" src="/assets/fancybox/jquery.easing.pack.js"/-->
|
||||||
|
|
||||||
<!-- Add mousewheel plugin (this is optional) -->
|
<!-- Add mousewheel plugin (this is optional) -->
|
||||||
|
|
@ -68,16 +68,17 @@
|
||||||
<!-- Add Media helper (this is optional) -->
|
<!-- Add Media helper (this is optional) -->
|
||||||
<script type="text/javascript" src="/assets/fancybox2/source/helpers/jquery.fancybox-media.js"></script>
|
<script type="text/javascript" src="/assets/fancybox2/source/helpers/jquery.fancybox-media.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">$(document).ready(function() {$("a.imageZoom").fancybox({'type':'image'}); $("a.imageGallery").fancybox({'type':'image'});});</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("a.imageZoom").fancybox({'type':'image'});
|
$("a.imageZoom").fancybox({'type':'image'});
|
||||||
$("a.imageGallery").fancybox({
|
$("a.imageGallery").fancybox({
|
||||||
'type': 'image',
|
type: 'image',
|
||||||
'helpers': {
|
helpers: {
|
||||||
'buttons': {
|
title: {
|
||||||
'position': 'bottom',
|
type: 'inside',
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
position: 'bottom',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -120,7 +121,7 @@
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:if test="../id = $firstMatch">
|
<!--<xsl:if test="../id = $firstMatch">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("a.<xsl:value-of select="$imageGallery"/>").fancybox({
|
$("a.<xsl:value-of select="$imageGallery"/>").fancybox({
|
||||||
|
|
@ -140,16 +141,16 @@
|
||||||
<xsl:with-param name="settingName" select="@id"/>
|
<xsl:with-param name="settingName" select="@id"/>
|
||||||
<xsl:with-param name="value" select="."/>
|
<xsl:with-param name="value" select="."/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:for-each>
|
</xsl:for-each>-->
|
||||||
|
|
||||||
<!-- DE Hack, um ein korrektes Array zu erzeugen. Es gibt leider keine Möglichkeit
|
<!-- DE Hack, um ein korrektes Array zu erzeugen. Es gibt leider keine Möglichkeit
|
||||||
das Komma hinter den letzten Eintrag wegzulassen, daher wird hier ein "leerer"
|
das Komma hinter den letzten Eintrag wegzulassen, daher wird hier ein "leerer"
|
||||||
Eintrag angelegt, den fancybox ignoriert. -->
|
Eintrag angelegt, den fancybox ignoriert. -->
|
||||||
<xsl:text>'dummyEntry' : 'ignoreMe'</xsl:text>
|
<!--<xsl:text>'dummyEntry' : 'ignoreMe'</xsl:text>
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</xsl:if>
|
</xsl:if>-->
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="mandalay:setImageGalleryConfigParam">
|
<xsl:template name="mandalay:setImageGalleryConfigParam">
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,16 @@
|
||||||
along with Mandalay. If not, see <http://www.gnu.org/licenses/>.
|
along with Mandalay. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
_
|
||||||
|
| | Currently not used due to compatibility problems between FancyBox 2 and the code in
|
||||||
|
| | imageGallery.js which interprets the settings!
|
||||||
|
|_|
|
||||||
|
(_)
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
<settings>
|
<settings>
|
||||||
<setting id="padding">10</setting>
|
<setting id="padding">10</setting>
|
||||||
<setting id="margin">20</setting>
|
<setting id="margin">20</setting>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue