CT Image
* Neue Felder hinzugefügt * Fehlende Datei für TextAsset hinzugefügt git-svn-id: https://svn.libreccm.org/ccm/trunk@774 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
1ef984825e
commit
d498fe2540
|
|
@ -20,6 +20,10 @@ object type Image extends ContentPage {
|
||||||
String[0..1] copyright = ct_images.copyright VARCHAR(400);
|
String[0..1] copyright = ct_images.copyright VARCHAR(400);
|
||||||
String[0..1] site = ct_images.site VARCHAR(500);
|
String[0..1] site = ct_images.site VARCHAR(500);
|
||||||
String[0..1] license = ct_images.license VARCHAR(300);
|
String[0..1] license = ct_images.license VARCHAR(300);
|
||||||
|
String[0..1] material = ct_images.material VARCHAR(200);
|
||||||
|
String[0..1] technique = ct_images.technique VARCHAR(200);
|
||||||
|
String[0..1] origin = ct_images.origin VARCHAR(200);
|
||||||
|
String[0..1] origSize = ct_images.origSize VARCHAR(100);
|
||||||
|
|
||||||
reference key (ct_images.item_id);
|
reference key (ct_images.item_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,11 @@ public class Image extends ContentPage {
|
||||||
public static final String COPYRIGHT = "copyright";
|
public static final String COPYRIGHT = "copyright";
|
||||||
public static final String SITE = "site";
|
public static final String SITE = "site";
|
||||||
public static final String LICENSE = "license";
|
public static final String LICENSE = "license";
|
||||||
|
public static final String MATERIAL = "material";
|
||||||
|
public static final String TECHNIQUE = "technique";
|
||||||
|
public static final String ORIGIN = "origin";
|
||||||
|
public static final String ORIGSIZE = "origSize";
|
||||||
|
|
||||||
protected static final int SUMMARY_SIZE = 1024;
|
protected static final int SUMMARY_SIZE = 1024;
|
||||||
/** Data object type for this domain object */
|
/** Data object type for this domain object */
|
||||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Image";
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Image";
|
||||||
|
|
@ -249,4 +254,36 @@ public class Image extends ContentPage {
|
||||||
public void setLicense(String license) {
|
public void setLicense(String license) {
|
||||||
set(LICENSE, license);
|
set(LICENSE, license);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMaterial() {
|
||||||
|
return (String) get(MATERIAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaterial(String material) {
|
||||||
|
set(MATERIAL, material);
|
||||||
|
}
|
||||||
|
public String getTechnique() {
|
||||||
|
return (String) get(TECHNIQUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTechnique(String technique) {
|
||||||
|
set(TECHNIQUE, technique);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrigin() {
|
||||||
|
return (String) get(ORIGIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrigin(String origin) {
|
||||||
|
set(ORIGIN, origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalSize() {
|
||||||
|
return (String) get(ORIGSIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalSize(String origSize) {
|
||||||
|
set(ORIGSIZE, origSize);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,13 @@ cms.contenttypes.ui.image.caption=Caption:
|
||||||
cms.contenttypes.ui.image.artist=Artist:
|
cms.contenttypes.ui.image.artist=Artist:
|
||||||
cms.contenttypes.ui.image.publishDate=Publishing Date:
|
cms.contenttypes.ui.image.publishDate=Publishing Date:
|
||||||
cms.contenttypes.ui.image.source=Source:
|
cms.contenttypes.ui.image.source=Source:
|
||||||
cms.contenttypes.ui.image.media=Media:
|
cms.contenttypes.ui.image.media=Type of Object:
|
||||||
cms.contenttypes.ui.image.copyright=Copyright:
|
cms.contenttypes.ui.image.copyright=Copyright:
|
||||||
cms.contenttypes.ui.image.site=Site:
|
cms.contenttypes.ui.image.site=Site:
|
||||||
cms.contenttypes.ui.image.license=License:
|
cms.contenttypes.ui.image.license=License:
|
||||||
cms.contenttypes.ui.image.width=Width:
|
cms.contenttypes.ui.image.width=Width:
|
||||||
cms.contenttypes.ui.image.height=Height:
|
cms.contenttypes.ui.image.height=Height:
|
||||||
|
cms.contenttypes.ui.image.material=Material:
|
||||||
|
cms.contenttypes.ui.image.technique=Technique:
|
||||||
|
cms.contenttypes.ui.image.origin=Point of Origin:
|
||||||
|
cms.contenttypes.ui.image.origSize=Size of Original:
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,13 @@ cms.contenttypes.ui.image.caption=Bilduntertitel:
|
||||||
cms.contenttypes.ui.image.artist=K\u00fcnstler:
|
cms.contenttypes.ui.image.artist=K\u00fcnstler:
|
||||||
cms.contenttypes.ui.image.publishDate=Ver\u00f6ffentlichungsdatum:
|
cms.contenttypes.ui.image.publishDate=Ver\u00f6ffentlichungsdatum:
|
||||||
cms.contenttypes.ui.image.source=Quelle:
|
cms.contenttypes.ui.image.source=Quelle:
|
||||||
cms.contenttypes.ui.image.media=Medium:
|
cms.contenttypes.ui.image.media=Art des Objektes:
|
||||||
cms.contenttypes.ui.image.copyright=Copyright:
|
cms.contenttypes.ui.image.copyright=Copyright:
|
||||||
cms.contenttypes.ui.image.site=Standort:
|
cms.contenttypes.ui.image.site=Standort:
|
||||||
cms.contenttypes.ui.image.license=Lizenz:
|
cms.contenttypes.ui.image.license=Lizenz:
|
||||||
cms.contenttypes.ui.image.width=Breite:
|
cms.contenttypes.ui.image.width=Breite:
|
||||||
cms.contenttypes.ui.image.height=H\u00f6he:
|
cms.contenttypes.ui.image.height=H\u00f6he:
|
||||||
|
cms.contenttypes.ui.image.material=Material:
|
||||||
|
cms.contenttypes.ui.image.technique=Technik:
|
||||||
|
cms.contenttypes.ui.image.origin=Ort der Entstehung:
|
||||||
|
cms.contenttypes.ui.image.origSize=Gr\u00f6\u00dfe des Originals:
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,10 @@ public class ImagePropertiesStep extends SimpleEditStep {
|
||||||
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.copyright"), Image.COPYRIGHT);
|
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.copyright"), Image.COPYRIGHT);
|
||||||
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.site"), Image.SITE);
|
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.site"), Image.SITE);
|
||||||
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.license"), Image.LICENSE);
|
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.license"), Image.LICENSE);
|
||||||
|
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.material"), Image.MATERIAL);
|
||||||
|
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.technique"), Image.TECHNIQUE);
|
||||||
|
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.origin"), Image.ORIGIN);
|
||||||
|
sheet.add(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.origSize"), Image.ORIGSIZE);
|
||||||
|
|
||||||
container.add(sheet);
|
container.add(sheet);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,30 @@ public class ImagePropertyForm
|
||||||
TextField license = new TextField(licenseParam);
|
TextField license = new TextField(licenseParam);
|
||||||
add(license);
|
add(license);
|
||||||
|
|
||||||
|
add(new Label(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.material")));
|
||||||
|
ParameterModel materialParam = new StringParameter(Image.MATERIAL);
|
||||||
|
materialParam.addParameterListener(new StringInRangeValidationListener(0, 200));
|
||||||
|
TextField material = new TextField(materialParam);
|
||||||
|
add(material);
|
||||||
|
|
||||||
|
add(new Label(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.technique")));
|
||||||
|
ParameterModel techniqueParam = new StringParameter(Image.TECHNIQUE);
|
||||||
|
techniqueParam.addParameterListener(new StringInRangeValidationListener(0, 200));
|
||||||
|
TextField technique = new TextField(techniqueParam);
|
||||||
|
add(technique);
|
||||||
|
|
||||||
|
add(new Label(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.origin")));
|
||||||
|
ParameterModel originParam = new StringParameter(Image.ORIGIN);
|
||||||
|
originParam.addParameterListener(new StringInRangeValidationListener(0, 200));
|
||||||
|
TextField origin = new TextField(originParam);
|
||||||
|
add(origin);
|
||||||
|
|
||||||
|
add(new Label(ImageGlobalizationUtil.globalize("cms.contenttypes.ui.image.origSize")));
|
||||||
|
ParameterModel origSizeParam = new StringParameter(Image.ORIGSIZE);
|
||||||
|
origSizeParam.addParameterListener(new StringInRangeValidationListener(0, 100));
|
||||||
|
TextField origSize = new TextField(origSizeParam);
|
||||||
|
add(origSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Form initialisation hook. Fills widgets with data. */
|
/** Form initialisation hook. Fills widgets with data. */
|
||||||
|
|
@ -158,6 +182,10 @@ public class ImagePropertyForm
|
||||||
data.put(Image.COPYRIGHT, image.getCopyright());
|
data.put(Image.COPYRIGHT, image.getCopyright());
|
||||||
data.put(Image.SITE, image.getSite());
|
data.put(Image.SITE, image.getSite());
|
||||||
data.put(Image.LICENSE, image.getLicense());
|
data.put(Image.LICENSE, image.getLicense());
|
||||||
|
data.put(Image.MATERIAL, image.getMaterial());
|
||||||
|
data.put(Image.TECHNIQUE, image.getTechnique());
|
||||||
|
data.put(Image.ORIGIN, image.getOrigin());
|
||||||
|
data.put(Image.ORIGSIZE, image.getOriginalSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -193,6 +221,10 @@ public class ImagePropertyForm
|
||||||
image.setCopyright((String) data.get(Image.COPYRIGHT));
|
image.setCopyright((String) data.get(Image.COPYRIGHT));
|
||||||
image.setSite((String) data.get(Image.SITE));
|
image.setSite((String) data.get(Image.SITE));
|
||||||
image.setLicense((String) data.get(Image.LICENSE));
|
image.setLicense((String) data.get(Image.LICENSE));
|
||||||
|
image.setMaterial((String) data.get(Image.MATERIAL));
|
||||||
|
image.setTechnique((String) data.get(Image.TECHNIQUE));
|
||||||
|
image.setOrigin((String) data.get(Image.ORIGIN));
|
||||||
|
image.setOriginalSize((String) data.get(Image.ORIGSIZE));
|
||||||
|
|
||||||
image.save();
|
image.save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,195 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* 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.contenttypes.ui;
|
||||||
|
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.TextAsset;
|
||||||
|
import com.arsdigita.cms.contenttypes.Image;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.TextAssetBody;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the current text body of the article and allows the user
|
||||||
|
* to edit it, by uploading a file or entering text in a textbox.
|
||||||
|
*
|
||||||
|
* The {@link com.arsdigita.bebop.PropertySheet} class is often used
|
||||||
|
* as the display component in the default authoring kit steps of
|
||||||
|
* this class.
|
||||||
|
*
|
||||||
|
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
||||||
|
* @version $Id: ImageTextBody.java 1949 2009-06-25 08:30:50Z terry $
|
||||||
|
*/
|
||||||
|
public class ImageTextBody extends TextAssetBody {
|
||||||
|
|
||||||
|
protected AuthoringKitWizard m_parent;
|
||||||
|
protected ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new ImageTextBody component
|
||||||
|
*
|
||||||
|
* @param itemModel The {@link ItemSelectionModel} which will
|
||||||
|
* be responsible for loading the current item
|
||||||
|
*
|
||||||
|
* @param parent The parent wizard which contains the form. The form
|
||||||
|
* may use the wizard's methods, such as stepForward and stepBack,
|
||||||
|
* in its process listener.
|
||||||
|
*/
|
||||||
|
public ImageTextBody(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||||
|
super(new ItemAssetModel(itemModel));
|
||||||
|
m_itemModel = itemModel;
|
||||||
|
m_parent = parent;
|
||||||
|
|
||||||
|
// Rest the component when it is hidden
|
||||||
|
parent.getList().addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
reset(state);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set the right component access on the forms
|
||||||
|
Component f = getComponent(FILE_UPLOAD);
|
||||||
|
if (f != null) {
|
||||||
|
setComponentAccess(FILE_UPLOAD,
|
||||||
|
new WorkflowLockedComponentAccess(f, itemModel));
|
||||||
|
}
|
||||||
|
Component t = getComponent(TEXT_ENTRY);
|
||||||
|
setComponentAccess(TEXT_ENTRY,
|
||||||
|
new WorkflowLockedComponentAccess(t, itemModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the options for the mime type select widget of
|
||||||
|
* <code>GenericArticleForm</code> and sets the default mime type.
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
protected void setMimeTypeOptions(SingleSelect mimeSelect) {
|
||||||
|
mimeSelect.addOption(new Option("text/html", "HTML Text"));
|
||||||
|
mimeSelect.setOptionSelected("text/html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new text asset and associate it with the current item
|
||||||
|
*
|
||||||
|
* @param s the current page state
|
||||||
|
* @return a valid TextAsset
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected TextAsset createTextAsset(PageState s) {
|
||||||
|
Image item = getImage(s);
|
||||||
|
TextAsset t = new TextAsset();
|
||||||
|
t.setName(item.getName() + "_text_" + item.getID());
|
||||||
|
// no need - cg. Text doesn't need a security context,
|
||||||
|
// and ownership of text is recorded in text_pages
|
||||||
|
// t.setParent(item);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set additional parameters of a brand new text asset, such as the
|
||||||
|
* parent ID, after the asset has been successfully uploaded
|
||||||
|
*
|
||||||
|
* @param s the current page state
|
||||||
|
* @param a the new <code>TextAsset</code>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void updateTextAsset(PageState s, TextAsset a) {
|
||||||
|
Image t = getImage(s);
|
||||||
|
Assert.exists(t);
|
||||||
|
// no need - cg. Text doesn't need a security context,
|
||||||
|
// and ownership of text is recorded in text_pages
|
||||||
|
|
||||||
|
// a.setParent(t);
|
||||||
|
t.setTextAsset(a);
|
||||||
|
a.save();
|
||||||
|
t.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current Image
|
||||||
|
*/
|
||||||
|
protected Image getImage(PageState s) {
|
||||||
|
return (Image)m_itemModel.getSelectedObject(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An ACSObjectSelectionModel that selects the current text asset for
|
||||||
|
* the text page
|
||||||
|
*/
|
||||||
|
private static class ItemAssetModel extends ItemSelectionModel {
|
||||||
|
|
||||||
|
private RequestLocal m_asset;
|
||||||
|
|
||||||
|
public ItemAssetModel(ItemSelectionModel m) {
|
||||||
|
super(m);
|
||||||
|
|
||||||
|
m_asset = new RequestLocal() {
|
||||||
|
@Override
|
||||||
|
protected Object initialValue(PageState s) {
|
||||||
|
Image t = (Image)
|
||||||
|
((ItemSelectionModel)getSingleSelectionModel())
|
||||||
|
.getSelectedObject(s);
|
||||||
|
Assert.exists(t);
|
||||||
|
return t.getTextAsset();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getSelectedKey(PageState s) {
|
||||||
|
TextAsset a = (TextAsset)getSelectedObject(s);
|
||||||
|
return (a == null) ? null : a.getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DomainObject getSelectedObject(PageState s) {
|
||||||
|
return (DomainObject)m_asset.get(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectedObject(PageState s, DomainObject o) {
|
||||||
|
m_asset.set(s, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectedKey(PageState s, Object key) {
|
||||||
|
throw new UnsupportedOperationException( (String) GlobalizationUtil.globalize("cms.ui.authoring.not_implemented").localize());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSelected(PageState s) {
|
||||||
|
return (getSelectedObject(s) != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue