<%-- ADOBE CONFIDENTIAL __________________ Copyright 2011 Adobe Systems Incorporated All Rights Reserved. NOTICE: All information contained herein is, and remains the property of Adobe Systems Incorporated and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to Adobe Systems Incorporated and its suppliers and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Adobe Systems Incorporated. --%><% %> <%@page session="false" import="com.day.cq.replication.ContentBuilder, org.apache.commons.lang3.StringEscapeUtils, org.apache.sling.api.resource.Resource, org.apache.sling.api.resource.ValueMap, java.io.UnsupportedEncodingException, java.net.URLEncoder, java.util.Comparator, java.util.Map, java.util.TreeMap" %> <% %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %> <% %><% String path = request.getParameter("path"); String agentName = path.substring(path.lastIndexOf("/") + 1); Resource r = resourceResolver.getResource(path + "/jcr:content"); if (r == null) { response.sendError(404); return; } ValueMap value = r.adaptTo(ValueMap.class); boolean defaultAgent = false; boolean reverseAgent = false; boolean staticAgent = false; String agentType = value.get("agentType", String.class); // CQ contents // FIXME: is this the proper way? CQ doesn't have agentType property if (agentType == null) { if (path.equals("/etc/replication/agents.author/publish") || path.equals("/etc/replication/agents.author/flush") || path.equals("/etc/replication/agents.publish/flush") || path.equals("/etc/replication/agents.publish/outbox")) { defaultAgent = true; } else if (path.equals("/etc/replication/agents.author/publish_reverse")) { reverseAgent = true; } else if (path.equals("/etc/replication/agents.author/static")) { staticAgent = true; } } else { defaultAgent = agentType.equals("default"); reverseAgent = agentType.equals("reverse"); staticAgent = agentType.equals("static"); } TreeMap builderOptions = new TreeMap(new Comparator() { /** * Special comparator that ensures, that "durbo" comes before "flush" comes before * all other keys. */ public int compare(String o1, String o2) { if (o1.equals("durbo")) o1 = "!"; if (o2.equals("durbo")) o2 = "!"; if (o1.equals("flush")) o1 = "!!"; if (o2.equals("flush")) o2 = "!!"; return o1.compareTo(o2); } }); Object[] builders = sling.getServices(ContentBuilder.class, null); if (builders != null) { for (Object o : builders) { ContentBuilder b = (ContentBuilder) o; String name = b.getName(); String title = b.getTitle(); if (name.equals("flush")) { title = "Dispatcher Flush"; } else if (name.equals("durbo")) { title = "Default"; } builderOptions.put(name, title); } } String pageId = "g-agent-edit-" + agentName; String name = StringEscapeUtils.escapeXml((String) value.get("jcr:title")); if ("".equals(name)) name = agentName; String escapedName = StringEscapeUtils.escapeHtml4(name); %>

<%=escapedName%>

<% String error = request.getParameter("error"); if (error != null && error.trim().length() > 0) { %>

<%=StringEscapeUtils.escapeHtml4(request.getParameter("error"))%>

<% } %>
<% if (defaultAgent) { %> <% } else if (staticAgent) { %> <% } else if (reverseAgent) { %> <% } %> <%-- ------------------------------------------------ --%> <%-- SETTINGS --%> <%-- ------------------------------------------------ --%>

General Settings

Informative title of this agent

<% if (defaultAgent) { %>
<% } %>

Time in milliseconds

Leave empty to use system user

<% if (defaultAgent) { %>
Options />

If checked, agent will not force a replication status update

/>

If checked, agent is excluded from normal replication, i.e. will not be used if a content author issues a replication action

/>

If checked, agent will replicate also aliased paths e.g. like vanity URLs

<% } %> <% if (staticAgent) { %> <%-- ------------------------------------------------ --%> <%-- RULE --%> <%-- ------------------------------------------------ --%>

Rule Settings

Target directory on server, e.g. /tmp

<% } %> <% if (defaultAgent || reverseAgent) { %> <%-- ------------------------------------------------ --%> <%-- TRANSPORT --%> <%-- ------------------------------------------------ --%>

Transport Settings

Target URI, e.g. http://localhost:4503/bin/receive

User name for the transport credentials

Password for the transport credentials

Domain for NTLM authentication, e.g. WORKGROUP

(this) Host for NTLM authentication e.g. server01

SSL Options />

Enable to accept self-certified SSL certificates

/>

Enable to accept expired SSL certificates

<%-- ------------------------------------------------ --%> <%-- PROXY --%> <%-- ------------------------------------------------ --%>

Proxy Settings

Hostname of the (transport) proxy

Port of the (transport) proxy

User name for the proxy credentials

Password for the proxy credentials

Domain for proxy NTLM authentication. e.g. WORKGROUP

(this) Host for proxy NTLM authentication, e.g. server01

<%-- ------------------------------------------------ --%> <%-- EXTENDED --%> <%-- ------------------------------------------------ --%>

Extended Transport Settings

Socket interface to bind to

HTTP method to use

Additional HTTP headers. Put each header in separate lines

  />

Enable to close connection after each request

Connect timeout in milliseconds (default: 900000ms)

Socket timeout in milliseconds (default: 900000ms)

Version of protocol, e.g. '1.0' (for HTTP/1.0)

<% } %> <% if (defaultAgent) { %> <%-- ------------------------------------------------ --%> <%-- CQ Specific --%> <%-- ------------------------------------------------ --%>

CQ Specific Settings

Triggers />

If checked, agent will chain-replicate

/>

If checked, agent will auto-replicate if content is modified

/>

If checked, the agent will auto-replicate when content marked for distribution is modified

 

If checked, agent will not force versioning of activated pages

<% } %>
<%! private static String encode(String text) { try { return URLEncoder.encode(text, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } %>