diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties
index c18cfc522f..c2883d7f2c 100644
--- a/config/alfresco/messages/webclient.properties
+++ b/config/alfresco/messages/webclient.properties
@@ -267,6 +267,7 @@ other_action=Run Action
information=Information
move=Move
type=Type
+tag=Tag
encoding=Encoding
aspect=Aspect
workflow=Workflow
@@ -538,7 +539,7 @@ cancel_button=Cancel
clear_button=Clear
you_may_want=You may want to
summary_step_description=Shows a summary of the information entered.
-error_wizard_completed_already=This wizard has been already been completed, please re-launch it to continue.
+error_wizard_completed_already=This wizard has already been completed, please re-launch it to continue.
you_may_want_checkout_document=You may want to Check Out this document to prevent the possibility of other users overwriting your changes.
# Category Management messages
@@ -865,6 +866,7 @@ content=Content
text_content=Plain Text Content
html_content=HTML Content
xml_content=XML Content
+node_locked_dialog_closed=The created node is locked, this is probably due to a configured rule in this space. As the node can not be edited the Modify Content Properties dialog has been closed.
regenerate_renditions_title=Regenerate Renditions Wizard
regenerate_renditions_desc=This wizard helps you regenerate renditions.
@@ -1004,6 +1006,8 @@ selected_actions=Selected Rule Actions
action_cannot_be_execute_repeatedly=Action cannot be executed repeatedly
condition_has_aspect=Item has aspect ''{0}''
condition_has_aspect_not=Item does not have aspect ''{0}''
+condition_has_tag=Item has tag ''{0}''
+condition_has_tag_not=Item does not have tag ''{0}''
condition_is_subtype=Item is a subtype of ''{0}''
condition_is_subtype_not=Item is not a subtype of ''{0}''
condition_compare_mime_type=Item has a mimetype of ''{0}''
@@ -1328,6 +1332,9 @@ revert_selected_title=Undo Selected Items
revert_selected_desc=To undo the changes to the selected files in the sandbox, click OK.
revert_selected_confirm=Are you sure you want to undo the changes to the selected files in from the sandbox?
revert_all_title=Undo All Items
+revert_snapshot_title=Revert Snapshot
+revert_snapshot_desc=Revert a sandbox to a specific snapshot version ID
+revert_snapshot_confirm=Revert a sandbox to version: {0}
revert_all_conflicts=Revert all Conflicts
revert_all_desc=To undo the changes to all the files in the sandbox, click OK.
revert_all_confirm=Are you sure you want to undo the changes to all files in the sandbox?
@@ -1480,7 +1487,6 @@ title_recovery_report=Recovery Report
deleted_items=Deleted Items
manage_deleted_items=Manage Deleted Items
manage_deleted_items_description=Remove or recover previously deleted items
-recover_all_items=Recover All Items
delete_all_items=Delete All Items
deleted_items_info=Use the Search to find deleted items by name or content and use the filters to reduce the list.
original_location=Original Location
@@ -1499,8 +1505,6 @@ recover_item_info=Recover an item from the deleted file store
recover_item_confirm=Are you sure you want to recover \"{0}\" from the deleted file store?
delete_all_items_info=Permanently delete all files and spaces from the deleted file store
delete_all_items_confirm=Are you sure you want to permanently delete all files and spaces from the deleted file store? The items cannot be recovered once this action has been performed.
-recover_all_items_info=Recover all files and spaces from the deleted file store
-recover_all_items_confirm=Are you sure you want to recover all the deleted files and spaces from the deleted file store?
delete_listed_items=Delete Listed Items
delete_listed_items_info=Permanently delete the listed files and spaces from the deleted file store
delete_listed_items_confirm=Are you sure you want to permanently delete the following deleted files and spaces from the deleted file store? The items cannot be recovered once this action has been performed.
@@ -1880,6 +1884,7 @@ title_condition_has_mimetype=Has Mimetype Condition
title_condition_in_category=In Category Condition
title_condition_is_subtype=Is Subtype Condition
title_condition_has_aspect=Has Aspect Condition
+title_condition_has_tag=Has Tag Condition
title_new_user_person_props=User - Person Properties
title_new_user_user_props=User - User Properties
title_new_user_summary=User - Summary
@@ -1980,6 +1985,7 @@ error_not_stored=No error currently stored
error_no_stack_trace=No stack trace available
error_permissions=You do not have sufficient permissions to view the requested item.
error_not_found=Sorry, the requested file does not exist at this location
+error_external_protocol_support=External links should be typed manually in the text box.
# Confirmations
return_to_application=Return to application
diff --git a/config/alfresco/templates/client/myspaces_preview_panel.ftl b/config/alfresco/templates/client/myspaces_preview_panel.ftl
index 2aeb4e2db2..030ea0f8ff 100644
--- a/config/alfresco/templates/client/myspaces_preview_panel.ftl
+++ b/config/alfresco/templates/client/myspaces_preview_panel.ftl
@@ -3,39 +3,39 @@
- <#if node.isDocument && !isImage>
- <#assign c=cropContent(node.properties.content, 2048)>
- <#if c?length != 0>
+ <#if node.isDocument && !isImage>
+ <#assign c=cropContent(node.properties.content, 2048)>
+ <#if c?length != 0>
${c?html?replace('$', '
', 'rm')}<#if (c?length >= 2048)>...#if>
<#else>
Sorry, no preview currently available for this document.
- #if>
+ #if>
<#elseif isImage>
-
- <#elseif node.isContainer>
- <#assign childs=node.children?sort_by('name')>
- <#if childs?size != 0>
- <#list childs as c>
- <#--if (c_index >= 25)>
...
<#break>#if>-->
- <#if c.isDocument || c.isContainer>
-
- #if>
- #list>
- <#else>
+
+ <#elseif node.isContainer>
+ <#assign childs=node.children?sort_by('name')>
+ <#if childs?size != 0>
+ <#list childs as c>
+ <#--if (c_index >= 25)>
...
<#break>#if>-->
+ <#if c.isDocument || c.isContainer>
+
+ #if>
+ #list>
+ <#else>
${msg("no_items")}
#if>
- #if>
+ #if>
<#if node.isDocument>
-<#assign navurl='/navigate/showDocDetails/' + node.nodeRef.storeRef.protocol + '/' + node.nodeRef.storeRef.identifier + '/' + node.nodeRef.id>
+ <#assign navurl='/navigate/showDocDetails/' + node.nodeRef.storeRef.protocol + '/' + node.nodeRef.storeRef.identifier + '/' + node.nodeRef.id>
<#elseif node.isContainer>
-<#assign navurl='/navigate/showSpaceDetails/' + node.nodeRef.storeRef.protocol + '/' + node.nodeRef.storeRef.identifier + '/' + node.nodeRef.id>
+ <#assign navurl='/navigate/showSpaceDetails/' + node.nodeRef.storeRef.protocol + '/' + node.nodeRef.storeRef.identifier + '/' + node.nodeRef.id>
<#else>
-<#assign navurl='#'>
+ <#assign navurl='#'>
#if>
<#if node.isDocument>
@@ -70,7 +70,7 @@
<#else>
- ${msg("edit_details")}
+ ${msg("edit_details")}
onclick='event.cancelBubble=true;MySpaces.deleteItem("${node.name}", "${node.nodeRef}");'#if>>${msg("delete")}
diff --git a/config/alfresco/templates/email/notify_user_email.ftl b/config/alfresco/templates/email/notify_user_email.ftl
index fbe83fc922..b0ff63f98a 100644
--- a/config/alfresco/templates/email/notify_user_email.ftl
+++ b/config/alfresco/templates/email/notify_user_email.ftl
@@ -3,12 +3,21 @@ A new document '${document.name}', is available in the '${space.name}' space, it
You can view it through this link:
${url.serverPath}/alfresco${document.url}
-Or through the Alfresco client:
+<#if document.siteShortName??>
+Or through Share:
+<#assign fullPath=document.displayPath>
+<#assign path=fullPath[fullPath?index_of("documentLibrary")+15..]>
+
+${url.serverPath}/share/page/site/${document.siteShortName}/documentlibrary#filter=path|${path}&page=1
+<#else>
+Or through Explorer:
<#assign ref=space.nodeRef>
<#assign workspace=ref[0..ref?index_of("://")-1]>
<#assign storenode=ref[ref?index_of("://")+3..]>
+
${url.serverPath}/alfresco/navigate/browse/${workspace}/${storenode}
+#if>
Regards
-Alfresco
+Alfresco
\ No newline at end of file
diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml
index 980579557f..bef4d279ab 100644
--- a/config/alfresco/web-client-config-actions.xml
+++ b/config/alfresco/web-client-config-actions.xml
@@ -440,7 +440,7 @@
#{actionContext.nodeRef}
-
+ #{NavigationBean.currentNodeId}
@@ -614,14 +614,6 @@
dialog:manageDeletedItems
-
-
- recover_all_items
- /images/icons/recover_all.gif
- dialog:recoverAllItems
- #{TrashcanRecoverAllItemsDialog.setupListAction}
-
-
delete_all_items
@@ -1223,7 +1215,6 @@
diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml
index 1cb6e487c2..949b427b94 100644
--- a/config/alfresco/web-client-config-dialogs.xml
+++ b/config/alfresco/web-client-config-dialogs.xml
@@ -296,6 +296,10 @@
icon="/images/icons/revert_all_large.gif" title-id="revert_all_title"
description-id="revert_all_desc" />
+
+
@@ -529,10 +533,6 @@
icon="/images/icons/recover_large.gif" title-id="recover_item"
description-id="recover_item_info" />
-
-
diff --git a/config/alfresco/web-client-config-forum-actions.xml b/config/alfresco/web-client-config-forum-actions.xml
index be76f86bf7..e731d57b32 100644
--- a/config/alfresco/web-client-config-forum-actions.xml
+++ b/config/alfresco/web-client-config-forum-actions.xml
@@ -29,7 +29,7 @@
#{ClipboardBean.cutNode}
#{actionContext.nodeRef}
-
+ #{NavigationBean.currentNodeId}
diff --git a/config/alfresco/web-client-config-wcm.xml b/config/alfresco/web-client-config-wcm.xml
index 4761eb58d3..aca8bf5cb3 100644
--- a/config/alfresco/web-client-config-wcm.xml
+++ b/config/alfresco/web-client-config-wcm.xml
@@ -57,7 +57,7 @@
- bold,italic,underline,strikethrough,separator,fontselect,fontsizeselect
+ bold,italic,underline,strikethrough,separator,fontselect,fontsizeselect,separator,code
link,unlink,image,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,undo,redo,separator,forecolor,backcolor
600
exact
diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml
index ca41586475..bd88105a21 100644
--- a/config/alfresco/web-client-config.xml
+++ b/config/alfresco/web-client-config.xml
@@ -48,12 +48,15 @@
500
-
+
500
500
+
+
+ 100
/app:company_home/app:user_homes
@@ -441,6 +444,7 @@
+
diff --git a/source/java/org/alfresco/web/app/servlet/command/EditSpaceCommand.java b/source/java/org/alfresco/web/app/servlet/command/EditSpaceCommand.java
new file mode 100755
index 0000000000..1ef4a11c0a
--- /dev/null
+++ b/source/java/org/alfresco/web/app/servlet/command/EditSpaceCommand.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2005-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.web.app.servlet.command;
+
+import java.util.Map;
+
+import javax.faces.application.NavigationHandler;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.service.ServiceRegistry;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.springframework.extensions.surf.util.ParameterCheck;
+import org.alfresco.web.app.servlet.BaseServlet;
+import org.alfresco.web.app.servlet.FacesHelper;
+import org.alfresco.web.bean.BrowseBean;
+import org.alfresco.web.bean.repository.Node;
+
+/**
+ * Command to execute the Edit Space dialog via url.
+ *
+ * Arguments: noderef - of the space to show the edit props dialog for
+ *
+ * @author Pavel Yurkevich
+ */
+public class EditSpaceCommand extends BaseUIActionCommand
+{
+ public static final String PROP_NODEREF = "noderef";
+
+ private static final String[] PROPERTIES = new String[] {
+ PROP_SERVLETCONTEXT, PROP_REQUEST, PROP_RESPONSE, PROP_NODEREF};
+
+ /**
+ * @see org.alfresco.web.app.servlet.command.Command#execute(org.alfresco.service.ServiceRegistry, java.util.Map)
+ */
+ public Object execute(ServiceRegistry serviceRegistry, Map properties)
+ {
+ ServletContext sc = (ServletContext)properties.get(PROP_SERVLETCONTEXT);
+ ServletRequest req = (ServletRequest)properties.get(PROP_REQUEST);
+ ServletResponse res = (ServletResponse)properties.get(PROP_RESPONSE);
+ FacesContext fc = FacesHelper.getFacesContext(req, res, sc, "/jsp/close.jsp");
+ BrowseBean browseBean = (BrowseBean)FacesHelper.getManagedBean(fc, BrowseBean.BEAN_NAME);
+
+ // setup context from url args in properties map
+ String strNodeRef = (String)properties.get(PROP_NODEREF);
+ ParameterCheck.mandatoryString(PROP_NODEREF, strNodeRef);
+ browseBean.setActionSpace(new Node(new NodeRef(strNodeRef)));
+
+ NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
+ navigationHandler.handleNavigation(fc, null, "dialog:editSpace");
+ String viewId = fc.getViewRoot().getViewId();
+ try
+ {
+ sc.getRequestDispatcher(BaseServlet.FACES_SERVLET + viewId).forward(req, res);
+ }
+ catch (Exception e)
+ {
+ throw new AlfrescoRuntimeException("Unable to forward to viewId: " + viewId, e);
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.alfresco.web.app.servlet.command.Command#getPropertyNames()
+ */
+ public String[] getPropertyNames()
+ {
+ return PROPERTIES;
+ }
+}
diff --git a/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java b/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java
index 38b11a2321..7cc346a8dc 100644
--- a/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java
+++ b/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java
@@ -62,6 +62,7 @@ public class UIActionCommandProcessor implements ExtCommandProcessor
CommandFactory.getInstance().registerCommand("managetask", ManageTaskDialogCommand.class);
CommandFactory.getInstance().registerCommand("editcontentprops", EditContentPropertiesCommand.class);
CommandFactory.getInstance().registerCommand("userprofile", UserProfileDialogCommand.class);
+ CommandFactory.getInstance().registerCommand("editspace", EditSpaceCommand.class);
}
diff --git a/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java
index f2fe43530f..52154b7efb 100644
--- a/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java
+++ b/source/java/org/alfresco/web/bean/clipboard/AVMClipboardItem.java
@@ -32,6 +32,7 @@ import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.repository.CrossRepositoryCopyService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
+import org.alfresco.wcm.util.WCMUtil;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean;
@@ -72,7 +73,22 @@ public class AVMClipboardItem extends AbstractClipboardItem
*/
public boolean canCopyToViewId(String viewId)
{
- return (AVM_PASTE_VIEW_ID.equals(viewId) || WORKSPACE_PASTE_VIEW_ID.equals(viewId));
+ if (AVM_PASTE_VIEW_ID.equals(viewId))
+ {
+ AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), AVMBrowseBean.BEAN_NAME);
+ String destPath = avmBrowseBean.getCurrentPath();
+
+ if (WCMUtil.isStagingStore(WCMUtil.getStoreName(destPath)))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ else
+ {
+ return WORKSPACE_PASTE_VIEW_ID.equals(viewId);
+ }
}
/**
diff --git a/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java
index b2944ca60a..79b47a7979 100644
--- a/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java
+++ b/source/java/org/alfresco/web/bean/clipboard/AbstractClipboardItem.java
@@ -55,6 +55,7 @@ abstract class AbstractClipboardItem implements ClipboardItem
transient private ServiceRegistry services = null;
protected NodeRef ref;
+ protected NodeRef parent;
protected ClipboardStatus mode;
// cached values
@@ -91,6 +92,20 @@ abstract class AbstractClipboardItem implements ClipboardItem
this.mode = mode;
}
+ /**
+ * Constructor
+ *
+ * @param ref The ref of the item on the clipboard
+ * @param parent The parent of the item on the clipboard
+ * @param mode The ClipboardStatus enum value
+ */
+ public AbstractClipboardItem(NodeRef ref, NodeRef parent, ClipboardStatus mode)
+ {
+ this.ref = ref;
+ this.mode = mode;
+ this.parent = parent;
+ }
+
public ClipboardStatus getMode()
{
return this.mode;
@@ -130,6 +145,11 @@ abstract class AbstractClipboardItem implements ClipboardItem
return this.ref;
}
+ public NodeRef getParent()
+ {
+ return this.parent;
+ }
+
/**
* Override equals() to compare NodeRefs
*/
diff --git a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java
index bf5a0db5da..f70342514a 100644
--- a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java
+++ b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java
@@ -110,7 +110,7 @@ public class ClipboardBean implements Serializable
String ref = params.get("ref");
if (ref != null && ref.length() != 0)
{
- addClipboardNode(new NodeRef(ref), ClipboardStatus.COPY);
+ addClipboardNode(new NodeRef(ref), null, ClipboardStatus.COPY);
}
}
@@ -122,9 +122,15 @@ public class ClipboardBean implements Serializable
UIActionLink link = (UIActionLink)event.getComponent();
Map params = link.getParameterMap();
String ref = params.get("ref");
+ String parent = params.get("parent");
if (ref != null && ref.length() != 0)
{
- addClipboardNode(new NodeRef(ref), ClipboardStatus.CUT);
+ NodeRef parentNodeRef = null;
+ if (parent != null)
+ {
+ parentNodeRef = new NodeRef(Repository.getStoreRef(), parent);
+ }
+ addClipboardNode(new NodeRef(ref), parentNodeRef, ClipboardStatus.CUT);
}
}
@@ -276,15 +282,16 @@ public class ClipboardBean implements Serializable
* Add a clipboard node to the clipboard ready for a cut/copy operation
*
* @param ref NodeRef of the item for the operation
+ * @param parent Parent of the item for the operation
* @param mode ClipboardStatus for the operation
*/
- private void addClipboardNode(NodeRef ref, ClipboardStatus mode)
+ private void addClipboardNode(NodeRef ref, NodeRef parent, ClipboardStatus mode)
{
// construct item based on store protocol
ClipboardItem item = null;
if (StoreRef.PROTOCOL_WORKSPACE.equals(ref.getStoreRef().getProtocol()))
{
- item = new WorkspaceClipboardItem(ref, mode);
+ item = new WorkspaceClipboardItem(ref, parent, mode);
}
else if (StoreRef.PROTOCOL_AVM.equals(ref.getStoreRef().getProtocol()))
{
diff --git a/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java b/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java
index 49a2c1adfd..4ab1daca26 100644
--- a/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java
+++ b/source/java/org/alfresco/web/bean/clipboard/WorkspaceClipboardItem.java
@@ -20,6 +20,7 @@ package org.alfresco.web.bean.clipboard;
import java.io.Serializable;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
@@ -76,6 +77,15 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
{
super(ref, mode);
}
+
+ /**
+ * @param ref
+ * @param mode
+ */
+ public WorkspaceClipboardItem(NodeRef ref, NodeRef parent, ClipboardStatus mode)
+ {
+ super(ref, parent, mode);
+ }
/**
* @see org.alfresco.web.bean.clipboard.ClipboardItem#supportsLink()
@@ -136,14 +146,33 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
FileFolderService fileFolderService = getServiceRegistry().getFileFolderService();
CopyService copyService = getServiceRegistry().getCopyService();
MultilingualContentService multilingualContentService = getServiceRegistry().getMultilingualContentService();
+
+ boolean isPrimaryParent = true;
- // TODO: Should we be using primary parent here?
- // We are assuming that the item exists in only a single parent and that the source for
- // the clipboard operation (e.g. the source folder) is specifically that parent node.
- // So does not allow for more than one possible parent node - or for linked objects!
- // This code should be refactored to use a parent ID when appropriate.
- ChildAssociationRef assocRef = nodeService.getPrimaryParent(getNodeRef());
+ ChildAssociationRef assocRef = null;
+ if (getParent() == null)
+ {
+ assocRef = nodeService.getPrimaryParent(getNodeRef());
+ }
+ else
+ {
+ NodeRef parentNodeRef = getParent();
+ List assocList = nodeService.getParentAssocs(getNodeRef());
+ if (assocList != null)
+ {
+ for (ChildAssociationRef assocListEntry : assocList)
+ {
+ if (parentNodeRef.equals(assocListEntry.getParentRef()))
+ {
+ assocRef = assocListEntry;
+ break;
+ }
+ }
+ }
+ isPrimaryParent = parentNodeRef.equals(nodeService.getPrimaryParent(getNodeRef()).getParentRef());
+ }
+
// initial name to attempt the copy of the item with
String name = getName();
String translationPrefix = "";
@@ -162,7 +191,7 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
try
{
// attempt each copy/paste in its own transaction
- tx = Repository.getUserTransaction(fc);
+ tx = Repository.getUserTransaction(fc, false);
tx.begin();
if (getMode() == ClipboardStatus.COPY)
{
@@ -274,10 +303,7 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
dd.isSubClass(getType(), ContentModel.TYPE_FOLDER))
{
// move the file/folder
- fileFolderService.move(
- getNodeRef(),
- destRef,
- name);
+ fileFolderService.move(getNodeRef(), getParent(), destRef, name);
}
else if(dd.isSubClass(getType(), ContentModel.TYPE_MULTILINGUAL_CONTAINER))
{
@@ -286,12 +312,16 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
}
else
{
- // move the node
- nodeService.moveNode(
- getNodeRef(),
- destRef,
- ContentModel.ASSOC_CONTAINS,
- assocRef.getQName());
+ if (isPrimaryParent)
+ {
+ // move the node
+ nodeService.moveNode(getNodeRef(), destRef, ContentModel.ASSOC_CONTAINS, assocRef.getQName());
+ }
+ else
+ {
+ nodeService.removeChild(getParent(), getNodeRef());
+ nodeService.addChild(destRef, getNodeRef(), assocRef.getTypeQName(), assocRef.getQName());
+ }
}
// if we get here without an exception, the clipboard move operation was successful
@@ -349,7 +379,7 @@ public class WorkspaceClipboardItem extends AbstractClipboardItem
try
{
// attempt each copy/paste in its own transaction
- tx = Repository.getUserTransaction(fc);
+ tx = Repository.getUserTransaction(fc, false);
tx.begin();
if (getMode() == ClipboardStatus.COPY)
{
diff --git a/source/java/org/alfresco/web/bean/coci/EditOnlineDialog.java b/source/java/org/alfresco/web/bean/coci/EditOnlineDialog.java
index 0aac13c9c3..2a9cb24b14 100644
--- a/source/java/org/alfresco/web/bean/coci/EditOnlineDialog.java
+++ b/source/java/org/alfresco/web/bean/coci/EditOnlineDialog.java
@@ -27,6 +27,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.service.cmr.repository.ContentReader;
+import org.alfresco.service.cmr.rule.RuleType;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
@@ -163,20 +164,28 @@ public class EditOnlineDialog extends CCCheckoutFileDialog
{
tx = Repository.getUserTransaction(context, false);
tx.begin();
-
+
// if current content is already working copy then we don't checkout
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false)
{
// if checkout is successful, then checkoutFile sets property workingDocument
checkoutFile(FacesContext.getCurrentInstance(), null);
-
+
Node workingCopyNode = property.getWorkingDocument();
if (workingCopyNode != null)
{
- // set working copy node as document for editing
- property.setDocument(workingCopyNode);
- getNodeService().setProperty(workingCopyNode.getNodeRef(), ContentModel.PROP_WORKING_COPY_MODE, ONLINE_EDITING);
+ getRuleService().disableRules();
+ try
+ {
+ // set working copy node as document for editing
+ property.setDocument(workingCopyNode);
+ getNodeService().setProperty(workingCopyNode.getNodeRef(), ContentModel.PROP_WORKING_COPY_MODE, ONLINE_EDITING);
+ }
+ finally
+ {
+ getRuleService().enableRules();
+ }
}
}
diff --git a/source/java/org/alfresco/web/bean/content/AddContentDialog.java b/source/java/org/alfresco/web/bean/content/AddContentDialog.java
index cef1e9b55c..709a450c17 100644
--- a/source/java/org/alfresco/web/bean/content/AddContentDialog.java
+++ b/source/java/org/alfresco/web/bean/content/AddContentDialog.java
@@ -120,11 +120,22 @@ public class AddContentDialog extends BaseContentWizard
// to otherwise just return
if (this.showOtherProperties)
{
- // we are going to immediately edit the properties so we need
- // to setup the BrowseBean context appropriately
- this.browseBean.setDocument(new Node(this.createdNode));
+ // check whether the created node is checked out, if a 'check out'
+ // rule is present in the space the new node will be and an
+ // attempt to modify the properties will cause an error (ALF-438)
+ if (getNodeService().hasAspect(this.createdNode, ContentModel.ASPECT_LOCKABLE))
+ {
+ Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), MSG_NODE_LOCKED));
+ return outcome;
+ }
+ else
+ {
+ // we are going to immediately edit the properties so we need
+ // to setup the BrowseBean context appropriately
+ this.browseBean.setDocument(new Node(this.createdNode));
- return "dialog:setContentProperties";
+ return "dialog:setContentProperties";
+ }
}
else
{
diff --git a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java
index 5c20948f02..50aa0df896 100644
--- a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java
+++ b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java
@@ -28,9 +28,6 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
-import org.springframework.extensions.config.Config;
-import org.springframework.extensions.config.ConfigElement;
-import org.springframework.extensions.config.ConfigService;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.ServiceRegistry;
@@ -50,12 +47,16 @@ import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.repo.component.UICharsetSelector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.springframework.extensions.config.Config;
+import org.springframework.extensions.config.ConfigElement;
+import org.springframework.extensions.config.ConfigService;
/**
* Base class for the content related wizards and dialogs
*
* @author gavinc
*/
+@SuppressWarnings("serial")
public abstract class BaseContentWizard extends BaseWizardBean
{
protected String fileName;
@@ -74,6 +75,8 @@ public abstract class BaseContentWizard extends BaseWizardBean
protected List objectTypes;
transient private ContentService contentService;
+ protected static final String MSG_NODE_LOCKED = "node_locked_dialog_closed";
+
protected static Log logger = LogFactory.getLog(BaseContentWizard.class);
@@ -100,8 +103,8 @@ public abstract class BaseContentWizard extends BaseWizardBean
public boolean getFinishButtonDisabled()
{
return (this.fileName == null ||
- this.fileName.length() == 0 ||
- this.mimeType == null);
+ this.fileName.length() == 0 ||
+ this.mimeType == null);
}
@@ -294,7 +297,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
*/
public List getObjectTypes()
{
- if ((this.objectTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
+ if ((this.objectTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
{
FacesContext context = FacesContext.getCurrentInstance();
@@ -481,17 +484,17 @@ public abstract class BaseContentWizard extends BaseWizardBean
// apply the titled aspect - title and description
editProps.put(ContentModel.PROP_TITLE, this.title);
- editProps.put(ContentModel.PROP_DESCRIPTION, this.description);
+ editProps.put(ContentModel.PROP_DESCRIPTION, this.description);
if (logger.isDebugEnabled())
logger.debug("Added titled aspect with properties: " + this.title + ", " + this.description);
// create the node
NodeRef fileNodeRef = this.getNodeService().createNode(
- containerNodeRef,
- ContentModel.ASSOC_CONTAINS,
- QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, this.fileName),
+ containerNodeRef,
+ ContentModel.ASSOC_CONTAINS,
+ QName.createQNameWithValidLocalName(NamespaceService.CONTENT_MODEL_1_0_URI, this.fileName),
Repository.resolveToQName(this.objectType),
- editProps).getChildRef();
+ editProps).getChildRef();
if (logger.isDebugEnabled())
logger.debug("Created file node for file: " + this.fileName);
diff --git a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java
index 4aef7c573b..a2c8ca6665 100644
--- a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java
+++ b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java
@@ -34,6 +34,7 @@ import javax.faces.model.SelectItem;
import org.springframework.extensions.config.Config;
import org.springframework.extensions.config.ConfigElement;
import org.springframework.extensions.config.ConfigService;
+import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.service.cmr.model.FileExistsException;
@@ -199,12 +200,23 @@ public class CreateContentWizard extends BaseContentWizard
// to otherwise just return
if (this.showOtherProperties)
{
- // we are going to immediately edit the properties so we need
- // to setup the BrowseBean context appropriately
- this.browseBean.setDocument(new Node(this.createdNode));
+ // check whether the created node is checked out, if a 'check out'
+ // rule is present in the space the new node will be and an
+ // attempt to modify the properties will cause an error (ALF-438)
+ if (getNodeService().hasAspect(this.createdNode, ContentModel.ASPECT_LOCKABLE))
+ {
+ Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), MSG_NODE_LOCKED));
+ return outcome;
+ }
+ else
+ {
+ // we are going to immediately edit the properties so we need
+ // to setup the BrowseBean context appropriately
+ this.browseBean.setDocument(new Node(this.createdNode));
- return getDefaultFinishOutcome() + AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
- "dialog:setContentProperties";
+ return getDefaultFinishOutcome() + AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
+ "dialog:setContentProperties";
+ }
}
else
{
diff --git a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java
index 02140583e8..4c06ff7a76 100644
--- a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java
+++ b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java
@@ -32,6 +32,7 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.rule.RuleService;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.transaction.TransactionService;
@@ -65,6 +66,7 @@ public abstract class BaseDialogBean implements IDialogBean, Serializable
transient private SearchService searchService;
transient private DictionaryService dictionaryService;
transient private NamespaceService namespaceService;
+ transient private RuleService ruleService;
public void init(Map parameters)
{
@@ -270,6 +272,19 @@ public abstract class BaseDialogBean implements IDialogBean, Serializable
return this.nodeService;
}
+ /**
+ * Get the rule service
+ * @return RuleService rule service
+ */
+ protected RuleService getRuleService()
+ {
+ if (ruleService == null)
+ {
+ ruleService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getRuleService();
+ }
+ return ruleService;
+ }
+
/**
* @param fileFolderService used to manipulate folder/folder model nodes
*/
diff --git a/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java b/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java
index 0aab029cd0..194f4bacc8 100644
--- a/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java
+++ b/source/java/org/alfresco/web/bean/groups/AddUsersDialog.java
@@ -231,8 +231,10 @@ public class AddUsersDialog extends BaseDialogBean
{
String firstName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
String lastName = (String)getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
-
- SelectItem item = new SortableSelectItem(username, firstName + " " + lastName + " [" + username + "]", lastName);
+
+ // build a sensible label for display
+ String name = (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : "");
+ SelectItem item = new SortableSelectItem(username, name + " [" + username + "]", lastName != null ? lastName : username);
itemList.add(item);
}
}
@@ -309,12 +311,11 @@ public class AddUsersDialog extends BaseDialogBean
NodeRef ref = this.getPersonService().getPerson(authority);
String firstName = (String)getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME);
String lastName = (String)getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME);
-
+
// build a sensible label for display
- label.append(firstName).append(' ').append(lastName);
-
- // add a wrapper object with the details to the results list
- // for display
+ label.append(firstName != null ? firstName : "").append(' ').append(lastName != null ? lastName : "");
+
+ // add a wrapper object with the details to the results list for display
UserAuthorityDetails userDetails = new UserAuthorityDetails(label.toString(), authority);
this.usersForGroup.add(userDetails);
}
diff --git a/source/java/org/alfresco/web/bean/groups/GroupsDialog.java b/source/java/org/alfresco/web/bean/groups/GroupsDialog.java
index c45a06fe2e..5048632eee 100644
--- a/source/java/org/alfresco/web/bean/groups/GroupsDialog.java
+++ b/source/java/org/alfresco/web/bean/groups/GroupsDialog.java
@@ -127,12 +127,24 @@ public class GroupsDialog extends BaseDialogBean
// ------------------------------------------------------------------------------
// Dialog implementation
+
+
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return null;
}
+ @Override
+ public String cancel()
+ {
+ // reset UI back to group search on leaving the groups dialog
+ this.location = null;
+ setCurrentGroup(null, null);
+
+ return super.cancel();
+ }
+
@Override
public String getContainerSubTitle()
{
diff --git a/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java b/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java
index b3ad08c91f..6f87655b45 100644
--- a/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java
+++ b/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java
@@ -82,7 +82,8 @@ public class EditMLContainerDialog extends BaseDialogBean
{
QName qname = QName.createQName(entry.getKey());
- if(! qname.getNamespaceURI().equals(NamespaceService.SYSTEM_MODEL_1_0_URI) )
+ if (!qname.getNamespaceURI().equals(NamespaceService.SYSTEM_MODEL_1_0_URI) ||
+ qname.equals(ContentModel.PROP_LOCALE))
{
// Update the property on the real node
getNodeService().setProperty(container, qname, (Serializable) entry.getValue());
diff --git a/source/java/org/alfresco/web/bean/repository/Preferences.java b/source/java/org/alfresco/web/bean/repository/Preferences.java
index 19f530a3ca..e22512f37e 100644
--- a/source/java/org/alfresco/web/bean/repository/Preferences.java
+++ b/source/java/org/alfresco/web/bean/repository/Preferences.java
@@ -49,10 +49,6 @@ public final class Preferences implements Serializable
*/
Preferences(NodeRef prefRef)
{
- if (prefRef == null)
- {
- throw new IllegalArgumentException("Preferences NodeRef cannot be null.");
- }
this.preferencesRef = prefRef;
}
@@ -65,13 +61,20 @@ public final class Preferences implements Serializable
*/
public Serializable getValue(String name)
{
- Serializable value = this.cache.get(name);
- if (value == null)
+ Serializable value = null;
+
+ if (this.preferencesRef != null)
{
- QName qname = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, name);
- value = getNodeService().getProperty(this.preferencesRef, qname);
- this.cache.put(name, value);
+ value = this.cache.get(name);
+
+ if (value == null)
+ {
+ QName qname = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, name);
+ value = getNodeService().getProperty(this.preferencesRef, qname);
+ this.cache.put(name, value);
+ }
}
+
return value;
}
@@ -83,27 +86,30 @@ public final class Preferences implements Serializable
*/
public void setValue(String name, Serializable value)
{
- QName qname = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, name);
+ if (this.preferencesRef != null)
+ {
+ QName qname = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, name);
- // persist the property to the repo
- UserTransaction tx = null;
- try
- {
- FacesContext context = FacesContext.getCurrentInstance();
- tx = Repository.getUserTransaction(context);
- tx.begin();
+ // persist the property to the repo
+ UserTransaction tx = null;
+ try
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ tx = Repository.getUserTransaction(context);
+ tx.begin();
- getNodeService().setProperty(this.preferencesRef, qname, value);
+ getNodeService().setProperty(this.preferencesRef, qname, value);
- tx.commit();
+ tx.commit();
- // update the cache
- this.cache.put(name, value);
- }
- catch (Throwable err)
- {
- // we cannot update the properties if a user is no longer authenticated
- try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
+ // update the cache
+ this.cache.put(name, value);
+ }
+ catch (Throwable err)
+ {
+ // we cannot update the properties if a user is no longer authenticated
+ try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
+ }
}
}
diff --git a/source/java/org/alfresco/web/bean/repository/Repository.java b/source/java/org/alfresco/web/bean/repository/Repository.java
index 7889987b96..5c390c60c4 100644
--- a/source/java/org/alfresco/web/bean/repository/Repository.java
+++ b/source/java/org/alfresco/web/bean/repository/Repository.java
@@ -720,8 +720,9 @@ public final class Repository
// this will also force initialisation of the props now during the UserTransaction
// it is much better for performance to do this now rather than during page bind
Map props = node.getProperties();
+ String firstName = (String)props.get("firstName");
String lastName = (String)props.get("lastName");
- props.put("fullName", ((String)props.get("firstName")) + ' ' + (lastName != null ? lastName : ""));
+ props.put("fullName", (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : ""));
NodeRef homeFolderNodeRef = (NodeRef)props.get("homeFolder");
if (homeFolderNodeRef != null)
{
diff --git a/source/java/org/alfresco/web/bean/repository/TransientNode.java b/source/java/org/alfresco/web/bean/repository/TransientNode.java
index 51ee732b2e..1dcd078da7 100644
--- a/source/java/org/alfresco/web/bean/repository/TransientNode.java
+++ b/source/java/org/alfresco/web/bean/repository/TransientNode.java
@@ -272,11 +272,11 @@ public class TransientNode extends Node
throw new AlfrescoRuntimeException("Failed to find type definition: " + this.type);
}
- this.aspects = new HashSet();
- for (AspectDefinition aspectDef : typeDef.getDefaultAspects())
- {
- this.aspects.add(aspectDef.getName());
- }
+ // get flat list of all aspects for the type
+ List defaultAspects = new ArrayList(16);
+ getMandatoryAspects(typeDef, defaultAspects);
+
+ this.aspects = new HashSet(defaultAspects);
// setup remaining variables
this.path = null;
diff --git a/source/java/org/alfresco/web/bean/repository/User.java b/source/java/org/alfresco/web/bean/repository/User.java
index fc2cb41727..efe59b3d2e 100644
--- a/source/java/org/alfresco/web/bean/repository/User.java
+++ b/source/java/org/alfresco/web/bean/repository/User.java
@@ -38,6 +38,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
+import org.alfresco.service.transaction.TransactionService;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.jsf.FacesContextUtils;
@@ -107,9 +108,9 @@ public final class User implements SessionUser
{
if (this.fullName == null)
{
+ String firstName = (String)service.getProperty(this.person, ContentModel.PROP_FIRSTNAME);
String lastName = (String)service.getProperty(this.person, ContentModel.PROP_LASTNAME);
- this.fullName = service.getProperty(this.person, ContentModel.PROP_FIRSTNAME) +
- (lastName != null ? (" " + lastName) : "");
+ this.fullName = (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : "");
}
return this.fullName;
@@ -208,11 +209,12 @@ public final class User implements SessionUser
* Utilises the 'configurable' aspect on the Person linked to this user.
*/
synchronized NodeRef getUserPreferencesRef(WebApplicationContext context)
- {
+ {
final ServiceRegistry registry = (ServiceRegistry) context.getBean("ServiceRegistry");
final NodeService nodeService = registry.getNodeService();
final SearchService searchService = registry.getSearchService();
final NamespaceService namespaceService = registry.getNamespaceService();
+ final TransactionService txService = registry.getTransactionService();
final ConfigurableService configurableService = (ConfigurableService) context.getBean("ConfigurableService");
RetryingTransactionHelper txnHelper = registry.getRetryingTransactionHelper();
return txnHelper.doInTransaction(new RetryingTransactionCallback()
@@ -224,8 +226,16 @@ public final class User implements SessionUser
NodeRef person = getPerson();
if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false)
{
- // create the configuration folder for this Person node
- configurableService.makeConfigurable(person);
+ // if the repository is in read-only mode just return null
+ if (txService.isReadOnly())
+ {
+ return null;
+ }
+ else
+ {
+ // create the configuration folder for this Person node
+ configurableService.makeConfigurable(person);
+ }
}
// target of the assoc is the configurations folder ref
@@ -245,13 +255,16 @@ public final class User implements SessionUser
}
else
{
- // create the preferences Node for this user
- ChildAssociationRef childRef = nodeService
- .createNode(configRef, ContentModel.ASSOC_CONTAINS, QName.createQName(
- NamespaceService.APP_MODEL_1_0_URI, "preferences"), ContentModel.TYPE_CMOBJECT);
-
- prefRef = childRef.getChildRef();
+ // create the preferences Node for this user (if repo is not read-only)
+ if (txService.isReadOnly() == false)
+ {
+ ChildAssociationRef childRef = nodeService.createNode(configRef,
+ ContentModel.ASSOC_CONTAINS, QName.createQName(
+ NamespaceService.APP_MODEL_1_0_URI, "preferences"),
+ ContentModel.TYPE_CMOBJECT);
+ prefRef = childRef.getChildRef();
+ }
}
return prefRef;
}
diff --git a/source/java/org/alfresco/web/bean/rules/handlers/HasTagHandler.java b/source/java/org/alfresco/web/bean/rules/handlers/HasTagHandler.java
new file mode 100644
index 0000000000..358bfba222
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/rules/handlers/HasTagHandler.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2005-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.web.bean.rules.handlers;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.repo.action.evaluator.HasTagEvaluator;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.wizard.IWizardBean;
+
+/**
+ * Condition handler for the "has-tag" condition.
+ *
+ * @author arsenyko
+ */
+public class HasTagHandler extends BaseConditionHandler
+{
+ private static final long serialVersionUID = 1L;
+
+ public String getJSPPath()
+ {
+ return getJSPPath(HasTagEvaluator.NAME);
+ }
+
+ public void prepareForSave(Map conditionProps,
+ Map repoProps)
+ {
+ String tag = (String)conditionProps.get(HasTagEvaluator.PARAM_TAG);
+ repoProps.put(HasTagEvaluator.PARAM_TAG, tag);
+ }
+
+ public void prepareForEdit(Map conditionProps,
+ Map repoProps)
+ {
+ String tag = (String)repoProps.get(HasTagEvaluator.PARAM_TAG);
+ conditionProps.put(HasTagEvaluator.PARAM_TAG, tag);
+ }
+
+ public String generateSummary(FacesContext context, IWizardBean wizard,
+ Map conditionProps)
+ {
+ Boolean not = (Boolean)conditionProps.get(PROP_CONDITION_NOT);
+ String msgId = not.booleanValue() ? "condition_has_tag_not" : "condition_has_tag";
+
+ String label = (String) conditionProps.get(HasTagEvaluator.PARAM_TAG);
+
+ return MessageFormat.format(Application.getMessage(context, msgId),
+ new Object[] {label});
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/trashcan/TrashcanRecoverAllItemsDialog.java b/source/java/org/alfresco/web/bean/trashcan/TrashcanRecoverAllItemsDialog.java
deleted file mode 100644
index cce6561579..0000000000
--- a/source/java/org/alfresco/web/bean/trashcan/TrashcanRecoverAllItemsDialog.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Alfresco Software Limited.
- *
- * This file is part of Alfresco
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-package org.alfresco.web.bean.trashcan;
-
-import java.util.List;
-
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-
-import org.alfresco.repo.node.archive.RestoreNodeReport;
-import org.alfresco.web.app.Application;
-import org.alfresco.web.bean.repository.Repository;
-
-public class TrashcanRecoverAllItemsDialog extends TrashcanDialog
-{
- private static final long serialVersionUID = -1869377322722271833L;
-
- private static final String OUTCOME_RECOVERY_REPORT = "dialog:recoveryReport";
- private static final String MSG_NO = "no";
- private static final String MSG_YES = "yes";
-
- private String recoverAllItems(FacesContext context, String outcome)
- {
- if (property.isInProgress())
- return null;
-
- property.setInProgress(true);
-
- try
- {
-
- // restore all nodes - the user may have requested a restore to a
- // different parent
- List reports;
- if (property.getDestination() == null)
- {
- reports = property.getNodeArchiveService().restoreAllArchivedNodes(Repository.getStoreRef());
- }
- else
- {
- reports = property.getNodeArchiveService().restoreAllArchivedNodes(Repository.getStoreRef(), property.getDestination(), null, null);
- }
-
- saveReportDetail(reports);
-
- }
- finally
- {
- property.setInProgress(false);
- }
-
- return OUTCOME_RECOVERY_REPORT;
- }
-
- @Override
- protected String finishImpl(FacesContext context, String outcome) throws Exception
- {
-
- return recoverAllItems(context, outcome);
-
- }
-
- @Override
- public String getCancelButtonLabel()
- {
- return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
- }
-
- @Override
- public boolean getFinishButtonDisabled()
- {
- return false;
- }
-
- @Override
- public String getFinishButtonLabel()
- {
- return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
- }
-
- @Override
- public void setupListAction(ActionEvent event)
- {
-
- super.setupListAction(event);
- clearSearch(event);
- getItems();
- }
-}
diff --git a/source/java/org/alfresco/web/bean/users/UserMembersBean.java b/source/java/org/alfresco/web/bean/users/UserMembersBean.java
index 7db93d5501..03593c1606 100644
--- a/source/java/org/alfresco/web/bean/users/UserMembersBean.java
+++ b/source/java/org/alfresco/web/bean/users/UserMembersBean.java
@@ -425,8 +425,9 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext
// this will also force initialisation of the props now during the UserTransaction
// it is much better for performance to do this now rather than during page bind
Map props = node.getProperties();
+ String firstName = (String)props.get("firstName");
String lastName = (String)props.get("lastName");
- props.put("fullName", ((String)props.get("firstName")) + ' ' + (lastName != null ? lastName : ""));
+ props.put("fullName", (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : ""));
props.put("userNameLabel", props.get("userName"));
props.put("roles", roleListToString(context, permissionMap.get(authority)));
props.put("icon", WebResources.IMAGE_PERSON);
@@ -642,8 +643,9 @@ public abstract class UserMembersBean extends BaseDialogBean implements IContext
Node node = new Node(ref);
// setup convience function for current user full name
- setPersonName((String)node.getProperties().get(ContentModel.PROP_FIRSTNAME) + ' ' +
- (String)node.getProperties().get(ContentModel.PROP_LASTNAME));
+ String firstName = (String)node.getProperties().get(ContentModel.PROP_FIRSTNAME);
+ String lastName = (String)node.getProperties().get(ContentModel.PROP_LASTNAME);
+ setPersonName((firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : ""));
}
else
{
diff --git a/source/java/org/alfresco/web/bean/users/UsersDialog.java b/source/java/org/alfresco/web/bean/users/UsersDialog.java
index 6d4ef968bb..cecf66b120 100644
--- a/source/java/org/alfresco/web/bean/users/UsersDialog.java
+++ b/source/java/org/alfresco/web/bean/users/UsersDialog.java
@@ -333,7 +333,9 @@ public class UsersDialog extends BaseDialogBean implements IContextListener, Cha
// this will also force initialisation of the props now during the UserTransaction
// it is much better for performance to do this now rather than during page bind
Map props = node.getProperties();
- props.put("fullName", ((String)props.get("firstName")) + ' ' + ((String)props.get("lastName")));
+ String firstName = (String)props.get("firstName");
+ String lastName = (String)props.get("lastName");
+ props.put("fullName", (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : ""));
NodeRef homeFolderNodeRef = (NodeRef)props.get("homeFolder");
if (homeFolderNodeRef != null)
{
diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java
index 8bfb283fdb..59ed52a7e1 100644
--- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java
+++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java
@@ -1690,10 +1690,8 @@ public class AVMBrowseBean implements IContextListener
/**
* Revert a sandbox to a specific snapshot version ID
*/
- public void revertSnapshot(ActionEvent event)
+ public void revertSnapshot(Map params)
{
- UIActionLink link = (UIActionLink)event.getComponent();
- Map params = link.getParameterMap();
String sandbox = params.get("sandbox");
String strVersion = params.get("version");
if (sandbox != null && strVersion != null && strVersion.length() != 0)
diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java
index 45340034c7..054a45f498 100644
--- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java
+++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java
@@ -810,13 +810,30 @@ public class CreateWebContentWizard extends CreateContentWizard
}
/**
- * Provides the url to the preview sandbox containing the asset currently being edited.
+ * Provides path to current WCM webApp folder.
*/
public String getPreviewSandboxUrl()
{
return AVMUtil.buildWebappUrl(AVMUtil.getCorrespondingPreviewStoreName(this.avmBrowseBean.getSandbox()), this.avmBrowseBean.getWebapp());
}
+ /**
+ * Provides name of current WCM webApp folder.
+ */
+
+ public String getAvmWebappPrefix()
+ {
+ return AVMUtil.getPreviewURI(AVMUtil.getCorrespondingPreviewStoreName(this.avmBrowseBean.getSandbox()));
+ }
+
+ /**
+ * Provides the url to the preview sandbox containing the asset currently being edited.
+ */
+ public String getAvmWebappName()
+ {
+ return this.avmBrowseBean.getWebapp();
+ }
+
public String getSummary()
{
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
diff --git a/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java b/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java
index 8325092353..bf47c2998b 100644
--- a/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java
+++ b/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java
@@ -97,6 +97,7 @@ public class FilePickerBean implements Serializable
private static final String PARAM_SELECTABLE_TYPES = "selectableTypes";
private static final String PARAM_FILTER_MIME_TYPES = "filterMimetypes";
private static final String PARAM_CURRENT_PATH = "currentPath";
+ private static final String EXTERNAL_PROTOCOL_REGEXP = "^.*:.*";
private final Set uploads = new HashSet();
@@ -362,12 +363,27 @@ public class FilePickerBean implements Serializable
String currentPathReqParam = (String) externalContext
.getRequestParameterMap().get(PARAM_CURRENT_PATH);
+ // create file picker data XML document to return
+ // and append file picker data element to it
+ final org.w3c.dom.Document filePickerDataDoc = XMLUtil.newDocument();
+ final org.w3c.dom.Element filePickerDataElement = filePickerDataDoc
+ .createElement("file-picker-data");
+ filePickerDataDoc.appendChild(filePickerDataElement);
+
// if current path request parameter null then set current path to the
// current AVM path
- if ((currentPathReqParam == null))
+ if (currentPathReqParam == null)
{
currentPath = this.getCurrentAVMPath();
}
+
+ // Fix for ALF-3764. We cannot select an external protocol link (i.e. http://example.net by filepicker.
+ // Such links should be typed manually in the text box.
+ if (currentPathReqParam.matches(EXTERNAL_PROTOCOL_REGEXP))
+ {
+ currentPath = this.getCurrentAVMPath();
+ filePickerDataElement.setAttribute("error", Application.getMessage(facesContext, "error_external_protocol_support"));
+ }
// else set current path to current path request parameter converted to
// AVM preview
// store path
@@ -399,13 +415,6 @@ public class FilePickerBean implements Serializable
+ StringUtils.join(filterMimetypes, ",") + "])");
}
- // create file picker data XML document to return
- // and append file picker data element to it
- final org.w3c.dom.Document filePickerDataDoc = XMLUtil.newDocument();
- final org.w3c.dom.Element filePickerDataElement = filePickerDataDoc
- .createElement("file-picker-data");
- filePickerDataDoc.appendChild(filePickerDataElement);
-
// make sure that there is a node associated with current path
// if not, set an applicable error message as an attribute on
// the file picker data element
diff --git a/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java b/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java
index 0b1d55840e..069713e5b0 100644
--- a/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java
+++ b/source/java/org/alfresco/web/bean/wcm/ManageChangeRequestTaskDialog.java
@@ -26,11 +26,12 @@ import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
-import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.AVMNodeConverter;
+import org.alfresco.repo.transaction.RetryingTransactionHelper;
+import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
import org.alfresco.service.cmr.avmsync.AVMDifference;
@@ -98,96 +99,99 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog
if (logger.isDebugEnabled())
logger.debug("Transitioning change request task: " + this.getWorkflowTask().id);
- FacesContext context = FacesContext.getCurrentInstance();
- UserTransaction tx = null;
-
+ final FacesContext context = FacesContext.getCurrentInstance();
+
try
{
- tx = Repository.getUserTransaction(context);
- tx.begin();
-
- // get the current username and place in list
- String username = Application.getCurrentUser(context).getUserName();
- List newLockOwners = new ArrayList(1);
- newLockOwners.add(username);
-
- // prepare the edited parameters for saving
- Map params = WorkflowUtil.prepareTaskParams(this.taskNode);
-
- // update the task with the updated parameters and resources
- this.getWorkflowService().updateTask(this.getWorkflowTask().id, params, null, null);
-
- // get the list of nodes that have expired (comparing workflow store to
- // the users main store)
- List submitPaths = new ArrayList();
- List submitNodes = new ArrayList();
- Pair pkgPath = AVMNodeConverter.ToAVMVersionPath(this.workflowPackage);
- AVMNodeDescriptor pkgDesc = this.getAvmService().lookup(pkgPath.getFirst(), pkgPath.getSecond());
- String targetPath = pkgDesc.getIndirection();
- List diffs = this.getAvmSyncService().compare(pkgPath.getFirst(),
- pkgPath.getSecond(), -1, targetPath, null);
-
- // update the users main store with the changes from the workflow store
- this.getAvmSyncService().update(diffs, null, false, false, true, true, null, null);
-
- // move locks
- for (AVMDifference diff : diffs)
+ RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(FacesContext.getCurrentInstance());
+ RetryingTransactionCallback callback = new RetryingTransactionCallback()
{
- // move the lock for this path from the user workflow sandbox to the users main store
- // we need to do this because the workflow endTask will trigger deletion of the (user)
- // workflow store which will in turn recursively remove all the locks.
- String diffSourcePath = diff.getSourcePath();
- String diffSourceAvmStore = WCMUtil.getWebProjectStoreIdFromPath(diffSourcePath);
- String sourceWebProject = WCMUtil.getWebProjectStoreId(diffSourceAvmStore);
- String diffTargetPath = diff.getDestinationPath();
- String diffTargetAvmStore = WCMUtil.getWebProjectStoreIdFromPath(diffTargetPath);
- String targetWebProject = WCMUtil.getWebProjectStoreId(diffSourceAvmStore);
- if (!sourceWebProject.equals(targetWebProject))
+ public Object execute() throws Throwable
{
- throw new AlfrescoRuntimeException(
- "The source web project does not match the target web project: \n" +
- " Source: " + diffSourcePath + "\n" +
- " Target: " + diffTargetPath);
+ // get the current username and place in list
+ String username = Application.getCurrentUser(context).getUserName();
+ List newLockOwners = new ArrayList(1);
+ newLockOwners.add(username);
+
+ // prepare the edited parameters for saving
+ Map params = WorkflowUtil.prepareTaskParams(taskNode);
+
+ // update the task with the updated parameters and resources
+ getWorkflowService().updateTask(getWorkflowTask().id, params, null, null);
+
+ // get the list of nodes that have expired (comparing workflow store to
+ // the users main store)
+ List submitPaths = new ArrayList();
+ List submitNodes = new ArrayList();
+ Pair pkgPath = AVMNodeConverter.ToAVMVersionPath(workflowPackage);
+ AVMNodeDescriptor pkgDesc = getAvmService().lookup(pkgPath.getFirst(), pkgPath.getSecond());
+ String targetPath = pkgDesc.getIndirection();
+ List diffs = getAvmSyncService().compare(pkgPath.getFirst(),
+ pkgPath.getSecond(), -1, targetPath, null);
+
+ // update the users main store with the changes from the workflow store
+ getAvmSyncService().update(diffs, null, false, false, true, true, null, null);
+
+ // move locks
+ for (AVMDifference diff : diffs)
+ {
+ // move the lock for this path from the user workflow sandbox to the users main store
+ // we need to do this because the workflow endTask will trigger deletion of the (user)
+ // workflow store which will in turn recursively remove all the locks.
+ String diffSourcePath = diff.getSourcePath();
+ String diffSourceAvmStore = WCMUtil.getWebProjectStoreIdFromPath(diffSourcePath);
+ String sourceWebProject = WCMUtil.getWebProjectStoreId(diffSourceAvmStore);
+ String diffTargetPath = diff.getDestinationPath();
+ String diffTargetAvmStore = WCMUtil.getWebProjectStoreIdFromPath(diffTargetPath);
+ String targetWebProject = WCMUtil.getWebProjectStoreId(diffSourceAvmStore);
+ if (!sourceWebProject.equals(targetWebProject))
+ {
+ throw new AlfrescoRuntimeException(
+ "The source web project does not match the target web project: \n" +
+ " Source: " + diffSourcePath + "\n" +
+ " Target: " + diffTargetPath);
+ }
+
+ Map lockAttributes = Collections.singletonMap(
+ WCMUtil.LOCK_KEY_STORE_NAME, diffTargetAvmStore);
+ boolean modified = getAvmLockingService().modifyLock(
+ sourceWebProject, AVMUtil.getStoreRelativePath(diffSourcePath), username,
+ sourceWebProject, AVMUtil.getStoreRelativePath(diffTargetPath), lockAttributes);
+ if (modified && logger.isDebugEnabled())
+ {
+ logger.debug(
+ "Moved lock: " + AVMUtil.getStoreId(diffSourcePath) + "-" +
+ AVMUtil.getStoreRelativePath(diffSourcePath) +
+ " to user: " + username);
+ }
+ }
+
+ // re-submit all the items now if requested
+ if (doResubmitNow)
+ {
+ for (AVMDifference diff : diffs)
+ {
+ String destPath = diff.getDestinationPath();
+
+ AVMNodeDescriptor node = getAvmService().lookup(diff.getDestinationVersion(),
+ destPath, true);
+ if (node != null)
+ {
+ submitNodes.add(node);
+ submitPaths.add(destPath);
+ }
+ }
+
+ setupSubmitDialog(context, submitPaths, submitNodes);
+ }
+
+ // signal the default transition to the workflow task
+ getWorkflowService().endTask(getWorkflowTask().id, null);
+
+ return null;
}
-
- Map lockAttributes = Collections.singletonMap(
- WCMUtil.LOCK_KEY_STORE_NAME, diffTargetAvmStore);
- boolean modified = this.getAvmLockingService().modifyLock(
- sourceWebProject, AVMUtil.getStoreRelativePath(diffSourcePath), username,
- sourceWebProject, AVMUtil.getStoreRelativePath(diffTargetPath), lockAttributes);
- if (modified && logger.isDebugEnabled())
- {
- logger.debug(
- "Moved lock: " + AVMUtil.getStoreId(diffSourcePath) + "-" +
- AVMUtil.getStoreRelativePath(diffSourcePath) +
- " to user: " + username);
- }
- }
-
- // re-submit all the items now if requested
- if (this.doResubmitNow)
- {
- for (AVMDifference diff : diffs)
- {
- String destPath = diff.getDestinationPath();
-
- AVMNodeDescriptor node = this.getAvmService().lookup(diff.getDestinationVersion(),
- destPath, true);
- if (node != null)
- {
- submitNodes.add(node);
- submitPaths.add(destPath);
- }
- }
-
- setupSubmitDialog(context, submitPaths, submitNodes);
- }
-
- // signal the default transition to the workflow task
- this.getWorkflowService().endTask(this.getWorkflowTask().id, null);
-
- // commit the changes
- tx.commit();
+ };
+ txnHelper.doInTransaction(callback);
// if we get this far close the task dialog
if (this.doResubmitNow)
@@ -200,8 +204,6 @@ public class ManageChangeRequestTaskDialog extends ManageTaskDialog
}
catch (Throwable e)
{
- // rollback the transaction
- try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(formatErrorMessage(e), e);
outcome = this.getErrorOutcome(e);
}
diff --git a/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java
index cd1e00fdc7..35311ce00a 100644
--- a/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java
+++ b/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java
@@ -294,11 +294,13 @@ public class ManagePermissionsDialog extends BasePermissionsDialog implements IC
if (perms == null || perms.size() == 0)
return;
Map props = (Map) ((QNameNodeMap) node.getProperties()).clone();
- props.put("fullName", ((String) node.get("firstName")) + ' ' + ((String) node.get("lastName")));
+ String firstName = (String)node.get("firstName");
+ String lastName = (String)node.get("lastName");
+ props.put("fullName", (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : ""));
props.put("perms", UserMembersBean.roleListToString(context, perms));
props.put("icon", WebResources.IMAGE_PERSON);
props.put("inherited", inherited);
-
+
personNodes.add(props);
}
diff --git a/source/java/org/alfresco/web/bean/wcm/RevertSnapshotDialog.java b/source/java/org/alfresco/web/bean/wcm/RevertSnapshotDialog.java
new file mode 100644
index 0000000000..9d932b1216
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/wcm/RevertSnapshotDialog.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2005-2010 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+package org.alfresco.web.bean.wcm;
+
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.dialog.BaseDialogBean;
+
+/**
+ * Revert snapshot
+ * @author valerysh
+ *
+ */
+public class RevertSnapshotDialog extends BaseDialogBean
+{
+ private static final String MSG_REVERT_SNAPSHOT_CONFIRM = "revert_snapshot_confirm";
+
+ protected AVMBrowseBean avmBrowseBean;
+
+ Map parameters;
+
+ /**
+ * @param avmBrowseBean The AVM BrowseBean to set
+ */
+ public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
+ {
+ this.avmBrowseBean = avmBrowseBean;
+ }
+
+ @Override
+ public void init(Map parameters)
+ {
+ super.init(parameters);
+
+ this.parameters = parameters;
+ }
+
+ /**
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
+ */
+ @Override
+ protected String finishImpl(FacesContext context, String outcome) throws Exception
+ {
+ this.avmBrowseBean.revertSnapshot(parameters);
+ return outcome;
+ }
+
+ /**
+ * @return the confirmation to display to the user
+ */
+ public String getConfirmMessage()
+ {
+ return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), MSG_REVERT_SNAPSHOT_CONFIRM),
+ parameters.get("version"));
+ }
+
+ /**
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled()
+ */
+ @Override
+ public boolean getFinishButtonDisabled()
+ {
+ return false;
+ }
+}
diff --git a/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java b/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java
index 95bf87da1d..6d0fa465c1 100644
--- a/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java
+++ b/source/java/org/alfresco/web/bean/wizard/BaseInviteUsersWizard.java
@@ -486,12 +486,14 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean
for (int index=0; index tasks = this.getWorkflowService().getAssignedTasks(
- userName, WorkflowTaskState.COMPLETED);
+ ClientConfigElement clientConfig = (ClientConfigElement)Application.getConfigService(context).getGlobalConfig().getConfigElement(
+ ClientConfigElement.CONFIG_ELEMENT_ID);
+ WorkflowTaskQuery query = new WorkflowTaskQuery();
+ query.setActive(null);
+ query.setActorId(userName);
+ query.setTaskState(WorkflowTaskState.COMPLETED);
+ query.setLimit(clientConfig.getTasksCompletedMaxResults());
+ List tasks = this.getWorkflowService().queryTasks(query);
// create a list of transient nodes to represent
this.completedTasks = new ArrayList(tasks.size());
diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowUtil.java b/source/java/org/alfresco/web/bean/workflow/WorkflowUtil.java
index 337b74a89d..f6437e1e77 100644
--- a/source/java/org/alfresco/web/bean/workflow/WorkflowUtil.java
+++ b/source/java/org/alfresco/web/bean/workflow/WorkflowUtil.java
@@ -185,6 +185,7 @@ public class WorkflowUtil
* @param node The node to package up for persistence
* @return The map of data representing the node
*/
+ @SuppressWarnings("unchecked")
public static Map prepareTaskParams(Node node)
{
Map params = new HashMap();
@@ -209,17 +210,57 @@ public class WorkflowUtil
// get the associations added and create list of targets
Map addedAssocs = assocs.get(assocName);
+ List originalAssocRefs = (List) node.getAssociations().get(assocName);
List targets = new ArrayList(addedAssocs.size());
+
+ if (originalAssocRefs != null)
+ {
+ for (AssociationRef assoc : originalAssocRefs)
+ {
+ targets.add(assoc.getTargetRef());
+ }
+ }
+
for (AssociationRef assoc : addedAssocs.values())
{
targets.add(assoc.getTargetRef());
}
- // add the targets for this particular association
- if (targets.size() > 0)
+ params.put(assocQName, (Serializable)targets);
+ }
+
+ // go through the removed associations and either setup or adjust the
+ // parameters map accordingly
+ assocs = node.getRemovedAssociations();
+
+ for (String assocName : assocs.keySet())
+ {
+ QName assocQName = Repository.resolveToQName(assocName);
+
+ // get the associations removed and create list of targets
+ Map removedAssocs = assocs.get(assocName);
+ List targets = (List)params.get(assocQName);
+
+ if (targets == null)
{
- params.put(assocQName, (Serializable)targets);
+ // if there weren't any assocs of this type added get the current
+ // set of assocs from the node
+ List originalAssocRefs = (List)node.getAssociations().get(assocName);
+ targets = new ArrayList(originalAssocRefs.size());
+
+ for (AssociationRef assoc : originalAssocRefs)
+ {
+ targets.add(assoc.getTargetRef());
+ }
}
+
+ // remove the assocs the user deleted
+ for (AssociationRef assoc : removedAssocs.values())
+ {
+ targets.remove(assoc.getTargetRef());
+ }
+
+ params.put(assocQName, (Serializable)targets);
}
// TODO: Deal with child associations if and when we need to support
diff --git a/source/java/org/alfresco/web/config/ClientConfigElement.java b/source/java/org/alfresco/web/config/ClientConfigElement.java
index 581b8af509..08e54bc60e 100644
--- a/source/java/org/alfresco/web/config/ClientConfigElement.java
+++ b/source/java/org/alfresco/web/config/ClientConfigElement.java
@@ -60,6 +60,7 @@ public class ClientConfigElement extends ConfigElementAdapter
private int searchMaxResults = -1;
private int selectorsSearchMaxResults = 500;
private int inviteUsersMaxResults = 500;
+ private int tasksCompletedMaxResults = 100;
private String helpUrl = null;
private String editLinkType = "http";
private String homeSpacePermission = null;
@@ -226,7 +227,12 @@ public class ClientConfigElement extends ConfigElementAdapter
{
combinedElement.setInviteUsersMaxResults(newElement.getInviteUsersMaxResults());
}
-
+
+ if (newElement.getTasksCompletedMaxResults() != combinedElement.getTasksCompletedMaxResults())
+ {
+ combinedElement.setTasksCompletedMaxResults(newElement.getTasksCompletedMaxResults());
+ }
+
if (newElement.isShelfVisible() != combinedElement.isShelfVisible())
{
combinedElement.setShelfVisible(newElement.isShelfVisible());
@@ -568,6 +574,28 @@ public class ClientConfigElement extends ConfigElementAdapter
this.inviteUsersMaxResults = inviteUsersMaxResults;
}
+ /**
+ * If positive, this will limit the size of the result set of the
+ * completed tasks.
+ *
+ * @return The maximum number of completed tasks to display
+ */
+ public int getTasksCompletedMaxResults()
+ {
+ return tasksCompletedMaxResults;
+ }
+
+ /**
+ * Set if the the number of completed tasks displayed shall be limited.
+ * If negative it is unlimited, by default, this is set to 100.
+ *
+ * @param tasksCompletedMaxResults
+ */
+ /*package*/ void setTasksCompletedMaxResults(int tasksCompletedMaxResults)
+ {
+ this.tasksCompletedMaxResults = tasksCompletedMaxResults;
+ }
+
/**
* @return Returns the default Home Space permissions.
*/
diff --git a/source/java/org/alfresco/web/config/ClientElementReader.java b/source/java/org/alfresco/web/config/ClientElementReader.java
index b984f2c51d..a1962dfc93 100644
--- a/source/java/org/alfresco/web/config/ClientElementReader.java
+++ b/source/java/org/alfresco/web/config/ClientElementReader.java
@@ -45,6 +45,7 @@ public class ClientElementReader implements ConfigElementReader
public static final String ELEMENT_SEARCHMAXRESULTS = "search-max-results";
public static final String ELEMENT_SELECTORSSEARCHMAXRESULTS = "selectors-search-max-results";
public static final String ELEMENT_INVITESEARCHMAXRESULTS = "invite-users-max-results";
+ public static final String ELEMENT_TASKSCOMPLETEDMAXRESULTS = "tasks-completed-max-results";
public static final String ELEMENT_HOMESPACEPERMISSION = "home-space-permission";
public static final String ELEMENT_FROMEMAILADDRESS = "from-email-address";
public static final String ELEMENT_SHELFVISIBLE = "shelf-visible";
@@ -154,6 +155,14 @@ public class ClientElementReader implements ConfigElementReader
configElement.setInviteUsersMaxResults(
Integer.parseInt(inviteUsersMaxResults.getTextTrim()));
}
+
+ // get the invite users max results size
+ Element completedTasksMaxResults = element.element(ELEMENT_TASKSCOMPLETEDMAXRESULTS);
+ if (completedTasksMaxResults != null)
+ {
+ configElement.setTasksCompletedMaxResults(
+ Integer.parseInt(completedTasksMaxResults.getTextTrim()));
+ }
// get the default permission for newly created users Home Spaces
Element permission = element.element(ELEMENT_HOMESPACEPERMISSION);
diff --git a/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java b/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java
index dec4db13b7..91cea6953d 100644
--- a/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java
+++ b/source/java/org/alfresco/web/forms/xforms/XFormsProcessor.java
@@ -222,6 +222,19 @@ public class XFormsProcessor implements FormProcessor
AVMUtil.buildStoreWebappPath(storeName, avmWebApp).replace(":","")));
}
}
+
+ js.append("';\n");
+
+ js.append("alfresco.constants.AVM_WEBAPP_PREFIX = '");
+ if (avmWebApp != null)
+ {
+ String storeName = AVMUtil.getCorrespondingPreviewStoreName(avmBrowseBean.getSandbox());
+ if (storeName != null)
+ {
+ js.append(JavaScriptUtils.javaScriptEscape(fc.getExternalContext().getRequestContextPath() + "/wcs/api/path/content/avm/" +
+ AVMUtil.buildSandboxRootPath(storeName).replace(":","")));
+ }
+ }
js.append("';\n");
js.append("alfresco.xforms.constants.XFORMS_UI_DIV_ID = '").
diff --git a/source/java/org/alfresco/web/ui/common/component/data/UIDataPager.java b/source/java/org/alfresco/web/ui/common/component/data/UIDataPager.java
index 8e00ee390c..2b5edeaef4 100644
--- a/source/java/org/alfresco/web/ui/common/component/data/UIDataPager.java
+++ b/source/java/org/alfresco/web/ui/common/component/data/UIDataPager.java
@@ -132,7 +132,7 @@ public class UIDataPager extends UICommand
else
{
inputPageNumber.append(" ");
}
@@ -570,12 +570,12 @@ public class UIDataPager extends UICommand
}
/**
- * Output the JavaScript event script to handle onkeyup event in the Page Number input.
+ * Output the JavaScript event script to handle onkeypress event in the Page Number input.
* It validates and sends appropriate page number on 'Enter'.
*
* @return JavaScript code
*/
- private String generateInputOnkeyupScript(String pageInputId, String formClientId, String hiddenFieldName)
+ private String generateInputOnkeyPressScript(String pageInputId, String formClientId, String hiddenFieldName)
{
final StringBuilder script = new StringBuilder(128);
script.append("return validateAndSubmit(event,'")
diff --git a/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java b/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java
index 129bd75a73..bf00889a69 100644
--- a/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java
+++ b/source/java/org/alfresco/web/ui/repo/component/UINodeWorkflowInfo.java
@@ -237,7 +237,7 @@ public class UINodeWorkflowInfo extends SelfRenderingComponent
{
actionPattern = Application.getMessage(FacesContext.getCurrentInstance(), "space_action");
}
- Object[] params = new Object[] {action, approveFolderName, Utils.encode(approveStepName)};
+ Object[] params = new Object[] {action, approveFolderName, approveStepName};
out.write(Utils.encode(MessageFormat.format(actionPattern, params)));
// add details of the reject step if there is one
@@ -253,7 +253,7 @@ public class UINodeWorkflowInfo extends SelfRenderingComponent
}
out.write(" ");
- params = new Object[] {action, rejectFolderName, Utils.encode(rejectStepName)};
+ params = new Object[] {action, rejectFolderName, rejectStepName};
out.write(Utils.encode(MessageFormat.format(actionPattern, params)));
}
}
diff --git a/source/java/org/alfresco/web/ui/repo/tag/PageTag.java b/source/java/org/alfresco/web/ui/repo/tag/PageTag.java
index 9fbc4cd692..bfaf3fc0ec 100644
--- a/source/java/org/alfresco/web/ui/repo/tag/PageTag.java
+++ b/source/java/org/alfresco/web/ui/repo/tag/PageTag.java
@@ -73,7 +73,9 @@ public class PageTag extends TagSupport
"/scripts/ajax/summary-info.js",
// ajax pickers
"/scripts/ajax/picker.js",
- "/scripts/ajax/tagger.js"
+ "/scripts/ajax/tagger.js",
+ // validation handling
+ "/scripts/validation.js"
};
private final static String[] CSS =
diff --git a/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java b/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java
index ed5f43e580..a4fa11dafc 100644
--- a/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java
+++ b/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java
@@ -278,7 +278,8 @@ public class UISandboxSnapshots extends SelfRenderingComponent
Map params = new HashMap(2, 1.0f);
params.put("sandbox", sandbox);
params.put("version", "#{" + REQUEST_SNAPVERSION + "}");
- action = createAction(context, sandbox, ACT_SNAPSHOT_REVERT, "/images/icons/revert.gif", "#{AVMBrowseBean.revertSnapshot}", null, null, params);
+ action = createAction(context, sandbox, ACT_SNAPSHOT_REVERT, "/images/icons/revert.gif", "#{DialogManager.setupParameters}", "dialog:revertSnapshot",
+ null, params);
}
requestMap.put(REQUEST_SNAPVERSION, Integer.toString(item.getVersion()));
diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml
index 25837712a7..2f7ebddca1 100644
--- a/source/web/WEB-INF/faces-config-beans.xml
+++ b/source/web/WEB-INF/faces-config-beans.xml
@@ -4316,6 +4316,19 @@
+ The bean that backs up the Revert Snapshot Dialog
+
+ RevertSnapshotDialog
+ org.alfresco.web.bean.wcm.RevertSnapshotDialog
+ session
+
+ avmBrowseBean
+ #{AVMBrowseBean}
+
+
+
+
+
The bean that backs up the Deploy Website Dialog
DeployWebsiteDialog
@@ -5557,31 +5570,6 @@
-
- The bean for the Recover All Items Screen.
- TrashcanRecoverAllItemsDialog
-
- org.alfresco.web.bean.trashcan.TrashcanRecoverAllItemsDialog
-
- session
-
- nodeService
- #{NodeService}
-
-
- searchService
- #{SearchService}
-
-
- dictionaryService
- #{DictionaryService}
-
-
- property
- #{TrashcanDialogProperty}
-
-
-
The bean for the Recover Listed Items Screen.
TrashcanRecoverListedItemsDialog
diff --git a/source/web/images/filetypes32/xlsx.gif b/source/web/images/filetypes32/xlsx.gif
new file mode 100644
index 0000000000..7f25dee557
Binary files /dev/null and b/source/web/images/filetypes32/xlsx.gif differ
diff --git a/source/web/images/filetypes64/xlsx.png b/source/web/images/filetypes64/xlsx.png
new file mode 100644
index 0000000000..10169172a3
Binary files /dev/null and b/source/web/images/filetypes64/xlsx.png differ
diff --git a/source/web/images/icons/recover_all.gif b/source/web/images/icons/recover_all.gif
deleted file mode 100644
index 29c35e8a24..0000000000
Binary files a/source/web/images/icons/recover_all.gif and /dev/null differ
diff --git a/source/web/images/icons/recover_all_large.gif b/source/web/images/icons/recover_all_large.gif
deleted file mode 100644
index aef3ea4484..0000000000
Binary files a/source/web/images/icons/recover_all_large.gif and /dev/null differ
diff --git a/source/web/jsp/actions/add-features.jsp b/source/web/jsp/actions/add-features.jsp
index 4769bb741e..c68f1ada2a 100644
--- a/source/web/jsp/actions/add-features.jsp
+++ b/source/web/jsp/actions/add-features.jsp
@@ -122,12 +122,12 @@
-
+
-
diff --git a/source/web/jsp/actions/check-in.jsp b/source/web/jsp/actions/check-in.jsp
index 145b1f1306..268299ae99 100644
--- a/source/web/jsp/actions/check-in.jsp
+++ b/source/web/jsp/actions/check-in.jsp
@@ -128,12 +128,12 @@
-
+
-
diff --git a/source/web/jsp/actions/check-out.jsp b/source/web/jsp/actions/check-out.jsp
index 8de7738ca8..c0668b299f 100644
--- a/source/web/jsp/actions/check-out.jsp
+++ b/source/web/jsp/actions/check-out.jsp
@@ -123,13 +123,13 @@
-
-
diff --git a/source/web/jsp/actions/copy-to-web-project.jsp b/source/web/jsp/actions/copy-to-web-project.jsp
index ffec5c92ff..7df332cb3a 100644
--- a/source/web/jsp/actions/copy-to-web-project.jsp
+++ b/source/web/jsp/actions/copy-to-web-project.jsp
@@ -128,13 +128,13 @@
-
-
diff --git a/source/web/jsp/actions/copy.jsp b/source/web/jsp/actions/copy.jsp
index e55db2c030..0e8993e161 100644
--- a/source/web/jsp/actions/copy.jsp
+++ b/source/web/jsp/actions/copy.jsp
@@ -123,13 +123,13 @@
-
-
diff --git a/source/web/jsp/actions/import.jsp b/source/web/jsp/actions/import.jsp
index 5bf3b75855..47adca1a7f 100644
--- a/source/web/jsp/actions/import.jsp
+++ b/source/web/jsp/actions/import.jsp
@@ -134,13 +134,13 @@
-
-
diff --git a/source/web/jsp/actions/link-category.jsp b/source/web/jsp/actions/link-category.jsp
index fff28d2dd0..78d2ab98cf 100644
--- a/source/web/jsp/actions/link-category.jsp
+++ b/source/web/jsp/actions/link-category.jsp
@@ -122,13 +122,13 @@
-
-
diff --git a/source/web/jsp/actions/mail.jsp b/source/web/jsp/actions/mail.jsp
index 8f987768b8..033208638a 100644
--- a/source/web/jsp/actions/mail.jsp
+++ b/source/web/jsp/actions/mail.jsp
@@ -39,7 +39,7 @@
/* The mootools API is used since its lib included in head.
It also usefull to use their String.trim() to disable blank subject field */
- window.addEvent('load', mailPageLoaded);
+ addEventToElement(window, 'load', mailPageLoaded, false);
function mailPageLoaded()
{
@@ -252,7 +252,7 @@
-
diff --git a/source/web/jsp/actions/move.jsp b/source/web/jsp/actions/move.jsp
index 3ec4b5ff24..7456acaa40 100644
--- a/source/web/jsp/actions/move.jsp
+++ b/source/web/jsp/actions/move.jsp
@@ -123,13 +123,13 @@
-
-
diff --git a/source/web/jsp/actions/remove-features.jsp b/source/web/jsp/actions/remove-features.jsp
index e5dac101c0..08dfdce3c0 100644
--- a/source/web/jsp/actions/remove-features.jsp
+++ b/source/web/jsp/actions/remove-features.jsp
@@ -122,12 +122,12 @@
-
+
-
diff --git a/source/web/jsp/actions/simple-workflow.jsp b/source/web/jsp/actions/simple-workflow.jsp
index 06d7c5172b..f08679c00c 100644
--- a/source/web/jsp/actions/simple-workflow.jsp
+++ b/source/web/jsp/actions/simple-workflow.jsp
@@ -30,7 +30,7 @@
-
+
@@ -53,7 +75,7 @@
-
+
diff --git a/source/web/jsp/content/add-content-dialog.jsp b/source/web/jsp/content/add-content-dialog.jsp
index 19621c0178..1a12b1d858 100644
--- a/source/web/jsp/content/add-content-dialog.jsp
+++ b/source/web/jsp/content/add-content-dialog.jsp
@@ -173,13 +173,10 @@ if (fileUploaded)
-
-
<%
if (fileUploaded)
{
@@ -181,11 +179,10 @@
<%
if (fileUploaded)
{
@@ -166,11 +165,10 @@
-
var finishButtonPressed = false;
- window.onload = pageLoaded;
+ addEventToElement(window, 'load', pageLoaded, false);
function pageLoaded()
{
document.getElementById("dialog:dialog-body:name").focus();
- document.getElementById("dialog").onsubmit = validate;
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
checkButtonState();
}
diff --git a/source/web/jsp/wcm/create-web-content-wizard/create-html.jsp b/source/web/jsp/wcm/create-web-content-wizard/create-html.jsp
index 60e5798f34..ce00124005 100644
--- a/source/web/jsp/wcm/create-web-content-wizard/create-html.jsp
+++ b/source/web/jsp/wcm/create-web-content-wizard/create-html.jsp
@@ -43,6 +43,8 @@
alfresco.constants.WEBAPP_CONTEXT = "${pageContext.request.contextPath}";
alfresco.constants.AVM_WEBAPP_URL = "${WizardManager.bean.previewSandboxUrl}";
+ alfresco.constants.AVM_WEBAPP_PREFIX = "${WizardManager.bean.avmWebappPrefix}";
+ alfresco.constants.AVM_WEBAPP_CONTEXT = "${WizardManager.bean.avmWebappName}";
alfresco.resources =
{
@@ -57,10 +59,13 @@
select: "${msg.select}",
upload: "${msg.upload}"
};
+
+ var lang = "${UserPreferencesBean.language}";
+ lang = lang.substring(0,lang.indexOf("_"));
tinyMCE.init({
theme : "advanced",
- language : "${pageContext.request.locale.language}",
+ language : lang,
mode : "exact",
elements : "editor",
save_callback : "saveContent",
@@ -78,6 +83,14 @@
function saveContent(id, content)
{
+ if (alfresco.constants.AVM_WEBAPP_CONTEXT == "ROOT")
+ {
+ content = content.replace(new RegExp(alfresco.constants.AVM_WEBAPP_URL, "g"), "");
+ }
+ else
+ {
+ content = content.replace(new RegExp(alfresco.constants.AVM_WEBAPP_PREFIX, "g"), "");
+ }
document.getElementById("wizard:wizard-body:editor-output").value = content;
return content;
}
diff --git a/source/web/jsp/wcm/create-web-content-wizard/details.jsp b/source/web/jsp/wcm/create-web-content-wizard/details.jsp
index 81efb8c037..e11a7b48e7 100644
--- a/source/web/jsp/wcm/create-web-content-wizard/details.jsp
+++ b/source/web/jsp/wcm/create-web-content-wizard/details.jsp
@@ -22,16 +22,14 @@
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
-
-
-
-
diff --git a/source/web/jsp/wcm/edit-permissions.jsp b/source/web/jsp/wcm/edit-permissions.jsp
index 49e0a5fb42..a4c89e6fe5 100644
--- a/source/web/jsp/wcm/edit-permissions.jsp
+++ b/source/web/jsp/wcm/edit-permissions.jsp
@@ -29,7 +29,7 @@
\ No newline at end of file
diff --git a/source/web/jsp/workflow/cancel-workflow-dialog.jsp b/source/web/jsp/workflow/cancel-workflow-dialog.jsp
index 6bf1dbc866..7b1f77f811 100644
--- a/source/web/jsp/workflow/cancel-workflow-dialog.jsp
+++ b/source/web/jsp/workflow/cancel-workflow-dialog.jsp
@@ -17,10 +17,6 @@
* along with Alfresco. If not, see .
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
-<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
diff --git a/source/web/jsp/workflow/manage-task-dialog.jsp b/source/web/jsp/workflow/manage-task-dialog.jsp
index 6a749daa63..ba20d4043a 100644
--- a/source/web/jsp/workflow/manage-task-dialog.jsp
+++ b/source/web/jsp/workflow/manage-task-dialog.jsp
@@ -125,7 +125,7 @@
-
+
diff --git a/source/web/jsp/workflow/reassign-task-dialog.jsp b/source/web/jsp/workflow/reassign-task-dialog.jsp
index e00f4cebcc..c6d17146ef 100644
--- a/source/web/jsp/workflow/reassign-task-dialog.jsp
+++ b/source/web/jsp/workflow/reassign-task-dialog.jsp
@@ -32,7 +32,11 @@
+ (end)
+
+ Returns:
+ email=bob@bob.com&zipCode=90210
+ */
+
+ toQueryString: function(){
+ var queryString = [];
+ this.getFormElements().each(function(el){
+ var name = el.name;
+ var value = el.getValue();
+ if (value === false || !name || el.disabled) return;
+ var qs = function(val){
+ queryString.push(name + '=' + encodeURIComponent(val));
+ };
+ if ($type(value) == 'array') value.each(qs);
+ else qs(value);
+ });
+ return queryString.join('&');
+ }
+
+});
+
+/*
+Script: Element.Dimensions.js
+ Contains Element prototypes to deal with Element size and position in space.
+
+Note:
+ The functions in this script require n XHTML doctype.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Element
+ Custom class to allow all of its methods to be used with any DOM element via the dollar function <$>.
+*/
+
+Element.extend({
+
+ /*
+ Property: scrollTo
+ Scrolls the element to the specified coordinated (if the element has an overflow)
+
+ Arguments:
+ x - the x coordinate
+ y - the y coordinate
+
+ Example:
+ >$('myElement').scrollTo(0, 100)
+ */
+
+ scrollTo: function(x, y){
+ this.scrollLeft = x;
+ this.scrollTop = y;
+ },
+
+ /*
+ Property: getSize
+ Return an Object representing the size/scroll values of the element.
+
+ Example:
+ (start code)
+ $('myElement').getSize();
+ (end)
+
+ Returns:
+ (start code)
+ {
+ 'scroll': {'x': 100, 'y': 100},
+ 'size': {'x': 200, 'y': 400},
+ 'scrollSize': {'x': 300, 'y': 500}
+ }
+ (end)
+ */
+
+ getSize: function(){
+ return {
+ 'scroll': {'x': this.scrollLeft, 'y': this.scrollTop},
+ 'size': {'x': this.offsetWidth, 'y': this.offsetHeight},
+ 'scrollSize': {'x': this.scrollWidth, 'y': this.scrollHeight}
+ };
+ },
+
+ /*
+ Property: getPosition
+ Returns the real offsets of the element.
+
+ Arguments:
+ overflown - optional, an array of nested scrolling containers for scroll offset calculation, use this if your element is inside any element containing scrollbars
+
+ Example:
+ >$('element').getPosition();
+
+ Returns:
+ >{x: 100, y:500};
+ */
+
+ getPosition: function(overflown){
+ overflown = overflown || [];
+ var el = this, left = 0, top = 0;
+ do {
+ left += el.offsetLeft || 0;
+ top += el.offsetTop || 0;
+ el = el.offsetParent;
+ } while (el);
+ overflown.each(function(element){
+ left -= element.scrollLeft || 0;
+ top -= element.scrollTop || 0;
+ });
+ return {'x': left, 'y': top};
+ },
+
+ /*
+ Property: getTop
+ Returns the distance from the top of the window to the Element.
+
+ Arguments:
+ overflown - optional, an array of nested scrolling containers, see Element::getPosition
+ */
+
+ getTop: function(overflown){
+ return this.getPosition(overflown).y;
+ },
+
+ /*
+ Property: getLeft
+ Returns the distance from the left of the window to the Element.
+
+ Arguments:
+ overflown - optional, an array of nested scrolling containers, see Element::getPosition
+ */
+
+ getLeft: function(overflown){
+ return this.getPosition(overflown).x;
+ },
+
+ /*
+ Property: getCoordinates
+ Returns an object with width, height, left, right, top, and bottom, representing the values of the Element
+
+ Arguments:
+ overflown - optional, an array of nested scrolling containers, see Element::getPosition
+
+ Example:
+ (start code)
+ var myValues = $('myElement').getCoordinates();
+ (end)
+
+ Returns:
+ (start code)
+ {
+ width: 200,
+ height: 300,
+ left: 100,
+ top: 50,
+ right: 300,
+ bottom: 350
+ }
+ (end)
+ */
+
+ getCoordinates: function(overflown){
+ var position = this.getPosition(overflown);
+ var obj = {
+ 'width': this.offsetWidth,
+ 'height': this.offsetHeight,
+ 'left': position.x,
+ 'top': position.y
+ };
+ obj.right = obj.left + obj.width;
+ obj.bottom = obj.top + obj.height;
+ return obj;
+ }
+
+});
+
+/*
+Script: Window.DomReady.js
+ Contains the custom event domready, for window.
+
+License:
+ MIT-style license.
+*/
+
+/* Section: Custom Events */
+
+/*
+Event: domready
+ executes a function when the dom tree is loaded, without waiting for images. Only works when called from window.
+
+Credits:
+ (c) Dean Edwards/Matthias Miller/John Resig, remastered for MooTools.
+
+Arguments:
+ fn - the function to execute when the DOM is ready
+
+Example:
+ > window.addEvent('domready', function(){
+ > alert('the dom is ready');
+ > });
+*/
+
+Element.Events.domready = {
+
+ add: function(fn){
+ if (window.loaded){
+ fn.call(this);
+ return;
+ }
+ var domReady = function(){
+ if (window.loaded) return;
+ window.loaded = true;
+ window.timer = $clear(window.timer);
+ this.fireEvent('domready');
+ }.bind(this);
+ if (document.readyState && window.webkit){
+ window.timer = function(){
+ if (['loaded','complete'].contains(document.readyState)) domReady();
+ }.periodical(50);
+ } else if (document.readyState && window.ie){
+ /** [Alfresco] Replaced; taken from mootools 1.2 */
+ var readyStateDone = false,
+ init = function() {
+ // only fire once
+ if (!readyStateDone) {
+ readyStateDone = true;
+ domReady();
+ }
+ };
+ // polling for no errors
+ (function() {
+ try {
+ // throws errors until after ondocumentready
+ document.documentElement.doScroll('left');
+ } catch (e) {
+ setTimeout(arguments.callee, 20);
+ return;
+ }
+ // no errors, ok to init
+ init();
+ })();
+ // trying to always fire before onload
+ document.onreadystatechange = function() {
+ if (document.readyState == 'complete') {
+ document.onreadystatechange = null;
+ init();
+ }
+ };
+ /** [/Alfresco] */
+ } else {
+ window.addListener("load", domReady);
+ document.addListener("DOMContentLoaded", domReady);
+ }
+ }
+
+};
+
+/*compatibility*/
+
+window.onDomReady = function(fn){
+ return this.addEvent('domready', fn);
+};
+
+/*end compatibility*/
+
+/*
+Script: Window.Size.js
+ Window cross-browser dimensions methods.
+
+Note:
+ The Functions in this script require an XHTML doctype.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: window
+ Cross browser methods to get various window dimensions.
+ Warning: All these methods require that the browser operates in strict mode, not quirks mode.
+*/
+
+window.extend({
+
+ /*
+ Property: getWidth
+ Returns an integer representing the width of the browser window (without the scrollbar).
+ */
+
+ getWidth: function(){
+ if (this.webkit419) return this.innerWidth;
+ if (this.opera) return document.body.clientWidth;
+ return document.documentElement.clientWidth;
+ },
+
+ /*
+ Property: getHeight
+ Returns an integer representing the height of the browser window (without the scrollbar).
+ */
+
+ getHeight: function(){
+ if (this.webkit419) return this.innerHeight;
+ if (this.opera) return document.body.clientHeight;
+ return document.documentElement.clientHeight;
+ },
+
+ /*
+ Property: getScrollWidth
+ Returns an integer representing the scrollWidth of the window.
+ This value is equal to or bigger than .
+
+ See Also:
+
+ */
+
+ getScrollWidth: function(){
+ if (this.ie) return Math.max(document.documentElement.offsetWidth, document.documentElement.scrollWidth);
+ if (this.webkit) return document.body.scrollWidth;
+ return document.documentElement.scrollWidth;
+ },
+
+ /*
+ Property: getScrollHeight
+ Returns an integer representing the scrollHeight of the window.
+ This value is equal to or bigger than .
+
+ See Also:
+
+ */
+
+ getScrollHeight: function(){
+ if (this.ie) return Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight);
+ if (this.webkit) return document.body.scrollHeight;
+ return document.documentElement.scrollHeight;
+ },
+
+ /*
+ Property: getScrollLeft
+ Returns an integer representing the scrollLeft of the window (the number of pixels the window has scrolled from the left).
+
+ See Also:
+
+ */
+
+ getScrollLeft: function(){
+ return this.pageXOffset || document.documentElement.scrollLeft;
+ },
+
+ /*
+ Property: getScrollTop
+ Returns an integer representing the scrollTop of the window (the number of pixels the window has scrolled from the top).
+
+ See Also:
+
+ */
+
+ getScrollTop: function(){
+ return this.pageYOffset || document.documentElement.scrollTop;
+ },
+
+ /*
+ Property: getSize
+ Same as
+ */
+
+ getSize: function(){
+ return {
+ 'size': {'x': this.getWidth(), 'y': this.getHeight()},
+ 'scrollSize': {'x': this.getScrollWidth(), 'y': this.getScrollHeight()},
+ 'scroll': {'x': this.getScrollLeft(), 'y': this.getScrollTop()}
+ };
+ },
+
+ //ignore
+ getPosition: function(){return {'x': 0, 'y': 0};}
+
+});
+
+/*
+Script: Fx.Base.js
+ Contains , the foundamentals of the MooTools Effects.
+
+License:
+ MIT-style license.
+*/
+
+var Fx = {};
+
+/*
+Class: Fx.Base
+ Base class for the Effects.
+
+Options:
+ transition - the equation to use for the effect see ; default is
+ duration - the duration of the effect in ms; 500 is the default.
+ unit - the unit is 'px' by default (other values include things like 'em' for fonts or '%').
+ wait - boolean: to wait or not to wait for a current transition to end before running another of the same instance. defaults to true.
+ fps - the frames per second for the transition; default is 50
+
+Events:
+ onStart - the function to execute as the effect begins; nothing () by default.
+ onComplete - the function to execute after the effect has processed; nothing () by default.
+ onCancel - the function to execute when you manually stop the effect.
+*/
+
+Fx.Base = new Class({
+
+ options: {
+ onStart: Class.empty,
+ onComplete: Class.empty,
+ onCancel: Class.empty,
+ transition: function(p){
+ return -(Math.cos(Math.PI * p) - 1) / 2;
+ },
+ duration: 500,
+ unit: 'px',
+ wait: true,
+ fps: 50
+ },
+
+ initialize: function(options){
+ this.element = this.element || null;
+ this.setOptions(options);
+ if (this.options.initialize) this.options.initialize.call(this);
+ },
+
+ step: function(){
+ var time = $time();
+ if (time < this.time + this.options.duration){
+ this.delta = this.options.transition((time - this.time) / this.options.duration);
+ this.setNow();
+ this.increase();
+ } else {
+ this.stop(true);
+ this.set(this.to);
+ this.fireEvent('onComplete', this.element, 10);
+ this.callChain();
+ }
+ },
+
+ /*
+ Property: set
+ Immediately sets the value with no transition.
+
+ Arguments:
+ to - the point to jump to
+
+ Example:
+ >var myFx = new Fx.Style('myElement', 'opacity').set(0); //will make it immediately transparent
+ */
+
+ set: function(to){
+ this.now = to;
+ this.increase();
+ return this;
+ },
+
+ setNow: function(){
+ this.now = this.compute(this.from, this.to);
+ },
+
+ compute: function(from, to){
+ return (to - from) * this.delta + from;
+ },
+
+ /*
+ Property: start
+ Executes an effect from one position to the other.
+
+ Arguments:
+ from - integer: staring value
+ to - integer: the ending value
+
+ Examples:
+ >var myFx = new Fx.Style('myElement', 'opacity').start(0,1); //display a transition from transparent to opaque.
+ */
+
+ start: function(from, to){
+ if (!this.options.wait) this.stop();
+ else if (this.timer) return this;
+ this.from = from;
+ this.to = to;
+ this.change = this.to - this.from;
+ this.time = $time();
+ this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this);
+ this.fireEvent('onStart', this.element);
+ return this;
+ },
+
+ /*
+ Property: stop
+ Stops the transition.
+ */
+
+ stop: function(end){
+ if (!this.timer) return this;
+ this.timer = $clear(this.timer);
+ if (!end) this.fireEvent('onCancel', this.element);
+ return this;
+ }/*compatibility*/,
+
+ custom: function(from, to){
+ return this.start(from, to);
+ },
+
+ clearTimer: function(end){
+ return this.stop(end);
+ }
+
+ /*end compatibility*/
+
+});
+
+Fx.Base.implement(new Chain, new Events, new Options);
+
+/*
+Script: Fx.CSS.js
+ Css parsing class for effects. Required by , , . No documentation needed, as its used internally.
+
+License:
+ MIT-style license.
+*/
+
+Fx.CSS = {
+
+ select: function(property, to){
+ if (property.test(/color/i)) return this.Color;
+ var type = $type(to);
+ if ((type == 'array') || (type == 'string' && to.contains(' '))) return this.Multi;
+ return this.Single;
+ },
+
+ parse: function(el, property, fromTo){
+ if (!fromTo.push) fromTo = [fromTo];
+ var from = fromTo[0], to = fromTo[1];
+ if (!$chk(to)){
+ to = from;
+ from = el.getStyle(property);
+ }
+ var css = this.select(property, to);
+ return {'from': css.parse(from), 'to': css.parse(to), 'css': css};
+ }
+
+};
+
+Fx.CSS.Single = {
+
+ parse: function(value){
+ return parseFloat(value);
+ },
+
+ getNow: function(from, to, fx){
+ return fx.compute(from, to);
+ },
+
+ getValue: function(value, unit, property){
+ if (unit == 'px' && property != 'opacity') value = Math.round(value);
+ return value + unit;
+ }
+
+};
+
+Fx.CSS.Multi = {
+
+ parse: function(value){
+ return value.push ? value : value.split(' ').map(function(v){
+ return parseFloat(v);
+ });
+ },
+
+ getNow: function(from, to, fx){
+ var now = [];
+ for (var i = 0; i < from.length; i++) now[i] = fx.compute(from[i], to[i]);
+ return now;
+ },
+
+ getValue: function(value, unit, property){
+ if (unit == 'px' && property != 'opacity') value = value.map(Math.round);
+ return value.join(unit + ' ') + unit;
+ }
+
+};
+
+Fx.CSS.Color = {
+
+ parse: function(value){
+ return value.push ? value : value.hexToRgb(true);
+ },
+
+ getNow: function(from, to, fx){
+ var now = [];
+ for (var i = 0; i < from.length; i++) now[i] = Math.round(fx.compute(from[i], to[i]));
+ return now;
+ },
+
+ getValue: function(value){
+ return 'rgb(' + value.join(',') + ')';
+ }
+
+};
+
+/*
+Script: Fx.Style.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Fx.Style
+ The Style effect, used to transition any css property from one value to another. Includes colors.
+ Colors must be in hex format.
+ Inherits methods, properties, options and events from .
+
+Arguments:
+ el - the $(element) to apply the style transition to
+ property - the property to transition
+ options - the Fx.Base options (see: )
+
+Example:
+ >var marginChange = new Fx.Style('myElement', 'margin-top', {duration:500});
+ >marginChange.start(10, 100);
+*/
+
+Fx.Style = Fx.Base.extend({
+
+ initialize: function(el, property, options){
+ this.element = $(el);
+ this.property = property;
+ this.parent(options);
+ },
+
+ /*
+ Property: hide
+ Same as (0); hides the element immediately without transition.
+ */
+
+ hide: function(){
+ return this.set(0);
+ },
+
+ setNow: function(){
+ this.now = this.css.getNow(this.from, this.to, this);
+ },
+
+ /*
+ Property: set
+ Sets the element's css property (specified at instantiation) to the specified value immediately.
+
+ Example:
+ (start code)
+ var marginChange = new Fx.Style('myElement', 'margin-top', {duration:500});
+ marginChange.set(10); //margin-top is set to 10px immediately
+ (end)
+ */
+
+ set: function(to){
+ this.css = Fx.CSS.select(this.property, to);
+ return this.parent(this.css.parse(to));
+ },
+
+ /*
+ Property: start
+ Displays the transition to the value/values passed in
+
+ Arguments:
+ from - (integer; optional) the starting position for the transition
+ to - (integer) the ending position for the transition
+
+ Note:
+ If you provide only one argument, the transition will use the current css value for its starting value.
+
+ Example:
+ (start code)
+ var marginChange = new Fx.Style('myElement', 'margin-top', {duration:500});
+ marginChange.start(10); //tries to read current margin top value and goes from current to 10
+ (end)
+ */
+
+ start: function(from, to){
+ if (this.timer && this.options.wait) return this;
+ var parsed = Fx.CSS.parse(this.element, this.property, [from, to]);
+ this.css = parsed.css;
+ return this.parent(parsed.from, parsed.to);
+ },
+
+ increase: function(){
+ this.element.setStyle(this.property, this.css.getValue(this.now, this.options.unit, this.property));
+ }
+
+});
+
+/*
+Class: Element
+ Custom class to allow all of its methods to be used with any DOM element via the dollar function <$>.
+*/
+
+Element.extend({
+
+ /*
+ Property: effect
+ Applies an to the Element; This a shortcut for .
+
+ Arguments:
+ property - (string) the css property to alter
+ options - (object; optional) key/value set of options (see )
+
+ Example:
+ >var myEffect = $('myElement').effect('height', {duration: 1000, transition: Fx.Transitions.linear});
+ >myEffect.start(10, 100);
+ >//OR
+ >$('myElement').effect('height', {duration: 1000, transition: Fx.Transitions.linear}).start(10,100);
+ */
+
+ effect: function(property, options){
+ return new Fx.Style(this, property, options);
+ }
+
+});
+
+/*
+Script: Fx.Styles.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Fx.Styles
+ Allows you to animate multiple css properties at once;
+ Colors must be in hex format.
+ Inherits methods, properties, options and events from .
+
+Arguments:
+ el - the $(element) to apply the styles transition to
+ options - the fx options (see: )
+
+Example:
+ (start code)
+ var myEffects = new Fx.Styles('myElement', {duration: 1000, transition: Fx.Transitions.linear});
+
+ //height from 10 to 100 and width from 900 to 300
+ myEffects.start({
+ 'height': [10, 100],
+ 'width': [900, 300]
+ });
+
+ //or height from current height to 100 and width from current width to 300
+ myEffects.start({
+ 'height': 100,
+ 'width': 300
+ });
+ (end)
+*/
+
+Fx.Styles = Fx.Base.extend({
+
+ initialize: function(el, options){
+ this.element = $(el);
+ this.parent(options);
+ },
+
+ setNow: function(){
+ for (var p in this.from) this.now[p] = this.css[p].getNow(this.from[p], this.to[p], this);
+ },
+
+ set: function(to){
+ var parsed = {};
+ this.css = {};
+ for (var p in to){
+ this.css[p] = Fx.CSS.select(p, to[p]);
+ parsed[p] = this.css[p].parse(to[p]);
+ }
+ return this.parent(parsed);
+ },
+
+ /*
+ Property: start
+ Executes a transition for any number of css properties in tandem.
+
+ Arguments:
+ obj - an object containing keys that specify css properties to alter and values that specify either the from/to values (as an array) or just the end value (an integer).
+
+ Example:
+ see
+ */
+
+ start: function(obj){
+ if (this.timer && this.options.wait) return this;
+ this.now = {};
+ this.css = {};
+ var from = {}, to = {};
+ for (var p in obj){
+ var parsed = Fx.CSS.parse(this.element, p, obj[p]);
+ from[p] = parsed.from;
+ to[p] = parsed.to;
+ this.css[p] = parsed.css;
+ }
+ return this.parent(from, to);
+ },
+
+ increase: function(){
+ for (var p in this.now) this.element.setStyle(p, this.css[p].getValue(this.now[p], this.options.unit, p));
+ }
+
+});
+
+/*
+Class: Element
+ Custom class to allow all of its methods to be used with any DOM element via the dollar function <$>.
+*/
+
+Element.extend({
+
+ /*
+ Property: effects
+ Applies an to the Element; This a shortcut for .
+
+ Example:
+ >var myEffects = $(myElement).effects({duration: 1000, transition: Fx.Transitions.Sine.easeInOut});
+ >myEffects.start({'height': [10, 100], 'width': [900, 300]});
+ */
+
+ effects: function(options){
+ return new Fx.Styles(this, options);
+ }
+
+});
+
+/*
+Script: Fx.Elements.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Fx.Elements
+ Fx.Elements allows you to apply any number of styles transitions to a selection of elements. Includes colors (must be in hex format).
+ Inherits methods, properties, options and events from .
+
+Arguments:
+ elements - a collection of elements the effects will be applied to.
+ options - same as options.
+*/
+
+Fx.Elements = Fx.Base.extend({
+
+ initialize: function(elements, options){
+ this.elements = $$(elements);
+ this.parent(options);
+ },
+
+ setNow: function(){
+ for (var i in this.from){
+ var iFrom = this.from[i], iTo = this.to[i], iCss = this.css[i], iNow = this.now[i] = {};
+ for (var p in iFrom) iNow[p] = iCss[p].getNow(iFrom[p], iTo[p], this);
+ }
+ },
+
+ set: function(to){
+ var parsed = {};
+ this.css = {};
+ for (var i in to){
+ var iTo = to[i], iCss = this.css[i] = {}, iParsed = parsed[i] = {};
+ for (var p in iTo){
+ iCss[p] = Fx.CSS.select(p, iTo[p]);
+ iParsed[p] = iCss[p].parse(iTo[p]);
+ }
+ }
+ return this.parent(parsed);
+ },
+
+ /*
+ Property: start
+ Applies the passed in style transitions to each object named (see example). Each item in the collection is refered to as a numerical string ("1" for instance). The first item is "0", the second "1", etc.
+
+ Example:
+ (start code)
+ var myElementsEffects = new Fx.Elements($$('a'));
+ myElementsEffects.start({
+ '0': { //let's change the first element's opacity and width
+ 'opacity': [0,1],
+ 'width': [100,200]
+ },
+ '4': { //and the fifth one's opacity
+ 'opacity': [0.2, 0.5]
+ }
+ });
+ (end)
+ */
+
+ start: function(obj){
+ if (this.timer && this.options.wait) return this;
+ this.now = {};
+ this.css = {};
+ var from = {}, to = {};
+ for (var i in obj){
+ var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {}, iCss = this.css[i] = {};
+ for (var p in iProps){
+ var parsed = Fx.CSS.parse(this.elements[i], p, iProps[p]);
+ iFrom[p] = parsed.from;
+ iTo[p] = parsed.to;
+ iCss[p] = parsed.css;
+ }
+ }
+ return this.parent(from, to);
+ },
+
+ increase: function(){
+ for (var i in this.now){
+ var iNow = this.now[i], iCss = this.css[i];
+ for (var p in iNow) this.elements[i].setStyle(p, iCss[p].getValue(iNow[p], this.options.unit, p));
+ }
+ }
+
+});
+
+/*
+Script: Fx.Scroll.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Fx.Scroll
+ Scroll any element with an overflow, including the window element.
+ Inherits methods, properties, options and events from .
+
+Note:
+ Fx.Scroll requires an XHTML doctype.
+
+Arguments:
+ element - the element to scroll
+ options - optional, see Options below.
+
+Options:
+ all the Fx.Base options and events, plus:
+ offset - the distance for the scrollTo point/element. an Object with x/y properties.
+ overflown - an array of nested scrolling containers, see
+*/
+
+Fx.Scroll = Fx.Base.extend({
+
+ options: {
+ overflown: [],
+ offset: {'x': 0, 'y': 0},
+ wheelStops: true
+ },
+
+ initialize: function(element, options){
+ this.now = [];
+ this.element = $(element);
+ this.bound = {'stop': this.stop.bind(this, false)};
+ this.parent(options);
+ if (this.options.wheelStops){
+ this.addEvent('onStart', function(){
+ document.addEvent('mousewheel', this.bound.stop);
+ }.bind(this));
+ this.addEvent('onComplete', function(){
+ document.removeEvent('mousewheel', this.bound.stop);
+ }.bind(this));
+ }
+ },
+
+ setNow: function(){
+ for (var i = 0; i < 2; i++) this.now[i] = this.compute(this.from[i], this.to[i]);
+ },
+
+ /*
+ Property: scrollTo
+ Scrolls the chosen element to the x/y coordinates.
+
+ Arguments:
+ x - the x coordinate to scroll the element to
+ y - the y coordinate to scroll the element to
+ */
+
+ scrollTo: function(x, y){
+ if (this.timer && this.options.wait) return this;
+ var el = this.element.getSize();
+ var values = {'x': x, 'y': y};
+ for (var z in el.size){
+ var max = el.scrollSize[z] - el.size[z];
+ if ($chk(values[z])) values[z] = ($type(values[z]) == 'number') ? values[z].limit(0, max) : max;
+ else values[z] = el.scroll[z];
+ values[z] += this.options.offset[z];
+ }
+ return this.start([el.scroll.x, el.scroll.y], [values.x, values.y]);
+ },
+
+ /*
+ Property: toTop
+ Scrolls the chosen element to its maximum top.
+ */
+
+ toTop: function(){
+ return this.scrollTo(false, 0);
+ },
+
+ /*
+ Property: toBottom
+ Scrolls the chosen element to its maximum bottom.
+ */
+
+ toBottom: function(){
+ return this.scrollTo(false, 'full');
+ },
+
+ /*
+ Property: toLeft
+ Scrolls the chosen element to its maximum left.
+ */
+
+ toLeft: function(){
+ return this.scrollTo(0, false);
+ },
+
+ /*
+ Property: toRight
+ Scrolls the chosen element to its maximum right.
+ */
+
+ toRight: function(){
+ return this.scrollTo('full', false);
+ },
+
+ /*
+ Property: toElement
+ Scrolls the specified element to the position the passed in element is found.
+
+ Arguments:
+ el - the $(element) to scroll the window to
+ */
+
+ toElement: function(el){
+ var parent = this.element.getPosition(this.options.overflown);
+ var target = $(el).getPosition(this.options.overflown);
+ return this.scrollTo(target.x - parent.x, target.y - parent.y);
+ },
+
+ increase: function(){
+ this.element.scrollTo(this.now[0], this.now[1]);
+ }
+
+});
+
+/*
+Script: Fx.Slide.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Fx.Slide
+ The slide effect; slides an element in horizontally or vertically, the contents will fold inside.
+ Inherits methods, properties, options and events from .
+
+Note:
+ Fx.Slide requires an XHTML doctype.
+
+Options:
+ mode - set it to vertical or horizontal. Defaults to vertical.
+ options - all the options
+
+Example:
+ (start code)
+ var mySlider = new Fx.Slide('myElement', {duration: 500});
+ mySlider.toggle() //toggle the slider up and down.
+ (end)
+*/
+
+Fx.Slide = Fx.Base.extend({
+
+ options: {
+ mode: 'vertical'
+ },
+
+ initialize: function(el, options){
+ this.element = $(el);
+ this.wrapper = new Element('div', {'styles': $extend(this.element.getStyles('margin'), {'overflow': 'hidden'})}).injectAfter(this.element).adopt(this.element);
+ this.element.setStyle('margin', 0);
+ this.setOptions(options);
+ this.now = [];
+ this.parent(this.options);
+ this.open = true;
+ this.addEvent('onComplete', function(){
+ this.open = (this.now[0] === 0);
+ });
+ if (window.webkit419) this.addEvent('onComplete', function(){
+ if (this.open) this.element.remove().inject(this.wrapper);
+ });
+ },
+
+ setNow: function(){
+ for (var i = 0; i < 2; i++) this.now[i] = this.compute(this.from[i], this.to[i]);
+ },
+
+ vertical: function(){
+ this.margin = 'margin-top';
+ this.layout = 'height';
+ this.offset = this.element.offsetHeight;
+ },
+
+ horizontal: function(){
+ this.margin = 'margin-left';
+ this.layout = 'width';
+ this.offset = this.element.offsetWidth;
+ },
+
+ /*
+ Property: slideIn
+ Slides the elements in view horizontally or vertically.
+
+ Arguments:
+ mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
+ */
+
+ slideIn: function(mode){
+ this[mode || this.options.mode]();
+ return this.start([this.element.getStyle(this.margin).toInt(), this.wrapper.getStyle(this.layout).toInt()], [0, this.offset]);
+ },
+
+ /*
+ Property: slideOut
+ Sides the elements out of view horizontally or vertically.
+
+ Arguments:
+ mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
+ */
+
+ slideOut: function(mode){
+ this[mode || this.options.mode]();
+ return this.start([this.element.getStyle(this.margin).toInt(), this.wrapper.getStyle(this.layout).toInt()], [-this.offset, 0]);
+ },
+
+ /*
+ Property: hide
+ Hides the element without a transition.
+
+ Arguments:
+ mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
+ */
+
+ hide: function(mode){
+ this[mode || this.options.mode]();
+ this.open = false;
+ return this.set([-this.offset, 0]);
+ },
+
+ /*
+ Property: show
+ Shows the element without a transition.
+
+ Arguments:
+ mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
+ */
+
+ show: function(mode){
+ this[mode || this.options.mode]();
+ this.open = true;
+ return this.set([0, this.offset]);
+ },
+
+ /*
+ Property: toggle
+ Slides in or Out the element, depending on its state
+
+ Arguments:
+ mode - (optional, string) 'horizontal' or 'vertical'; defaults to options.mode.
+
+ */
+
+ toggle: function(mode){
+ if (this.wrapper.offsetHeight == 0 || this.wrapper.offsetWidth == 0) return this.slideIn(mode);
+ return this.slideOut(mode);
+ },
+
+ increase: function(){
+ this.element.setStyle(this.margin, this.now[0] + this.options.unit);
+ this.wrapper.setStyle(this.layout, this.now[1] + this.options.unit);
+ }
+
+});
+
+/*
+Script: Fx.Transitions.js
+ Effects transitions, to be used with all the effects.
+
+License:
+ MIT-style license.
+
+Credits:
+ Easing Equations by Robert Penner, , modified & optimized to be used with mootools.
+*/
+
+/*
+Class: Fx.Transitions
+ A collection of tweening transitions for use with the classes.
+
+Example:
+ >//Elastic.easeOut with default values:
+ >new Fx.Style('margin', {transition: Fx.Transitions.Elastic.easeOut});
+ >//Elastic.easeOut with user-defined value for elasticity.
+ > var myTransition = new Fx.Transition(Fx.Transitions.Elastic, 3);
+ >new Fx.Style('margin', {transition: myTransition.easeOut});
+
+See also:
+ http://www.robertpenner.com/easing/
+*/
+
+Fx.Transition = function(transition, params){
+ params = params || [];
+ if ($type(params) != 'array') params = [params];
+ return $extend(transition, {
+ easeIn: function(pos){
+ return transition(pos, params);
+ },
+ easeOut: function(pos){
+ return 1 - transition(1 - pos, params);
+ },
+ easeInOut: function(pos){
+ return (pos <= 0.5) ? transition(2 * pos, params) / 2 : (2 - transition(2 * (1 - pos), params)) / 2;
+ }
+ });
+};
+
+Fx.Transitions = new Abstract({
+
+ /*
+ Property: linear
+ displays a linear transition.
+
+ Graph:
+ (see Linear.png)
+ */
+
+ linear: function(p){
+ return p;
+ }
+
+});
+
+Fx.Transitions.extend = function(transitions){
+ for (var transition in transitions){
+ Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
+ /*compatibility*/
+ Fx.Transitions.compat(transition);
+ /*end compatibility*/
+ }
+};
+
+/*compatibility*/
+
+Fx.Transitions.compat = function(transition){
+ ['In', 'Out', 'InOut'].each(function(easeType){
+ Fx.Transitions[transition.toLowerCase() + easeType] = Fx.Transitions[transition]['ease' + easeType];
+ });
+};
+
+/*end compatibility*/
+
+Fx.Transitions.extend({
+
+ /*
+ Property: Quad
+ displays a quadratic transition. Must be used as Quad.easeIn or Quad.easeOut or Quad.easeInOut
+
+ Graph:
+ (see Quad.png)
+ */
+
+ //auto generated
+
+ /*
+ Property: Cubic
+ displays a cubicular transition. Must be used as Cubic.easeIn or Cubic.easeOut or Cubic.easeInOut
+
+ Graph:
+ (see Cubic.png)
+ */
+
+ //auto generated
+
+ /*
+ Property: Quart
+ displays a quartetic transition. Must be used as Quart.easeIn or Quart.easeOut or Quart.easeInOut
+
+ Graph:
+ (see Quart.png)
+ */
+
+ //auto generated
+
+ /*
+ Property: Quint
+ displays a quintic transition. Must be used as Quint.easeIn or Quint.easeOut or Quint.easeInOut
+
+ Graph:
+ (see Quint.png)
+ */
+
+ //auto generated
+
+ /*
+ Property: Pow
+ Used to generate Quad, Cubic, Quart and Quint.
+ By default is p^6.
+
+ Graph:
+ (see Pow.png)
+ */
+
+ Pow: function(p, x){
+ return Math.pow(p, x[0] || 6);
+ },
+
+ /*
+ Property: Expo
+ displays a exponential transition. Must be used as Expo.easeIn or Expo.easeOut or Expo.easeInOut
+
+ Graph:
+ (see Expo.png)
+ */
+
+ Expo: function(p){
+ return Math.pow(2, 8 * (p - 1));
+ },
+
+ /*
+ Property: Circ
+ displays a circular transition. Must be used as Circ.easeIn or Circ.easeOut or Circ.easeInOut
+
+ Graph:
+ (see Circ.png)
+ */
+
+ Circ: function(p){
+ return 1 - Math.sin(Math.acos(p));
+ },
+
+
+ /*
+ Property: Sine
+ displays a sineousidal transition. Must be used as Sine.easeIn or Sine.easeOut or Sine.easeInOut
+
+ Graph:
+ (see Sine.png)
+ */
+
+ Sine: function(p){
+ return 1 - Math.sin((1 - p) * Math.PI / 2);
+ },
+
+ /*
+ Property: Back
+ makes the transition go back, then all forth. Must be used as Back.easeIn or Back.easeOut or Back.easeInOut
+
+ Graph:
+ (see Back.png)
+ */
+
+ Back: function(p, x){
+ x = x[0] || 1.618;
+ return Math.pow(p, 2) * ((x + 1) * p - x);
+ },
+
+ /*
+ Property: Bounce
+ makes the transition bouncy. Must be used as Bounce.easeIn or Bounce.easeOut or Bounce.easeInOut
+
+ Graph:
+ (see Bounce.png)
+ */
+
+ Bounce: function(p){
+ var value;
+ for (var a = 0, b = 1; 1; a += b, b /= 2){
+ if (p >= (7 - 4 * a) / 11){
+ value = - Math.pow((11 - 6 * a - 11 * p) / 4, 2) + b * b;
+ break;
+ }
+ }
+ return value;
+ },
+
+ /*
+ Property: Elastic
+ Elastic curve. Must be used as Elastic.easeIn or Elastic.easeOut or Elastic.easeInOut
+
+ Graph:
+ (see Elastic.png)
+ */
+
+ Elastic: function(p, x){
+ return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x[0] || 1) / 3);
+ }
+
+});
+
+['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
+ Fx.Transitions[transition] = new Fx.Transition(function(p){
+ return Math.pow(p, [i + 2]);
+ });
+
+ /*compatibility*/
+ Fx.Transitions.compat(transition);
+ /*end compatibility*/
+});
+
+/*
+Script: Drag.Base.js
+ Contains ,
+
+License:
+ MIT-style license.
+*/
+
+var Drag = {};
+
+/*
+Class: Drag.Base
+ Modify two css properties of an element based on the position of the mouse.
+
+Note:
+ Drag.Base requires an XHTML doctype.
+
+Arguments:
+ el - the $(element) to apply the transformations to.
+ options - optional. The options object.
+
+Options:
+ handle - the $(element) to act as the handle for the draggable element. defaults to the $(element) itself.
+ modifiers - an object. see Modifiers Below.
+ limit - an object, see Limit below.
+ grid - optional, distance in px for snap-to-grid dragging
+ snap - optional, the distance you have to drag before the element starts to respond to the drag. defaults to false
+
+ modifiers:
+ x - string, the style you want to modify when the mouse moves in an horizontal direction. defaults to 'left'
+ y - string, the style you want to modify when the mouse moves in a vertical direction. defaults to 'top'
+
+ limit:
+ x - array with start and end limit relative to modifiers.x
+ y - array with start and end limit relative to modifiers.y
+
+Events:
+ onStart - optional, function to execute when the user starts to drag (on mousedown);
+ onComplete - optional, function to execute when the user completes the drag.
+ onDrag - optional, function to execute at every step of the drag
+*/
+
+Drag.Base = new Class({
+
+ options: {
+ handle: false,
+ unit: 'px',
+ onStart: Class.empty,
+ onBeforeStart: Class.empty,
+ onComplete: Class.empty,
+ onSnap: Class.empty,
+ onDrag: Class.empty,
+ limit: false,
+ modifiers: {x: 'left', y: 'top'},
+ grid: false,
+ snap: 6
+ },
+
+ initialize: function(el, options){
+ this.setOptions(options);
+ this.element = $(el);
+ this.handle = $(this.options.handle) || this.element;
+ this.mouse = {'now': {}, 'pos': {}};
+ this.value = {'start': {}, 'now': {}};
+ this.bound = {
+ 'start': this.start.bindWithEvent(this),
+ 'check': this.check.bindWithEvent(this),
+ 'drag': this.drag.bindWithEvent(this),
+ 'stop': this.stop.bind(this)
+ };
+ this.attach();
+ if (this.options.initialize) this.options.initialize.call(this);
+ },
+
+ attach: function(){
+ this.handle.addEvent('mousedown', this.bound.start);
+ return this;
+ },
+
+ detach: function(){
+ this.handle.removeEvent('mousedown', this.bound.start);
+ return this;
+ },
+
+ start: function(event){
+ this.fireEvent('onBeforeStart', this.element);
+ this.mouse.start = event.page;
+ var limit = this.options.limit;
+ this.limit = {'x': [], 'y': []};
+ for (var z in this.options.modifiers){
+ if (!this.options.modifiers[z]) continue;
+ this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt();
+ this.mouse.pos[z] = event.page[z] - this.value.now[z];
+ if (limit && limit[z]){
+ for (var i = 0; i < 2; i++){
+ if ($chk(limit[z][i])) this.limit[z][i] = ($type(limit[z][i]) == 'function') ? limit[z][i]() : limit[z][i];
+ }
+ }
+ }
+ if ($type(this.options.grid) == 'number') this.options.grid = {'x': this.options.grid, 'y': this.options.grid};
+ document.addListener('mousemove', this.bound.check);
+ document.addListener('mouseup', this.bound.stop);
+ this.fireEvent('onStart', this.element);
+ event.stop();
+ },
+
+ check: function(event){
+ var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2)));
+ if (distance > this.options.snap){
+ document.removeListener('mousemove', this.bound.check);
+ document.addListener('mousemove', this.bound.drag);
+ this.drag(event);
+ this.fireEvent('onSnap', this.element);
+ }
+ event.stop();
+ },
+
+ drag: function(event){
+ this.out = false;
+ this.mouse.now = event.page;
+ for (var z in this.options.modifiers){
+ if (!this.options.modifiers[z]) continue;
+ this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
+ if (this.limit[z]){
+ if ($chk(this.limit[z][1]) && (this.value.now[z] > this.limit[z][1])){
+ this.value.now[z] = this.limit[z][1];
+ this.out = true;
+ } else if ($chk(this.limit[z][0]) && (this.value.now[z] < this.limit[z][0])){
+ this.value.now[z] = this.limit[z][0];
+ this.out = true;
+ }
+ }
+ if (this.options.grid[z]) this.value.now[z] -= (this.value.now[z] % this.options.grid[z]);
+ this.element.setStyle(this.options.modifiers[z], this.value.now[z] + this.options.unit);
+ }
+ this.fireEvent('onDrag', this.element);
+ event.stop();
+ },
+
+ stop: function(){
+ document.removeListener('mousemove', this.bound.check);
+ document.removeListener('mousemove', this.bound.drag);
+ document.removeListener('mouseup', this.bound.stop);
+ this.fireEvent('onComplete', this.element);
+ }
+
+});
+
+Drag.Base.implement(new Events, new Options);
+
+/*
+Class: Element
+ Custom class to allow all of its methods to be used with any DOM element via the dollar function <$>.
+*/
+
+Element.extend({
+
+ /*
+ Property: makeResizable
+ Makes an element resizable (by dragging) with the supplied options.
+
+ Arguments:
+ options - see for acceptable options.
+ */
+
+ makeResizable: function(options){
+ return new Drag.Base(this, $merge({modifiers: {x: 'width', y: 'height'}}, options));
+ }
+
+});
+
+/*
+Script: Drag.Move.js
+ Contains ,
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Drag.Move
+ Extends , has additional functionality for dragging an element, support snapping and droppables.
+ Drag.move supports either position absolute or relative. If no position is found, absolute will be set.
+ Inherits methods, properties, options and events from .
+
+Note:
+ Drag.Move requires an XHTML doctype.
+
+Arguments:
+ el - the $(element) to apply the drag to.
+ options - optional. see Options below.
+
+Options:
+ all the drag.Base options, plus:
+ container - an element, will fill automatically limiting options based on the $(element) size and position. defaults to false (no limiting)
+ droppables - an array of elements you can drop your draggable to.
+ overflown - an array of nested scrolling containers, see Element::getPosition
+*/
+
+Drag.Move = Drag.Base.extend({
+
+ options: {
+ droppables: [],
+ container: false,
+ overflown: []
+ },
+
+ initialize: function(el, options){
+ this.setOptions(options);
+ this.element = $(el);
+ this.droppables = $$(this.options.droppables);
+ this.container = $(this.options.container);
+ this.position = {'element': this.element.getStyle('position'), 'container': false};
+ if (this.container) this.position.container = this.container.getStyle('position');
+ if (!['relative', 'absolute', 'fixed'].contains(this.position.element)) this.position.element = 'absolute';
+ var top = this.element.getStyle('top').toInt();
+ var left = this.element.getStyle('left').toInt();
+ if (this.position.element == 'absolute' && !['relative', 'absolute', 'fixed'].contains(this.position.container)){
+ top = $chk(top) ? top : this.element.getTop(this.options.overflown);
+ left = $chk(left) ? left : this.element.getLeft(this.options.overflown);
+ } else {
+ top = $chk(top) ? top : 0;
+ left = $chk(left) ? left : 0;
+ }
+ this.element.setStyles({'top': top, 'left': left, 'position': this.position.element});
+ this.parent(this.element);
+ },
+
+ start: function(event){
+ this.overed = null;
+ if (this.container){
+ var cont = this.container.getCoordinates();
+ var el = this.element.getCoordinates();
+ if (this.position.element == 'absolute' && !['relative', 'absolute', 'fixed'].contains(this.position.container)){
+ this.options.limit = {
+ 'x': [cont.left, cont.right - el.width],
+ 'y': [cont.top, cont.bottom - el.height]
+ };
+ } else {
+ this.options.limit = {
+ 'y': [0, cont.height - el.height],
+ 'x': [0, cont.width - el.width]
+ };
+ }
+ }
+ this.parent(event);
+ },
+
+ drag: function(event){
+ this.parent(event);
+ var overed = this.out ? false : this.droppables.filter(this.checkAgainst, this).getLast();
+ if (this.overed != overed){
+ if (this.overed) this.overed.fireEvent('leave', [this.element, this]);
+ this.overed = overed ? overed.fireEvent('over', [this.element, this]) : null;
+ }
+ return this;
+ },
+
+ checkAgainst: function(el){
+ el = el.getCoordinates(this.options.overflown);
+ var now = this.mouse.now;
+ return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
+ },
+
+ stop: function(){
+ if (this.overed && !this.out) this.overed.fireEvent('drop', [this.element, this]);
+ else this.element.fireEvent('emptydrop', this);
+ this.parent();
+ return this;
+ }
+
+});
+
+/*
+Class: Element
+ Custom class to allow all of its methods to be used with any DOM element via the dollar function <$>.
+*/
+
+Element.extend({
+
+ /*
+ Property: makeDraggable
+ Makes an element draggable with the supplied options.
+
+ Arguments:
+ options - see and for acceptable options.
+ */
+
+ makeDraggable: function(options){
+ return new Drag.Move(this, options);
+ }
+
+});
+
+/*
+Script: XHR.js
+ Contains the basic XMLHttpRequest Class Wrapper.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: XHR
+ Basic XMLHttpRequest Wrapper.
+
+Arguments:
+ options - an object with options names as keys. See options below.
+
+Options:
+ method - 'post' or 'get' - the protocol for the request; optional, defaults to 'post'.
+ async - boolean: asynchronous option; true uses asynchronous requests. Defaults to true.
+ encoding - the encoding, defaults to utf-8.
+ autoCancel - cancels the already running request if another one is sent. defaults to false.
+ headers - accepts an object, that will be set to request headers.
+
+Events:
+ onRequest - function to execute when the XHR request is fired.
+ onSuccess - function to execute when the XHR request completes.
+ onStateChange - function to execute when the state of the XMLHttpRequest changes.
+ onFailure - function to execute when the state of the XMLHttpRequest changes.
+
+Properties:
+ running - true if the request is running.
+ response - object, text and xml as keys. You can access this property in the onSuccess event.
+
+Example:
+ >var myXHR = new XHR({method: 'get'}).send('http://site.com/requestHandler.php', 'name=john&lastname=dorian');
+*/
+
+var XHR = new Class({
+
+ options: {
+ method: 'post',
+ async: true,
+ onRequest: Class.empty,
+ onSuccess: Class.empty,
+ onFailure: Class.empty,
+ urlEncoded: true,
+ encoding: 'utf-8',
+ autoCancel: false,
+ headers: {}
+ },
+
+ setTransport: function(){
+ this.transport = (window.XMLHttpRequest) ? new XMLHttpRequest() : (window.ie ? new ActiveXObject('Microsoft.XMLHTTP') : false);
+ return this;
+ },
+
+ initialize: function(options){
+ this.setTransport().setOptions(options);
+ this.options.isSuccess = this.options.isSuccess || this.isSuccess;
+ this.headers = {};
+ if (this.options.urlEncoded && this.options.method == 'post'){
+ var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
+ this.setHeader('Content-type', 'application/x-www-form-urlencoded' + encoding);
+ }
+ if (this.options.initialize) this.options.initialize.call(this);
+ },
+
+ onStateChange: function(){
+ if (this.transport.readyState != 4 || !this.running) return;
+ this.running = false;
+ var status = 0;
+ try {status = this.transport.status;} catch(e){};
+ if (this.options.isSuccess.call(this, status)) this.onSuccess();
+ else this.onFailure();
+ this.transport.onreadystatechange = Class.empty;
+ },
+
+ isSuccess: function(status){
+ return ((status >= 200) && (status < 300));
+ },
+
+ onSuccess: function(){
+ this.response = {
+ 'text': this.transport.responseText,
+ 'xml': this.transport.responseXML
+ };
+ this.fireEvent('onSuccess', [this.response.text, this.response.xml]);
+ this.callChain();
+ },
+
+ onFailure: function(){
+ this.fireEvent('onFailure', this.transport);
+ },
+
+ /*
+ Property: setHeader
+ Add/modify an header for the request. It will not override headers from the options.
+
+ Example:
+ >var myXhr = new XHR(url, {method: 'get', headers: {'X-Request': 'JSON'}});
+ >myXhr.setHeader('Last-Modified','Sat, 1 Jan 2005 05:00:00 GMT');
+ */
+
+ setHeader: function(name, value){
+ this.headers[name] = value;
+ return this;
+ },
+
+ /*
+ Property: send
+ Opens the XHR connection and sends the data. Data has to be null or a string.
+
+ Example:
+ >var myXhr = new XHR({method: 'post'});
+ >myXhr.send(url, querystring);
+ >
+ >var syncXhr = new XHR({async: false, method: 'post'});
+ >syncXhr.send(url, null);
+ >
+ */
+
+ send: function(url, data){
+ if (this.options.autoCancel) this.cancel();
+ else if (this.running) return this;
+ this.running = true;
+ if (data && this.options.method == 'get'){
+ url = url + (url.contains('?') ? '&' : '?') + data;
+ data = null;
+ }
+ this.transport.open(this.options.method.toUpperCase(), url, this.options.async);
+ this.transport.onreadystatechange = this.onStateChange.bind(this);
+ if ((this.options.method == 'post') && this.transport.overrideMimeType) this.setHeader('Connection', 'close');
+ $extend(this.headers, this.options.headers);
+ for (var type in this.headers) try {this.transport.setRequestHeader(type, this.headers[type]);} catch(e){};
+ this.fireEvent('onRequest');
+ this.transport.send($pick(data, null));
+ /** [Alfresco] Added */ if (!this.options.async) this.onStateChange(); /** [/Alfresco] */
+ return this;
+ },
+
+ /*
+ Property: cancel
+ Cancels the running request. No effect if the request is not running.
+
+ Example:
+ >var myXhr = new XHR({method: 'get'}).send(url);
+ >myXhr.cancel();
+ */
+
+ cancel: function(){
+ if (!this.running) return this;
+ this.running = false;
+ this.transport.abort();
+ this.transport.onreadystatechange = Class.empty;
+ this.setTransport();
+ this.fireEvent('onCancel');
+ return this;
+ }
+
+});
+
+XHR.implement(new Chain, new Events, new Options);
+
+/*
+Script: Ajax.js
+ Contains the class. Also contains methods to generate querystings from forms and Objects.
+
+Credits:
+ Loosely based on the version from prototype.js
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Ajax
+ An Ajax class, For all your asynchronous needs.
+ Inherits methods, properties, options and events from .
+
+Arguments:
+ url - the url pointing to the server-side script.
+ options - optional, an object containing options.
+
+Options:
+ data - you can write parameters here. Can be a querystring, an object or a Form element.
+ update - $(element) to insert the response text of the XHR into, upon completion of the request.
+ evalScripts - boolean; default is false. Execute scripts in the response text onComplete. When the response is javascript the whole response is evaluated.
+ evalResponse - boolean; default is false. Force global evalulation of the whole response, no matter what content-type it is.
+
+Events:
+ onComplete - function to execute when the ajax request completes.
+
+Example:
+ >var myAjax = new Ajax(url, {method: 'get'}).request();
+*/
+
+var Ajax = XHR.extend({
+
+ options: {
+ data: null,
+ update: null,
+ onComplete: Class.empty,
+ evalScripts: false,
+ evalResponse: false
+ },
+
+ initialize: function(url, options){
+ this.addEvent('onSuccess', this.onComplete);
+ this.setOptions(options);
+ /*compatibility*/
+ this.options.data = this.options.data || this.options.postBody;
+ /*end compatibility*/
+ if (!['post', 'get'].contains(this.options.method)){
+ this._method = '_method=' + this.options.method;
+ this.options.method = 'post';
+ }
+ this.parent();
+ this.setHeader('X-Requested-With', 'XMLHttpRequest');
+ this.setHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
+ this.url = url;
+ },
+
+ onComplete: function(){
+ if (this.options.update) $(this.options.update).empty().setHTML(this.response.text);
+ if (this.options.evalScripts || this.options.evalResponse) this.evalScripts();
+ this.fireEvent('onComplete', [this.response.text, this.response.xml], 20);
+ },
+
+ /*
+ Property: request
+ Executes the ajax request.
+
+ Example:
+ >var myAjax = new Ajax(url, {method: 'get'});
+ >myAjax.request();
+
+ OR
+
+ >new Ajax(url, {method: 'get'}).request();
+ */
+
+ request: function(data){
+ data = data || this.options.data;
+ switch($type(data)){
+ case 'element': data = $(data).toQueryString(); break;
+ case 'object': data = Object.toQueryString(data);
+ }
+ if (this._method) data = (data) ? [this._method, data].join('&') : this._method;
+ return this.send(this.url, data);
+ },
+
+ /*
+ Property: evalScripts
+ Executes scripts in the response text
+ */
+
+ evalScripts: function(){
+ var script, scripts;
+ if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) scripts = this.response.text;
+ else {
+ scripts = [];
+ var regexp = /
+ (end)
+ */
+
+ send: function(options){
+ return new Ajax(this.getProperty('action'), $merge({data: this.toQueryString()}, options, {method: 'post'})).request();
+ }
+
+});
+
+/*
+Script: Cookie.js
+ A cookie reader/creator
+
+Credits:
+ based on the functions by Peter-Paul Koch (http://quirksmode.org)
+*/
+
+/*
+Class: Cookie
+ Class for creating, getting, and removing cookies.
+*/
+
+var Cookie = new Abstract({
+
+ options: {
+ domain: false,
+ path: false,
+ duration: false,
+ secure: false
+ },
+
+ /*
+ Property: set
+ Sets a cookie in the browser.
+
+ Arguments:
+ key - the key (name) for the cookie
+ value - the value to set, cannot contain semicolons
+ options - an object representing the Cookie options. See Options below. Default values are stored in Cookie.options.
+
+ Options:
+ domain - the domain the Cookie belongs to. If you want to share the cookie with pages located on a different domain, you have to set this value. Defaults to the current domain.
+ path - the path the Cookie belongs to. If you want to share the cookie with pages located in a different path, you have to set this value, for example to "/" to share the cookie with all pages on the domain. Defaults to the current path.
+ duration - the duration of the Cookie before it expires, in days.
+ If set to false or 0, the cookie will be a session cookie that expires when the browser is closed. This is default.
+ secure - Stored cookie information can be accessed only from a secure environment.
+
+ Returns:
+ An object with the options, the key and the value. You can give it as first parameter to Cookie.remove.
+
+ Example:
+ >Cookie.set('username', 'Harald'); // session cookie (duration is false), or ...
+ >Cookie.set('username', 'JackBauer', {duration: 1}); // save this for 1 day
+
+ */
+
+ set: function(key, value, options){
+ options = $merge(this.options, options);
+ value = encodeURIComponent(value);
+ if (options.domain) value += '; domain=' + options.domain;
+ if (options.path) value += '; path=' + options.path;
+ if (options.duration){
+ var date = new Date();
+ date.setTime(date.getTime() + options.duration * 24 * 60 * 60 * 1000);
+ value += '; expires=' + date.toGMTString();
+ }
+ if (options.secure) value += '; secure';
+ document.cookie = key + '=' + value;
+ return $extend(options, {'key': key, 'value': value});
+ },
+
+ /*
+ Property: get
+ Gets the value of a cookie.
+
+ Arguments:
+ key - the name of the cookie you wish to retrieve.
+
+ Returns:
+ The cookie string value, or false if not found.
+
+ Example:
+ >Cookie.get("username") //returns JackBauer
+ */
+
+ get: function(key){
+ var value = document.cookie.match('(?:^|;)\\s*' + key.escapeRegExp() + '=([^;]*)');
+ return value ? decodeURIComponent(value[1]) : false;
+ },
+
+ /*
+ Property: remove
+ Removes a cookie from the browser.
+
+ Arguments:
+ cookie - the name of the cookie to remove or a previous cookie (for domains)
+ options - optional. you can also pass the domain and path here. Same as options in
+
+ Examples:
+ >Cookie.remove('username') //bye-bye JackBauer, cya in 24 hours
+ >
+ >var myCookie = Cookie.set('username', 'Aaron', {domain: 'mootools.net'}); // Cookie.set returns an object with all values need to remove the cookie
+ >Cookie.remove(myCookie);
+ */
+
+ remove: function(cookie, options){
+ if ($type(cookie) == 'object') this.set(cookie.key, '', $merge(cookie, {duration: -1}));
+ else this.set(cookie, '', $merge(options, {duration: -1}));
+ }
+
+});
+
+/*
+Script: Json.js
+ Simple Json parser and Stringyfier, See:
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Json
+ Simple Json parser and Stringyfier, See:
+*/
+
+var Json = {
+
+ /*
+ Property: toString
+ Converts an object to a string, to be passed in server-side scripts as a parameter. Although its not normal usage for this class, this method can also be used to convert functions and arrays to strings.
+
+ Arguments:
+ obj - the object to convert to string
+
+ Returns:
+ A json string
+
+ Example:
+ (start code)
+ Json.toString({apple: 'red', lemon: 'yellow'}); '{"apple":"red","lemon":"yellow"}'
+ (end)
+ */
+
+ toString: function(obj){
+ switch($type(obj)){
+ case 'string':
+ return '"' + obj.replace(/(["\\])/g, '\\$1') + '"';
+ case 'array':
+ return '[' + obj.map(Json.toString).join(',') + ']';
+ case 'object':
+ var string = [];
+ for (var property in obj) string.push(Json.toString(property) + ':' + Json.toString(obj[property]));
+ return '{' + string.join(',') + '}';
+ case 'number':
+ if (isFinite(obj)) break;
+ case false:
+ return 'null';
+ }
+ return String(obj);
+ },
+
+ /*
+ Property: evaluate
+ converts a json string to an javascript Object.
+
+ Arguments:
+ str - the string to evaluate. if its not a string, it returns false.
+ secure - optionally, performs syntax check on json string. Defaults to false.
+
+ Credits:
+ Json test regexp is by Douglas Crockford .
+
+ Example:
+ >var myObject = Json.evaluate('{"apple":"red","lemon":"yellow"}');
+ >//myObject will become {apple: 'red', lemon: 'yellow'}
+ */
+
+ evaluate: function(str, secure){
+ return (($type(str) != 'string') || (secure && !str.test(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/))) ? null : eval('(' + str + ')');
+ }
+
+};
+
+/*
+Script: Json.Remote.js
+ Contains .
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Json.Remote
+ Wrapped XHR with automated sending and receiving of Javascript Objects in Json Format.
+ Inherits methods, properties, options and events from .
+
+Arguments:
+ url - the url you want to send your object to.
+ options - see options
+
+Example:
+ this code will send user information based on name/last name
+ (start code)
+ var jSonRequest = new Json.Remote("http://site.com/tellMeAge.php", {onComplete: function(person){
+ alert(person.age); //is 25 years
+ alert(person.height); //is 170 cm
+ alert(person.weight); //is 120 kg
+ }}).send({'name': 'John', 'lastName': 'Doe'});
+ (end)
+*/
+
+Json.Remote = XHR.extend({
+
+ initialize: function(url, options){
+ this.url = url;
+ this.addEvent('onSuccess', this.onComplete);
+ this.parent(options);
+ this.setHeader('X-Request', 'JSON');
+ },
+
+ send: function(obj){
+ return this.parent(this.url, 'json=' + Json.toString(obj));
+ },
+
+ onComplete: function(){
+ this.fireEvent('onComplete', [Json.evaluate(this.response.text, this.options.secure)]);
+ }
+
+});
+
+/*
+Script: Assets.js
+ provides dynamic loading for images, css and javascript files.
+
+License:
+ MIT-style license.
+*/
+
+var Asset = new Abstract({
+
+ /*
+ Property: javascript
+ Injects a javascript file in the page.
+
+ Arguments:
+ source - the path of the javascript file
+ properties - some additional attributes you might want to add to the script element
+
+ Example:
+ > new Asset.javascript('/scripts/myScript.js', {id: 'myScript'});
+ */
+
+ javascript: function(source, properties){
+ properties = $merge({
+ 'onload': Class.empty
+ }, properties);
+ var script = new Element('script', {'src': source}).addEvents({
+ 'load': properties.onload,
+ 'readystatechange': function(){
+ if (this.readyState == 'complete') this.fireEvent('load');
+ }
+ });
+ delete properties.onload;
+ return script.setProperties(properties).inject(document.head);
+ },
+
+ /*
+ Property: css
+ Injects a css file in the page.
+
+ Arguments:
+ source - the path of the css file
+ properties - some additional attributes you might want to add to the link element
+
+ Example:
+ > new Asset.css('/css/myStyle.css', {id: 'myStyle', title: 'myStyle'});
+ */
+
+ css: function(source, properties){
+ return new Element('link', $merge({
+ 'rel': 'stylesheet', 'media': 'screen', 'type': 'text/css', 'href': source
+ }, properties)).inject(document.head);
+ },
+
+ /*
+ Property: image
+ Preloads an image and returns the img element. does not inject it to the page.
+
+ Arguments:
+ source - the path of the image file
+ properties - some additional attributes you might want to add to the img element
+
+ Example:
+ > new Asset.image('/images/myImage.png', {id: 'myImage', title: 'myImage', onload: myFunction});
+
+ Returns:
+ the img element. you can inject it anywhere you want with //
+ */
+
+ image: function(source, properties){
+ properties = $merge({
+ 'onload': Class.empty,
+ 'onabort': Class.empty,
+ 'onerror': Class.empty
+ }, properties);
+ var image = new Image();
+ image.src = source;
+ var element = new Element('img', {'src': source});
+ ['load', 'abort', 'error'].each(function(type){
+ var event = properties['on' + type];
+ delete properties['on' + type];
+ element.addEvent(type, function(){
+ this.removeEvent(type, arguments.callee);
+ event.call(this);
+ });
+ });
+ if (image.width && image.height) element.fireEvent('load', element, 1);
+ return element.setProperties(properties);
+ },
+
+ /*
+ Property: images
+ Preloads an array of images (as strings) and returns an array of img elements. does not inject them to the page.
+
+ Arguments:
+ sources - array, the paths of the image files
+ options - object, see below
+
+ Options:
+ onComplete - a function to execute when all image files are loaded in the browser's cache
+ onProgress - a function to execute when one image file is loaded in the browser's cache
+
+ Example:
+ (start code)
+ new Asset.images(['/images/myImage.png', '/images/myImage2.gif'], {
+ onComplete: function(){
+ alert('all images loaded!');
+ }
+ });
+ (end)
+
+ Returns:
+ the img elements as $$. you can inject them anywhere you want with //
+ */
+
+ images: function(sources, options){
+ options = $merge({
+ onComplete: Class.empty,
+ onProgress: Class.empty
+ }, options);
+ if (!sources.push) sources = [sources];
+ var images = [];
+ var counter = 0;
+ sources.each(function(source){
+ var img = new Asset.image(source, {
+ 'onload': function(){
+ options.onProgress.call(this, counter);
+ counter++;
+ if (counter == sources.length) options.onComplete();
+ }
+ });
+ images.push(img);
+ });
+ return new Elements(images);
+ }
+
+});
+
+/*
+Script: Hash.js
+ Contains the class Hash.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Hash
+ It wraps an object that it uses internally as a map. The user must use set(), get(), and remove() to add/change, retrieve and remove values, it must not access the internal object directly. null/undefined values are allowed.
+
+Note:
+ Each hash instance has the length property.
+
+Arguments:
+ obj - an object to convert into a Hash instance.
+
+Example:
+ (start code)
+ var hash = new Hash({a: 'hi', b: 'world', c: 'howdy'});
+ hash.remove('b'); // b is removed.
+ hash.set('c', 'hello');
+ hash.get('c'); // returns 'hello'
+ hash.length // returns 2 (a and c)
+ (end)
+*/
+
+var Hash = new Class({
+
+ length: 0,
+
+ initialize: function(object){
+ this.obj = object || {};
+ this.setLength();
+ },
+
+ /*
+ Property: get
+ Retrieves a value from the hash.
+
+ Arguments:
+ key - The key
+
+ Returns:
+ The value
+ */
+
+ get: function(key){
+ return (this.hasKey(key)) ? this.obj[key] : null;
+ },
+
+ /*
+ Property: hasKey
+ Check the presence of a specified key-value pair in the hash.
+
+ Arguments:
+ key - The key
+
+ Returns:
+ True if the Hash contains a value for the specified key, otherwise false
+ */
+
+ hasKey: function(key){
+ return (key in this.obj);
+ },
+
+ /*
+ Property: set
+ Adds a key-value pair to the hash or replaces a previous value associated with the key.
+
+ Arguments:
+ key - The key
+ value - The value
+ */
+
+ set: function(key, value){
+ if (!this.hasKey(key)) this.length++;
+ this.obj[key] = value;
+ return this;
+ },
+
+ setLength: function(){
+ this.length = 0;
+ for (var p in this.obj) this.length++;
+ return this;
+ },
+
+ /*
+ Property: remove
+ Removes a key-value pair from the hash.
+
+ Arguments:
+ key - The key
+ */
+
+ remove: function(key){
+ if (this.hasKey(key)){
+ delete this.obj[key];
+ this.length--;
+ }
+ return this;
+ },
+
+ /*
+ Property: each
+ Calls a function for each key-value pair. The first argument passed to the function will be the value, the second one will be the key, like $each.
+
+ Arguments:
+ fn - The function to call for each key-value pair
+ bind - Optional, the object that will be referred to as "this" in the function
+ */
+
+ each: function(fn, bind){
+ $each(this.obj, fn, bind);
+ },
+
+ /*
+ Property: extend
+ Extends the current hash with an object containing key-value pairs. Values for duplicate keys will be replaced by the new ones.
+
+ Arguments:
+ obj - An object containing key-value pairs
+ */
+
+ extend: function(obj){
+ $extend(this.obj, obj);
+ return this.setLength();
+ },
+
+ /*
+ Property: merge
+ Merges the current hash with multiple objects.
+ */
+
+ merge: function(){
+ this.obj = $merge.apply(null, [this.obj].extend(arguments));
+ return this.setLength();
+ },
+
+ /*
+ Property: empty
+ Empties all hash values properties and values.
+ */
+
+ empty: function(){
+ this.obj = {};
+ this.length = 0;
+ return this;
+ },
+
+ /*
+ Property: keys
+ Returns an array containing all the keys, in the same order as the values returned by .
+
+ Returns:
+ An array containing all the keys of the hash
+ */
+
+ keys: function(){
+ var keys = [];
+ for (var property in this.obj) keys.push(property);
+ return keys;
+ },
+
+ /*
+ Property: values
+ Returns an array containing all the values, in the same order as the keys returned by .
+
+ Returns:
+ An array containing all the values of the hash
+ */
+
+ values: function(){
+ var values = [];
+ for (var property in this.obj) values.push(this.obj[property]);
+ return values;
+ }
+
+});
+
+/* Section: Utility Functions */
+
+/*
+Function: $H
+ Shortcut to create a Hash from an Object.
+*/
+
+function $H(obj){
+ return new Hash(obj);
+};
+
+/*
+Script: Hash.Cookie.js
+ Stores and loads an Hash as a cookie using Json format.
+*/
+
+/*
+Class: Hash.Cookie
+ Inherits all the methods from , additional methods are save and load.
+ Hash json string has a limit of 4kb (4096byte), so be careful with your Hash size.
+ Creating a new instance automatically loads the data from the Cookie into the Hash.
+ If the Hash is emptied, the cookie is also removed.
+
+Arguments:
+ name - the key (name) for the cookie
+ options - options are identical to and are simply passed along to it.
+ In addition, it has the autoSave option, to save the cookie at every operation. defaults to true.
+
+Example:
+ (start code)
+ var fruits = new Hash.Cookie('myCookieName', {duration: 3600});
+ fruits.extend({
+ 'lemon': 'yellow',
+ 'apple': 'red'
+ });
+ fruits.set('melon', 'green');
+ fruits.get('lemon'); // yellow
+
+ // ... on another page ... values load automatically
+
+ var fruits = new Hash.Cookie('myCookieName', {duration: 365});
+ fruits.get('melon'); // green
+
+ fruits.erase(); // delete cookie
+ (end)
+*/
+
+Hash.Cookie = Hash.extend({
+
+ initialize: function(name, options){
+ this.name = name;
+ this.options = $extend({'autoSave': true}, options || {});
+ this.load();
+ },
+
+ /*
+ Property: save
+ Saves the Hash to the cookie. If the hash is empty, removes the cookie.
+
+ Returns:
+ Returns false when the JSON string cookie is too long (4kb), otherwise true.
+
+ Example:
+ (start code)
+ var login = new Hash.Cookie('userstatus', {autoSave: false});
+
+ login.extend({
+ 'username': 'John',
+ 'credentials': [4, 7, 9]
+ });
+ login.set('last_message', 'User logged in!');
+
+ login.save(); // finally save the Hash
+ (end)
+ */
+
+ save: function(){
+ if (this.length == 0){
+ Cookie.remove(this.name, this.options);
+ return true;
+ }
+ var str = Json.toString(this.obj);
+ if (str.length > 4096) return false; //cookie would be truncated!
+ Cookie.set(this.name, str, this.options);
+ return true;
+ },
+
+ /*
+ Property: load
+ Loads the cookie and assigns it to the Hash.
+ */
+
+ load: function(){
+ this.obj = Json.evaluate(Cookie.get(this.name), true) || {};
+ this.setLength();
+ }
+
+});
+
+Hash.Cookie.Methods = {};
+['extend', 'set', 'merge', 'empty', 'remove'].each(function(method){
+ Hash.Cookie.Methods[method] = function(){
+ Hash.prototype[method].apply(this, arguments);
+ if (this.options.autoSave) this.save();
+ return this;
+ };
+});
+Hash.Cookie.implement(Hash.Cookie.Methods);
+
+/*
+Script: Color.js
+ Contains the Color class.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Color
+ Creates a new Color Object, which is an array with some color specific methods.
+Arguments:
+ color - the hex, the RGB array or the HSB array of the color to create. For HSB colors, you need to specify the second argument.
+ type - a string representing the type of the color to create. needs to be specified if you intend to create the color with HSB values, or an array of HEX values. Can be 'rgb', 'hsb' or 'hex'.
+
+Example:
+ (start code)
+ var black = new Color('#000');
+ var purple = new Color([255,0,255]);
+ // mix black with white and purple, each time at 10% of the new color
+ var darkpurple = black.mix('#fff', purple, 10);
+ $('myDiv').setStyle('background-color', darkpurple);
+ (end)
+*/
+
+var Color = new Class({
+
+ initialize: function(color, type){
+ type = type || (color.push ? 'rgb' : 'hex');
+ var rgb, hsb;
+ switch(type){
+ case 'rgb':
+ rgb = color;
+ hsb = rgb.rgbToHsb();
+ break;
+ case 'hsb':
+ rgb = color.hsbToRgb();
+ hsb = color;
+ break;
+ default:
+ rgb = color.hexToRgb(true);
+ hsb = rgb.rgbToHsb();
+ }
+ rgb.hsb = hsb;
+ rgb.hex = rgb.rgbToHex();
+ return $extend(rgb, Color.prototype);
+ },
+
+ /*
+ Property: mix
+ Mixes two or more colors with the Color.
+
+ Arguments:
+ color - a color to mix. you can use as arguments how many colors as you want to mix with the original one.
+ alpha - if you use a number as the last argument, it will be threated as the amount of the color to mix.
+ */
+
+ mix: function(){
+ var colors = $A(arguments);
+ var alpha = ($type(colors[colors.length - 1]) == 'number') ? colors.pop() : 50;
+ var rgb = this.copy();
+ colors.each(function(color){
+ color = new Color(color);
+ for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
+ });
+ return new Color(rgb, 'rgb');
+ },
+
+ /*
+ Property: invert
+ Inverts the Color.
+ */
+
+ invert: function(){
+ return new Color(this.map(function(value){
+ return 255 - value;
+ }));
+ },
+
+ /*
+ Property: setHue
+ Modifies the hue of the Color, and returns a new one.
+
+ Arguments:
+ value - the hue to set
+ */
+
+ setHue: function(value){
+ return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
+ },
+
+ /*
+ Property: setSaturation
+ Changes the saturation of the Color, and returns a new one.
+
+ Arguments:
+ percent - the percentage of the saturation to set
+ */
+
+ setSaturation: function(percent){
+ return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
+ },
+
+ /*
+ Property: setBrightness
+ Changes the brightness of the Color, and returns a new one.
+
+ Arguments:
+ percent - the percentage of the brightness to set
+ */
+
+ setBrightness: function(percent){
+ return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
+ }
+
+});
+
+/* Section: Utility Functions */
+
+/*
+Function: $RGB
+ Shortcut to create a new color, based on red, green, blue values.
+
+Arguments:
+ r - (integer) red value (0-255)
+ g - (integer) green value (0-255)
+ b - (integer) blue value (0-255)
+
+*/
+
+function $RGB(r, g, b){
+ return new Color([r, g, b], 'rgb');
+};
+
+/*
+Function: $HSB
+ Shortcut to create a new color, based on hue, saturation, brightness values.
+
+Arguments:
+ h - (integer) hue value (0-100)
+ s - (integer) saturation value (0-100)
+ b - (integer) brightness value (0-100)
+*/
+
+function $HSB(h, s, b){
+ return new Color([h, s, b], 'hsb');
+};
+
+/*
+Class: Array
+ A collection of The Array Object prototype methods.
+*/
+
+Array.extend({
+
+ /*
+ Property: rgbToHsb
+ Converts a RGB array to an HSB array.
+
+ Returns:
+ the HSB array.
+ */
+
+ rgbToHsb: function(){
+ var red = this[0], green = this[1], blue = this[2];
+ var hue, saturation, brightness;
+ var max = Math.max(red, green, blue), min = Math.min(red, green, blue);
+ var delta = max - min;
+ brightness = max / 255;
+ saturation = (max != 0) ? delta / max : 0;
+ if (saturation == 0){
+ hue = 0;
+ } else {
+ var rr = (max - red) / delta;
+ var gr = (max - green) / delta;
+ var br = (max - blue) / delta;
+ if (red == max) hue = br - gr;
+ else if (green == max) hue = 2 + rr - br;
+ else hue = 4 + gr - rr;
+ hue /= 6;
+ if (hue < 0) hue++;
+ }
+ return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
+ },
+
+ /*
+ Property: hsbToRgb
+ Converts an HSB array to an RGB array.
+
+ Returns:
+ the RGB array.
+ */
+
+ hsbToRgb: function(){
+ var br = Math.round(this[2] / 100 * 255);
+ if (this[1] == 0){
+ return [br, br, br];
+ } else {
+ var hue = this[0] % 360;
+ var f = hue % 60;
+ var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
+ var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
+ var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
+ switch(Math.floor(hue / 60)){
+ case 0: return [br, t, p];
+ case 1: return [q, br, p];
+ case 2: return [p, br, t];
+ case 3: return [p, q, br];
+ case 4: return [t, p, br];
+ case 5: return [br, p, q];
+ }
+ }
+ return false;
+ }
+
+});
+
+/*
+Script: Scroller.js
+ Contains the .
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Scroller
+ The Scroller is a class to scroll any element with an overflow (including the window) when the mouse cursor reaches certain buondaries of that element.
+ You must call its start method to start listening to mouse movements.
+
+Note:
+ The Scroller requires an XHTML doctype.
+
+Arguments:
+ element - required, the element to scroll.
+ options - optional, see options below, and options.
+
+Options:
+ area - integer, the necessary boundaries to make the element scroll.
+ velocity - integer, velocity ratio, the modifier for the window scrolling speed.
+
+Events:
+ onChange - optionally, when the mouse reaches some boundaries, you can choose to alter some other values, instead of the scrolling offsets.
+ Automatically passes as parameters x and y values.
+*/
+
+var Scroller = new Class({
+
+ options: {
+ area: 20,
+ velocity: 1,
+ onChange: function(x, y){
+ this.element.scrollTo(x, y);
+ }
+ },
+
+ initialize: function(element, options){
+ this.setOptions(options);
+ this.element = $(element);
+ this.mousemover = ([window, document].contains(element)) ? $(document.body) : this.element;
+ },
+
+ /*
+ Property: start
+ The scroller starts listening to mouse movements.
+ */
+
+ start: function(){
+ this.coord = this.getCoords.bindWithEvent(this);
+ this.mousemover.addListener('mousemove', this.coord);
+ },
+
+ /*
+ Property: stop
+ The scroller stops listening to mouse movements.
+ */
+
+ stop: function(){
+ this.mousemover.removeListener('mousemove', this.coord);
+ this.timer = $clear(this.timer);
+ },
+
+ getCoords: function(event){
+ this.page = (this.element == window) ? event.client : event.page;
+ if (!this.timer) this.timer = this.scroll.periodical(50, this);
+ },
+
+ scroll: function(){
+ var el = this.element.getSize();
+ var pos = this.element.getPosition();
+
+ var change = {'x': 0, 'y': 0};
+ for (var z in this.page){
+ if (this.page[z] < (this.options.area + pos[z]) && el.scroll[z] != 0)
+ change[z] = (this.page[z] - this.options.area - pos[z]) * this.options.velocity;
+ else if (this.page[z] + this.options.area > (el.size[z] + pos[z]) && el.scroll[z] + el.size[z] != el.scrollSize[z])
+ change[z] = (this.page[z] - el.size[z] + this.options.area - pos[z]) * this.options.velocity;
+ }
+ if (change.y || change.x) this.fireEvent('onChange', [el.scroll.x + change.x, el.scroll.y + change.y]);
+ }
+
+});
+
+Scroller.implement(new Events, new Options);
+
+/*
+Script: Slider.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Slider
+ Creates a slider with two elements: a knob and a container. Returns the values.
+
+Note:
+ The Slider requires an XHTML doctype.
+
+Arguments:
+ element - the knob container
+ knob - the handle
+ options - see Options below
+
+Options:
+ steps - the number of steps for your slider.
+ mode - either 'horizontal' or 'vertical'. defaults to horizontal.
+ offset - relative offset for knob position. default to 0.
+
+Events:
+ onChange - a function to fire when the value changes.
+ onComplete - a function to fire when you're done dragging.
+ onTick - optionally, you can alter the onTick behavior, for example displaying an effect of the knob moving to the desired position.
+ Passes as parameter the new position.
+*/
+
+var Slider = new Class({
+
+ options: {
+ onChange: Class.empty,
+ onComplete: Class.empty,
+ onTick: function(pos){
+ this.knob.setStyle(this.p, pos);
+ },
+ mode: 'horizontal',
+ steps: 100,
+ offset: 0
+ },
+
+ initialize: function(el, knob, options){
+ this.element = $(el);
+ this.knob = $(knob);
+ this.setOptions(options);
+ this.previousChange = -1;
+ this.previousEnd = -1;
+ this.step = -1;
+ this.element.addEvent('mousedown', this.clickedElement.bindWithEvent(this));
+ var mod, offset;
+ switch(this.options.mode){
+ case 'horizontal':
+ this.z = 'x';
+ this.p = 'left';
+ mod = {'x': 'left', 'y': false};
+ offset = 'offsetWidth';
+ break;
+ case 'vertical':
+ this.z = 'y';
+ this.p = 'top';
+ mod = {'x': false, 'y': 'top'};
+ offset = 'offsetHeight';
+ }
+ this.max = this.element[offset] - this.knob[offset] + (this.options.offset * 2);
+ this.half = this.knob[offset]/2;
+ this.getPos = this.element['get' + this.p.capitalize()].bind(this.element);
+ this.knob.setStyle('position', 'relative').setStyle(this.p, - this.options.offset);
+ var lim = {};
+ lim[this.z] = [- this.options.offset, this.max - this.options.offset];
+ this.drag = new Drag.Base(this.knob, {
+ limit: lim,
+ modifiers: mod,
+ snap: 0,
+ onStart: function(){
+ this.draggedKnob();
+ }.bind(this),
+ onDrag: function(){
+ this.draggedKnob();
+ }.bind(this),
+ onComplete: function(){
+ this.draggedKnob();
+ this.end();
+ }.bind(this)
+ });
+ if (this.options.initialize) this.options.initialize.call(this);
+ },
+
+ /*
+ Property: set
+ The slider will get the step you pass.
+
+ Arguments:
+ step - one integer
+ */
+
+ set: function(step){
+ this.step = step.limit(0, this.options.steps);
+ this.checkStep();
+ this.end();
+ this.fireEvent('onTick', this.toPosition(this.step));
+ return this;
+ },
+
+ clickedElement: function(event){
+ var position = event.page[this.z] - this.getPos() - this.half;
+ position = position.limit(-this.options.offset, this.max -this.options.offset);
+ this.step = this.toStep(position);
+ this.checkStep();
+ this.end();
+ this.fireEvent('onTick', position);
+ },
+
+ draggedKnob: function(){
+ this.step = this.toStep(this.drag.value.now[this.z]);
+ this.checkStep();
+ },
+
+ checkStep: function(){
+ if (this.previousChange != this.step){
+ this.previousChange = this.step;
+ this.fireEvent('onChange', this.step);
+ }
+ },
+
+ end: function(){
+ if (this.previousEnd !== this.step){
+ this.previousEnd = this.step;
+ this.fireEvent('onComplete', this.step + '');
+ }
+ },
+
+ toStep: function(position){
+ return Math.round((position + this.options.offset) / this.max * this.options.steps);
+ },
+
+ toPosition: function(step){
+ return this.max * step / this.options.steps;
+ }
+
+});
+
+Slider.implement(new Events);
+Slider.implement(new Options);
+
+/*
+Script: SmoothScroll.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: SmoothScroll
+ Auto targets all the anchors in a page and display a smooth scrolling effect upon clicking them.
+ Inherits methods, properties, options and events from .
+
+Note:
+ SmoothScroll requires an XHTML doctype.
+
+Arguments:
+ options - the Fx.Scroll options (see: ) plus links, a collection of elements you want your smoothscroll on. Defaults to document.links.
+
+Example:
+ >new SmoothScroll();
+*/
+
+var SmoothScroll = Fx.Scroll.extend({
+
+ initialize: function(options){
+ this.parent(window, options);
+ this.links = (this.options.links) ? $$(this.options.links) : $$(document.links);
+ var location = window.location.href.match(/^[^#]*/)[0] + '#';
+ this.links.each(function(link){
+ if (link.href.indexOf(location) != 0) return;
+ var anchor = link.href.substr(location.length);
+ if (anchor && $(anchor)) this.useLink(link, anchor);
+ }, this);
+ if (!window.webkit419) this.addEvent('onComplete', function(){
+ window.location.hash = this.anchor;
+ });
+ },
+
+ useLink: function(link, anchor){
+ link.addEvent('click', function(event){
+ this.anchor = anchor;
+ this.toElement(anchor);
+ event.stop();
+ }.bindWithEvent(this));
+ }
+
+});
+
+/*
+Script: Sortables.js
+ Contains Class.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Sortables
+ Creates an interface for and drop, resorting of a list.
+
+Note:
+ The Sortables require an XHTML doctype.
+
+Arguments:
+ list - required, the list that will become sortable.
+ options - an Object, see options below.
+
+Options:
+ handles - a collection of elements to be used for drag handles. defaults to the elements.
+
+Events:
+ onStart - function executed when the item starts dragging
+ onComplete - function executed when the item ends dragging
+*/
+
+var Sortables = new Class({
+
+ options: {
+ handles: false,
+ onStart: Class.empty,
+ onComplete: Class.empty,
+ ghost: true,
+ snap: 3,
+ onDragStart: function(element, ghost){
+ ghost.setStyle('opacity', 0.7);
+ element.setStyle('opacity', 0.7);
+ },
+ onDragComplete: function(element, ghost){
+ element.setStyle('opacity', 1);
+ ghost.remove();
+ this.trash.remove();
+ }
+ },
+
+ initialize: function(list, options){
+ this.setOptions(options);
+ this.list = $(list);
+ this.elements = this.list.getChildren();
+ this.handles = (this.options.handles) ? $$(this.options.handles) : this.elements;
+ this.bound = {
+ 'start': [],
+ 'moveGhost': this.moveGhost.bindWithEvent(this)
+ };
+ for (var i = 0, l = this.handles.length; i < l; i++){
+ this.bound.start[i] = this.start.bindWithEvent(this, this.elements[i]);
+ }
+ this.attach();
+ if (this.options.initialize) this.options.initialize.call(this);
+ this.bound.move = this.move.bindWithEvent(this);
+ this.bound.end = this.end.bind(this);
+ },
+
+ attach: function(){
+ this.handles.each(function(handle, i){
+ handle.addEvent('mousedown', this.bound.start[i]);
+ }, this);
+ },
+
+ detach: function(){
+ this.handles.each(function(handle, i){
+ handle.removeEvent('mousedown', this.bound.start[i]);
+ }, this);
+ },
+
+ start: function(event, el){
+ this.active = el;
+ this.coordinates = this.list.getCoordinates();
+ if (this.options.ghost){
+ var position = el.getPosition();
+ this.offset = event.page.y - position.y;
+ this.trash = new Element('div').inject(document.body);
+ this.ghost = el.clone().inject(this.trash).setStyles({
+ 'position': 'absolute',
+ 'left': position.x,
+ 'top': event.page.y - this.offset
+ });
+ document.addListener('mousemove', this.bound.moveGhost);
+ this.fireEvent('onDragStart', [el, this.ghost]);
+ }
+ document.addListener('mousemove', this.bound.move);
+ document.addListener('mouseup', this.bound.end);
+ this.fireEvent('onStart', el);
+ event.stop();
+ },
+
+ moveGhost: function(event){
+ var value = event.page.y - this.offset;
+ value = value.limit(this.coordinates.top, this.coordinates.bottom - this.ghost.offsetHeight);
+ this.ghost.setStyle('top', value);
+ event.stop();
+ },
+
+ move: function(event){
+ var now = event.page.y;
+ this.previous = this.previous || now;
+ var up = ((this.previous - now) > 0);
+ var prev = this.active.getPrevious();
+ var next = this.active.getNext();
+ if (prev && up && now < prev.getCoordinates().bottom) this.active.injectBefore(prev);
+ if (next && !up && now > next.getCoordinates().top) this.active.injectAfter(next);
+ this.previous = now;
+ },
+
+ serialize: function(converter){
+ return this.list.getChildren().map(converter || function(el){
+ return this.elements.indexOf(el);
+ }, this);
+ },
+
+ end: function(){
+ this.previous = null;
+ document.removeListener('mousemove', this.bound.move);
+ document.removeListener('mouseup', this.bound.end);
+ if (this.options.ghost){
+ document.removeListener('mousemove', this.bound.moveGhost);
+ this.fireEvent('onDragComplete', [this.active, this.ghost]);
+ }
+ this.fireEvent('onComplete', this.active);
+ }
+
+});
+
+Sortables.implement(new Events, new Options);
+
+/*
+Script: Tips.js
+ Tooltips, BubbleTips, whatever they are, they will appear on mouseover
+
+License:
+ MIT-style license.
+
+Credits:
+ The idea behind Tips.js is based on Bubble Tooltips () by Alessandro Fulcitiniti
+*/
+
+/*
+Class: Tips
+ Display a tip on any element with a title and/or href.
+
+Note:
+ Tips requires an XHTML doctype.
+
+Arguments:
+ elements - a collection of elements to apply the tooltips to on mouseover.
+ options - an object. See options Below.
+
+Options:
+ maxTitleChars - the maximum number of characters to display in the title of the tip. defaults to 30.
+ showDelay - the delay the onShow method is called. (defaults to 100 ms)
+ hideDelay - the delay the onHide method is called. (defaults to 100 ms)
+
+ className - the prefix for your tooltip classNames. defaults to 'tool'.
+
+ the whole tooltip will have as classname: tool-tip
+
+ the title will have as classname: tool-title
+
+ the text will have as classname: tool-text
+
+ offsets - the distance of your tooltip from the mouse. an Object with x/y properties.
+ fixed - if set to true, the toolTip will not follow the mouse.
+
+Events:
+ onShow - optionally you can alter the default onShow behaviour with this option (like displaying a fade in effect);
+ onHide - optionally you can alter the default onHide behaviour with this option (like displaying a fade out effect);
+
+Example:
+ (start code)
+
+
+ (end)
+
+Note:
+ The title of the element will always be used as the tooltip body. If you put :: on your title, the text before :: will become the tooltip title.
+*/
+
+var Tips = new Class({
+
+ options: {
+ onShow: function(tip){
+ tip.setStyle('visibility', 'visible');
+ },
+ onHide: function(tip){
+ tip.setStyle('visibility', 'hidden');
+ },
+ maxTitleChars: 30,
+ showDelay: 100,
+ hideDelay: 100,
+ className: 'tool',
+ offsets: {'x': 16, 'y': 16},
+ fixed: false
+ },
+
+ initialize: function(elements, options){
+ this.setOptions(options);
+ this.toolTip = new Element('div', {
+ 'class': this.options.className + '-tip',
+ 'styles': {
+ 'position': 'absolute',
+ 'top': '0',
+ 'left': '0',
+ 'visibility': 'hidden'
+ }
+ }).inject(document.body);
+ this.wrapper = new Element('div').inject(this.toolTip);
+ $$(elements).each(this.build, this);
+ if (this.options.initialize) this.options.initialize.call(this);
+ },
+
+ build: function(el){
+ el.$tmp.myTitle = (el.href && el.getTag() == 'a') ? el.href.replace('http://', '') : (el.rel || false);
+ if (el.title){
+ var dual = el.title.split('::');
+ if (dual.length > 1){
+ el.$tmp.myTitle = dual[0].trim();
+ el.$tmp.myText = dual[1].trim();
+ } else {
+ el.$tmp.myText = el.title;
+ }
+ el.removeAttribute('title');
+ } else {
+ el.$tmp.myText = false;
+ }
+ if (el.$tmp.myTitle && el.$tmp.myTitle.length > this.options.maxTitleChars) el.$tmp.myTitle = el.$tmp.myTitle.substr(0, this.options.maxTitleChars - 1) + "…";
+ el.addEvent('mouseenter', function(event){
+ this.start(el);
+ if (!this.options.fixed) this.locate(event);
+ else this.position(el);
+ }.bind(this));
+ if (!this.options.fixed) el.addEvent('mousemove', this.locate.bindWithEvent(this));
+ var end = this.end.bind(this);
+ el.addEvent('mouseleave', end);
+ el.addEvent('trash', end);
+ },
+
+ start: function(el){
+ this.wrapper.empty();
+ if (el.$tmp.myTitle){
+ this.title = new Element('span').inject(new Element('div', {'class': this.options.className + '-title'}).inject(this.wrapper)).setHTML(el.$tmp.myTitle);
+ }
+ if (el.$tmp.myText){
+ this.text = new Element('span').inject(new Element('div', {'class': this.options.className + '-text'}).inject(this.wrapper)).setHTML(el.$tmp.myText);
+ }
+ $clear(this.timer);
+ this.timer = this.show.delay(this.options.showDelay, this);
+ },
+
+ end: function(event){
+ $clear(this.timer);
+ this.timer = this.hide.delay(this.options.hideDelay, this);
+ },
+
+ position: function(element){
+ var pos = element.getPosition();
+ this.toolTip.setStyles({
+ 'left': pos.x + this.options.offsets.x,
+ 'top': pos.y + this.options.offsets.y
+ });
+ },
+
+ locate: function(event){
+ var win = {'x': window.getWidth(), 'y': window.getHeight()};
+ var scroll = {'x': window.getScrollLeft(), 'y': window.getScrollTop()};
+ var tip = {'x': this.toolTip.offsetWidth, 'y': this.toolTip.offsetHeight};
+ var prop = {'x': 'left', 'y': 'top'};
+ for (var z in prop){
+ var pos = event.page[z] + this.options.offsets[z];
+ if ((pos + tip[z] - scroll[z]) > win[z]) pos = event.page[z] - this.options.offsets[z] - tip[z];
+ this.toolTip.setStyle(prop[z], pos);
+ };
+ },
+
+ show: function(){
+ if (this.options.timeout) this.timer = this.hide.delay(this.options.timeout, this);
+ this.fireEvent('onShow', [this.toolTip]);
+ },
+
+ hide: function(){
+ this.fireEvent('onHide', [this.toolTip]);
+ }
+
+});
+
+Tips.implement(new Events, new Options);
+
+/*
+Script: Group.js
+ For Grouping Classes or Elements Events. The Event added to the Group will fire when all of the events of the items of the group are fired.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Group
+ An "Utility" Class.
+
+Arguments:
+ List of Class instances
+
+Example:
+ (start code)
+ xhr1 = new Ajax('data.js', {evalScript: true});
+ xhr2 = new Ajax('abstraction.js', {evalScript: true});
+ xhr3 = new Ajax('template.js', {evalScript: true});
+
+ var group = new Group(xhr1, xhr2, xhr3);
+ group.addEvent('onComplete', function(){
+ alert('All Scripts loaded');
+ });
+
+ xhr1.request();
+ xhr2.request();
+ xhr3.request();
+ (end)
+
+*/
+
+var Group = new Class({
+
+ initialize: function(){
+ this.instances = $A(arguments);
+ this.events = {};
+ this.checker = {};
+ },
+
+ /*
+ Property: addEvent
+ adds an event to the stack of events of the Class instances.
+
+ Arguments:
+ type - string; the event name (e.g. 'onComplete')
+ fn - function to execute when all instances fired this event
+ */
+
+ addEvent: function(type, fn){
+ this.checker[type] = this.checker[type] || {};
+ this.events[type] = this.events[type] || [];
+ if (this.events[type].contains(fn)) return false;
+ else this.events[type].push(fn);
+ this.instances.each(function(instance, i){
+ instance.addEvent(type, this.check.bind(this, [type, instance, i]));
+ }, this);
+ return this;
+ },
+
+ check: function(type, instance, i){
+ this.checker[type][i] = true;
+ var every = this.instances.every(function(current, j){
+ return this.checker[type][j] || false;
+ }, this);
+ if (!every) return;
+ this.checker[type] = {};
+ this.events[type].each(function(event){
+ event.call(this, this.instances, instance);
+ }, this);
+ }
+
+});
+
+/*
+Script: Accordion.js
+ Contains
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Accordion
+ The Accordion class creates a group of elements that are toggled when their handles are clicked. When one elements toggles in, the others toggles back.
+ Inherits methods, properties, options and events from .
+
+Note:
+ The Accordion requires an XHTML doctype.
+
+Arguments:
+ togglers - required, a collection of elements, the elements handlers that will be clickable.
+ elements - required, a collection of elements the transitions will be applied to.
+ options - optional, see options below, and options and events.
+
+Options:
+ show - integer, the Index of the element to show at start.
+ display - integer, the Index of the element to show at start (with a transition). defaults to 0.
+ fixedHeight - integer, if you want the elements to have a fixed height. defaults to false.
+ fixedWidth - integer, if you want the elements to have a fixed width. defaults to false.
+ height - boolean, will add a height transition to the accordion if true. defaults to true.
+ opacity - boolean, will add an opacity transition to the accordion if true. defaults to true.
+ width - boolean, will add a width transition to the accordion if true. defaults to false, css mastery is required to make this work!
+ alwaysHide - boolean, will allow to hide all elements if true, instead of always keeping one element shown. defaults to false.
+
+Events:
+ onActive - function to execute when an element starts to show
+ onBackground - function to execute when an element starts to hide
+*/
+
+var Accordion = Fx.Elements.extend({
+
+ options: {
+ onActive: Class.empty,
+ onBackground: Class.empty,
+ display: 0,
+ show: false,
+ height: true,
+ width: false,
+ opacity: true,
+ fixedHeight: false,
+ fixedWidth: false,
+ wait: false,
+ alwaysHide: false
+ },
+
+ initialize: function(){
+ var options, togglers, elements, container;
+ $each(arguments, function(argument, i){
+ switch($type(argument)){
+ case 'object': options = argument; break;
+ case 'element': container = $(argument); break;
+ default:
+ var temp = $$(argument);
+ if (!togglers) togglers = temp;
+ else elements = temp;
+ }
+ });
+ this.togglers = togglers || [];
+ this.elements = elements || [];
+ this.container = $(container);
+ this.setOptions(options);
+ this.previous = -1;
+ if (this.options.alwaysHide) this.options.wait = true;
+ if ($chk(this.options.show)){
+ this.options.display = false;
+ this.previous = this.options.show;
+ }
+ if (this.options.start){
+ this.options.display = false;
+ this.options.show = false;
+ }
+ this.effects = {};
+ if (this.options.opacity) this.effects.opacity = 'fullOpacity';
+ if (this.options.width) this.effects.width = this.options.fixedWidth ? 'fullWidth' : 'offsetWidth';
+ if (this.options.height) this.effects.height = this.options.fixedHeight ? 'fullHeight' : 'scrollHeight';
+ for (var i = 0, l = this.togglers.length; i < l; i++) this.addSection(this.togglers[i], this.elements[i]);
+ this.elements.each(function(el, i){
+ if (this.options.show === i){
+ this.fireEvent('onActive', [this.togglers[i], el]);
+ } else {
+ for (var fx in this.effects) el.setStyle(fx, 0);
+ }
+ }, this);
+ this.parent(this.elements);
+ if ($chk(this.options.display)) this.display(this.options.display);
+ },
+
+ /*
+ Property: addSection
+ Dynamically adds a new section into the accordion at the specified position.
+
+ Arguments:
+ toggler - (dom element) the element that toggles the accordion section open.
+ element - (dom element) the element that stretches open when the toggler is clicked.
+ pos - (integer) the index where these objects are to be inserted within the accordion.
+ */
+
+ addSection: function(toggler, element, pos){
+ toggler = $(toggler);
+ element = $(element);
+ var test = this.togglers.contains(toggler);
+ var len = this.togglers.length;
+ this.togglers.include(toggler);
+ this.elements.include(element);
+ if (len && (!test || pos)){
+ pos = $pick(pos, len - 1);
+ toggler.injectBefore(this.togglers[pos]);
+ element.injectAfter(toggler);
+ } else if (this.container && !test){
+ toggler.inject(this.container);
+ element.inject(this.container);
+ }
+ var idx = this.togglers.indexOf(toggler);
+ toggler.addEvent('click', this.display.bind(this, idx));
+ if (this.options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
+ if (this.options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
+ element.fullOpacity = 1;
+ if (this.options.fixedWidth) element.fullWidth = this.options.fixedWidth;
+ if (this.options.fixedHeight) element.fullHeight = this.options.fixedHeight;
+ element.setStyle('overflow', 'hidden');
+ if (!test){
+ for (var fx in this.effects) element.setStyle(fx, 0);
+ }
+ return this;
+ },
+
+ /*
+ Property: display
+ Shows a specific section and hides all others. Useful when triggering an accordion from outside.
+
+ Arguments:
+ index - integer, the index of the item to show, or the actual element to show.
+ */
+
+ display: function(index){
+ index = ($type(index) == 'element') ? this.elements.indexOf(index) : index;
+ if ((this.timer && this.options.wait) || (index === this.previous && !this.options.alwaysHide)) return this;
+ this.previous = index;
+ var obj = {};
+ this.elements.each(function(el, i){
+ obj[i] = {};
+ var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > 0));
+ this.fireEvent(hide ? 'onBackground' : 'onActive', [this.togglers[i], el]);
+ for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
+ }, this);
+ return this.start(obj);
+ },
+
+ showThisHideOpen: function(index){return this.display(index);}
+
+});
+
+Fx.Accordion = Accordion;
\ No newline at end of file
diff --git a/source/web/scripts/ajax/mootools.v1.11.js b/source/web/scripts/ajax/mootools.v1.11.js
deleted file mode 100644
index 84141c27b3..0000000000
--- a/source/web/scripts/ajax/mootools.v1.11.js
+++ /dev/null
@@ -1,100 +0,0 @@
-//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, , MIT Style License.
-
-var MooTools={version:'1.11'};function $defined(obj){return(obj!=undefined);};function $type(obj){if(!$defined(obj))return false;if(obj.htmlElement)return'element';var type=typeof obj;if(type=='object'&&obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}
-if(type=='object'||type=='function'){switch(obj.constructor){case Array:return'array';case RegExp:return'regexp';case Class:return'class';}
-if(typeof obj.length=='number'){if(obj.item)return'collection';if(obj.callee)return'arguments';}}
-return type;};function $merge(){var mix={};for(var i=0;i-1:this.indexOf(string)>-1;},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,'\\$1');}});Array.extend({rgbToHex:function(array){if(this.length<3)return false;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
-return array?hex:'#'+hex.join('');},hexToRgb:function(array){if(this.length!=3)return false;var rgb=[];for(var i=0;i<3;i++){rgb.push(parseInt((this[i].length==1)?this[i]+this[i]:this[i],16));}
-return array?rgb:'rgb('+rgb.join(',')+')';}});Function.extend({create:function(options){var fn=this;options=$merge({'bind':fn,'event':false,'arguments':null,'delay':false,'periodical':false,'attempt':false},options);if($chk(options.arguments)&&$type(options.arguments)!='array')options.arguments=[options.arguments];return function(event){var args;if(options.event){event=event||window.event;args=[(options.event===true)?event:new options.event(event)];if(options.arguments)args.extend(options.arguments);}
-else args=options.arguments||arguments;var returns=function(){return fn.apply($pick(options.bind,fn),args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)try{return returns();}catch(err){return false;};return returns();};},pass:function(args,bind){return this.create({'arguments':args,'bind':bind});},attempt:function(args,bind){return this.create({'arguments':args,'bind':bind,'attempt':true})();},bind:function(bind,args){return this.create({'bind':bind,'arguments':args});},bindAsEventListener:function(bind,args){return this.create({'bind':bind,'event':true,'arguments':args});},delay:function(delay,bind,args){return this.create({'delay':delay,'bind':bind,'arguments':args})();},periodical:function(interval,bind,args){return this.create({'periodical':interval,'bind':bind,'arguments':args})();}});Number.extend({toInt:function(){return parseInt(this);},toFloat:function(){return parseFloat(this);},limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn){for(var i=0;i';}
-el=document.createElement(el);}
-el=$(el);return(!props||!el)?el:el.set(props);}});var Elements=new Class({initialize:function(elements){return(elements)?$extend(elements,this):this;}});Elements.extend=function(props){for(var prop in props){this.prototype[prop]=props[prop];this[prop]=$native.generic(prop);}};function $(el){if(!el)return null;if(el.htmlElement)return Garbage.collect(el);/* if([window,document].contains(el))return el; */ var type=$type(el);if(type=='string'){el=document.getElementById(el);type=(el)?'element':false;}
-if(type!='element')return null;if(el.htmlElement)return Garbage.collect(el);if(['object','embed'].contains(el.tagName.toLowerCase()))return el;$extend(el,Element.prototype);el.htmlElement=function(){};return Garbage.collect(el);};document.getElementsBySelector=document.getElementsByTagName;function $$(){var elements=[];for(var i=0,j=arguments.length;i0&&fKey<13)this.key='f'+fKey;}
-this.key=this.key||String.fromCharCode(this.code).toLowerCase();}else if(this.type.test(/(click|mouse|menu)/)){this.page={'x':event.pageX||event.clientX+document.documentElement.scrollLeft,'y':event.pageY||event.clientY+document.documentElement.scrollTop};this.client={'x':event.pageX?event.pageX-window.pageXOffset:event.clientX,'y':event.pageY?event.pageY-window.pageYOffset:event.clientY};this.rightClick=(event.which==3)||(event.button==2);switch(this.type){case'mouseover':this.relatedTarget=event.relatedTarget||event.fromElement;break;case'mouseout':this.relatedTarget=event.relatedTarget||event.toElement;}
-this.fixRelatedTarget();}
-return this;},stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});Event.fix={relatedTarget:function(){if(this.relatedTarget&&this.relatedTarget.nodeType==3)this.relatedTarget=this.relatedTarget.parentNode;},relatedTargetGecko:function(){try{Event.fix.relatedTarget.call(this);}catch(e){this.relatedTarget=this.target;}}};Event.prototype.fixRelatedTarget=(window.gecko)?Event.fix.relatedTargetGecko:Event.fix.relatedTarget;Event.keys=new Abstract({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Element.Methods.Events={addEvent:function(type,fn){this.$events=this.$events||{};this.$events[type]=this.$events[type]||{'keys':[],'values':[]};if(this.$events[type].keys.contains(fn))return this;this.$events[type].keys.push(fn);var realType=type;var custom=Element.Events[type];if(custom){if(custom.add)custom.add.call(this,fn);if(custom.map)fn=custom.map;if(custom.type)realType=custom.type;}
-if(!this.addEventListener)fn=fn.create({'bind':this,'event':true});this.$events[type].values.push(fn);return(Element.NativeEvents.contains(realType))?this.addListener(realType,fn):this;},removeEvent:function(type,fn){if(!this.$events||!this.$events[type])return this;var pos=this.$events[type].keys.indexOf(fn);if(pos==-1)return this;var key=this.$events[type].keys.splice(pos,1)[0];var value=this.$events[type].values.splice(pos,1)[0];var custom=Element.Events[type];if(custom){if(custom.remove)custom.remove.call(this,fn);if(custom.type)type=custom.type;}
-return(Element.NativeEvents.contains(type))?this.removeListener(type,value):this;},addEvents:function(source){return Element.setMany(this,'addEvent',source);},removeEvents:function(type){if(!this.$events)return this;if(!type){for(var evType in this.$events)this.removeEvents(evType);this.$events=null;}else if(this.$events[type]){this.$events[type].keys.each(function(fn){this.removeEvent(type,fn);},this);this.$events[type]=null;}
-return this;},fireEvent:function(type,args,delay){if(this.$events&&this.$events[type]){this.$events[type].keys.each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);}
-return this;},cloneEvents:function(from,type){if(!from.$events)return this;if(!type){for(var evType in from.$events)this.cloneEvents(from,evType);}else if(from.$events[type]){from.$events[type].keys.each(function(fn){this.addEvent(type,fn);},this);}
-return this;}};window.extend(Element.Methods.Events);document.extend(Element.Methods.Events);Element.extend(Element.Methods.Events);Element.Events=new Abstract({'mouseenter':{type:'mouseover',map:function(event){event=new Event(event);if(event.relatedTarget!=this&&!this.hasChild(event.relatedTarget))this.fireEvent('mouseenter',event);}},'mouseleave':{type:'mouseout',map:function(event){event=new Event(event);if(event.relatedTarget!=this&&!this.hasChild(event.relatedTarget))this.fireEvent('mouseleave',event);}},'mousewheel':{type:(window.gecko)?'DOMMouseScroll':'mousewheel'}});Element.NativeEvents=['click','dblclick','mouseup','mousedown','mousewheel','DOMMouseScroll','mouseover','mouseout','mousemove','keydown','keypress','keyup','load','unload','beforeunload','resize','move','focus','blur','change','submit','reset','select','error','abort','contextmenu','scroll'];Function.extend({bindWithEvent:function(bind,args){return this.create({'bind':bind,'arguments':args,'event':Event});}});Elements.extend({filterByTag:function(tag){return new Elements(this.filter(function(el){return(Element.getTag(el)==tag);}));},filterByClass:function(className,nocash){var elements=this.filter(function(el){return(el.className&&el.className.contains(className,' '));});return(nocash)?elements:new Elements(elements);},filterById:function(id,nocash){var elements=this.filter(function(el){return(el.id==id);});return(nocash)?elements:new Elements(elements);},filterByAttribute:function(name,operator,value,nocash){var elements=this.filter(function(el){var current=Element.getProperty(el,name);if(!current)return false;if(!operator)return true;switch(operator){case'=':return(current==value);case'*=':return(current.contains(value));case'^=':return(current.substr(0,value.length)==value);case'$=':return(current.substr(current.length-value.length)==value);case'!=':return(current!=value);case'~=':return current.contains(value,' ');}
-return false;});return(nocash)?elements:new Elements(elements);}});function $E(selector,filter){return($(filter)||document).getElement(selector);};function $ES(selector,filter){return($(filter)||document).getElementsBySelector(selector);};$$.shared={'regexp':/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,'xpath':{getParam:function(items,context,param,i){var temp=[context.namespaceURI?'xhtml:':'',param[1]];if(param[2])temp.push('[@id="',param[2],'"]');if(param[3])temp.push('[contains(concat(" ", @class, " "), " ',param[3],' ")]');if(param[4]){if(param[5]&¶m[6]){switch(param[5]){case'*=':temp.push('[contains(@',param[4],', "',param[6],'")]');break;case'^=':temp.push('[starts-with(@',param[4],', "',param[6],'")]');break;case'$=':temp.push('[substring(@',param[4],', string-length(@',param[4],') - ',param[6].length,' + 1) = "',param[6],'"]');break;case'=':temp.push('[@',param[4],'="',param[6],'"]');break;case'!=':temp.push('[@',param[4],'!="',param[6],'"]');}}else{temp.push('[@',param[4],']');}}
-items.push(temp.join(''));return items;},getItems:function(items,context,nocash){var elements=[];var xpath=document.evaluate('.//'+items.join('//'),context,$$.shared.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,j=xpath.snapshotLength;i<\/script>');$('ie_ready').onreadystatechange=function(){if(this.readyState=='complete')domReady();};}}else{window.addListener("load",domReady);document.addListener("DOMContentLoaded",domReady);}}};window.onDomReady=function(fn){return this.addEvent('domready',fn);};window.extend({getWidth:function(){if(this.webkit419)return this.innerWidth;if(this.opera)return document.body.clientWidth;return document.documentElement.clientWidth;},getHeight:function(){if(this.webkit419)return this.innerHeight;if(this.opera)return document.body.clientHeight;return document.documentElement.clientHeight;},getScrollWidth:function(){if(this.ie)return Math.max(document.documentElement.offsetWidth,document.documentElement.scrollWidth);if(this.webkit)return document.body.scrollWidth;return document.documentElement.scrollWidth;},getScrollHeight:function(){if(this.ie)return Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight);if(this.webkit)return document.body.scrollHeight;return document.documentElement.scrollHeight;},getScrollLeft:function(){return this.pageXOffset||document.documentElement.scrollLeft;},getScrollTop:function(){return this.pageYOffset||document.documentElement.scrollTop;},getSize:function(){return{'size':{'x':this.getWidth(),'y':this.getHeight()},'scrollSize':{'x':this.getScrollWidth(),'y':this.getScrollHeight()},'scroll':{'x':this.getScrollLeft(),'y':this.getScrollTop()}};},getPosition:function(){return{'x':0,'y':0};}});var Fx={};Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(p){return-(Math.cos(Math.PI*p)-1)/2;},duration:500,unit:'px',wait:true,fps:50},initialize:function(options){this.element=this.element||null;this.setOptions(options);if(this.options.initialize)this.options.initialize.call(this);},step:function(){var time=$time();if(time=(7-4*a)/11){value=-Math.pow((11-6*a-11*p)/4,2)+b*b;break;}}
-return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}});['Quad','Cubic','Quart','Quint'].each(function(transition,i){Fx.Transitions[transition]=new Fx.Transition(function(p){return Math.pow(p,[i+2]);});Fx.Transitions.compat(transition);});var Drag={};Drag.Base=new Class({options:{handle:false,unit:'px',onStart:Class.empty,onBeforeStart:Class.empty,onComplete:Class.empty,onSnap:Class.empty,onDrag:Class.empty,limit:false,modifiers:{x:'left',y:'top'},grid:false,snap:6},initialize:function(el,options){this.setOptions(options);this.element=$(el);this.handle=$(this.options.handle)||this.element;this.mouse={'now':{},'pos':{}};this.value={'start':{},'now':{}};this.bound={'start':this.start.bindWithEvent(this),'check':this.check.bindWithEvent(this),'drag':this.drag.bindWithEvent(this),'stop':this.stop.bind(this)};this.attach();if(this.options.initialize)this.options.initialize.call(this);},attach:function(){this.handle.addEvent('mousedown',this.bound.start);return this;},detach:function(){this.handle.removeEvent('mousedown',this.bound.start);return this;},start:function(event){this.fireEvent('onBeforeStart',this.element);this.mouse.start=event.page;var limit=this.options.limit;this.limit={'x':[],'y':[]};for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;this.value.now[z]=this.element.getStyle(this.options.modifiers[z]).toInt();this.mouse.pos[z]=event.page[z]-this.value.now[z];if(limit&&limit[z]){for(var i=0;i<2;i++){if($chk(limit[z][i]))this.limit[z][i]=($type(limit[z][i])=='function')?limit[z][i]():limit[z][i];}}}
-if($type(this.options.grid)=='number')this.options.grid={'x':this.options.grid,'y':this.options.grid};document.addListener('mousemove',this.bound.check);document.addListener('mouseup',this.bound.stop);this.fireEvent('onStart',this.element);event.stop();},check:function(event){var distance=Math.round(Math.sqrt(Math.pow(event.page.x-this.mouse.start.x,2)+Math.pow(event.page.y-this.mouse.start.y,2)));if(distance>this.options.snap){document.removeListener('mousemove',this.bound.check);document.addListener('mousemove',this.bound.drag);this.drag(event);this.fireEvent('onSnap',this.element);}
-event.stop();},drag:function(event){this.out=false;this.mouse.now=event.page;for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;this.value.now[z]=this.mouse.now[z]-this.mouse.pos[z];if(this.limit[z]){if($chk(this.limit[z][1])&&(this.value.now[z]>this.limit[z][1])){this.value.now[z]=this.limit[z][1];this.out=true;}else if($chk(this.limit[z][0])&&(this.value.now[z]el.left&&now.xel.top);},stop:function(){if(this.overed&&!this.out)this.overed.fireEvent('drop',[this.element,this]);else this.element.fireEvent('emptydrop',this);this.parent();return this;}});Element.extend({makeDraggable:function(options){return new Drag.Move(this,options);}});var XHR=new Class({options:{method:'post',async:true,onRequest:Class.empty,onSuccess:Class.empty,onFailure:Class.empty,urlEncoded:true,encoding:'utf-8',autoCancel:false,headers:{}},setTransport:function(){this.transport=(window.XMLHttpRequest)?new XMLHttpRequest():(window.ie?new ActiveXObject('Microsoft.XMLHTTP'):false);return this;},initialize:function(options){this.setTransport().setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers={};if(this.options.urlEncoded&&this.options.method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.setHeader('Content-type','application/x-www-form-urlencoded'+encoding);}
-if(this.options.initialize)this.options.initialize.call(this);},onStateChange:function(){if(this.transport.readyState!=4||!this.running)return;this.running=false;var status=0;try{status=this.transport.status;}catch(e){};if(this.options.isSuccess.call(this,status))this.onSuccess();else this.onFailure();this.transport.onreadystatechange=Class.empty;},isSuccess:function(status){return((status>=200)&&(status<300));},onSuccess:function(){this.response={'text':this.transport.responseText,'xml':this.transport.responseXML};this.fireEvent('onSuccess',[this.response.text,this.response.xml]);this.callChain();},onFailure:function(){this.fireEvent('onFailure',this.transport);},setHeader:function(name,value){this.headers[name]=value;return this;},send:function(url,data){if(this.options.autoCancel)this.cancel();else if(this.running)return this;this.running=true;if(data&&this.options.method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;}
-this.transport.open(this.options.method.toUpperCase(),url,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);if((this.options.method=='post')&&this.transport.overrideMimeType)this.setHeader('Connection','close');$extend(this.headers,this.options.headers);for(var type in this.headers)try{this.transport.setRequestHeader(type,this.headers[type]);}catch(e){};this.fireEvent('onRequest');this.transport.send($pick(data,null));if(!this.options.async)this.onStateChange();return this;},cancel:function(){if(!this.running)return this;this.running=false;this.transport.abort();this.transport.onreadystatechange=Class.empty;this.setTransport();this.fireEvent('onCancel');return this;}});XHR.implement(new Chain,new Events,new Options);var Ajax=XHR.extend({options:{data:null,update:null,onComplete:Class.empty,evalScripts:false,evalResponse:false},initialize:function(url,options){this.addEvent('onSuccess',this.onComplete);this.setOptions(options);this.options.data=this.options.data||this.options.postBody;if(!['post','get'].contains(this.options.method)){this._method='_method='+this.options.method;this.options.method='post';}
-this.parent();this.setHeader('X-Requested-With','XMLHttpRequest');this.setHeader('Accept','text/javascript, text/html, application/xml, text/xml, */*');this.url=url;},onComplete:function(){if(this.options.update)$(this.options.update).empty().setHTML(this.response.text);if(this.options.evalScripts||this.options.evalResponse)this.evalScripts();this.fireEvent('onComplete',[this.response.text,this.response.xml],20);},request:function(data){data=data||this.options.data;switch($type(data)){case'element':data=$(data).toQueryString();break;case'object':data=Object.toQueryString(data);}
-if(this._method)data=(data)?[this._method,data].join('&'):this._method;return this.send(this.url,data);},evalScripts:function(){var script,scripts;if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))scripts=this.response.text;else{scripts=[];var regexp=/');};if(!tinymce.is(u,'string')){each(u,function(u){loadScript(u);});if(cb)cb.call(s||t);}else{loadScript(u);if(cb)cb.call(s||t);}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb)cb.call(s||t);each(t.queueCallbacks,function(o){o.func.call(o.scope);});});}else if(cb)t.queueCallbacks.push({func:cb,scope:s||t});},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co);}catch(ex){eval(co,w);}}else w.execScript(co);},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func)o.func.call(o.scope||t);};function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--;}else load(o);});if(l===0&&cb){cb.call(s||t);cb=0;}};function load(o){if(o.state>0)return;o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone();});};each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o);}else o=lo[u];if(o.state>0)return;if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol='';if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone();});if(tinymce.isIE)ol=' onreadystatechange="';else ol=' onload="';ol+='tinymce.dom.ScriptLoader._onLoad(this,\''+u+'\','+ix+');"';}document.write('');if(!o.func)done(o);}else load(o);});allDone();},'static':{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1;},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=='complete')this._funcs[ix].call(this);},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0;}};if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done();}});}else{e=tinymce.DOM.create('script',{id:id,type:'text/javascript',src:tinymce._addVer(u)});Event.add(e,'load',done);(document.getElementsByTagName('head')[0]||document.body).appendChild(e);}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader();})();(function(){var DOM=tinymce.DOM,is=tinymce.is;tinymce.create('tinymce.ui.Control',{Control:function(id,s){this.id=id;this.settings=s=s||{};this.rendered=false;this.onRender=new tinymce.util.Dispatcher(this);this.classPrefix='';this.scope=s.scope||this;this.disabled=0;this.active=0;},setDisabled:function(s){var e;if(s!=this.disabled){e=DOM.get(this.id);if(e&&this.settings.unavailable_prefix){if(s){this.prevTitle=e.title;e.title=this.settings.unavailable_prefix+": "+e.title;}else e.title=this.prevTitle;}this.setState('Disabled',s);this.setState('Enabled',!s);this.disabled=s;}},isDisabled:function(){return this.disabled;},setActive:function(s){if(s!=this.active){this.setState('Active',s);this.active=s;}},isActive:function(){return this.active;},setState:function(c,s){var n=DOM.get(this.id);c=this.classPrefix+c;if(s)DOM.addClass(n,c);else DOM.removeClass(n,c);},isRendered:function(){return this.rendered;},renderHTML:function(){},renderTo:function(n){DOM.setHTML(n,this.renderHTML());},postRender:function(){var t=this,b;if(is(t.disabled)){b=t.disabled;t.disabled=-1;t.setDisabled(b);}if(is(t.active)){b=t.active;t.active=-1;t.setActive(b);}},remove:function(){DOM.remove(this.id);this.destroy();},destroy:function(){tinymce.dom.Event.clear(this.id);}});})();tinymce.create('tinymce.ui.Container:tinymce.ui.Control',{Container:function(id,s){this.parent(id,s);this.controls=[];this.lookup={};},add:function(c){this.lookup[c.id]=c;this.controls.push(c);return c;},get:function(n){return this.lookup[n];}});tinymce.create('tinymce.ui.Separator:tinymce.ui.Control',{Separator:function(id,s){this.parent(id,s);this.classPrefix='mceSeparator';},renderHTML:function(){return tinymce.DOM.createHTML('span',{'class':this.classPrefix});}});(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control',{MenuItem:function(id,s){this.parent(id,s);this.classPrefix='mceMenuItem';},setSelected:function(s){this.setState('Selected',s);this.selected=s;},isSelected:function(){return this.selected;},postRender:function(){var t=this;t.parent();if(is(t.selected))t.setSelected(t.selected);}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem',{Menu:function(id,s){var t=this;t.parent(id,s);t.items={};t.collapsed=false;t.menuCount=0;t.onAddItem=new tinymce.util.Dispatcher(this);},expand:function(d){var t=this;if(d){walk(t,function(o){if(o.expand)o.expand();},'items',t);}t.collapsed=false;},collapse:function(d){var t=this;if(d){walk(t,function(o){if(o.collapse)o.collapse();},'items',t);}t.collapsed=true;},isCollapsed:function(){return this.collapsed;},add:function(o){if(!o.settings)o=new tinymce.ui.MenuItem(o.id||DOM.uniqueId(),o);this.onAddItem.dispatch(this,o);return this.items[o.id]=o;},addSeparator:function(){return this.add({separator:true});},addMenu:function(o){if(!o.collapse)o=this.createMenu(o);this.menuCount++;return this.add(o);},hasMenus:function(){return this.menuCount!==0;},remove:function(o){delete this.items[o.id];},removeAll:function(){var t=this;walk(t,function(o){if(o.removeAll)o.removeAll();else o.remove();o.destroy();},'items',t);t.items={};},createMenu:function(o){var m=new tinymce.ui.Menu(o.id||DOM.uniqueId(),o);m.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return m;}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,Event=tinymce.dom.Event,Element=tinymce.dom.Element;tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu',{DropMenu:function(id,s){s=s||{};s.container=s.container||DOM.doc.body;s.offset_x=s.offset_x||0;s.offset_y=s.offset_y||0;s.vp_offset_x=s.vp_offset_x||0;s.vp_offset_y=s.vp_offset_y||0;if(is(s.icons)&&!s.icons)s['class']+=' mceNoIcons';this.parent(id,s);this.onShowMenu=new tinymce.util.Dispatcher(this);this.onHideMenu=new tinymce.util.Dispatcher(this);this.classPrefix='mceMenu';},createMenu:function(s){var t=this,cs=t.settings,m;s.container=s.container||cs.container;s.parent=t;s.constrain=s.constrain||cs.constrain;s['class']=s['class']||cs['class'];s.vp_offset_x=s.vp_offset_x||cs.vp_offset_x;s.vp_offset_y=s.vp_offset_y||cs.vp_offset_y;m=new tinymce.ui.DropMenu(s.id||DOM.uniqueId(),s);m.onAddItem.add(t.onAddItem.dispatch,t.onAddItem);return m;},update:function(){var t=this,s=t.settings,tb=DOM.get('menu_'+t.id+'_tbl'),co=DOM.get('menu_'+t.id+'_co'),tw,th;tw=s.max_width?Math.min(tb.clientWidth,s.max_width):tb.clientWidth;th=s.max_height?Math.min(tb.clientHeight,s.max_height):tb.clientHeight;if(!DOM.boxModel)t.element.setStyles({width:tw+2,height:th+2});else t.element.setStyles({width:tw,height:th});if(s.max_width)DOM.setStyle(co,'width',tw);if(s.max_height){DOM.setStyle(co,'height',th);if(tb.clientHeightmx)x=px?px-w:Math.max(0,(mx-s.vp_offset_x)-w);if((y+s.vp_offset_y+h)>my)y=Math.max(0,(my-s.vp_offset_y)-h);}DOM.setStyles(co,{left:x,top:y});t.element.update();t.isMenuVisible=1;t.mouseClickFunc=Event.add(co,'click',function(e){var m;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))&&!DOM.hasClass(e,cp+'ItemSub')){m=t.items[e.id];if(m.isDisabled())return;dm=t;while(dm){if(dm.hideMenu)dm.hideMenu();dm=dm.settings.parent;}if(m.settings.onclick)m.settings.onclick(e);return Event.cancel(e);}});if(t.hasMenus()){t.mouseOverFunc=Event.add(co,'mouseover',function(e){var m,r,mi;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))){m=t.items[e.id];if(t.lastMenu)t.lastMenu.collapse(1);if(m.isDisabled())return;if(e&&DOM.hasClass(e,cp+'ItemSub')){r=DOM.getRect(e);m.showMenu((r.x+r.w-ot),r.y-ot,r.x);t.lastMenu=m;DOM.addClass(DOM.get(m.id).firstChild,cp+'ItemActive');}}});}t.onShowMenu.dispatch(t);if(s.keyboard_focus){Event.add(co,'keydown',t._keyHandler,t);DOM.select('a','menu_'+t.id)[0].focus();t._focusIdx=0;}},hideMenu:function(c){var t=this,co=DOM.get('menu_'+t.id),e;if(!t.isMenuVisible)return;Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);Event.remove(co,'keydown',t._keyHandler);DOM.hide(co);t.isMenuVisible=0;if(!c)t.collapse(1);if(t.element)t.element.hide();if(e=DOM.get(t.id))DOM.removeClass(e.firstChild,t.classPrefix+'ItemActive');t.onHideMenu.dispatch(t);},add:function(o){var t=this,co;o=t.parent(o);if(t.isRendered&&(co=DOM.get('menu_'+t.id)))t._add(DOM.select('tbody',co)[0],o);return o;},collapse:function(d){this.parent(d);this.hideMenu(1);},remove:function(o){DOM.remove(o.id);this.destroy();return this.parent(o);},destroy:function(){var t=this,co=DOM.get('menu_'+t.id);Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);if(t.element)t.element.remove();DOM.remove(co);},renderNode:function(){var t=this,s=t.settings,n,tb,co,w;w=DOM.create('div',{id:'menu_'+t.id,'class':s['class'],'style':'position:absolute;left:0;top:0;z-index:200000'});co=DOM.add(w,'div',{id:'menu_'+t.id+'_co','class':t.classPrefix+(s['class']?' '+s['class']:'')});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});if(s.menu_line)DOM.add(co,'span',{'class':t.classPrefix+'Line'});n=DOM.add(co,'table',{id:'menu_'+t.id+'_tbl',border:0,cellPadding:0,cellSpacing:0});tb=DOM.add(n,'tbody');each(t.items,function(o){t._add(tb,o);});t.rendered=true;return w;},_keyHandler:function(e){var t=this,kc=e.keyCode;function focus(d){var i=t._focusIdx+d,e=DOM.select('a','menu_'+t.id)[i];if(e){t._focusIdx=i;e.focus();}};switch(kc){case 38:focus(-1);return;case 40:focus(1);return;case 13:return;case 27:return this.hideMenu();}},_add:function(tb,o){var n,s=o.settings,a,ro,it,cp=this.classPrefix,ic;if(s.separator){ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'ItemSeparator'});DOM.add(ro,'td',{'class':cp+'ItemSeparator'});if(n=ro.previousSibling)DOM.addClass(n,'mceLast');return;}n=ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'Item '+cp+'ItemEnabled'});n=it=DOM.add(n,'td');n=a=DOM.add(n,'a',{href:'javascript:;',onclick:"return false;",onmousedown:'return false;'});DOM.addClass(it,s['class']);ic=DOM.add(n,'span',{'class':'mceIcon'+(s.icon?' mce_'+s.icon:'')});if(s.icon_src)DOM.add(ic,'img',{src:s.icon_src});n=DOM.add(n,s.element||'span',{'class':'mceText',title:o.settings.title},o.settings.title);if(o.settings.style)DOM.setAttrib(n,'style',o.settings.style);if(tb.childNodes.length==1)DOM.addClass(ro,'mceFirst');if((n=ro.previousSibling)&&DOM.hasClass(n,cp+'ItemSeparator'))DOM.addClass(ro,'mceFirst');if(o.collapse)DOM.addClass(ro,cp+'ItemSub');if(n=ro.previousSibling)DOM.removeClass(n,'mceLast');DOM.addClass(ro,'mceLast');}});})();(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.ui.Button:tinymce.ui.Control',{Button:function(id,s){this.parent(id,s);this.classPrefix='mceButton';},renderHTML:function(){var cp=this.classPrefix,s=this.settings,h,l;l=DOM.encode(s.label||'');h='';if(s.image)h+=' '+l+' ';else h+=' '+(l?''+l+' ':'')+'';return h;},postRender:function(){var t=this,s=t.settings;tinymce.dom.Event.add(t.id,'click',function(e){if(!t.isDisabled())return s.onclick.call(s.scope,e);});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control',{ListBox:function(id,s){var t=this;t.parent(id,s);t.items=[];t.onChange=new Dispatcher(t);t.onPostRender=new Dispatcher(t);t.onAdd=new Dispatcher(t);t.onRenderMenu=new tinymce.util.Dispatcher(this);t.classPrefix='mceListBox';},select:function(va){var t=this,fv,f;if(va==undefined)return t.selectByIndex(-1);if(va&&va.call)f=va;else{f=function(v){return v==va;};}if(va!=t.selectedValue){each(t.items,function(o,i){if(f(o.value)){fv=1;t.selectByIndex(i);return false;}});if(!fv)t.selectByIndex(-1);}},selectByIndex:function(idx){var t=this,e,o;if(idx!=t.selectedIndex){e=DOM.get(t.id+'_text');o=t.items[idx];if(o){t.selectedValue=o.value;t.selectedIndex=idx;DOM.setHTML(e,DOM.encode(o.title));DOM.removeClass(e,'mceTitle');}else{DOM.setHTML(e,DOM.encode(t.settings.title));DOM.addClass(e,'mceTitle');t.selectedValue=t.selectedIndex=null;}e=0;}else t.selectedValue=t.selectedIndex=null;},add:function(n,v,o){var t=this;o=o||{};o=tinymce.extend(o,{title:n,value:v});t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return this.items.length;},renderHTML:function(){var h='',t=this,s=t.settings,cp=t.classPrefix;h='';h+=''+DOM.createHTML('a',{id:t.id+'_text',href:'javascript:;','class':'mceText',onclick:"return false;",onmousedown:'return false;'},DOM.encode(t.settings.title))+' ';h+=''+DOM.createHTML('a',{id:t.id+'_open',tabindex:-1,href:'javascript:;','class':'mceOpen',onclick:"return false;",onmousedown:'return false;'},' ')+' ';h+='
';return h;},showMenu:function(){var t=this,p1,p2,e=DOM.get(this.id),m;if(t.isDisabled()||t.items.length==0)return;if(t.menu&&t.menu.isMenuVisible)return t.hideMenu();if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(this.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.keyboard_focus=!tinymce.isOpera;if(t.oldID)m.items[t.oldID].setSelected(0);each(t.items,function(o){if(o.value===t.selectedValue){m.items[o.id].setSelected(1);t.oldID=o.id;}});m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);DOM.addClass(t.id,t.classPrefix+'Selected');},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&(e.target.id==t.id+'_text'||e.target.id==t.id+'_open'))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){DOM.removeClass(t.id,t.classPrefix+'Selected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':t.classPrefix+'Menu mceNoIcons',max_width:150,max_height:150});m.onHideMenu.add(t.hideMenu,t);m.add({title:t.settings.title,'class':'mceMenuItemTitle',onclick:function(){if(t.settings.onselect('')!==false)t.select('');}});each(t.items,function(o){o.id=DOM.uniqueId();o.onclick=function(){if(t.settings.onselect(o.value)!==false)t.select(o.value);};m.add(o);});t.onRenderMenu.dispatch(t,m);t.menu=m;},postRender:function(){var t=this,cp=t.classPrefix;Event.add(t.id,'click',t.showMenu,t);Event.add(t.id+'_text','focus',function(e){if(!t._focused){t.keyDownHandler=Event.add(t.id+'_text','keydown',function(e){var idx=-1,v,kc=e.keyCode;each(t.items,function(v,i){if(t.selectedValue==v.value)idx=i;});if(kc==38)v=t.items[idx-1];else if(kc==40)v=t.items[idx+1];else if(kc==13){v=t.selectedValue;t.selectedValue=null;t.settings.onselect(v);return Event.cancel(e);}if(v){t.hideMenu();t.select(v.value);}});}t._focused=1;});Event.add(t.id+'_text','blur',function(){Event.remove(t.id+'_text','keydown',t.keyDownHandler);t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.addClass(t.id,cp+'Hover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.removeClass(t.id,cp+'Hover');});}t.onPostRender.dispatch(t,DOM.get(t.id));},destroy:function(){this.parent();Event.clear(this.id+'_text');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox',{NativeListBox:function(id,s){this.parent(id,s);this.classPrefix='mceNativeListBox';},setDisabled:function(s){DOM.get(this.id).disabled=s;},isDisabled:function(){return DOM.get(this.id).disabled;},select:function(va){var t=this,fv,f;if(va==undefined)return t.selectByIndex(-1);if(va&&va.call)f=va;else{f=function(v){return v==va;};}if(va!=t.selectedValue){each(t.items,function(o,i){if(f(o.value)){fv=1;t.selectByIndex(i);return false;}});if(!fv)t.selectByIndex(-1);}},selectByIndex:function(idx){DOM.get(this.id).selectedIndex=idx+1;this.selectedValue=this.items[idx]?this.items[idx].value:null;},add:function(n,v,a){var o,t=this;a=a||{};a.value=v;if(t.isRendered())DOM.add(DOM.get(this.id),'option',a,n);o={title:n,value:v,attribs:a};t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return DOM.get(this.id).options.length-1;},renderHTML:function(){var h,t=this;h=DOM.createHTML('option',{value:''},'-- '+t.settings.title+' --');each(t.items,function(it){h+=DOM.createHTML('option',{value:it.value},it.title);});h=DOM.createHTML('select',{id:t.id,'class':'mceNativeListBox'},h);return h;},postRender:function(){var t=this,ch;t.rendered=true;function onChange(e){var v=t.items[e.target.selectedIndex-1];if(v&&(v=v.value)){t.onChange.dispatch(t,v);if(t.settings.onselect)t.settings.onselect(v);}};Event.add(t.id,'change',onChange);Event.add(t.id,'keydown',function(e){var bf;Event.remove(t.id,'change',ch);bf=Event.add(t.id,'blur',function(){Event.add(t.id,'change',onChange);Event.remove(t.id,'blur',bf);});if(e.keyCode==13||e.keyCode==32){onChange(e);return Event.cancel(e);}});t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button',{MenuButton:function(id,s){this.parent(id,s);this.onRenderMenu=new tinymce.util.Dispatcher(this);s.menu_container=s.menu_container||DOM.doc.body;},showMenu:function(){var t=this,p1,p2,e=DOM.get(t.id),m;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();p1=DOM.getPos(t.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.vp_offset_x=p2.x;m.settings.vp_offset_y=p2.y;m.settings.keyboard_focus=t._focused;m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);t.setState('Selected',1);t.isMenuVisible=1;},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':this.classPrefix+'Menu',icons:t.settings.icons});m.onHideMenu.add(t.hideMenu,t);t.onRenderMenu.dispatch(t,m);t.menu=m;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id||e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){t.setState('Selected',0);Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}t.isMenuVisible=0;},postRender:function(){var t=this,s=t.settings;Event.add(t.id,'click',function(){if(!t.isDisabled()){if(s.onclick)s.onclick(t.value);t.showMenu();}});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton',{SplitButton:function(id,s){this.parent(id,s);this.classPrefix='mceSplitButton';},renderHTML:function(){var h,t=this,s=t.settings,h1;h='';if(s.image)h1=DOM.createHTML('img ',{src:s.image,'class':'mceAction '+s['class']});else h1=DOM.createHTML('span',{'class':'mceAction '+s['class']},'');h+=''+DOM.createHTML('a',{id:t.id+'_action',href:'javascript:;','class':'mceAction '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+' ';h1=DOM.createHTML('span',{'class':'mceOpen '+s['class']});h+=''+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'mceOpen '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+' ';h+=' ';return DOM.createHTML('table',{id:t.id,'class':'mceSplitButton mceSplitButtonEnabled '+s['class'],cellpadding:'0',cellspacing:'0',onmousedown:'return false;',title:s.title},h);},postRender:function(){var t=this,s=t.settings;if(s.onclick){Event.add(t.id+'_action','click',function(){if(!t.isDisabled())s.onclick(t.value);});}Event.add(t.id+'_open','click',t.showMenu,t);Event.add(t.id+'_open','focus',function(){t._focused=1;});Event.add(t.id+'_open','blur',function(){t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.addClass(t.id,'mceSplitButtonHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.removeClass(t.id,'mceSplitButtonHover');});}},destroy:function(){this.parent();Event.clear(this.id+'_action');Event.clear(this.id+'_open');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,is=tinymce.is,each=tinymce.each;tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton',{ColorSplitButton:function(id,s){var t=this;t.parent(id,s);t.settings=s=tinymce.extend({colors:'000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',grid_width:8,default_color:'#888888'},t.settings);t.onShowMenu=new tinymce.util.Dispatcher(t);t.onHideMenu=new tinymce.util.Dispatcher(t);t.value=s.default_color;},showMenu:function(){var t=this,r,p,e,p2;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();e=DOM.get(t.id);DOM.show(t.id+'_menu');DOM.addClass(e,'mceSplitButtonSelected');p2=DOM.getPos(e);DOM.setStyles(t.id+'_menu',{left:p2.x,top:p2.y+e.clientHeight,zIndex:200000});e=0;Event.add(DOM.doc,'mousedown',t.hideMenu,t);if(t._focused){t._keyHandler=Event.add(t.id+'_menu','keydown',function(e){if(e.keyCode==27)t.hideMenu();});DOM.select('a',t.id+'_menu')[0].focus();}t.onShowMenu.dispatch(t);t.isMenuVisible=1;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceSplitButtonMenu');})){DOM.removeClass(t.id,'mceSplitButtonSelected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);Event.remove(t.id+'_menu','keydown',t._keyHandler);DOM.hide(t.id+'_menu');}t.onHideMenu.dispatch(t);t.isMenuVisible=0;},renderMenu:function(){var t=this,m,i=0,s=t.settings,n,tb,tr,w;w=DOM.add(s.menu_container,'div',{id:t.id+'_menu','class':s['menu_class']+' '+s['class'],style:'position:absolute;left:0;top:-1000px;'});m=DOM.add(w,'div',{'class':s['class']+' mceSplitButtonMenu'});DOM.add(m,'span',{'class':'mceMenuLine'});n=DOM.add(m,'table',{'class':'mceColorSplitMenu'});tb=DOM.add(n,'tbody');i=0;each(is(s.colors,'array')?s.colors:s.colors.split(','),function(c){c=c.replace(/^#/,'');if(!i--){tr=DOM.add(tb,'tr');i=s.grid_width-1;}n=DOM.add(tr,'td');n=DOM.add(n,'a',{href:'javascript:;',style:{backgroundColor:'#'+c},mce_color:'#'+c});});if(s.more_colors_func){n=DOM.add(tb,'tr');n=DOM.add(n,'td',{colspan:s.grid_width,'class':'mceMoreColors'});n=DOM.add(n,'a',{id:t.id+'_more',href:'javascript:;',onclick:'return false;','class':'mceMoreColors'},s.more_colors_title);Event.add(n,'click',function(e){s.more_colors_func.call(s.more_colors_scope||this);return Event.cancel(e);});}DOM.addClass(m,'mceColorSplitMenu');Event.add(t.id+'_menu','click',function(e){var c;e=e.target;if(e.nodeName=='A'&&(c=e.getAttribute('mce_color')))t.setColor(c);return Event.cancel(e);});return w;},setColor:function(c){var t=this;DOM.setStyle(t.id+'_preview','backgroundColor',c);t.value=c;t.hideMenu();t.settings.onselect(c);},postRender:function(){var t=this,id=t.id;t.parent();DOM.add(id+'_action','div',{id:id+'_preview','class':'mceColorPreview'});DOM.setStyle(t.id+'_preview','backgroundColor',t.value);},destroy:function(){this.parent();Event.clear(this.id+'_menu');Event.clear(this.id+'_more');DOM.remove(this.id+'_menu');}});})();tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container',{renderHTML:function(){var t=this,h='',c,co,dom=tinymce.DOM,s=t.settings,i,pr,nx,cl;cl=t.controls;for(i=0;i'));}if(pr&&co.ListBox){if(pr.Button||pr.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarEnd'},dom.createHTML('span',null,''));}if(dom.stdMode)h+=''+co.renderHTML()+' ';else h+=''+co.renderHTML()+' ';if(nx&&co.ListBox){if(nx.Button||nx.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarStart'},dom.createHTML('span',null,''));}}c='mceToolbarEnd';if(co.Button)c+=' mceToolbarEndButton';else if(co.SplitButton)c+=' mceToolbarEndSplitButton';else if(co.ListBox)c+=' mceToolbarEndListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,''));return dom.createHTML('table',{id:t.id,'class':'mceToolbar'+(s['class']?' '+s['class']:''),cellpadding:'0',cellspacing:'0',align:t.settings.align||''},''+h+' ');}});(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each;tinymce.create('tinymce.AddOnManager',{items:[],urls:{},lookup:{},onAdd:new Dispatcher(this),get:function(n){return this.lookup[n];},requireLangPack:function(n){var u,s=tinymce.EditorManager.settings;if(s&&s.language){u=this.urls[n]+'/langs/'+s.language+'.js';if(!tinymce.dom.Event.domLoaded&&!s.strict_mode)tinymce.ScriptLoader.load(u);else tinymce.ScriptLoader.add(u);}},add:function(id,o){this.items.push(o);this.lookup[id]=o;this.onAdd.dispatch(this,id,o);return o;},load:function(n,u,cb,s){var t=this;if(t.urls[n])return;if(u.indexOf('/')!=0&&u.indexOf('://')==-1)u=tinymce.baseURL+'/'+u;t.urls[n]=u.substring(0,u.lastIndexOf('/'));tinymce.ScriptLoader.add(u,cb,s);}});tinymce.PluginManager=new tinymce.AddOnManager();tinymce.ThemeManager=new tinymce.AddOnManager();}());(function(){var each=tinymce.each,extend=tinymce.extend,DOM=tinymce.DOM,Event=tinymce.dom.Event,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,explode=tinymce.explode;tinymce.create('static tinymce.EditorManager',{editors:{},i18n:{},activeEditor:null,preInit:function(){var t=this,lo=window.location;tinymce.documentBaseURL=lo.href.replace(/[\?#].*$/,'').replace(/[\/\\][^\/]+$/,'');if(!/[\/\\]$/.test(tinymce.documentBaseURL))tinymce.documentBaseURL+='/';tinymce.baseURL=new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);tinymce.EditorManager.baseURI=new tinymce.util.URI(tinymce.baseURL);if(document.domain&&lo.hostname!=document.domain)tinymce.relaxedDomain=document.domain;if(!tinymce.relaxedDomain&&tinymce.EditorManager.baseURI.host!=lo.hostname&&lo.hostname)document.domain=tinymce.relaxedDomain=lo.hostname.replace(/.*\.(.+\..+)$/,'$1');t.onBeforeUnload=new tinymce.util.Dispatcher(t);Event.add(window,'beforeunload',function(e){t.onBeforeUnload.dispatch(t,e);});},init:function(s){var t=this,pl,sl=tinymce.ScriptLoader,c,e,el=[],ed;function execCallback(se,n,s){var f=se[n];if(!f)return;if(tinymce.is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);}return f.apply(s||this,Array.prototype.slice.call(arguments,2));};s=extend({theme:"simple",language:"en",strict_loading_mode:document.contentType=='application/xhtml+xml'},s);t.settings=s;if(!Event.domLoaded&&!s.strict_loading_mode){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme&&s.theme.charAt(0)!='-'&&!ThemeManager.urls[s.theme])ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');if(s.plugins){pl=explode(s.plugins);if(tinymce.inArray(pl,'compat2x')!=-1)PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');each(pl,function(v){if(v&&v.charAt(0)!='-'&&!PluginManager.urls[v]){if(!tinymce.isWebKit&&v=='safari')return;PluginManager.load(v,'plugins/'+v+'/editor_plugin'+tinymce.suffix+'.js');}});}sl.loadQueue();}Event.add(document,'init',function(){var l,co;execCallback(s,'onpageload');if(s.browsers){l=false;each(explode(s.browsers),function(v){switch(v){case'ie':case'msie':if(tinymce.isIE)l=true;break;case'gecko':if(tinymce.isGecko)l=true;break;case'safari':case'webkit':if(tinymce.isWebKit)l=true;break;case'opera':if(tinymce.isOpera)l=true;break;}});if(!l)return;}switch(s.mode){case"exact":l=s.elements||'';if(l.length>0){each(explode(l),function(v){if(DOM.get(v)){ed=new tinymce.Editor(v,s);el.push(ed);ed.render(1);}else{c=0;each(document.forms,function(f){each(f.elements,function(e){if(e.name===v){v='mce_editor_'+c;DOM.setAttrib(e,'id',v);ed=new tinymce.Editor(v,s);el.push(ed);ed.render(1);}});});}});}break;case"textareas":case"specific_textareas":function hasClass(n,c){return c.constructor===RegExp?c.test(n.className):DOM.hasClass(n,c);};each(DOM.select('textarea'),function(v){if(s.editor_deselector&&hasClass(v,s.editor_deselector))return;if(!s.editor_selector||hasClass(v,s.editor_selector)){e=DOM.get(v.name);if(!v.id&&!e)v.id=v.name;if(!v.id||t.get(v.id))v.id=DOM.uniqueId();ed=new tinymce.Editor(v.id,s);el.push(ed);ed.render(1);}});break;}if(s.oninit){l=co=0;each(el,function(ed){co++;if(!ed.initialized){ed.onInit.add(function(){l++;if(l==co)execCallback(s,'oninit');});}else l++;if(l==co)execCallback(s,'oninit');});}});},get:function(id){return this.editors[id];},getInstanceById:function(id){return this.get(id);},add:function(e){this.editors[e.id]=e;this._setActive(e);return e;},remove:function(e){var t=this;if(!t.editors[e.id])return null;delete t.editors[e.id];if(t.activeEditor==e){each(t.editors,function(e){t._setActive(e);return false;});}e.destroy();return e;},execCommand:function(c,u,v){var t=this,ed=t.get(v),w;switch(c){case"mceFocus":ed.focus();return true;case"mceAddEditor":case"mceAddControl":if(!t.get(v))new tinymce.Editor(v,t.settings).render();return true;case"mceAddFrameControl":w=v.window;w.tinyMCE=tinyMCE;w.tinymce=tinymce;tinymce.DOM.doc=w.document;tinymce.DOM.win=w;ed=new tinymce.Editor(v.element_id,v);ed.render();if(tinymce.isIE){function clr(){ed.destroy();w.detachEvent('onunload',clr);w=w.tinyMCE=w.tinymce=null;};w.attachEvent('onunload',clr);}v.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(ed)ed.remove();return true;case'mceToggleEditor':if(!ed){t.execCommand('mceAddControl',0,v);return true;}if(ed.isHidden())ed.show();else ed.hide();return true;}if(t.activeEditor)return t.activeEditor.execCommand(c,u,v);return false;},execInstanceCommand:function(id,c,u,v){var ed=this.get(id);if(ed)return ed.execCommand(c,u,v);return false;},triggerSave:function(){each(this.editors,function(e){e.save();});},addI18n:function(p,o){var lo,i18n=this.i18n;if(!tinymce.is(p,'string')){each(p,function(o,lc){each(o,function(o,g){each(o,function(o,k){if(g==='common')i18n[lc+'.'+k]=o;else i18n[lc+'.'+g+'.'+k]=o;});});});}else{each(o,function(o,k){i18n[p+'.'+k]=o;});}},_setActive:function(e){this.selectedInstance=this.activeEditor=e;}});tinymce.EditorManager.preInit();})();var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,Dispatcher=tinymce.util.Dispatcher;var each=tinymce.each,isGecko=tinymce.isGecko,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit;var is=tinymce.is,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,EditorManager=tinymce.EditorManager;var inArray=tinymce.inArray,grep=tinymce.grep,explode=tinymce.explode;tinymce.create('tinymce.Editor',{Editor:function(id,s){var t=this;t.id=t.editorId=id;t.execCommands={};t.queryStateCommands={};t.queryValueCommands={};t.plugins={};each(['onPreInit','onBeforeRenderUI','onPostRender','onInit','onRemove','onActivate','onDeactivate','onClick','onEvent','onMouseUp','onMouseDown','onDblClick','onKeyDown','onKeyUp','onKeyPress','onContextMenu','onSubmit','onReset','onPaste','onPreProcess','onPostProcess','onBeforeSetContent','onBeforeGetContent','onSetContent','onGetContent','onLoadContent','onSaveContent','onNodeChange','onChange','onBeforeExecCommand','onExecCommand','onUndo','onRedo','onVisualAid','onSetProgressState'],function(e){t[e]=new Dispatcher(t);});t.settings=s=extend({id:id,language:'en',docs_language:'en',theme:'simple',skin:'default',delta_width:0,delta_height:0,popup_css:'',plugins:'',document_base_url:tinymce.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'',visual_table_class:'mceItemTable',visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:'xx-small,x-small,small,medium,large,x-large,xx-large',apply_source_formatting:1,directionality:'ltr',forced_root_block:'p',valid_elements:'@[id|class|style|title|dir ';t.iframeHTML+=' ';if(tinymce.relaxedDomain)t.iframeHTML+='';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='