<%@ page language="java"
%><%@ page import="java.util.*"
%><%@ page import="com.bmw.wcms.nsceditor.content.ObjectReference"
%><%@ page import="com.bmwgroup.wcms.cmsal.*"
%><%@ page import="com.bmwgroup.wcms.cmsal.exception.*"
%><%@ page import="com.bmwgroup.wcms.common.cmstools.*"
%><%@ page import="com.bmwgroup.wcms.contentmodel.*"
%><%@ page import="com.bmwgroup.wcms.websiteapi.*"
%><%@ page import="com.bmwgroup.wcms.base.*"
%><%@ page import="com.bmwgroup.wcms.base.util.*"
%><%@ page import="com.bmwgroup.wcms.base.mapelement.*"
%><%@ page import="com.bmwgroup.wcms.template.util.*"
%><%@ include file="../../../../../../../../../templates/_basic/_includes/mcCommon.inc.jsp"
%><%!
// make current oid and url globally available
final String thisVipOid = "2099441";
final String thisVipUrlAbsolute = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html";
%><%
final String configurationSetName = null;
final String vipSite = "bmw";
final String vipServer = "PROD";
final String vipserver = vipServer;
int stage = 0;
boolean forceSerializedObjects = false;
// prepared variables of scope inside _jspService
TextFormat standardFormat=null;
try {
CMSTemplate template = null;
CMSObject cmsObject = null;
CMSContext cmsContext = new CMSContext (vipSite, vipServer);
CMSToolKit cmsToolKit = CMSSessionPoolSingleton.getCMSToolkit(configurationSetName);
stage = cmsToolKit.mapStage(vipServer);
//make cmsContext globally available
cmsContextRef = cmsContext;
if ((!ContentModelUtils.isCalledFromEditor(request))||(ContentModelUtils.isGeneratorCall(request, stage))) {
//load Configuration
loadConfiguration(cmsContext, "2099441", "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html");
/* ---- Establish standard text formater start ---- */
String absoluteFormatUrl = ObjectUtils.absoluteUrl("http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html", ObjectUtils.getRelativeObjectUrl("2099441", "321", cmsContext));
standardFormat = new TextFormat();
standardFormat.init (absoluteFormatUrl);
/* ---- Establish standard text formater end ---- */
/* ---- Define js code for configuration variables start ---- */
// generate a relative url from confJavascriptConfigurationOid, to reference JS-Script
String confJavascriptConfigurationUrl=null;
if(confJavascriptConfigurationOid != null) {
try {
confJavascriptConfigurationUrl = ObjectUtils.getRelativeObjectUrl("2099441", confJavascriptConfigurationOid, cmsContext);
} catch(Exception e) {}
}
// include javascript configuration variables and configuration scripts
// configuration.js might be missing, so check
if(confJavascriptConfigurationUrl != null) {
%>
<%
}
String nearestMisc2Attribute = ObjectUtils.getNearestMetaAttributeAsString(ObjectUtils.getCMSEntry("2099441", cmsContext), CMSConstants.CMS_META_ATTR_MISC_2);
if(nearestMisc2Attribute == null){
nearestMisc2Attribute = "null";
} else {
nearestMisc2Attribute = "\""+nearestMisc2Attribute +"\"";
}
%>
<%
/* ---- Define js code for configuration variables end ---- */
} // End of if(!ContentModelUtils.isCalledFromEditor(request))
%>
teaser_idee
<%
if(!"".equals(confMetaEmail)){ %>
<% }
if(!"".equals(confMetaAuthor)){ %>
<% } %>
<%
// decide where to load generic.css from
String cssUrl = null;
String serverRelativeTopics2 = ObjectUtils.getServerRelativeTopic ("2099441", "2099441", cmsContext);
String serverPath2 = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html".substring(0,"http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html".indexOf(serverRelativeTopics2));
if(confCountryTopic != null) {
cssUrl = serverPath2 + "/" + confCountryTopic + "/_common/css/generic.css";
}
else {
cssUrl = /* VIPURL */"../../../../../../../../../_common/narrowband/css/generic.css";
}
%>
<%
// // CMSTemplate
template = new CMSTemplate( /* VIPURL */"");
{
template.setAttribute("ttCOMMENT", "This template is used to create small image teasers that are saved centrally in the teaser pool but can be integrated in numerous pages.\r\n\r\nImportant information:\r\nPlease ensure that you click \"generate\" following every save procedure.");
template.setAttribute("ttREGORDER", "comment, basic version text, video version text, video files, tell a friend, metadata, configuration, all, head data");
template.setVipObjId(new Integer("2099441"));
template.setName("");
template.setDescription("");
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_change_to_highend", "
\r\nIf you made no entry in the element \"download_video\" located under the tab \"video files\" you can choose to link directly to the highend (video) version. To do so, please tick the box below.\r\n\r\nIf this element is neither active, nor there is a videofile attached, the teaser will be displayed in the video version only.\r\n
");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "10");
e.setAttribute("tREGN", "basic version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nDownload version of the video. \r\nIf this value is left blank, there would be no download function displayed.\r\nIf this value is left blank AND the box of the element \"change_to_highend\" under the tab \"basic version text\" is not ticked, the teaser will be displayed in the video version only. \r\n
");
e.setAttribute("tORD", "600");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nText for save video link. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "130");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("show_taf_link");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nIf \"Selected Value\" is checked, the tell a friend link is is displayed.\r\nThis is only used in the video version!\r\n
");
e.setAttribute("tORD", "5000");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oVAL");
e.setAttribute("tT", "BOOLEAN");
template.setElement(e);
e = new CMSElement();
e.setName("taf_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf link text.\r\n
");
e.setAttribute("tORD", "5030");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_module");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf module identifier.\r\n
");
e.setAttribute("tORD", "5010");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_theme");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf theme identifier.\r\n
");
e.setAttribute("tORD", "5020");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeadline for the video layer. \r\nTo hide this link deactivate the is displayed checkbox. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "110");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeight of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "650");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nLeft position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "630");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTop position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "620");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nWidth of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "640");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo movie, it is only used in the video version and has to be an Macromedia Flash-Video (.flv) file. \r\n
");
e.setAttribute("tORD", "610");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("video_subtitles");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo subtitles. Activate the is displayed checkbox to show the subtitles. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "120");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tSQTYPE", "TEXT");
e.setAttribute("tT", "SEQUENCE");
template.setElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "100");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("tALWSUBT", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tAVINHDR", "TRUE");
e.setAttribute("tD", "
";
}
if("tDESTT".equals(attributeName)) {
return "xml";
}
if("tORD".equals(attributeName)) {
return "101";
}
if("tREGN".equals(attributeName)) {
return "configuration";
}
if("tSEQELHDR".equals(attributeName)) {
return "oOBJURL";
}
if("tT".equals(attributeName)) {
return "ATTACHMENT";
}
}
return "";
}
%>
<%
//
%>
<%
// // CMSObject
cmsObject = new CMSObject();
request.setAttribute("cmsObject", cmsObject);
{
cmsObject.setVipObjId(new Integer("2099441"));
cmsObject.setTemplate(template);
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_2_tn.jpg");
e.setAttribute("oT_headline", "BMW X6 \u2013 L\u2019id\u00e9e");
e.setAttribute("oT_text", "Imaginer de nouveaux concepts. Chris Bangle d\u00e9voile les secrets de la nouvelle BMW X6.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oOBJURL", /* VIPURL*/"zip/x6_idea.zip");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oT", "Start Video");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("show_taf_link");
e.setAttribute("oDISP", "FALSE");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oT", "BMW X6 \u2013 L\u2019id\u00e9e");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oT", "272");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oT", "280");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oT", "120");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oT", "484");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oOBJURL", /* VIPURL*/"../../../../../../../../../_common/highend/templates/individual/experience/x6/x6/2007/phase_1/highlights/sac/e71_sac_idea.flv");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_2_tn.jpg");
e.setAttribute("oT_headline", "BMW X6 \u2013 L\u2019id\u00e9e");
e.setAttribute("oT_text", "Imaginer de nouveaux concepts. Chris Bangle d\u00e9voile les secrets de la nouvelle BMW X6.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("oOBJURL", /* VIPURL*/"xml/teaser_idee.xml");
cmsObject.putElement(e);
e = null;
cmsObject.addElementAttributes(template.getElements(), false);
}
%>
<%!
public String getFullScopeElementAttribute(String elementName, String attributeName) {
if("xml_content".equals(elementName)) {
if("oOBJURL".equals(attributeName)) {
return /* VIPURL*/"xml/teaser_idee.xml";
}
if("oURLINTERNoOBJURL".equals(attributeName)) {
return "TRUE";
}
}
return "";
}
%>
<%
//
%>
<%
//
if (cmsObject == null) {
cmsObject = template.createDummyObject();
}
//
%>
<%!
private boolean fileExists(String fileURL){
if(!"".equals(fileURL) && fileURL.toLowerCase().indexOf("poweredby")==-1 && fileURL.toLowerCase().indexOf("deleted")==-1){
return true;
}else{
return false;
}
}
%>
<%
String generate = request.getParameter ("generate");
String userid = request.getParameter ("userid");
String password = request.getParameter("password");
if (!ContentModelUtils.isCalledFromEditor(request) && !ContentModelUtils.isGeneratorCall(request,stage)) {
// find tracking page needed for this teaser type
String TRACKING_TYPE = "download";
String trackingPage = null;
for(int i=0;i < confTrackingRedirectOids.size();i++){
String url = ObjectUtils.getServerRelativeUrl("2099441", (String)confTrackingRedirectOids.get(i), cmsContext);
if(url != null && !"".equals(url)){
String filename = url.substring(0,url.lastIndexOf("."));
filename = filename.substring(filename.lastIndexOf("/")+1,filename.length());
if(TRACKING_TYPE.equals(filename)){
trackingPage = url;
}
}
}
//------------------------------------------------------------------
// Prepare Page Elements
//------------------------------------------------------------------
AttachmentElement downloadUrl = new AttachmentElement(cmsContext, cmsObject, "download_video");
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "basic_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
BooleanElement changeToHighend = (BooleanElement)teaserElement.getAttribute("change_to_highend");
teaserHeadline.setFormatting(standardFormat,FORMAT_HTML);
teaserCopy.setFormatting(standardFormat,FORMAT_HTML);
teaserHeadline.setDefaultText("");
teaserCopy.setDefaultText("");
String fileParam="";
if(!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1){
fileParam = ObjectUtils.getServerRelativeUrl("2099441",downloadUrl.getRefUrl(),cmsContext);
}
%>
<%
if((!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1) || changeToHighend.isTrue()){
%>
<%= teaserHeadline.getTextUTF8() %><%= teaserCopy.getTextUTF8() %>
<%
}
%>
<%
} // if not called from editor
%>
<%
//------------------------------------------------------------------
// Generate XML Content File From Template
//------------------------------------------------------------------
String xmlOutput=null;
if (ContentModelUtils.isGeneratorCall(request,stage)) {
CMSSession cmsSession = ObjectUtils.sessionLogin (request, cmsContext);
try{
String xmlOutUrl = (new AttachmentElement(cmsContext, cmsObject,"xml_content")).getRefUrl();
// check if xml_content-file is available - if not, build it and attach it to the contentpage.
// fetch pagename and topic
String pageName = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html";
pageName = pageName.substring(pageName.lastIndexOf("/")+1, pageName.lastIndexOf(".htm"));
String xmlTopic = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html";
xmlTopic = xmlTopic.substring(0, xmlTopic.lastIndexOf("/")+1) + "xml/index.htm";
CMSEntry cmsEntryWriteXML = ObjectUtils.getCMSEntry(xmlTopic, null, cmsContext);
// start query, set filter and find xml-files in xml topic
CMSQuery currentQuery = cmsSession.getCMSQuery(stage, vipSite);
CMSFilter cmsFilter = cmsToolKit.createStringEqualsFilter (CMSConstants.CMS_META_ATTR_OBJ_NAME, pageName);
Iterator iterator = currentQuery.filter (cmsFilter, cmsEntryWriteXML.getOid(), CMSConstants.CMS_UNDEFINED_VALUE, CMSConstants.CMS_UNDEFINED_VALUE);
CMSEntry cmsXmlContentEntry = null;
//if there is a corresponding xml-file, use this one and attach it
if (iterator.hasNext()) {
cmsXmlContentEntry = (CMSEntry) iterator.next();
CMSElement cmsElement = cmsObject.getElement("xml_content");
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
//if no xml-file exists...
} else if("".equals(xmlOutUrl) || xmlOutUrl.toLowerCase().indexOf("poweredby")!=-1 || xmlOutUrl.toLowerCase().indexOf("deleted")!=-1){
//create xml-file
cmsXmlContentEntry = ObjectUtils.createObject(pageName, ".xml", cmsEntryWriteXML.getOid(), cmsContext, cmsSession);
CMSElement cmsElement = cmsObject.getElement("xml_content");
//attach xml-file
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
}
if(!"".equals(xmlOutUrl) && xmlOutUrl.toLowerCase().indexOf("poweredby")==-1 && xmlOutUrl.toLowerCase().indexOf("deleted")==-1){
StringBuffer xmlOutputBuffer = new StringBuffer();
boolean showTafLink = false;
BooleanElement showTafLinkElement = new BooleanElement(cmsContext, cmsObject,"show_taf_link");
showTafLink = showTafLinkElement.isTrue();
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "video_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
TextElement videoLayerHeadline = new TextElement(cmsContext, cmsObject, "video_layer_headline");
TextElement replayVideoLinkText = new TextElement(cmsContext, cmsObject, "replay_video_link_text");
TextElement videoLayerTopPosition = new TextElement(cmsContext, cmsObject, "video_layer_top_position");
TextElement videoLayerLeftPosition = new TextElement(cmsContext, cmsObject, "video_layer_left_position");
TextElement videoLayerWidth = new TextElement(cmsContext, cmsObject, "video_layer_width");
TextElement videoLayerHeight = new TextElement(cmsContext, cmsObject, "video_layer_height");
AttachmentElement downloadVideo = new AttachmentElement(cmsContext, cmsObject, "download_video");
AttachmentElement videoMovie = new AttachmentElement(cmsContext, cmsObject, "video_movie");
videoLayerTopPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerTopPosition.setDefaultText("");
videoLayerLeftPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerLeftPosition.setDefaultText("");
videoLayerWidth.setFormatting(standardFormat,FORMAT_XML);
videoLayerWidth.setDefaultText("");
videoLayerHeight.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeight.setDefaultText("");
teaserHeadline.setFormatting(standardFormat,FORMAT_XML);
teaserHeadline.setDefaultText("");
teaserCopy.setFormatting(standardFormat,FORMAT_XML);
teaserCopy.setDefaultText("");
videoLayerHeadline.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeadline.setDefaultText("");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
String virtualUrlPrefix = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html";
virtualUrlPrefix = virtualUrlPrefix.substring((virtualUrlPrefix.indexOf("/_teaserpool/")+13), virtualUrlPrefix.length());
virtualUrlPrefix = virtualUrlPrefix.substring(0, virtualUrlPrefix.lastIndexOf("."));
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(fileExists(downloadVideo.getRefUrl())){
xmlOutputBuffer.append(" \n");
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(showTafLink){
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
}
TextElement videoSubtitlesElement = new TextElement(cmsContext, cmsObject, "video_subtitles");
if(videoSubtitlesElement.getDisplayed()){
xmlOutputBuffer.append(" \n");
int sequenceLength = CoreElement.getSequenceSize(cmsObject, "video_subtitles");
for(int i=1; i <= sequenceLength; i++){
xmlOutputBuffer.append(" \n");
}
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append("\n");
xmlOutput=xmlOutputBuffer.toString();
xmlOutput = StringUtils.replaceAll(xmlOutput, cmsObject);
xmlOutput = StringUtils.replaceAll(xmlOutput, "\r\n", "\n");
ObjectUtils.writeContent(xmlOutUrl, StringUtils.convertToUTF8(xmlOutput), cmsContext, cmsSession);
xmlOutput = StringUtils.replaceAll(xmlOutput, "<", "<");
xmlOutput = StringUtils.replaceAll(xmlOutput, ">", ">");
} else {
xmlOutput="Output URL missing, no XML written!";
getServletConfig().getServletContext().log("--> Generate of XML failed for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html, output Url is missing.");
}
} catch(Exception e){%>
Exception occured:
<%
e.printStackTrace(new PrintWriter(out));
getServletConfig().getServletContext().log("--> Generate of XML failed with "+e.toString()+" for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_idee.html.");
%>
<%
} // end if generate
%>
<%
/* ---- free allocated objects ---- */
standardTextContent=null;
// included code to serialize objects
%><%@ include file="../../../../../../../../../templates/_basic/_includes/serializedObjects.inc.jsp" %><%
} catch (PendingDeploymentException pdEx) {
CMSSession cmsSession = CMSSessionPoolSingleton.getCMSSession(configurationSetName);
if (cmsSession != null) {
CMSQuery currenQuery = cmsSession.getCMSQuery(stage, vipSite);
if (currenQuery != null) {
CMSEntry pageEntry = currenQuery.getEntryByOid("2099441");
if (pageEntry != null) {
pageEntry.applyAction(CMSConstants.CMS_ACTION_REPUBLISH);
}
}
}
throw pdEx;
}
%>
<%@ page language="java"
%><%@ page import="java.util.*"
%><%@ page import="com.bmw.wcms.nsceditor.content.ObjectReference"
%><%@ page import="com.bmwgroup.wcms.cmsal.*"
%><%@ page import="com.bmwgroup.wcms.cmsal.exception.*"
%><%@ page import="com.bmwgroup.wcms.common.cmstools.*"
%><%@ page import="com.bmwgroup.wcms.contentmodel.*"
%><%@ page import="com.bmwgroup.wcms.websiteapi.*"
%><%@ page import="com.bmwgroup.wcms.base.*"
%><%@ page import="com.bmwgroup.wcms.base.util.*"
%><%@ page import="com.bmwgroup.wcms.base.mapelement.*"
%><%@ page import="com.bmwgroup.wcms.template.util.*"
%><%@ include file="../../../../../../../../../templates/_basic/_includes/mcCommon.inc.jsp"
%><%!
// make current oid and url globally available
final String thisVipOid = "2099435";
final String thisVipUrlAbsolute = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html";
%><%
final String configurationSetName = null;
final String vipSite = "bmw";
final String vipServer = "PROD";
final String vipserver = vipServer;
int stage = 0;
boolean forceSerializedObjects = false;
// prepared variables of scope inside _jspService
TextFormat standardFormat=null;
try {
CMSTemplate template = null;
CMSObject cmsObject = null;
CMSContext cmsContext = new CMSContext (vipSite, vipServer);
CMSToolKit cmsToolKit = CMSSessionPoolSingleton.getCMSToolkit(configurationSetName);
stage = cmsToolKit.mapStage(vipServer);
//make cmsContext globally available
cmsContextRef = cmsContext;
if ((!ContentModelUtils.isCalledFromEditor(request))||(ContentModelUtils.isGeneratorCall(request, stage))) {
//load Configuration
loadConfiguration(cmsContext, "2099435", "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html");
/* ---- Establish standard text formater start ---- */
String absoluteFormatUrl = ObjectUtils.absoluteUrl("http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html", ObjectUtils.getRelativeObjectUrl("2099435", "321", cmsContext));
standardFormat = new TextFormat();
standardFormat.init (absoluteFormatUrl);
/* ---- Establish standard text formater end ---- */
/* ---- Define js code for configuration variables start ---- */
// generate a relative url from confJavascriptConfigurationOid, to reference JS-Script
String confJavascriptConfigurationUrl=null;
if(confJavascriptConfigurationOid != null) {
try {
confJavascriptConfigurationUrl = ObjectUtils.getRelativeObjectUrl("2099435", confJavascriptConfigurationOid, cmsContext);
} catch(Exception e) {}
}
// include javascript configuration variables and configuration scripts
// configuration.js might be missing, so check
if(confJavascriptConfigurationUrl != null) {
%>
<%
}
String nearestMisc2Attribute = ObjectUtils.getNearestMetaAttributeAsString(ObjectUtils.getCMSEntry("2099435", cmsContext), CMSConstants.CMS_META_ATTR_MISC_2);
if(nearestMisc2Attribute == null){
nearestMisc2Attribute = "null";
} else {
nearestMisc2Attribute = "\""+nearestMisc2Attribute +"\"";
}
%>
<%
/* ---- Define js code for configuration variables end ---- */
} // End of if(!ContentModelUtils.isCalledFromEditor(request))
%>
teaser_dpc
<%
if(!"".equals(confMetaEmail)){ %>
<% }
if(!"".equals(confMetaAuthor)){ %>
<% } %>
<%
// decide where to load generic.css from
String cssUrl = null;
String serverRelativeTopics2 = ObjectUtils.getServerRelativeTopic ("2099435", "2099435", cmsContext);
String serverPath2 = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html".substring(0,"http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html".indexOf(serverRelativeTopics2));
if(confCountryTopic != null) {
cssUrl = serverPath2 + "/" + confCountryTopic + "/_common/css/generic.css";
}
else {
cssUrl = /* VIPURL */"../../../../../../../../../_common/narrowband/css/generic.css";
}
%>
<%
// // CMSTemplate
template = new CMSTemplate( /* VIPURL */"");
{
template.setAttribute("ttCOMMENT", "This template is used to create small image teasers that are saved centrally in the teaser pool but can be integrated in numerous pages.\r\n\r\nImportant information:\r\nPlease ensure that you click \"generate\" following every save procedure.");
template.setAttribute("ttREGORDER", "comment, basic version text, video version text, video files, tell a friend, metadata, configuration, all, head data");
template.setVipObjId(new Integer("2099435"));
template.setName("");
template.setDescription("");
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_change_to_highend", "
\r\nIf you made no entry in the element \"download_video\" located under the tab \"video files\" you can choose to link directly to the highend (video) version. To do so, please tick the box below.\r\n\r\nIf this element is neither active, nor there is a videofile attached, the teaser will be displayed in the video version only.\r\n
");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "10");
e.setAttribute("tREGN", "basic version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nDownload version of the video. \r\nIf this value is left blank, there would be no download function displayed.\r\nIf this value is left blank AND the box of the element \"change_to_highend\" under the tab \"basic version text\" is not ticked, the teaser will be displayed in the video version only. \r\n
");
e.setAttribute("tORD", "600");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nText for save video link. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "130");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("show_taf_link");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nIf \"Selected Value\" is checked, the tell a friend link is is displayed.\r\nThis is only used in the video version!\r\n
");
e.setAttribute("tORD", "5000");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oVAL");
e.setAttribute("tT", "BOOLEAN");
template.setElement(e);
e = new CMSElement();
e.setName("taf_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf link text.\r\n
");
e.setAttribute("tORD", "5030");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_module");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf module identifier.\r\n
");
e.setAttribute("tORD", "5010");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_theme");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf theme identifier.\r\n
");
e.setAttribute("tORD", "5020");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeadline for the video layer. \r\nTo hide this link deactivate the is displayed checkbox. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "110");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeight of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "650");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nLeft position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "630");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTop position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "620");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nWidth of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "640");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo movie, it is only used in the video version and has to be an Macromedia Flash-Video (.flv) file. \r\n
");
e.setAttribute("tORD", "610");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("video_subtitles");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo subtitles. Activate the is displayed checkbox to show the subtitles. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "120");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tSQTYPE", "TEXT");
e.setAttribute("tT", "SEQUENCE");
template.setElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "100");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("tALWSUBT", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tAVINHDR", "TRUE");
e.setAttribute("tD", "
";
}
if("tDESTT".equals(attributeName)) {
return "xml";
}
if("tORD".equals(attributeName)) {
return "101";
}
if("tREGN".equals(attributeName)) {
return "configuration";
}
if("tSEQELHDR".equals(attributeName)) {
return "oOBJURL";
}
if("tT".equals(attributeName)) {
return "ATTACHMENT";
}
}
return "";
}
%>
<%
//
%>
<%
// // CMSObject
cmsObject = new CMSObject();
request.setAttribute("cmsObject", cmsObject);
{
cmsObject.setVipObjId(new Integer("2099435"));
cmsObject.setTemplate(template);
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_5_tn.jpg");
e.setAttribute("oT_headline", "Dynamic Performance Control DPC");
e.setAttribute("oT_text", "D\u00e9couvrez l\u2019avenir du virage au volant de la BMW X6.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oOBJURL", /* VIPURL*/"zip/x6_dpc.zip");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oT", "Start Video");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oT", "Dynamic Performance Control DPC");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oT", "272");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oT", "280");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oT", "120");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oT", "484");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("oOBJURL", /* VIPURL*/"../../../../../../../../../_common/highend/templates/individual/experience/x6/x6/2007/phase_1/highlights/dpc/de/e71_dpc.flv");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_5_tn.jpg");
e.setAttribute("oT_headline", "Dynamic Performance Control DPC");
e.setAttribute("oT_text", "D\u00e9couvrez l\u2019avenir du virage au volant de la BMW X6.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("oOBJURL", /* VIPURL*/"xml/teaser_dpc.xml");
cmsObject.putElement(e);
e = null;
cmsObject.addElementAttributes(template.getElements(), false);
}
%>
<%!
public String getFullScopeElementAttribute(String elementName, String attributeName) {
if("xml_content".equals(elementName)) {
if("oOBJURL".equals(attributeName)) {
return /* VIPURL*/"xml/teaser_dpc.xml";
}
if("oURLINTERNoOBJURL".equals(attributeName)) {
return "TRUE";
}
}
return "";
}
%>
<%
//
%>
<%
//
if (cmsObject == null) {
cmsObject = template.createDummyObject();
}
//
%>
<%!
private boolean fileExists(String fileURL){
if(!"".equals(fileURL) && fileURL.toLowerCase().indexOf("poweredby")==-1 && fileURL.toLowerCase().indexOf("deleted")==-1){
return true;
}else{
return false;
}
}
%>
<%
String generate = request.getParameter ("generate");
String userid = request.getParameter ("userid");
String password = request.getParameter("password");
if (!ContentModelUtils.isCalledFromEditor(request) && !ContentModelUtils.isGeneratorCall(request,stage)) {
// find tracking page needed for this teaser type
String TRACKING_TYPE = "download";
String trackingPage = null;
for(int i=0;i < confTrackingRedirectOids.size();i++){
String url = ObjectUtils.getServerRelativeUrl("2099435", (String)confTrackingRedirectOids.get(i), cmsContext);
if(url != null && !"".equals(url)){
String filename = url.substring(0,url.lastIndexOf("."));
filename = filename.substring(filename.lastIndexOf("/")+1,filename.length());
if(TRACKING_TYPE.equals(filename)){
trackingPage = url;
}
}
}
//------------------------------------------------------------------
// Prepare Page Elements
//------------------------------------------------------------------
AttachmentElement downloadUrl = new AttachmentElement(cmsContext, cmsObject, "download_video");
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "basic_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
BooleanElement changeToHighend = (BooleanElement)teaserElement.getAttribute("change_to_highend");
teaserHeadline.setFormatting(standardFormat,FORMAT_HTML);
teaserCopy.setFormatting(standardFormat,FORMAT_HTML);
teaserHeadline.setDefaultText("");
teaserCopy.setDefaultText("");
String fileParam="";
if(!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1){
fileParam = ObjectUtils.getServerRelativeUrl("2099435",downloadUrl.getRefUrl(),cmsContext);
}
%>
<%
if((!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1) || changeToHighend.isTrue()){
%>
<%= teaserHeadline.getTextUTF8() %><%= teaserCopy.getTextUTF8() %>
<%
}
%>
<%
} // if not called from editor
%>
<%
//------------------------------------------------------------------
// Generate XML Content File From Template
//------------------------------------------------------------------
String xmlOutput=null;
if (ContentModelUtils.isGeneratorCall(request,stage)) {
CMSSession cmsSession = ObjectUtils.sessionLogin (request, cmsContext);
try{
String xmlOutUrl = (new AttachmentElement(cmsContext, cmsObject,"xml_content")).getRefUrl();
// check if xml_content-file is available - if not, build it and attach it to the contentpage.
// fetch pagename and topic
String pageName = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html";
pageName = pageName.substring(pageName.lastIndexOf("/")+1, pageName.lastIndexOf(".htm"));
String xmlTopic = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html";
xmlTopic = xmlTopic.substring(0, xmlTopic.lastIndexOf("/")+1) + "xml/index.htm";
CMSEntry cmsEntryWriteXML = ObjectUtils.getCMSEntry(xmlTopic, null, cmsContext);
// start query, set filter and find xml-files in xml topic
CMSQuery currentQuery = cmsSession.getCMSQuery(stage, vipSite);
CMSFilter cmsFilter = cmsToolKit.createStringEqualsFilter (CMSConstants.CMS_META_ATTR_OBJ_NAME, pageName);
Iterator iterator = currentQuery.filter (cmsFilter, cmsEntryWriteXML.getOid(), CMSConstants.CMS_UNDEFINED_VALUE, CMSConstants.CMS_UNDEFINED_VALUE);
CMSEntry cmsXmlContentEntry = null;
//if there is a corresponding xml-file, use this one and attach it
if (iterator.hasNext()) {
cmsXmlContentEntry = (CMSEntry) iterator.next();
CMSElement cmsElement = cmsObject.getElement("xml_content");
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
//if no xml-file exists...
} else if("".equals(xmlOutUrl) || xmlOutUrl.toLowerCase().indexOf("poweredby")!=-1 || xmlOutUrl.toLowerCase().indexOf("deleted")!=-1){
//create xml-file
cmsXmlContentEntry = ObjectUtils.createObject(pageName, ".xml", cmsEntryWriteXML.getOid(), cmsContext, cmsSession);
CMSElement cmsElement = cmsObject.getElement("xml_content");
//attach xml-file
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
}
if(!"".equals(xmlOutUrl) && xmlOutUrl.toLowerCase().indexOf("poweredby")==-1 && xmlOutUrl.toLowerCase().indexOf("deleted")==-1){
StringBuffer xmlOutputBuffer = new StringBuffer();
boolean showTafLink = false;
BooleanElement showTafLinkElement = new BooleanElement(cmsContext, cmsObject,"show_taf_link");
showTafLink = showTafLinkElement.isTrue();
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "video_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
TextElement videoLayerHeadline = new TextElement(cmsContext, cmsObject, "video_layer_headline");
TextElement replayVideoLinkText = new TextElement(cmsContext, cmsObject, "replay_video_link_text");
TextElement videoLayerTopPosition = new TextElement(cmsContext, cmsObject, "video_layer_top_position");
TextElement videoLayerLeftPosition = new TextElement(cmsContext, cmsObject, "video_layer_left_position");
TextElement videoLayerWidth = new TextElement(cmsContext, cmsObject, "video_layer_width");
TextElement videoLayerHeight = new TextElement(cmsContext, cmsObject, "video_layer_height");
AttachmentElement downloadVideo = new AttachmentElement(cmsContext, cmsObject, "download_video");
AttachmentElement videoMovie = new AttachmentElement(cmsContext, cmsObject, "video_movie");
videoLayerTopPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerTopPosition.setDefaultText("");
videoLayerLeftPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerLeftPosition.setDefaultText("");
videoLayerWidth.setFormatting(standardFormat,FORMAT_XML);
videoLayerWidth.setDefaultText("");
videoLayerHeight.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeight.setDefaultText("");
teaserHeadline.setFormatting(standardFormat,FORMAT_XML);
teaserHeadline.setDefaultText("");
teaserCopy.setFormatting(standardFormat,FORMAT_XML);
teaserCopy.setDefaultText("");
videoLayerHeadline.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeadline.setDefaultText("");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
String virtualUrlPrefix = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html";
virtualUrlPrefix = virtualUrlPrefix.substring((virtualUrlPrefix.indexOf("/_teaserpool/")+13), virtualUrlPrefix.length());
virtualUrlPrefix = virtualUrlPrefix.substring(0, virtualUrlPrefix.lastIndexOf("."));
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(fileExists(downloadVideo.getRefUrl())){
xmlOutputBuffer.append(" \n");
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(showTafLink){
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
}
TextElement videoSubtitlesElement = new TextElement(cmsContext, cmsObject, "video_subtitles");
if(videoSubtitlesElement.getDisplayed()){
xmlOutputBuffer.append(" \n");
int sequenceLength = CoreElement.getSequenceSize(cmsObject, "video_subtitles");
for(int i=1; i <= sequenceLength; i++){
xmlOutputBuffer.append(" \n");
}
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append("\n");
xmlOutput=xmlOutputBuffer.toString();
xmlOutput = StringUtils.replaceAll(xmlOutput, cmsObject);
xmlOutput = StringUtils.replaceAll(xmlOutput, "\r\n", "\n");
ObjectUtils.writeContent(xmlOutUrl, StringUtils.convertToUTF8(xmlOutput), cmsContext, cmsSession);
xmlOutput = StringUtils.replaceAll(xmlOutput, "<", "<");
xmlOutput = StringUtils.replaceAll(xmlOutput, ">", ">");
} else {
xmlOutput="Output URL missing, no XML written!";
getServletConfig().getServletContext().log("--> Generate of XML failed for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html, output Url is missing.");
}
} catch(Exception e){%>
Exception occured:
<%
e.printStackTrace(new PrintWriter(out));
getServletConfig().getServletContext().log("--> Generate of XML failed with "+e.toString()+" for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_dpc.html.");
%>
<%
} // end if generate
%>
<%
/* ---- free allocated objects ---- */
standardTextContent=null;
// included code to serialize objects
%><%@ include file="../../../../../../../../../templates/_basic/_includes/serializedObjects.inc.jsp" %><%
} catch (PendingDeploymentException pdEx) {
CMSSession cmsSession = CMSSessionPoolSingleton.getCMSSession(configurationSetName);
if (cmsSession != null) {
CMSQuery currenQuery = cmsSession.getCMSQuery(stage, vipSite);
if (currenQuery != null) {
CMSEntry pageEntry = currenQuery.getEntryByOid("2099435");
if (pageEntry != null) {
pageEntry.applyAction(CMSConstants.CMS_ACTION_REPUBLISH);
}
}
}
throw pdEx;
}
%>
<%@ page language="java"
%><%@ page import="java.util.*"
%><%@ page import="com.bmw.wcms.nsceditor.content.ObjectReference"
%><%@ page import="com.bmwgroup.wcms.cmsal.*"
%><%@ page import="com.bmwgroup.wcms.cmsal.exception.*"
%><%@ page import="com.bmwgroup.wcms.common.cmstools.*"
%><%@ page import="com.bmwgroup.wcms.contentmodel.*"
%><%@ page import="com.bmwgroup.wcms.websiteapi.*"
%><%@ page import="com.bmwgroup.wcms.base.*"
%><%@ page import="com.bmwgroup.wcms.base.util.*"
%><%@ page import="com.bmwgroup.wcms.base.mapelement.*"
%><%@ page import="com.bmwgroup.wcms.template.util.*"
%><%@ include file="../../../../../../../../../templates/_basic/_includes/mcCommon.inc.jsp"
%><%!
// make current oid and url globally available
final String thisVipOid = "2099452";
final String thisVipUrlAbsolute = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html";
%><%
final String configurationSetName = null;
final String vipSite = "bmw";
final String vipServer = "PROD";
final String vipserver = vipServer;
int stage = 0;
boolean forceSerializedObjects = false;
// prepared variables of scope inside _jspService
TextFormat standardFormat=null;
try {
CMSTemplate template = null;
CMSObject cmsObject = null;
CMSContext cmsContext = new CMSContext (vipSite, vipServer);
CMSToolKit cmsToolKit = CMSSessionPoolSingleton.getCMSToolkit(configurationSetName);
stage = cmsToolKit.mapStage(vipServer);
//make cmsContext globally available
cmsContextRef = cmsContext;
if ((!ContentModelUtils.isCalledFromEditor(request))||(ContentModelUtils.isGeneratorCall(request, stage))) {
//load Configuration
loadConfiguration(cmsContext, "2099452", "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html");
/* ---- Establish standard text formater start ---- */
String absoluteFormatUrl = ObjectUtils.absoluteUrl("http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html", ObjectUtils.getRelativeObjectUrl("2099452", "321", cmsContext));
standardFormat = new TextFormat();
standardFormat.init (absoluteFormatUrl);
/* ---- Establish standard text formater end ---- */
/* ---- Define js code for configuration variables start ---- */
// generate a relative url from confJavascriptConfigurationOid, to reference JS-Script
String confJavascriptConfigurationUrl=null;
if(confJavascriptConfigurationOid != null) {
try {
confJavascriptConfigurationUrl = ObjectUtils.getRelativeObjectUrl("2099452", confJavascriptConfigurationOid, cmsContext);
} catch(Exception e) {}
}
// include javascript configuration variables and configuration scripts
// configuration.js might be missing, so check
if(confJavascriptConfigurationUrl != null) {
%>
<%
}
String nearestMisc2Attribute = ObjectUtils.getNearestMetaAttributeAsString(ObjectUtils.getCMSEntry("2099452", cmsContext), CMSConstants.CMS_META_ATTR_MISC_2);
if(nearestMisc2Attribute == null){
nearestMisc2Attribute = "null";
} else {
nearestMisc2Attribute = "\""+nearestMisc2Attribute +"\"";
}
%>
<%
/* ---- Define js code for configuration variables end ---- */
} // End of if(!ContentModelUtils.isCalledFromEditor(request))
%>
teaser_hpi
<%
if(!"".equals(confMetaEmail)){ %>
<% }
if(!"".equals(confMetaAuthor)){ %>
<% } %>
<%
// decide where to load generic.css from
String cssUrl = null;
String serverRelativeTopics2 = ObjectUtils.getServerRelativeTopic ("2099452", "2099452", cmsContext);
String serverPath2 = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html".substring(0,"http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html".indexOf(serverRelativeTopics2));
if(confCountryTopic != null) {
cssUrl = serverPath2 + "/" + confCountryTopic + "/_common/css/generic.css";
}
else {
cssUrl = /* VIPURL */"../../../../../../../../../_common/narrowband/css/generic.css";
}
%>
<%
// // CMSTemplate
template = new CMSTemplate( /* VIPURL */"");
{
template.setAttribute("ttCOMMENT", "This template is used to create small image teasers that are saved centrally in the teaser pool but can be integrated in numerous pages.\r\n\r\nImportant information:\r\nPlease ensure that you click \"generate\" following every save procedure.");
template.setAttribute("ttREGORDER", "comment, basic version text, video version text, video files, tell a friend, metadata, configuration, all, head data");
template.setVipObjId(new Integer("2099452"));
template.setName("");
template.setDescription("");
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_change_to_highend", "
\r\nIf you made no entry in the element \"download_video\" located under the tab \"video files\" you can choose to link directly to the highend (video) version. To do so, please tick the box below.\r\n\r\nIf this element is neither active, nor there is a videofile attached, the teaser will be displayed in the video version only.\r\n
");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "10");
e.setAttribute("tREGN", "basic version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nDownload version of the video. \r\nIf this value is left blank, there would be no download function displayed.\r\nIf this value is left blank AND the box of the element \"change_to_highend\" under the tab \"basic version text\" is not ticked, the teaser will be displayed in the video version only. \r\n
");
e.setAttribute("tORD", "600");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nText for save video link. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "130");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("show_taf_link");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nIf \"Selected Value\" is checked, the tell a friend link is is displayed.\r\nThis is only used in the video version!\r\n
");
e.setAttribute("tORD", "5000");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oVAL");
e.setAttribute("tT", "BOOLEAN");
template.setElement(e);
e = new CMSElement();
e.setName("taf_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf link text.\r\n
");
e.setAttribute("tORD", "5030");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_module");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf module identifier.\r\n
");
e.setAttribute("tORD", "5010");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_theme");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf theme identifier.\r\n
");
e.setAttribute("tORD", "5020");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeadline for the video layer. \r\nTo hide this link deactivate the is displayed checkbox. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "110");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeight of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "650");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nLeft position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "630");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTop position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "620");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nWidth of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "640");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo movie, it is only used in the video version and has to be an Macromedia Flash-Video (.flv) file. \r\n
");
e.setAttribute("tORD", "610");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("video_subtitles");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo subtitles. Activate the is displayed checkbox to show the subtitles. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "120");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tSQTYPE", "TEXT");
e.setAttribute("tT", "SEQUENCE");
template.setElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "100");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("tALWSUBT", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tAVINHDR", "TRUE");
e.setAttribute("tD", "
";
}
if("tDESTT".equals(attributeName)) {
return "xml";
}
if("tORD".equals(attributeName)) {
return "101";
}
if("tREGN".equals(attributeName)) {
return "configuration";
}
if("tSEQELHDR".equals(attributeName)) {
return "oOBJURL";
}
if("tT".equals(attributeName)) {
return "ATTACHMENT";
}
}
return "";
}
%>
<%
//
%>
<%
// // CMSObject
cmsObject = new CMSObject();
request.setAttribute("cmsObject", cmsObject);
{
cmsObject.setVipObjId(new Integer("2099452"));
cmsObject.setTemplate(template);
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_7_tn.jpg");
e.setAttribute("oT_headline", "Injection directe haute pr\u00e9cision HPI");
e.setAttribute("oT_text", "Plus de puissance malgr\u00e9 une consommation moindre.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oOBJURL", /* VIPURL*/"zip/x6_hpi.zip");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oT", "Start Video");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oT", "Injection directe haute pr\u00e9cision HPI");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oT", "272");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oT", "280");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oT", "120");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oT", "484");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oOBJURL", /* VIPURL*/"../../../../../../../../../_common/highend/templates/individual/experience/x6/x6/2007/phase_1/highlights/effdyn/de/e71_effdyn_hpi.flv");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_7_tn.jpg");
e.setAttribute("oT_headline", "Injection directe haute pr\u00e9cision HPI");
e.setAttribute("oT_text", "Plus de puissance malgr\u00e9 une consommation moindre.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("oOBJURL", /* VIPURL*/"xml/teaser_hpi.xml");
cmsObject.putElement(e);
e = null;
cmsObject.addElementAttributes(template.getElements(), false);
}
%>
<%!
public String getFullScopeElementAttribute(String elementName, String attributeName) {
if("xml_content".equals(elementName)) {
if("oOBJURL".equals(attributeName)) {
return /* VIPURL*/"xml/teaser_hpi.xml";
}
if("oURLINTERNoOBJURL".equals(attributeName)) {
return "TRUE";
}
}
return "";
}
%>
<%
//
%>
<%
//
if (cmsObject == null) {
cmsObject = template.createDummyObject();
}
//
%>
<%!
private boolean fileExists(String fileURL){
if(!"".equals(fileURL) && fileURL.toLowerCase().indexOf("poweredby")==-1 && fileURL.toLowerCase().indexOf("deleted")==-1){
return true;
}else{
return false;
}
}
%>
<%
String generate = request.getParameter ("generate");
String userid = request.getParameter ("userid");
String password = request.getParameter("password");
if (!ContentModelUtils.isCalledFromEditor(request) && !ContentModelUtils.isGeneratorCall(request,stage)) {
// find tracking page needed for this teaser type
String TRACKING_TYPE = "download";
String trackingPage = null;
for(int i=0;i < confTrackingRedirectOids.size();i++){
String url = ObjectUtils.getServerRelativeUrl("2099452", (String)confTrackingRedirectOids.get(i), cmsContext);
if(url != null && !"".equals(url)){
String filename = url.substring(0,url.lastIndexOf("."));
filename = filename.substring(filename.lastIndexOf("/")+1,filename.length());
if(TRACKING_TYPE.equals(filename)){
trackingPage = url;
}
}
}
//------------------------------------------------------------------
// Prepare Page Elements
//------------------------------------------------------------------
AttachmentElement downloadUrl = new AttachmentElement(cmsContext, cmsObject, "download_video");
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "basic_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
BooleanElement changeToHighend = (BooleanElement)teaserElement.getAttribute("change_to_highend");
teaserHeadline.setFormatting(standardFormat,FORMAT_HTML);
teaserCopy.setFormatting(standardFormat,FORMAT_HTML);
teaserHeadline.setDefaultText("");
teaserCopy.setDefaultText("");
String fileParam="";
if(!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1){
fileParam = ObjectUtils.getServerRelativeUrl("2099452",downloadUrl.getRefUrl(),cmsContext);
}
%>
<%
if((!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1) || changeToHighend.isTrue()){
%>
<%= teaserHeadline.getTextUTF8() %><%= teaserCopy.getTextUTF8() %>
<%
}
%>
<%
} // if not called from editor
%>
<%
//------------------------------------------------------------------
// Generate XML Content File From Template
//------------------------------------------------------------------
String xmlOutput=null;
if (ContentModelUtils.isGeneratorCall(request,stage)) {
CMSSession cmsSession = ObjectUtils.sessionLogin (request, cmsContext);
try{
String xmlOutUrl = (new AttachmentElement(cmsContext, cmsObject,"xml_content")).getRefUrl();
// check if xml_content-file is available - if not, build it and attach it to the contentpage.
// fetch pagename and topic
String pageName = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html";
pageName = pageName.substring(pageName.lastIndexOf("/")+1, pageName.lastIndexOf(".htm"));
String xmlTopic = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html";
xmlTopic = xmlTopic.substring(0, xmlTopic.lastIndexOf("/")+1) + "xml/index.htm";
CMSEntry cmsEntryWriteXML = ObjectUtils.getCMSEntry(xmlTopic, null, cmsContext);
// start query, set filter and find xml-files in xml topic
CMSQuery currentQuery = cmsSession.getCMSQuery(stage, vipSite);
CMSFilter cmsFilter = cmsToolKit.createStringEqualsFilter (CMSConstants.CMS_META_ATTR_OBJ_NAME, pageName);
Iterator iterator = currentQuery.filter (cmsFilter, cmsEntryWriteXML.getOid(), CMSConstants.CMS_UNDEFINED_VALUE, CMSConstants.CMS_UNDEFINED_VALUE);
CMSEntry cmsXmlContentEntry = null;
//if there is a corresponding xml-file, use this one and attach it
if (iterator.hasNext()) {
cmsXmlContentEntry = (CMSEntry) iterator.next();
CMSElement cmsElement = cmsObject.getElement("xml_content");
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
//if no xml-file exists...
} else if("".equals(xmlOutUrl) || xmlOutUrl.toLowerCase().indexOf("poweredby")!=-1 || xmlOutUrl.toLowerCase().indexOf("deleted")!=-1){
//create xml-file
cmsXmlContentEntry = ObjectUtils.createObject(pageName, ".xml", cmsEntryWriteXML.getOid(), cmsContext, cmsSession);
CMSElement cmsElement = cmsObject.getElement("xml_content");
//attach xml-file
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
}
if(!"".equals(xmlOutUrl) && xmlOutUrl.toLowerCase().indexOf("poweredby")==-1 && xmlOutUrl.toLowerCase().indexOf("deleted")==-1){
StringBuffer xmlOutputBuffer = new StringBuffer();
boolean showTafLink = false;
BooleanElement showTafLinkElement = new BooleanElement(cmsContext, cmsObject,"show_taf_link");
showTafLink = showTafLinkElement.isTrue();
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "video_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
TextElement videoLayerHeadline = new TextElement(cmsContext, cmsObject, "video_layer_headline");
TextElement replayVideoLinkText = new TextElement(cmsContext, cmsObject, "replay_video_link_text");
TextElement videoLayerTopPosition = new TextElement(cmsContext, cmsObject, "video_layer_top_position");
TextElement videoLayerLeftPosition = new TextElement(cmsContext, cmsObject, "video_layer_left_position");
TextElement videoLayerWidth = new TextElement(cmsContext, cmsObject, "video_layer_width");
TextElement videoLayerHeight = new TextElement(cmsContext, cmsObject, "video_layer_height");
AttachmentElement downloadVideo = new AttachmentElement(cmsContext, cmsObject, "download_video");
AttachmentElement videoMovie = new AttachmentElement(cmsContext, cmsObject, "video_movie");
videoLayerTopPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerTopPosition.setDefaultText("");
videoLayerLeftPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerLeftPosition.setDefaultText("");
videoLayerWidth.setFormatting(standardFormat,FORMAT_XML);
videoLayerWidth.setDefaultText("");
videoLayerHeight.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeight.setDefaultText("");
teaserHeadline.setFormatting(standardFormat,FORMAT_XML);
teaserHeadline.setDefaultText("");
teaserCopy.setFormatting(standardFormat,FORMAT_XML);
teaserCopy.setDefaultText("");
videoLayerHeadline.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeadline.setDefaultText("");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
String virtualUrlPrefix = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html";
virtualUrlPrefix = virtualUrlPrefix.substring((virtualUrlPrefix.indexOf("/_teaserpool/")+13), virtualUrlPrefix.length());
virtualUrlPrefix = virtualUrlPrefix.substring(0, virtualUrlPrefix.lastIndexOf("."));
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(fileExists(downloadVideo.getRefUrl())){
xmlOutputBuffer.append(" \n");
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(showTafLink){
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
}
TextElement videoSubtitlesElement = new TextElement(cmsContext, cmsObject, "video_subtitles");
if(videoSubtitlesElement.getDisplayed()){
xmlOutputBuffer.append(" \n");
int sequenceLength = CoreElement.getSequenceSize(cmsObject, "video_subtitles");
for(int i=1; i <= sequenceLength; i++){
xmlOutputBuffer.append(" \n");
}
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append("\n");
xmlOutput=xmlOutputBuffer.toString();
xmlOutput = StringUtils.replaceAll(xmlOutput, cmsObject);
xmlOutput = StringUtils.replaceAll(xmlOutput, "\r\n", "\n");
ObjectUtils.writeContent(xmlOutUrl, StringUtils.convertToUTF8(xmlOutput), cmsContext, cmsSession);
xmlOutput = StringUtils.replaceAll(xmlOutput, "<", "<");
xmlOutput = StringUtils.replaceAll(xmlOutput, ">", ">");
} else {
xmlOutput="Output URL missing, no XML written!";
getServletConfig().getServletContext().log("--> Generate of XML failed for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html, output Url is missing.");
}
} catch(Exception e){%>
Exception occured:
<%
e.printStackTrace(new PrintWriter(out));
getServletConfig().getServletContext().log("--> Generate of XML failed with "+e.toString()+" for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_hpi.html.");
%>
<%
} // end if generate
%>
<%
/* ---- free allocated objects ---- */
standardTextContent=null;
// included code to serialize objects
%><%@ include file="../../../../../../../../../templates/_basic/_includes/serializedObjects.inc.jsp" %><%
} catch (PendingDeploymentException pdEx) {
CMSSession cmsSession = CMSSessionPoolSingleton.getCMSSession(configurationSetName);
if (cmsSession != null) {
CMSQuery currenQuery = cmsSession.getCMSQuery(stage, vipSite);
if (currenQuery != null) {
CMSEntry pageEntry = currenQuery.getEntryByOid("2099452");
if (pageEntry != null) {
pageEntry.applyAction(CMSConstants.CMS_ACTION_REPUBLISH);
}
}
}
throw pdEx;
}
%>
<%@ page language="java"
%><%@ page import="java.util.*"
%><%@ page import="com.bmw.wcms.nsceditor.content.ObjectReference"
%><%@ page import="com.bmwgroup.wcms.cmsal.*"
%><%@ page import="com.bmwgroup.wcms.cmsal.exception.*"
%><%@ page import="com.bmwgroup.wcms.common.cmstools.*"
%><%@ page import="com.bmwgroup.wcms.contentmodel.*"
%><%@ page import="com.bmwgroup.wcms.websiteapi.*"
%><%@ page import="com.bmwgroup.wcms.base.*"
%><%@ page import="com.bmwgroup.wcms.base.util.*"
%><%@ page import="com.bmwgroup.wcms.base.mapelement.*"
%><%@ page import="com.bmwgroup.wcms.template.util.*"
%><%@ include file="../../../../../../../../../templates/_basic/_includes/mcCommon.inc.jsp"
%><%!
// make current oid and url globally available
final String thisVipOid = "2099442";
final String thisVipUrlAbsolute = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html";
%><%
final String configurationSetName = null;
final String vipSite = "bmw";
final String vipServer = "PROD";
final String vipserver = vipServer;
int stage = 0;
boolean forceSerializedObjects = false;
// prepared variables of scope inside _jspService
TextFormat standardFormat=null;
try {
CMSTemplate template = null;
CMSObject cmsObject = null;
CMSContext cmsContext = new CMSContext (vipSite, vipServer);
CMSToolKit cmsToolKit = CMSSessionPoolSingleton.getCMSToolkit(configurationSetName);
stage = cmsToolKit.mapStage(vipServer);
//make cmsContext globally available
cmsContextRef = cmsContext;
if ((!ContentModelUtils.isCalledFromEditor(request))||(ContentModelUtils.isGeneratorCall(request, stage))) {
//load Configuration
loadConfiguration(cmsContext, "2099442", "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html");
/* ---- Establish standard text formater start ---- */
String absoluteFormatUrl = ObjectUtils.absoluteUrl("http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html", ObjectUtils.getRelativeObjectUrl("2099442", "321", cmsContext));
standardFormat = new TextFormat();
standardFormat.init (absoluteFormatUrl);
/* ---- Establish standard text formater end ---- */
/* ---- Define js code for configuration variables start ---- */
// generate a relative url from confJavascriptConfigurationOid, to reference JS-Script
String confJavascriptConfigurationUrl=null;
if(confJavascriptConfigurationOid != null) {
try {
confJavascriptConfigurationUrl = ObjectUtils.getRelativeObjectUrl("2099442", confJavascriptConfigurationOid, cmsContext);
} catch(Exception e) {}
}
// include javascript configuration variables and configuration scripts
// configuration.js might be missing, so check
if(confJavascriptConfigurationUrl != null) {
%>
<%
}
String nearestMisc2Attribute = ObjectUtils.getNearestMetaAttributeAsString(ObjectUtils.getCMSEntry("2099442", cmsContext), CMSConstants.CMS_META_ATTR_MISC_2);
if(nearestMisc2Attribute == null){
nearestMisc2Attribute = "null";
} else {
nearestMisc2Attribute = "\""+nearestMisc2Attribute +"\"";
}
%>
<%
/* ---- Define js code for configuration variables end ---- */
} // End of if(!ContentModelUtils.isCalledFromEditor(request))
%>
teaser_turbo
<%
if(!"".equals(confMetaEmail)){ %>
<% }
if(!"".equals(confMetaAuthor)){ %>
<% } %>
<%
// decide where to load generic.css from
String cssUrl = null;
String serverRelativeTopics2 = ObjectUtils.getServerRelativeTopic ("2099442", "2099442", cmsContext);
String serverPath2 = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html".substring(0,"http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html".indexOf(serverRelativeTopics2));
if(confCountryTopic != null) {
cssUrl = serverPath2 + "/" + confCountryTopic + "/_common/css/generic.css";
}
else {
cssUrl = /* VIPURL */"../../../../../../../../../_common/narrowband/css/generic.css";
}
%>
<%
// // CMSTemplate
template = new CMSTemplate( /* VIPURL */"");
{
template.setAttribute("ttCOMMENT", "This template is used to create small image teasers that are saved centrally in the teaser pool but can be integrated in numerous pages.\r\n\r\nImportant information:\r\nPlease ensure that you click \"generate\" following every save procedure.");
template.setAttribute("ttREGORDER", "comment, basic version text, video version text, video files, tell a friend, metadata, configuration, all, head data");
template.setVipObjId(new Integer("2099442"));
template.setName("");
template.setDescription("");
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_change_to_highend", "
\r\nIf you made no entry in the element \"download_video\" located under the tab \"video files\" you can choose to link directly to the highend (video) version. To do so, please tick the box below.\r\n\r\nIf this element is neither active, nor there is a videofile attached, the teaser will be displayed in the video version only.\r\n
");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "10");
e.setAttribute("tREGN", "basic version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nDownload version of the video. \r\nIf this value is left blank, there would be no download function displayed.\r\nIf this value is left blank AND the box of the element \"change_to_highend\" under the tab \"basic version text\" is not ticked, the teaser will be displayed in the video version only. \r\n
");
e.setAttribute("tORD", "600");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nText for save video link. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "130");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("show_taf_link");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nIf \"Selected Value\" is checked, the tell a friend link is is displayed.\r\nThis is only used in the video version!\r\n
");
e.setAttribute("tORD", "5000");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oVAL");
e.setAttribute("tT", "BOOLEAN");
template.setElement(e);
e = new CMSElement();
e.setName("taf_link_text");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf link text.\r\n
");
e.setAttribute("tORD", "5030");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_module");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf module identifier.\r\n
");
e.setAttribute("tORD", "5010");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("taf_theme");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTaf theme identifier.\r\n
");
e.setAttribute("tORD", "5020");
e.setAttribute("tREGN", "tell a friend");
e.setAttribute("tSEQELHDR", "oT");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeadline for the video layer. \r\nTo hide this link deactivate the is displayed checkbox. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "110");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nHeight of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "650");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nLeft position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "630");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nTop position of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "620");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nWidth of the video. \r\nThis value is used in the video version only!\r\n
");
e.setAttribute("tORD", "640");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "TEXT");
template.setElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo movie, it is only used in the video version and has to be an Macromedia Flash-Video (.flv) file. \r\n
");
e.setAttribute("tORD", "610");
e.setAttribute("tREGN", "video files");
e.setAttribute("tT", "ATTACHMENT");
template.setElement(e);
e = new CMSElement();
e.setName("video_subtitles");
e.setAttribute("oVAL", "FALSE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tD", "
\r\nVideo subtitles. Activate the is displayed checkbox to show the subtitles. \r\nThis text is used in the video version only!\r\n
");
e.setAttribute("tORD", "120");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tSQTYPE", "TEXT");
e.setAttribute("tT", "SEQUENCE");
template.setElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("tAH_image", "48");
e.setAttribute("tATTRDESCRIPTION_headline", "
\r\nHeadline of the teaser. \r\nThis headline is used in the video version only!\r\n
");
e.setAttribute("tATTRDESCRIPTION_image", "
\r\nTeaser image (located on the left next to the headline and copytext)\r\n
");
e.setAttribute("tATTRDESCRIPTION_text", "
\r\nCopytext of the teaser. \r\nThis text is used in the video version only!\r\n
\r\nSmall image teaser for viewing the video (Video version only) and to download the video (Both versions). \r\nIn the video version the teaser opens a video player layer to view the video. \r\nThere are two links at the end of the video, the first one is to replay the video, the other one is to downlod the video. \r\nIn the basic version the teaser is only used to download the video.\r\n
");
e.setAttribute("tDESTT_image", "img");
e.setAttribute("tIH_image", "48");
e.setAttribute("tIW_image", "86");
e.setAttribute("tORD", "100");
e.setAttribute("tREGN", "video version text");
e.setAttribute("tT", "GENERIC");
template.setElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("tALWSUBT", "TRUE");
e.setAttribute("tAUTOGEN", "FALSE");
e.setAttribute("tAVINHDR", "TRUE");
e.setAttribute("tD", "
";
}
if("tDESTT".equals(attributeName)) {
return "xml";
}
if("tORD".equals(attributeName)) {
return "101";
}
if("tREGN".equals(attributeName)) {
return "configuration";
}
if("tSEQELHDR".equals(attributeName)) {
return "oOBJURL";
}
if("tT".equals(attributeName)) {
return "ATTACHMENT";
}
}
return "";
}
%>
<%
//
%>
<%
// // CMSObject
cmsObject = new CMSObject();
request.setAttribute("cmsObject", cmsObject);
{
cmsObject.setVipObjId(new Integer("2099442"));
cmsObject.setTemplate(template);
CMSElement e;
e = new CMSElement();
e.setName("basic_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_6_tn.jpg");
e.setAttribute("oT_headline", "V8 Twin Turbo.");
e.setAttribute("oT_text", "Le nouveau moteur novateur de la BMW X6 \u00e9quip\u00e9 de la technologie Twin Turbo.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("download_video");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oOBJURL", /* VIPURL*/"zip/x6_twinturbo.zip");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("replay_video_link_text");
e.setAttribute("oT", "Start Video");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_headline");
e.setAttribute("oT", "V8 Twin Turbo");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_height");
e.setAttribute("oT", "272");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_left_position");
e.setAttribute("oT", "280");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_top_position");
e.setAttribute("oT", "120");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_layer_width");
e.setAttribute("oT", "484");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_movie");
e.setAttribute("oDISP", "TRUE");
e.setAttribute("oOBJURL", /* VIPURL*/"flv/TwinTurbo1.flv");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("video_teaser");
e.setAttribute("oIMURL_image", /* VIPURL*/"img/ani_6_tn.jpg");
e.setAttribute("oT_headline", "V8 Twin Turbo.");
e.setAttribute("oT_text", "Le nouveau moteur novateur de la BMW X6 \u00e9quip\u00e9 de la technologie Twin Turbo.");
cmsObject.putElement(e);
e = new CMSElement();
e.setName("xml_content");
e.setAttribute("oOBJURL", /* VIPURL*/"xml/teaser_turbo.xml");
cmsObject.putElement(e);
e = null;
cmsObject.addElementAttributes(template.getElements(), false);
}
%>
<%!
public String getFullScopeElementAttribute(String elementName, String attributeName) {
if("xml_content".equals(elementName)) {
if("oOBJURL".equals(attributeName)) {
return /* VIPURL*/"xml/teaser_turbo.xml";
}
if("oURLINTERNoOBJURL".equals(attributeName)) {
return "TRUE";
}
}
return "";
}
%>
<%
//
%>
<%
//
if (cmsObject == null) {
cmsObject = template.createDummyObject();
}
//
%>
<%!
private boolean fileExists(String fileURL){
if(!"".equals(fileURL) && fileURL.toLowerCase().indexOf("poweredby")==-1 && fileURL.toLowerCase().indexOf("deleted")==-1){
return true;
}else{
return false;
}
}
%>
<%
String generate = request.getParameter ("generate");
String userid = request.getParameter ("userid");
String password = request.getParameter("password");
if (!ContentModelUtils.isCalledFromEditor(request) && !ContentModelUtils.isGeneratorCall(request,stage)) {
// find tracking page needed for this teaser type
String TRACKING_TYPE = "download";
String trackingPage = null;
for(int i=0;i < confTrackingRedirectOids.size();i++){
String url = ObjectUtils.getServerRelativeUrl("2099442", (String)confTrackingRedirectOids.get(i), cmsContext);
if(url != null && !"".equals(url)){
String filename = url.substring(0,url.lastIndexOf("."));
filename = filename.substring(filename.lastIndexOf("/")+1,filename.length());
if(TRACKING_TYPE.equals(filename)){
trackingPage = url;
}
}
}
//------------------------------------------------------------------
// Prepare Page Elements
//------------------------------------------------------------------
AttachmentElement downloadUrl = new AttachmentElement(cmsContext, cmsObject, "download_video");
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "basic_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
BooleanElement changeToHighend = (BooleanElement)teaserElement.getAttribute("change_to_highend");
teaserHeadline.setFormatting(standardFormat,FORMAT_HTML);
teaserCopy.setFormatting(standardFormat,FORMAT_HTML);
teaserHeadline.setDefaultText("");
teaserCopy.setDefaultText("");
String fileParam="";
if(!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1){
fileParam = ObjectUtils.getServerRelativeUrl("2099442",downloadUrl.getRefUrl(),cmsContext);
}
%>
<%
if((!"".equals(downloadUrl.getRefUrl()) && downloadUrl.getRefUrl().toLowerCase().indexOf("poweredby")==-1 && downloadUrl.getRefUrl().toLowerCase().indexOf("deleted")==-1) || changeToHighend.isTrue()){
%>
<%= teaserHeadline.getTextUTF8() %><%= teaserCopy.getTextUTF8() %>
<%
}
%>
<%
} // if not called from editor
%>
<%
//------------------------------------------------------------------
// Generate XML Content File From Template
//------------------------------------------------------------------
String xmlOutput=null;
if (ContentModelUtils.isGeneratorCall(request,stage)) {
CMSSession cmsSession = ObjectUtils.sessionLogin (request, cmsContext);
try{
String xmlOutUrl = (new AttachmentElement(cmsContext, cmsObject,"xml_content")).getRefUrl();
// check if xml_content-file is available - if not, build it and attach it to the contentpage.
// fetch pagename and topic
String pageName = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html";
pageName = pageName.substring(pageName.lastIndexOf("/")+1, pageName.lastIndexOf(".htm"));
String xmlTopic = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html";
xmlTopic = xmlTopic.substring(0, xmlTopic.lastIndexOf("/")+1) + "xml/index.htm";
CMSEntry cmsEntryWriteXML = ObjectUtils.getCMSEntry(xmlTopic, null, cmsContext);
// start query, set filter and find xml-files in xml topic
CMSQuery currentQuery = cmsSession.getCMSQuery(stage, vipSite);
CMSFilter cmsFilter = cmsToolKit.createStringEqualsFilter (CMSConstants.CMS_META_ATTR_OBJ_NAME, pageName);
Iterator iterator = currentQuery.filter (cmsFilter, cmsEntryWriteXML.getOid(), CMSConstants.CMS_UNDEFINED_VALUE, CMSConstants.CMS_UNDEFINED_VALUE);
CMSEntry cmsXmlContentEntry = null;
//if there is a corresponding xml-file, use this one and attach it
if (iterator.hasNext()) {
cmsXmlContentEntry = (CMSEntry) iterator.next();
CMSElement cmsElement = cmsObject.getElement("xml_content");
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
//if no xml-file exists...
} else if("".equals(xmlOutUrl) || xmlOutUrl.toLowerCase().indexOf("poweredby")!=-1 || xmlOutUrl.toLowerCase().indexOf("deleted")!=-1){
//create xml-file
cmsXmlContentEntry = ObjectUtils.createObject(pageName, ".xml", cmsEntryWriteXML.getOid(), cmsContext, cmsSession);
CMSElement cmsElement = cmsObject.getElement("xml_content");
//attach xml-file
cmsElement.setAttribute(CMSElementConstants.ATTRIB_O_OBJECTREFURL, cmsXmlContentEntry.getURL());
xmlOutUrl = cmsXmlContentEntry.getURL();
}
if(!"".equals(xmlOutUrl) && xmlOutUrl.toLowerCase().indexOf("poweredby")==-1 && xmlOutUrl.toLowerCase().indexOf("deleted")==-1){
StringBuffer xmlOutputBuffer = new StringBuffer();
boolean showTafLink = false;
BooleanElement showTafLinkElement = new BooleanElement(cmsContext, cmsObject,"show_taf_link");
showTafLink = showTafLinkElement.isTrue();
GenericElement teaserElement = new GenericElement(cmsContext, cmsObject, "video_teaser");
TextAttributeI teaserHeadline = (TextAttributeI)teaserElement.getAttribute("headline");
TextAttributeI teaserCopy = (TextAttributeI)teaserElement.getAttribute("text");
ImageAttributeI teaserImage = (ImageAttributeI)teaserElement.getAttribute("image");
TextElement videoLayerHeadline = new TextElement(cmsContext, cmsObject, "video_layer_headline");
TextElement replayVideoLinkText = new TextElement(cmsContext, cmsObject, "replay_video_link_text");
TextElement videoLayerTopPosition = new TextElement(cmsContext, cmsObject, "video_layer_top_position");
TextElement videoLayerLeftPosition = new TextElement(cmsContext, cmsObject, "video_layer_left_position");
TextElement videoLayerWidth = new TextElement(cmsContext, cmsObject, "video_layer_width");
TextElement videoLayerHeight = new TextElement(cmsContext, cmsObject, "video_layer_height");
AttachmentElement downloadVideo = new AttachmentElement(cmsContext, cmsObject, "download_video");
AttachmentElement videoMovie = new AttachmentElement(cmsContext, cmsObject, "video_movie");
videoLayerTopPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerTopPosition.setDefaultText("");
videoLayerLeftPosition.setFormatting(standardFormat,FORMAT_XML);
videoLayerLeftPosition.setDefaultText("");
videoLayerWidth.setFormatting(standardFormat,FORMAT_XML);
videoLayerWidth.setDefaultText("");
videoLayerHeight.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeight.setDefaultText("");
teaserHeadline.setFormatting(standardFormat,FORMAT_XML);
teaserHeadline.setDefaultText("");
teaserCopy.setFormatting(standardFormat,FORMAT_XML);
teaserCopy.setDefaultText("");
videoLayerHeadline.setFormatting(standardFormat,FORMAT_XML);
videoLayerHeadline.setDefaultText("");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append("\n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
String virtualUrlPrefix = "http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html";
virtualUrlPrefix = virtualUrlPrefix.substring((virtualUrlPrefix.indexOf("/_teaserpool/")+13), virtualUrlPrefix.length());
virtualUrlPrefix = virtualUrlPrefix.substring(0, virtualUrlPrefix.lastIndexOf("."));
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(fileExists(downloadVideo.getRefUrl())){
xmlOutputBuffer.append(" \n");
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
if(showTafLink){
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
}
TextElement videoSubtitlesElement = new TextElement(cmsContext, cmsObject, "video_subtitles");
if(videoSubtitlesElement.getDisplayed()){
xmlOutputBuffer.append(" \n");
int sequenceLength = CoreElement.getSequenceSize(cmsObject, "video_subtitles");
for(int i=1; i <= sequenceLength; i++){
xmlOutputBuffer.append(" \n");
}
}else{
xmlOutputBuffer.append(" \n");
}
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append(" \n");
xmlOutputBuffer.append("\n");
xmlOutput=xmlOutputBuffer.toString();
xmlOutput = StringUtils.replaceAll(xmlOutput, cmsObject);
xmlOutput = StringUtils.replaceAll(xmlOutput, "\r\n", "\n");
ObjectUtils.writeContent(xmlOutUrl, StringUtils.convertToUTF8(xmlOutput), cmsContext, cmsSession);
xmlOutput = StringUtils.replaceAll(xmlOutput, "<", "<");
xmlOutput = StringUtils.replaceAll(xmlOutput, ">", ">");
} else {
xmlOutput="Output URL missing, no XML written!";
getServletConfig().getServletContext().log("--> Generate of XML failed for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html, output Url is missing.");
}
} catch(Exception e){%>
Exception occured:
<%
e.printStackTrace(new PrintWriter(out));
getServletConfig().getServletContext().log("--> Generate of XML failed with "+e.toString()+" for http://wcms10.bmwgroup.com/bmw_prod/be/fr/newvehicles/x6/x6/2007/allfacts/downloads/_teaser/teaser_turbo.html.");
%>