Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FLUID-2878: Ran the change line endings command from inside Aptana an…

…d an now checking back in the files.

svn path=/fluid/infusion/trunk/; revision=7297
  • Loading branch information...
commit 6d59f4ddf941ecfda6bd3d3ea4fd4735516ea0a2 1 parent e4d6f77
Eli Cochran authored
Showing with 13,042 additions and 13,042 deletions.
  1. +42 −42 build-scripts/build.xml
  2. +46 −46 maven.xml
  3. +33 −33 project.xml
  4. +7 −7 src/webapp/WEB-INF/web.xml
  5. +28 −28 src/webapp/components/inlineEdit/css/InlineEdit.css
  6. +672 −672 src/webapp/components/inlineEdit/js/InlineEdit.js
  7. +303 −303 src/webapp/components/inlineEdit/js/InlineEditIntegrations.js
  8. +814 −814 src/webapp/components/pager/js/Pager.js
  9. +239 −239 src/webapp/components/reorderer/html/ImageReordererRSF.html
  10. +158 −158 src/webapp/components/reorderer/js/ImageReorderer.js
  11. +709 −709 src/webapp/components/reorderer/js/Reorderer.js
  12. +34 −34 src/webapp/components/uiOptions/css/Slider.css
  13. +55 −55 src/webapp/components/uiOptions/css/UIOptions.css
  14. +17 −17 src/webapp/components/uiOptions/css/UIOptionsPreview.css
  15. +178 −178 src/webapp/components/uiOptions/html/UIOptions.html
  16. +85 −85 src/webapp/components/uiOptions/html/UIOptionsPreview.html
  17. +348 −348 src/webapp/framework/core/js/DataBinding.js
  18. +269 −269 src/webapp/framework/fss/css/fss-layout.css
  19. +137 −137 src/webapp/framework/fss/css/fss-reset.css
  20. +192 −192 src/webapp/framework/fss/css/fss-text.css
  21. +183 −183 src/webapp/framework/fss/css/fss-theme-coal.css
  22. +24 −24 src/webapp/framework/fss/css/fss-theme-debug.css
  23. +112 −112 src/webapp/framework/fss/css/fss-theme-hc.css
  24. +112 −112 src/webapp/framework/fss/css/fss-theme-hci.css
  25. +167 −167 src/webapp/framework/fss/css/fss-theme-mist.css
  26. +139 −139 src/webapp/framework/fss/css/fss-theme-rust.css
  27. +170 −170 src/webapp/framework/fss/css/fss-theme-slate.css
  28. +664 −664 src/webapp/framework/renderer/js/fluidParser.js
  29. +1,430 −1,430 src/webapp/framework/renderer/js/fluidRenderer.js
  30. +2 −2 src/webapp/integration-demos/bspace/html/section-info-inner.html
  31. +3 −3 src/webapp/integration-demos/sakai/css/announcements.css
  32. +18 −18 src/webapp/integration-demos/sakai/css/overrides.css
  33. +1 −1  src/webapp/integration-demos/sakai/css/sakai.components.ui-options.css
  34. +31 −31 src/webapp/integration-demos/sakai/css/sakai.css
  35. +47 −47 src/webapp/integration-demos/sakai/css/sakai.layout.css
  36. +12 −12 src/webapp/integration-demos/sakai/css/sakai.theme.coal.css
  37. +17 −17 src/webapp/integration-demos/sakai/css/sakai.theme.mist.css
  38. +16 −16 src/webapp/integration-demos/sakai/css/sakai.theme.rust.css
  39. +9 −9 src/webapp/integration-demos/sakai/css/sakai.theme.slate.css
  40. +56 −56 src/webapp/integration-demos/sakai/html/UIOptionsPreview.html
  41. +14 −14 src/webapp/integration-demos/sakai/html/inline-edit-announcements.html
  42. +5 −5 src/webapp/integration-demos/sakai/html/pager-site-setting.html
  43. +240 −240 src/webapp/integration-demos/sakai/html/ui-options-fss-sakai.html
  44. +84 −84 src/webapp/integration-demos/sakai/js/sakai.js
  45. +5 −5 src/webapp/integration-demos/uportal/html/portal.html
  46. +471 −471 src/webapp/lib/fastXmlPull/js/fastXmlPull.js
  47. +144 −144 src/webapp/lib/jquery/core/js/jquery.js
  48. +9 −9 src/webapp/lib/jquery/plugins/tooltip/css/jquery.tooltip.css
  49. +1 −1  src/webapp/standalone-demos/keyboard-a11y/css/Focus.css
  50. +18 −18 src/webapp/standalone-demos/keyboard-a11y/html/CheckboxExample.html
  51. +80 −80 src/webapp/standalone-demos/keyboard-a11y/js/AccessibleCheckbox.js
  52. +615 −615 src/webapp/standalone-demos/lib/jquery/js/ui.tabs.js
  53. +1 −1  src/webapp/standalone-demos/pager/html/pager.html
  54. +66 −66 src/webapp/standalone-demos/quick-start-examples/fss/css/FSSDemo.css
  55. +88 −88 src/webapp/standalone-demos/quick-start-examples/fss/html/FSS-helpers.html
  56. +139 −139 src/webapp/standalone-demos/quick-start-examples/fss/html/FSS-layout.html
  57. +403 −403 src/webapp/standalone-demos/quick-start-examples/fss/html/FSS-text.html
  58. +438 −438 src/webapp/standalone-demos/quick-start-examples/fss/html/FSS-themes.html
  59. +127 −127 src/webapp/standalone-demos/quick-start-examples/reorderer/html/LayoutReorderer.html
  60. +68 −68 src/webapp/standalone-demos/renderer/css/renderer-examples.css
  61. +1 −1  src/webapp/standalone-demos/renderer/html/data-bound-menu.html
  62. +60 −60 src/webapp/standalone-demos/renderer/html/id-based-inventory.html
  63. +62 −62 src/webapp/standalone-demos/renderer/html/selector-based-inventory.html
  64. +182 −182 src/webapp/standalone-demos/renderer/js/data-bound-menu.js
  65. +113 −113 src/webapp/standalone-demos/renderer/js/id-based-inventory.js
  66. +140 −140 src/webapp/standalone-demos/renderer/js/programmatic-tree-menu.js
  67. +133 −133 src/webapp/standalone-demos/renderer/js/selector-based-inventory.js
  68. +60 −60 src/webapp/standalone-demos/reorderer/css/markup-examples.css
  69. +49 −49 src/webapp/standalone-demos/reorderer/css/todo-list.css
  70. +211 −211 src/webapp/standalone-demos/reorderer/html/image-reorderer.html
  71. +5 −5 src/webapp/standalone-demos/reorderer/html/jquery-tabs.html
  72. +3 −3 src/webapp/standalone-demos/reorderer/html/sortable-styled-todo-list.html
  73. +1 −1  src/webapp/standalone-demos/table-of-contents/html/TableOfContents.html
  74. +30 −30 src/webapp/tests/component-tests/inlineEdit/html/InlineEdit-test.html
  75. +666 −666 src/webapp/tests/component-tests/inlineEdit/js/InlineEditTests.js
  76. +1 −1  src/webapp/tests/component-tests/pager/html/Pager-test.html
  77. +62 −62 src/webapp/tests/component-tests/reorderer/html/GeometricManager-test.html
  78. +284 −284 src/webapp/tests/component-tests/reorderer/html/ImageReorderer-test.html
  79. +129 −129 src/webapp/tests/component-tests/reorderer/html/LayoutReorderer-test.html
  80. +28 −28 src/webapp/tests/component-tests/reorderer/html/ReorderList-test.html
  81. +55 −55 src/webapp/tests/component-tests/reorderer/html/Scheduler-test.html
  82. +172 −172 src/webapp/tests/component-tests/reorderer/js/GeometricManagerTests.js
Sorry, we could not display the entire diff because it was too big.
View
84 build-scripts/build.xml
@@ -59,25 +59,25 @@
<mkdir dir="${licenses}" />
</target>
- <!-- Target: Minify the specified files and copy them into the specified directory. Don't call this directly. -->
- <target name="minify">
- <apply executable="java" dest="${toDir}" parallel="false">
- <!-- The files to act upon. -->
- <fileset dir="${fromDir}" casesensitive="no">
- <include name="**/${file-pattern}" />
- <exclude name="**/test/*" />
- </fileset>
-
- <arg line="-jar" />
- <arg path="${yuicompressor}" />
- <srcfile/>
+ <!-- Target: Minify the specified files and copy them into the specified directory. Don't call this directly. -->
+ <target name="minify">
+ <apply executable="java" dest="${toDir}" parallel="false">
+ <!-- The files to act upon. -->
+ <fileset dir="${fromDir}" casesensitive="no">
+ <include name="**/${file-pattern}" />
+ <exclude name="**/test/*" />
+ </fileset>
+
+ <arg line="-jar" />
+ <arg path="${yuicompressor}" />
+ <srcfile/>
<arg line="--nomunge" />
- <!-- -o option for YUI Compressor to output minified JS to a file instead of stdout. -->
- <arg line="${lineBreakArg}" />
- <arg line="-o" />
- <mapper type="glob" from="${file-pattern}" to="${file-pattern}" />
- <targetfile />
- </apply>
+ <!-- -o option for YUI Compressor to output minified JS to a file instead of stdout. -->
+ <arg line="${lineBreakArg}" />
+ <arg line="-o" />
+ <mapper type="glob" from="${file-pattern}" to="${file-pattern}" />
+ <targetfile />
+ </apply>
</target>
<!-- Minifies javascript and css files and puts them into the distribution -->
@@ -147,11 +147,11 @@
</target>
<!-- Builds the WAR file using Maven 2 and copies it to the distribution folder. -->
- <target name="buildWAR">
- <condition property="isWindows">
- <os family="windows" />
- </condition>
- <antcall target="invokeMavenForWAR"/>
+ <target name="buildWAR">
+ <condition property="isWindows">
+ <os family="windows" />
+ </condition>
+ <antcall target="invokeMavenForWAR"/>
<antcall target="invokeMavenForWARWindows"/>
<echo>Copying war file ${build}/war/target/${warfile} to ${dist}...</echo>
<copy todir="${dist}">
@@ -159,25 +159,25 @@
<include name="${warfile}" />
</fileset>
</copy>
- </target>
-
- <target name="invokeMavenForWAR" unless="isWindows">
- <echo>Building war file...</echo>
- <apply executable="mvn" dir="${build}/war" parallel="true">
- <fileset dir=".">
- <include name="pom.xml"/>
- </fileset>
- <arg value="install" />
- </apply>
- </target>
-
- <target name="invokeMavenForWARWindows" if="isWindows">
- <apply executable="cmd" dir="${build}/war" parallel="true" vmlauncher="false">
- <fileset dir=".">
- <include name="pom.xml"/>
- </fileset>
- <arg value="/c mvn.bat install" />
- </apply>
+ </target>
+
+ <target name="invokeMavenForWAR" unless="isWindows">
+ <echo>Building war file...</echo>
+ <apply executable="mvn" dir="${build}/war" parallel="true">
+ <fileset dir=".">
+ <include name="pom.xml"/>
+ </fileset>
+ <arg value="install" />
+ </apply>
+ </target>
+
+ <target name="invokeMavenForWARWindows" if="isWindows">
+ <apply executable="cmd" dir="${build}/war" parallel="true" vmlauncher="false">
+ <fileset dir=".">
+ <include name="pom.xml"/>
+ </fileset>
+ <arg value="/c mvn.bat install" />
+ </apply>
</target>
<!-- Builds the core Infusion WAR file. -->
View
92 maven.xml
@@ -1,46 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- default goal for the project builds and installs the war in the local repository -->
-<project default="full" xmlns:j="jelly:core"
- xmlns:maven="jelly:maven">
-
- <!-- the common "full" goal invokes the default goal. Used in maven -Dgoal=full multiproject:goal from .. -->
- <goal name="full">
- <!--attainGoal name="dependencies" /-->
- <attainGoal name="war:install" />
- </goal>
-
- <!-- Override jar:install goal to compose "partial WAR" strategy -->
- <goal name="jar:install">
- <attainGoal name="war:install"/>
- </goal>
-
-<!-- This standard stanza is required for any webapps participating in the
- "partial WAR" build strategy -->
- <preGoal name="war:resources">
- <echo>Expanding webapp dependencies</echo>
-
- <mkdir dir="${maven.war.webapp.dir}" />
- <j:forEach var="lib" items="${pom.artifacts}">
- <j:set var="dep" value="${lib.dependency}" />
- <j:if test="${dep.getProperty('explode') == 'true'}">
- <j:if test="${dep.type =='war'}">
- <unjar src="${lib.path}" dest="${maven.war.webapp.dir}" />
- </j:if>
- </j:if>
- </j:forEach>
- </preGoal>
-
-<!-- Do not deploy for now, will be folded into each deployed user
- <goal name="deploy" prereqs="war:install">
- <maven:property defaultValue="${pom.artifactId}" var="webappName"
- name="deploy.webappname" />
- <j:set var="destination"
- value="${maven.tomcat.home}/webapps/${webappName}" />
- <delete dir="${destination}"/>
- <echo>Copying ${maven.war.build.dir}/${maven.war.final.name} to ${destination}.war</echo>
- <copy file="${maven.war.build.dir}/${maven.war.final.name}"
- tofile="${destination}.war"/>
- </goal>
--->
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- default goal for the project builds and installs the war in the local repository -->
+<project default="full" xmlns:j="jelly:core"
+ xmlns:maven="jelly:maven">
+
+ <!-- the common "full" goal invokes the default goal. Used in maven -Dgoal=full multiproject:goal from .. -->
+ <goal name="full">
+ <!--attainGoal name="dependencies" /-->
+ <attainGoal name="war:install" />
+ </goal>
+
+ <!-- Override jar:install goal to compose "partial WAR" strategy -->
+ <goal name="jar:install">
+ <attainGoal name="war:install"/>
+ </goal>
+
+<!-- This standard stanza is required for any webapps participating in the
+ "partial WAR" build strategy -->
+ <preGoal name="war:resources">
+ <echo>Expanding webapp dependencies</echo>
+
+ <mkdir dir="${maven.war.webapp.dir}" />
+ <j:forEach var="lib" items="${pom.artifacts}">
+ <j:set var="dep" value="${lib.dependency}" />
+ <j:if test="${dep.getProperty('explode') == 'true'}">
+ <j:if test="${dep.type =='war'}">
+ <unjar src="${lib.path}" dest="${maven.war.webapp.dir}" />
+ </j:if>
+ </j:if>
+ </j:forEach>
+ </preGoal>
+
+<!-- Do not deploy for now, will be folded into each deployed user
+ <goal name="deploy" prereqs="war:install">
+ <maven:property defaultValue="${pom.artifactId}" var="webappName"
+ name="deploy.webappname" />
+ <j:set var="destination"
+ value="${maven.tomcat.home}/webapps/${webappName}" />
+ <delete dir="${destination}"/>
+ <echo>Copying ${maven.war.build.dir}/${maven.war.final.name} to ${destination}.war</echo>
+ <copy file="${maven.war.build.dir}/${maven.war.final.name}"
+ tofile="${destination}.war"/>
+ </goal>
+-->
+</project>
View
66 project.xml
@@ -1,36 +1,36 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project>
- <pomVersion>3</pomVersion>
- <artifactId>fluid-components</artifactId>
- <name>Fluid Infusion</name>
- <groupId>org.fluidproject</groupId>
- <currentVersion>1.1</currentVersion>
- <organization>
- <name>Fluid Project</name>
- <url>http://fluidproject.org</url>
- </organization>
- <inceptionYear>2007</inceptionYear>
- <properties>
- <!-- This project is NOT REALLY a JAR, but we want it not to deploy
- to the server when invoked as a byproduct of a Sakai build. -->
- <deploy.type>jar</deploy.type>
- </properties>
- <description>
- Fluid Components package, packaged for a standard Servlet environment.
- </description>
- <dependencies>
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <pomVersion>3</pomVersion>
+ <artifactId>fluid-components</artifactId>
+ <name>Fluid Infusion</name>
+ <groupId>org.fluidproject</groupId>
+ <currentVersion>1.1</currentVersion>
+ <organization>
+ <name>Fluid Project</name>
+ <url>http://fluidproject.org</url>
+ </organization>
+ <inceptionYear>2007</inceptionYear>
+ <properties>
+ <!-- This project is NOT REALLY a JAR, but we want it not to deploy
+ to the server when invoked as a byproduct of a Sakai build. -->
+ <deploy.type>jar</deploy.type>
+ </properties>
+ <description>
+ Fluid Components package, packaged for a standard Servlet environment.
+ </description>
+ <dependencies>
</dependencies>
<repository>
<connection>scm:svn:https://source.sakaiproject.org/contrib/utoronto/fluid/components/trunk</connection>
- </repository>
- <build>
- <sourceDirectory>src/java</sourceDirectory>
- <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
- <unitTest>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- </unitTest>
- </build>
-</project>
-
+ </repository>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+ <unitTest>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </unitTest>
+ </build>
+</project>
+
View
14 src/webapp/WEB-INF/web.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0"?>
-<!DOCTYPE web-app PUBLIC
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
-<!-- This empty web.xml is required by the darn Maven 2 war plugin - it should
-never appear in an application -->
+<?xml version="1.0"?>
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+<!-- This empty web.xml is required by the darn Maven 2 war plugin - it should
+never appear in an application -->
</web-app>
View
56 src/webapp/components/inlineEdit/css/InlineEdit.css
@@ -1,28 +1,28 @@
-.fl-inlineEdit-edit {margin:-2px; padding:0;}
-
-
-/* Base Appearance & States Appearance */
-.fl-inlineEdit-tooltip {
- position : absolute;
- background : #CCC;
- border : 1px solid #999;
- font : normal 75% sans-serif;
- padding : 3px 5px;
-}
-
-/* :hover */
-.fl-inlineEdit-invitation {
- border : 1px solid #999;
- background : lightyellow;
- cursor : pointer;
- /*margin : -1px;*/
-}
-
-/* :focus */
-.fl-inlineEdit-focus{
-
-}
-
-
-/* Themed Appearance + Themed States */
-
+.fl-inlineEdit-edit {margin:-2px; padding:0;}
+
+
+/* Base Appearance & States Appearance */
+.fl-inlineEdit-tooltip {
+ position : absolute;
+ background : #CCC;
+ border : 1px solid #999;
+ font : normal 75% sans-serif;
+ padding : 3px 5px;
+}
+
+/* :hover */
+.fl-inlineEdit-invitation {
+ border : 1px solid #999;
+ background : lightyellow;
+ cursor : pointer;
+ /*margin : -1px;*/
+}
+
+/* :focus */
+.fl-inlineEdit-focus{
+
+}
+
+
+/* Themed Appearance + Themed States */
+
View
1,344 src/webapp/components/inlineEdit/js/InlineEdit.js
@@ -1,672 +1,672 @@
-/*
-Copyright 2008-2009 University of Cambridge
-Copyright 2008-2009 University of Toronto
-Copyright 2007-2009 University of California, Berkeley
-
-Licensed under the Educational Community License (ECL), Version 2.0 or the New
-BSD license. You may not use this file except in compliance with one these
-Licenses.
-
-You may obtain a copy of the ECL 2.0 License and BSD License at
-https://source.fluidproject.org/svn/LICENSE.txt
-*/
-
-/*global jQuery*/
-/*global fluid_1_1*/
-
-fluid_1_1 = fluid_1_1 || {};
-
-(function ($, fluid) {
-
- function sendKey(control, event, virtualCode, charCode) {
- var kE = document.createEvent("KeyEvents");
- kE.initKeyEvent(event, 1, 1, null, 0, 0, 0, 0, virtualCode, charCode);
- control.dispatchEvent(kE);
- }
-
- /** Set the caret position to the end of a text field's value, also taking care
- * to scroll the field so that this position is visible.
- * @param {DOM node} control The control to be scrolled (input, or possibly textarea)
- * @param value The current value of the control
- */
- fluid.setCaretToEnd = function (control, value) {
- var pos = value? value.length : 0;
-
- try {
- control.focus();
- // see http://www.quirksmode.org/dom/range_intro.html - in Opera, must detect setSelectionRange first,
- // since its support for Microsoft TextRange is buggy
- if (control.setSelectionRange) {
-
- control.setSelectionRange(pos, pos);
- if ($.browser.mozilla && pos > 0) {
- // ludicrous fix for Firefox failure to scroll to selection position, inspired by
- // http://bytes.com/forum/thread496726.html
- sendKey(control, "keypress", 92, 92); // type in a junk character
- sendKey(control, "keydown", 8, 0); // delete key must be dispatched exactly like this
- sendKey(control, "keypress", 8, 0);
- }
- }
-
- else if (control.createTextRange) {
- var range = control.createTextRange();
- range.move("character", pos);
- range.select();
- }
- }
- catch (e) {}
- };
-
- fluid.deadMansBlur = function (control, exclusions, handler) {
- var blurPending = false;
- $(control).blur(function () {
- blurPending = true;
- setTimeout(function () {
- if (blurPending) {
- handler(control);
- }
- }, 150);
- });
- var canceller = function () {blurPending = false; };
- exclusions.focus(canceller);
- exclusions.click(canceller);
- };
-
- var renderEditContainer = function (that, really) {
- // If an edit container is found in the markup, use it. Otherwise generate one based on the view text.
- that.editContainer = that.locate("editContainer");
- that.editField = that.locate("edit");
- if (that.editContainer.length !== 1) {
- if (that.editField.length === 1) {
- // if all the same we found a unique edit field, use it as both container and field (FLUID-844)
- that.editContainer = that.editField;
- }
- else if (that.editContainer.length > 1) {
- fluid.fail("InlineEdit did not find a unique container for selector " + that.options.selectors.editContainer +
- ": " + fluid.dumpEl(that.editContainer));
- }
- }
- if (that.editContainer.length === 1 && !that.editField) {
- that.editField = that.locate("edit", that.editContainer);
- }
- if (!really) {return; } // do not invoke the renderer, unless this is the "final" effective time
- var editElms = that.options.editModeRenderer(that);
- if (editElms) {
- that.editContainer = editElms.container;
- that.editField = editElms.field;
- }
-
- if (that.editField.length === 0) {
- fluid.fail("InlineEdit improperly initialised - editField could not be located (selector " + that.options.selectors.edit + ")");
- }
- };
-
- var switchToViewMode = function (that) {
- that.editContainer.hide();
- that.viewEl.show();
- };
-
- var cancel = function (that) {
- if (that.isEditing()) {
- // Roll the edit field back to its old value and close it up.
- that.editView.value(that.model.value);
- switchToViewMode(that);
- }
- };
-
- var finish = function (that) {
- var newValue = that.editView.value();
- var oldValue = that.model.value;
-
- var viewNode = that.viewEl[0];
- var editNode = that.editField[0];
- var ret = that.events.onFinishEdit.fire(newValue, oldValue, editNode, viewNode);
- if (ret === false) {
- return;
- }
-
- that.updateModelValue(newValue);
- that.events.afterFinishEdit.fire(newValue, oldValue, editNode, viewNode);
-
- switchToViewMode(that);
- };
-
- var bindEditFinish = function (that) {
- if (that.options.submitOnEnter === undefined) {
- that.options.submitOnEnter = "textarea" !== fluid.unwrap(that.editField).nodeName.toLowerCase();
- }
- function keyCode(evt) {
- // Fix for handling arrow key presses. See FLUID-760.
- return evt.keyCode ? evt.keyCode : (evt.which ? evt.which : 0);
- }
- var escHandler = function (evt) {
- var code = keyCode(evt);
- if (code === $.ui.keyCode.ESCAPE) {
- cancel(that);
- return false;
- }
- };
- var finishHandler = function (evt) {
- var code = keyCode(evt);
- if (code !== $.ui.keyCode.ENTER) {
- return true;
- }
-
- finish(that);
- that.viewEl.focus(); // Moved here from inside "finish" to fix FLUID-857
- return false;
- };
- if (that.options.submitOnEnter) {
- that.editContainer.keypress(finishHandler);
- }
- that.editContainer.keydown(escHandler);
- };
-
- var bindBlurHandler = function (that) {
- if (that.options.blurHandlerBinder) {
- that.options.blurHandlerBinder(that);
- }
- else {
- var blurHandler = function (evt) {
- finish(that);
- return false;
- };
- that.editField.blur(blurHandler);
- }
- };
-
- var initializeEditView = function (that, initial) {
- if (!that.editInitialized) {
- renderEditContainer(that, !that.options.lazyEditView || !initial);
- if (!that.options.lazyEditView || !initial) {
- that.editView = fluid.initSubcomponent(that, "editView", that.editField);
-
- $.extend(true, that.editView, fluid.initSubcomponent(that, "editAccessor", that.editField));
-
- bindEditFinish(that);
- bindBlurHandler(that);
- that.editView.refreshView(that);
-
- that.editInitialized = true;
- }
- }
- };
-
- var edit = function (that) {
- initializeEditView(that, false);
-
- var viewEl = that.viewEl;
- var displayText = that.displayView.value();
- that.updateModelValue(displayText === that.options.defaultViewText? "" : displayText);
- if (that.options.applyEditPadding) {
- that.editField.width(Math.max(viewEl.width() + that.options.paddings.edit, that.options.paddings.minimumEdit));
- }
-
- viewEl.removeClass(that.options.styles.invitation);
- viewEl.removeClass(that.options.styles.focus);
- viewEl.hide();
- that.editContainer.show();
- if (that.tooltipEnabled()) {
- $("#" + that.options.tooltipId).hide();
- }
-
- // Work around for FLUID-726
- // Without 'setTimeout' the finish handler gets called with the event and the edit field is inactivated.
- setTimeout(function () {
- that.editField.focus();
- fluid.setCaretToEnd(that.editField[0], that.editView.value());
- if (that.options.selectOnEdit) {
- that.editField[0].select();
- }
- }, 0);
- that.events.afterBeginEdit.fire();
- };
-
- var clearEmptyViewStyles = function (textEl, defaultViewStyle, originalViewPadding) {
- textEl.removeClass(defaultViewStyle);
- textEl.css('padding-right', originalViewPadding);
- };
-
- var showDefaultViewText = function (that) {
- that.displayView.value(that.options.defaultViewText);
- that.viewEl.css('padding-right', that.existingPadding);
- that.viewEl.addClass(that.options.styles.defaultViewStyle);
- };
-
- var showNothing = function (that) {
- that.displayView.value("");
-
- // workaround for FLUID-938:
- // IE can not style an empty inline element, so force element to be display: inline-block
- if ($.browser.msie) {
- if (that.viewEl.css('display') === 'inline') {
- that.viewEl.css('display', "inline-block");
- }
- }
- };
-
- var showEditedText = function (that) {
- that.displayView.value(that.model.value);
- clearEmptyViewStyles(that.viewEl, that.options.styles.defaultViewStyle, that.existingPadding);
- };
-
- var refreshView = function (that, source) {
- that.displayView.refreshView(that, source);
- if (that.editView) {
- that.editView.refreshView(that, source);
- }
- };
-
- var initModel = function (that, value) {
- that.model.value = value;
- that.refreshView();
- };
-
- var updateModelValue = function (that, newValue, source) {
- if (that.model.value !== newValue) {
- var oldModel = $.extend(true, {}, that.model);
- that.model.value = newValue;
- that.events.modelChanged.fire(that.model, oldModel, source);
- that.refreshView(source);
- }
- };
-
- var bindHoverHandlers = function (viewEl, invitationStyle) {
- var over = function (evt) {
- viewEl.addClass(invitationStyle);
- };
- var out = function (evt) {
- viewEl.removeClass(invitationStyle);
- };
-
- viewEl.hover(over, out);
- };
-
- var makeEditHandler = function (that) {
- return function () {
- var prevent = that.events.onBeginEdit.fire();
- if (prevent === false) {
- return false;
- }
- edit(that);
-
- return true;
- };
- };
-
- function makeEditTriggerGuard(that) {
- var viewEl = fluid.unwrap(that.viewEl);
- return function (event) {
- // FLUID-2017 - avoid triggering edit mode when operating standard HTML controls. Ultimately this
- // might need to be extensible, in more complex authouring scenarios.
- var outer = fluid.findAncestor(event.target, function (elem) {
- if (/input|select|textarea|button|a/i.test(elem.nodeName) || elem === viewEl) {return true; }
- });
- if (outer === viewEl) {
- that.edit();
- return false;
- }
- };
- }
-
- var bindMouseHandlers = function (that) {
- bindHoverHandlers(that.viewEl, that.options.styles.invitation);
- that.viewEl.click(makeEditTriggerGuard(that));
- };
-
- var bindHighlightHandler = function (viewEl, focusStyle, invitationStyle) {
- var focusOn = function () {
- viewEl.addClass(focusStyle);
- viewEl.addClass(invitationStyle);
- };
- var focusOff = function () {
- viewEl.removeClass(focusStyle);
- viewEl.removeClass(invitationStyle);
- };
- viewEl.focus(focusOn);
- viewEl.blur(focusOff);
- };
-
- var bindKeyboardHandlers = function (that) {
- fluid.tabbable(that.viewEl);
- var guard = makeEditTriggerGuard(that);
- fluid.activatable(that.viewEl,
- function (event) {
- return guard(event);
- });
- };
-
- var aria = function (viewEl, editContainer) {
- viewEl.attr("role", "button");
- };
-
- var defaultEditModeRenderer = function (that) {
- if (that.editContainer.length > 0 && that.editField.length > 0) {
- return {
- container: that.editContainer,
- field: that.editField
- };
- }
- // Template strings.
- var editModeTemplate = "<span><input type='text' class='flc-inlineEdit-edit fl-inlineEdit-edit'/></span>";
-
- // Create the edit container and pull out the textfield.
- var editContainer = $(editModeTemplate);
- var editField = $("input", editContainer);
-
- var componentContainerId = that.container.attr("id");
- // Give the container and textfield a reasonable set of ids if necessary.
- if (componentContainerId) {
- var editContainerId = componentContainerId + "-edit-container";
- var editFieldId = componentContainerId + "-edit";
- editContainer.attr("id", editContainerId);
- editField.attr("id", editFieldId);
- }
-
- // Inject it into the DOM.
- that.viewEl.after(editContainer);
-
- // Package up the container and field for the component.
- return {
- container: editContainer,
- field: editField
- };
- };
-
- var makeIsEditing = function (that) {
- var isEditing = false;
- that.events.onBeginEdit.addListener(function () {isEditing = true; });
- that.events.afterFinishEdit.addListener(function () {isEditing = false; });
- return function () {return isEditing; };
- };
-
- var setupInlineEdit = function (componentContainer, that) {
- var padding = that.viewEl.css("padding-right");
- that.existingPadding = padding? parseFloat(padding) : 0;
- initModel(that, that.displayView.value());
-
- // Add event handlers.
- bindMouseHandlers(that);
- bindKeyboardHandlers(that);
-
- bindHighlightHandler(that.viewEl, that.options.styles.focus, that.options.styles.invitation);
-
- // Add ARIA support.
- aria(that.viewEl);
-
- // Hide the edit container to start
- if (that.editContainer) {
- that.editContainer.hide();
- }
-
- // Initialize the tooltip once the document is ready.
- // For more details, see http://issues.fluidproject.org/browse/FLUID-1030
- var initTooltip = function () {
- // Add tooltip handler if required and available
- if (that.tooltipEnabled()) {
- that.viewEl.tooltip({
- delay: that.options.tooltipDelay,
- extraClass: that.options.styles.tooltip,
- bodyHandler: function () {
- return that.options.tooltipText;
- },
- id: that.options.tooltipId
- });
- }
- };
- $(initTooltip);
-
- // Setup any registered decorators for the component.
- that.decorators = fluid.initSubcomponents(that, "componentDecorators",
- [that, fluid.COMPONENT_OPTIONS]);
- };
-
- /**
- * Creates a whole list of inline editors.
- */
- var setupInlineEdits = function (editables, options) {
- var editors = [];
- editables.each(function (idx, editable) {
- editors.push(fluid.inlineEdit($(editable), options));
- });
-
- return editors;
- };
-
- /**
- * Instantiates a new Inline Edit component
- *
- * @param {Object} componentContainer a selector, jquery, or a dom element representing the component's container
- * @param {Object} options a collection of options settings
- */
- fluid.inlineEdit = function (componentContainer, userOptions) {
- var that = fluid.initView("inlineEdit", componentContainer, userOptions);
-
- that.viewEl = that.locate("text");
- that.displayView = fluid.initSubcomponent(that, "displayView", that.viewEl);
- $.extend(true, that.displayView, fluid.initSubcomponent(that, "displayAccessor", that.viewEl));
-
- /**
- * The current value of the inline editable text. The "model" in MVC terms.
- */
- that.model = {value: ""};
-
- /**
- * Switches to edit mode.
- */
- that.edit = makeEditHandler(that);
-
- /**
- * Determines if the component is currently in edit mode.
- *
- * @return true if edit mode shown, false if view mode is shown
- */
- that.isEditing = makeIsEditing(that);
-
- /**
- * Finishes editing, switching back to view mode.
- */
- that.finish = function () {
- finish(that);
- };
-
- /**
- * Cancels the in-progress edit and switches back to view mode.
- */
- that.cancel = function () {
- cancel(that);
- };
-
- /**
- * Determines if the tooltip feature is enabled.
- *
- * @return true if the tooltip feature is turned on, false if not
- */
- that.tooltipEnabled = function () {
- return that.options.useTooltip && $.fn.tooltip;
- };
-
- /**
- * Updates the state of the inline editor in the DOM, based on changes that may have
- * happened to the model.
- *
- * @param {Object} source
- */
- that.refreshView = function (source) {
- refreshView(that, source);
- };
-
- /**
- * Pushes external changes to the model into the inline editor, refreshing its
- * rendering in the DOM. The modelChanged event will fire.
- *
- * @param {String} newValue The bare value of the model, that is, the string being edited
- * @param {Object} source An optional "source" (perhaps a DOM element) which triggered this event
- */
- that.updateModelValue = function (newValue, source) {
- updateModelValue(that, newValue, source);
- };
-
- /**
- * Pushes external changes to the model into the inline editor, refreshing its
- * rendering in the DOM. The modelChanged event will fire.
- *
- * @param {Object} newValue The full value of the new model, that is, a model object which contains the editable value as the element named "value"
- * @param {Object} source An optional "source" (perhaps a DOM element) which triggered this event
- */
- that.updateModel = function (newModel, source) {
- updateModelValue(that, newModel.value, source);
- };
-
- initializeEditView(that, true);
- setupInlineEdit(componentContainer, that);
- return that;
- };
-
-
- fluid.inlineEdit.standardAccessor = function (element) {
- var nodeName = element.nodeName.toLowerCase();
- var func = "input" === nodeName || "textarea" === nodeName? "val" : "text";
- return {
- value: function (newValue) {
- return $(element)[func](newValue);
- }
- };
- };
-
- fluid.inlineEdit.richTextViewAccessor = function (element) {
- return {
- value: function (newValue) {
- return $(element).html(newValue);
- }
- };
- };
-
- fluid.inlineEdit.standardDisplayView = function (viewEl) {
- var that = {
- refreshView: function (componentThat, source) {
- if (componentThat.model.value) {
- showEditedText(componentThat);
- } else if (componentThat.options.defaultViewText) {
- showDefaultViewText(componentThat);
- } else {
- showNothing(componentThat);
- }
- // If necessary, pad the view element enough that it will be evident to the user.
- if (($.trim(componentThat.viewEl.text()).length === 0) &&
- (componentThat.existingPadding < componentThat.options.paddings.minimumView)) {
- componentThat.viewEl.css('padding-right', componentThat.options.paddings.minimumView);
- }
- }
- };
- return that;
- };
-
- fluid.inlineEdit.standardEditView = function (editField) {
- var that = {
- refreshView: function (componentThat, source) {
- if (componentThat.editField && componentThat.editField.index(source) === -1) {
- componentThat.editView.value(componentThat.model.value);
- }
- }
- };
- $.extend(true, that, fluid.inlineEdit.standardAccessor(editField));
- return that;
- };
-
- /**
- * Instantiates a list of InlineEdit components.
- *
- * @param {Object} componentContainer the element containing the inline editors
- * @param {Object} options configuration options for the components
- */
- fluid.inlineEdits = function (componentContainer, options) {
- options = options || {};
- var selectors = $.extend({}, fluid.defaults("inlineEdits").selectors, options.selectors);
-
- // Bind to the DOM.
- var container = fluid.container(componentContainer);
- var editables = $(selectors.editables, container);
-
- return setupInlineEdits(editables, options);
- };
-
- fluid.defaults("inlineEdit", {
- selectors: {
- text: ".flc-inlineEdit-text",
- editContainer: ".flc-inlineEdit-editContainer",
- edit: ".flc-inlineEdit-edit"
- },
-
- styles: {
- text: "fl-inlineEdit-text",
- edit: "fl-inlineEdit-edit",
- invitation: "fl-inlineEdit-invitation",
- defaultViewStyle: "fl-inlineEdit-invitation-text",
- tooltip: "fl-inlineEdit-tooltip",
- focus: "fl-inlineEdit-focus"
- },
-
- events: {
- modelChanged: null,
- onBeginEdit: "preventable",
- afterBeginEdit: null,
- onFinishEdit: "preventable",
- afterFinishEdit: null,
- afterInitEdit: null
- },
-
- paddings: {
- edit: 10,
- minimumEdit: 80,
- minimumView: 60
- },
-
- applyEditPadding: true,
-
- blurHandlerBinder: null,
- // set this to true or false to cause unconditional submission, otherwise it will
- // be inferred from the edit element tag type.
- submitOnEnter: undefined,
-
- displayAccessor: {
- type: "fluid.inlineEdit.standardAccessor"
- },
-
- displayView: {
- type: "fluid.inlineEdit.standardDisplayView"
- },
-
- editAccessor: {
- type: "fluid.inlineEdit.standardAccessor"
- },
-
- editView: {
- type: "fluid.inlineEdit.standardEditView"
- },
-
- editModeRenderer: defaultEditModeRenderer,
-
- lazyEditView: false,
-
- defaultViewText: "Click here to edit",
-
- tooltipText: "Click item to edit",
-
- tooltipId: "tooltip",
-
- useTooltip: false,
-
- tooltipDelay: 1000,
-
- selectOnEdit: false
- });
-
-
- fluid.defaults("inlineEdits", {
- selectors: {
- editables: ".flc-inlineEditable"
- }
- });
-
-})(jQuery, fluid_1_1);
+/*
+Copyright 2008-2009 University of Cambridge
+Copyright 2008-2009 University of Toronto
+Copyright 2007-2009 University of California, Berkeley
+
+Licensed under the Educational Community License (ECL), Version 2.0 or the New
+BSD license. You may not use this file except in compliance with one these
+Licenses.
+
+You may obtain a copy of the ECL 2.0 License and BSD License at
+https://source.fluidproject.org/svn/LICENSE.txt
+*/
+
+/*global jQuery*/
+/*global fluid_1_1*/
+
+fluid_1_1 = fluid_1_1 || {};
+
+(function ($, fluid) {
+
+ function sendKey(control, event, virtualCode, charCode) {
+ var kE = document.createEvent("KeyEvents");
+ kE.initKeyEvent(event, 1, 1, null, 0, 0, 0, 0, virtualCode, charCode);
+ control.dispatchEvent(kE);
+ }
+
+ /** Set the caret position to the end of a text field's value, also taking care
+ * to scroll the field so that this position is visible.
+ * @param {DOM node} control The control to be scrolled (input, or possibly textarea)
+ * @param value The current value of the control
+ */
+ fluid.setCaretToEnd = function (control, value) {
+ var pos = value? value.length : 0;
+
+ try {
+ control.focus();
+ // see http://www.quirksmode.org/dom/range_intro.html - in Opera, must detect setSelectionRange first,
+ // since its support for Microsoft TextRange is buggy
+ if (control.setSelectionRange) {
+
+ control.setSelectionRange(pos, pos);
+ if ($.browser.mozilla && pos > 0) {
+ // ludicrous fix for Firefox failure to scroll to selection position, inspired by
+ // http://bytes.com/forum/thread496726.html
+ sendKey(control, "keypress", 92, 92); // type in a junk character
+ sendKey(control, "keydown", 8, 0); // delete key must be dispatched exactly like this
+ sendKey(control, "keypress", 8, 0);
+ }
+ }
+
+ else if (control.createTextRange) {
+ var range = control.createTextRange();
+ range.move("character", pos);
+ range.select();
+ }
+ }
+ catch (e) {}
+ };
+
+ fluid.deadMansBlur = function (control, exclusions, handler) {
+ var blurPending = false;
+ $(control).blur(function () {
+ blurPending = true;
+ setTimeout(function () {
+ if (blurPending) {
+ handler(control);
+ }
+ }, 150);
+ });
+ var canceller = function () {blurPending = false; };
+ exclusions.focus(canceller);
+ exclusions.click(canceller);
+ };
+
+ var renderEditContainer = function (that, really) {
+ // If an edit container is found in the markup, use it. Otherwise generate one based on the view text.
+ that.editContainer = that.locate("editContainer");
+ that.editField = that.locate("edit");
+ if (that.editContainer.length !== 1) {
+ if (that.editField.length === 1) {
+ // if all the same we found a unique edit field, use it as both container and field (FLUID-844)
+ that.editContainer = that.editField;
+ }
+ else if (that.editContainer.length > 1) {
+ fluid.fail("InlineEdit did not find a unique container for selector " + that.options.selectors.editContainer +
+ ": " + fluid.dumpEl(that.editContainer));
+ }
+ }
+ if (that.editContainer.length === 1 && !that.editField) {
+ that.editField = that.locate("edit", that.editContainer);
+ }
+ if (!really) {return; } // do not invoke the renderer, unless this is the "final" effective time
+ var editElms = that.options.editModeRenderer(that);
+ if (editElms) {
+ that.editContainer = editElms.container;
+ that.editField = editElms.field;
+ }
+
+ if (that.editField.length === 0) {
+ fluid.fail("InlineEdit improperly initialised - editField could not be located (selector " + that.options.selectors.edit + ")");
+ }
+ };
+
+ var switchToViewMode = function (that) {
+ that.editContainer.hide();
+ that.viewEl.show();
+ };
+
+ var cancel = function (that) {
+ if (that.isEditing()) {
+ // Roll the edit field back to its old value and close it up.
+ that.editView.value(that.model.value);
+ switchToViewMode(that);
+ }
+ };
+
+ var finish = function (that) {
+ var newValue = that.editView.value();
+ var oldValue = that.model.value;
+
+ var viewNode = that.viewEl[0];
+ var editNode = that.editField[0];
+ var ret = that.events.onFinishEdit.fire(newValue, oldValue, editNode, viewNode);
+ if (ret === false) {
+ return;
+ }
+
+ that.updateModelValue(newValue);
+ that.events.afterFinishEdit.fire(newValue, oldValue, editNode, viewNode);
+
+ switchToViewMode(that);
+ };
+
+ var bindEditFinish = function (that) {
+ if (that.options.submitOnEnter === undefined) {
+ that.options.submitOnEnter = "textarea" !== fluid.unwrap(that.editField).nodeName.toLowerCase();
+ }
+ function keyCode(evt) {
+ // Fix for handling arrow key presses. See FLUID-760.
+ return evt.keyCode ? evt.keyCode : (evt.which ? evt.which : 0);
+ }
+ var escHandler = function (evt) {
+ var code = keyCode(evt);
+ if (code === $.ui.keyCode.ESCAPE) {
+ cancel(that);
+ return false;
+ }
+ };
+ var finishHandler = function (evt) {
+ var code = keyCode(evt);
+ if (code !== $.ui.keyCode.ENTER) {
+ return true;
+ }
+
+ finish(that);
+ that.viewEl.focus(); // Moved here from inside "finish" to fix FLUID-857
+ return false;
+ };
+ if (that.options.submitOnEnter) {
+ that.editContainer.keypress(finishHandler);
+ }
+ that.editContainer.keydown(escHandler);
+ };
+
+ var bindBlurHandler = function (that) {
+ if (that.options.blurHandlerBinder) {
+ that.options.blurHandlerBinder(that);
+ }
+ else {
+ var blurHandler = function (evt) {
+ finish(that);
+ return false;
+ };
+ that.editField.blur(blurHandler);
+ }
+ };
+
+ var initializeEditView = function (that, initial) {
+ if (!that.editInitialized) {
+ renderEditContainer(that, !that.options.lazyEditView || !initial);
+ if (!that.options.lazyEditView || !initial) {
+ that.editView = fluid.initSubcomponent(that, "editView", that.editField);
+
+ $.extend(true, that.editView, fluid.initSubcomponent(that, "editAccessor", that.editField));
+
+ bindEditFinish(that);
+ bindBlurHandler(that);
+ that.editView.refreshView(that);
+
+ that.editInitialized = true;
+ }
+ }
+ };
+
+ var edit = function (that) {
+ initializeEditView(that, false);
+
+ var viewEl = that.viewEl;
+ var displayText = that.displayView.value();
+ that.updateModelValue(displayText === that.options.defaultViewText? "" : displayText);
+ if (that.options.applyEditPadding) {
+ that.editField.width(Math.max(viewEl.width() + that.options.paddings.edit, that.options.paddings.minimumEdit));
+ }
+
+ viewEl.removeClass(that.options.styles.invitation);
+ viewEl.removeClass(that.options.styles.focus);
+ viewEl.hide();
+ that.editContainer.show();
+ if (that.tooltipEnabled()) {
+ $("#" + that.options.tooltipId).hide();
+ }
+
+ // Work around for FLUID-726
+ // Without 'setTimeout' the finish handler gets called with the event and the edit field is inactivated.
+ setTimeout(function () {
+ that.editField.focus();
+ fluid.setCaretToEnd(that.editField[0], that.editView.value());
+ if (that.options.selectOnEdit) {
+ that.editField[0].select();
+ }
+ }, 0);
+ that.events.afterBeginEdit.fire();
+ };
+
+ var clearEmptyViewStyles = function (textEl, defaultViewStyle, originalViewPadding) {
+ textEl.removeClass(defaultViewStyle);
+ textEl.css('padding-right', originalViewPadding);
+ };
+
+ var showDefaultViewText = function (that) {
+ that.displayView.value(that.options.defaultViewText);
+ that.viewEl.css('padding-right', that.existingPadding);
+ that.viewEl.addClass(that.options.styles.defaultViewStyle);
+ };
+
+ var showNothing = function (that) {
+ that.displayView.value("");
+
+ // workaround for FLUID-938:
+ // IE can not style an empty inline element, so force element to be display: inline-block
+ if ($.browser.msie) {
+ if (that.viewEl.css('display') === 'inline') {
+ that.viewEl.css('display', "inline-block");
+ }
+ }
+ };
+
+ var showEditedText = function (that) {
+ that.displayView.value(that.model.value);
+ clearEmptyViewStyles(that.viewEl, that.options.styles.defaultViewStyle, that.existingPadding);
+ };
+
+ var refreshView = function (that, source) {
+ that.displayView.refreshView(that, source);
+ if (that.editView) {
+ that.editView.refreshView(that, source);
+ }
+ };
+
+ var initModel = function (that, value) {
+ that.model.value = value;
+ that.refreshView();
+ };
+
+ var updateModelValue = function (that, newValue, source) {
+ if (that.model.value !== newValue) {
+ var oldModel = $.extend(true, {}, that.model);
+ that.model.value = newValue;
+ that.events.modelChanged.fire(that.model, oldModel, source);
+ that.refreshView(source);
+ }
+ };
+
+ var bindHoverHandlers = function (viewEl, invitationStyle) {
+ var over = function (evt) {
+ viewEl.addClass(invitationStyle);
+ };
+ var out = function (evt) {
+ viewEl.removeClass(invitationStyle);
+ };
+
+ viewEl.hover(over, out);
+ };
+
+ var makeEditHandler = function (that) {
+ return function () {
+ var prevent = that.events.onBeginEdit.fire();
+ if (prevent === false) {
+ return false;
+ }
+ edit(that);
+
+ return true;
+ };
+ };
+
+ function makeEditTriggerGuard(that) {
+ var viewEl = fluid.unwrap(that.viewEl);
+ return function (event) {
+ // FLUID-2017 - avoid triggering edit mode when operating standard HTML controls. Ultimately this
+ // might need to be extensible, in more complex authouring scenarios.
+ var outer = fluid.findAncestor(event.target, function (elem) {
+ if (/input|select|textarea|button|a/i.test(elem.nodeName) || elem === viewEl) {return true; }
+ });
+ if (outer === viewEl) {
+ that.edit();
+ return false;
+ }
+ };
+ }
+
+ var bindMouseHandlers = function (that) {
+ bindHoverHandlers(that.viewEl, that.options.styles.invitation);
+ that.viewEl.click(makeEditTriggerGuard(that));
+ };
+
+ var bindHighlightHandler = function (viewEl, focusStyle, invitationStyle) {
+ var focusOn = function () {
+ viewEl.addClass(focusStyle);
+ viewEl.addClass(invitationStyle);
+ };
+ var focusOff = function () {
+ viewEl.removeClass(focusStyle);
+ viewEl.removeClass(invitationStyle);
+ };
+ viewEl.focus(focusOn);
+ viewEl.blur(focusOff);
+ };
+
+ var bindKeyboardHandlers = function (that) {
+ fluid.tabbable(that.viewEl);
+ var guard = makeEditTriggerGuard(that);
+ fluid.activatable(that.viewEl,
+ function (event) {
+ return guard(event);
+ });
+ };
+
+ var aria = function (viewEl, editContainer) {
+ viewEl.attr("role", "button");
+ };
+
+ var defaultEditModeRenderer = function (that) {
+ if (that.editContainer.length > 0 && that.editField.length > 0) {
+ return {
+ container: that.editContainer,
+ field: that.editField
+ };
+ }
+ // Template strings.
+ var editModeTemplate = "<span><input type='text' class='flc-inlineEdit-edit fl-inlineEdit-edit'/></span>";
+
+ // Create the edit container and pull out the textfield.
+ var editContainer = $(editModeTemplate);
+ var editField = $("input", editContainer);
+
+ var componentContainerId = that.container.attr("id");
+ // Give the container and textfield a reasonable set of ids if necessary.
+ if (componentContainerId) {
+ var editContainerId = componentContainerId + "-edit-container";
+ var editFieldId = componentContainerId + "-edit";
+ editContainer.attr("id", editContainerId);
+ editField.attr("id", editFieldId);
+ }
+
+ // Inject it into the DOM.
+ that.viewEl.after(editContainer);
+
+ // Package up the container and field for the component.
+ return {
+ container: editContainer,
+ field: editField
+ };
+ };
+
+ var makeIsEditing = function (that) {
+ var isEditing = false;
+ that.events.onBeginEdit.addListener(function () {isEditing = true; });
+ that.events.afterFinishEdit.addListener(function () {isEditing = false; });
+ return function () {return isEditing; };
+ };
+
+ var setupInlineEdit = function (componentContainer, that) {
+ var padding = that.viewEl.css("padding-right");
+ that.existingPadding = padding? parseFloat(padding) : 0;
+ initModel(that, that.displayView.value());
+
+ // Add event handlers.
+ bindMouseHandlers(that);
+ bindKeyboardHandlers(that);
+
+ bindHighlightHandler(that.viewEl, that.options.styles.focus, that.options.styles.invitation);
+
+ // Add ARIA support.
+ aria(that.viewEl);
+
+ // Hide the edit container to start
+ if (that.editContainer) {
+ that.editContainer.hide();
+ }
+
+ // Initialize the tooltip once the document is ready.
+ // For more details, see http://issues.fluidproject.org/browse/FLUID-1030
+ var initTooltip = function () {
+ // Add tooltip handler if required and available
+ if (that.tooltipEnabled()) {
+ that.viewEl.tooltip({
+ delay: that.options.tooltipDelay,
+ extraClass: that.options.styles.tooltip,
+ bodyHandler: function () {
+ return that.options.tooltipText;
+ },
+ id: that.options.tooltipId
+ });
+ }
+ };
+ $(initTooltip);
+
+ // Setup any registered decorators for the component.
+ that.decorators = fluid.initSubcomponents(that, "componentDecorators",
+ [that, fluid.COMPONENT_OPTIONS]);
+ };
+
+ /**
+ * Creates a whole list of inline editors.
+ */
+ var setupInlineEdits = function (editables, options) {
+ var editors = [];
+ editables.each(function (idx, editable) {
+ editors.push(fluid.inlineEdit($(editable), options));
+ });
+
+ return editors;
+ };
+
+ /**
+ * Instantiates a new Inline Edit component
+ *
+ * @param {Object} componentContainer a selector, jquery, or a dom element representing the component's container
+ * @param {Object} options a collection of options settings
+ */
+ fluid.inlineEdit = function (componentContainer, userOptions) {
+ var that = fluid.initView("inlineEdit", componentContainer, userOptions);
+
+ that.viewEl = that.locate("text");
+ that.displayView = fluid.initSubcomponent(that, "displayView", that.viewEl);
+ $.extend(true, that.displayView, fluid.initSubcomponent(that, "displayAccessor", that.viewEl));
+
+ /**
+ * The current value of the inline editable text. The "model" in MVC terms.
+ */
+ that.model = {value: ""};
+
+ /**
+ * Switches to edit mode.
+ */
+ that.edit = makeEditHandler(that);
+
+ /**
+ * Determines if the component is currently in edit mode.
+ *
+ * @return true if edit mode shown, false if view mode is shown
+ */
+ that.isEditing = makeIsEditing(that);
+
+ /**
+ * Finishes editing, switching back to view mode.
+ */
+ that.finish = function () {
+ finish(that);
+ };
+
+ /**
+ * Cancels the in-progress edit and switches back to view mode.
+ */
+ that.cancel = function () {
+ cancel(that);
+ };
+
+ /**
+ * Determines if the tooltip feature is enabled.
+ *
+ * @return true if the tooltip feature is turned on, false if not
+ */
+ that.tooltipEnabled = function () {
+ return that.options.useTooltip && $.fn.tooltip;
+ };
+
+ /**
+ * Updates the state of the inline editor in the DOM, based on changes that may have
+ * happened to the model.
+ *
+ * @param {Object} source
+ */
+ that.refreshView = function (source) {
+ refreshView(that, source);
+ };
+
+ /**
+ * Pushes external changes to the model into the inline editor, refreshing its
+ * rendering in the DOM. The modelChanged event will fire.
+ *
+ * @param {String} newValue The bare value of the model, that is, the string being edited
+ * @param {Object} source An optional "source" (perhaps a DOM element) which triggered this event
+ */
+ that.updateModelValue = function (newValue, source) {
+ updateModelValue(that, newValue, source);
+ };
+
+ /**
+ * Pushes external changes to the model into the inline editor, refreshing its
+ * rendering in the DOM. The modelChanged event will fire.
+ *
+ * @param {Object} newValue The full value of the new model, that is, a model object which contains the editable value as the element named "value"
+ * @param {Object} source An optional "source" (perhaps a DOM element) which triggered this event
+ */
+ that.updateModel = function (newModel, source) {
+ updateModelValue(that, newModel.value, source);
+ };
+
+ initializeEditView(that, true);
+ setupInlineEdit(componentContainer, that);
+ return that;
+ };
+
+
+ fluid.inlineEdit.standardAccessor = function (element) {
+ var nodeName = element.nodeName.toLowerCase();
+ var func = "input" === nodeName || "textarea" === nodeName? "val" : "text";
+ return {
+ value: function (newValue) {
+ return $(element)[func](newValue);
+ }
+ };
+ };
+
+ fluid.inlineEdit.richTextViewAccessor = function (element) {
+ return {
+ value: function (newValue) {
+ return $(element).html(newValue);
+ }
+ };
+ };
+
+ fluid.inlineEdit.standardDisplayView = function (viewEl) {
+ var that = {
+ refreshView: function (componentThat, source) {
+ if (componentThat.model.value) {
+ showEditedText(componentThat);
+ } else if (componentThat.options.defaultViewText) {
+ showDefaultViewText(componentThat);
+ } else {
+ showNothing(componentThat);
+ }
+ // If necessary, pad the view element enough that it will be evident to the user.
+ if (($.trim(componentThat.viewEl.text()).length === 0) &&
+ (componentThat.existingPadding < componentThat.options.paddings.minimumView)) {
+ componentThat.viewEl.css('padding-right', componentThat.options.paddings.minimumView);
+ }
+ }
+ };
+ return that;
+ };
+
+ fluid.inlineEdit.standardEditView = function (editField) {
+ var that = {
+ refreshView: function (componentThat, source) {
+ if (componentThat.editField && componentThat.editField.index(source) === -1) {
+ componentThat.editView.value(componentThat.model.value);
+ }
+ }
+ };
+ $.extend(true, that, fluid.inlineEdit.standardAccessor(editField));
+ return that;
+ };
+
+ /**
+ * Instantiates a list of InlineEdit components.
+ *
+ * @param {Object} componentContainer the element containing the inline editors
+ * @param {Object} options configuration options for the components
+ */
+ fluid.inlineEdits = function (componentContainer, options) {
+ options = options || {};
+ var selectors = $.extend({}, fluid.defaults("inlineEdits").selectors, options.selectors);
+
+ // Bind to the DOM.
+ var container = fluid.container(componentContainer);
+ var editables = $(selectors.editables, container);
+
+ return setupInlineEdits(editables, options);
+ };
+
+ fluid.defaults("inlineEdit", {
+ selectors: {
+ text: ".flc-inlineEdit-text",
+ editContainer: ".flc-inlineEdit-editContainer",
+ edit: ".flc-inlineEdit-edit"
+ },
+
+ styles: {
+ text: "fl-inlineEdit-text",
+ edit: "fl-inlineEdit-edit",
+ invitation: "fl-inlineEdit-invitation",
+ defaultViewStyle: "fl-inlineEdit-invitation-text",
+ tooltip: "fl-inlineEdit-tooltip",
+ focus: "fl-inlineEdit-focus"
+ },
+
+ events: {
+ modelChanged: null,
+ onBeginEdit: "preventable",
+ afterBeginEdit: null,
+ onFinishEdit: "preventable",
+ afterFinishEdit: null,
+ afterInitEdit: null
+ },
+
+ paddings: {
+ edit: 10,
+ minimumEdit: 80,
+ minimumView: 60
+ },
+
+ applyEditPadding: true,
+
+ blurHandlerBinder: null,
+ // set this to true or false to cause unconditional submission, otherwise it will
+ // be inferred from the edit element tag type.
+ submitOnEnter: undefined,
+
+ displayAccessor: {
+ type: "fluid.inlineEdit.standardAccessor"
+ },
+
+ displayView: {
+ type: "fluid.inlineEdit.standardDisplayView"
+ },
+
+ editAccessor: {
+ type: "fluid.inlineEdit.standardAccessor"
+ },
+
+ editView: {
+ type: "fluid.inlineEdit.standardEditView"
+ },
+
+ editModeRenderer: defaultEditModeRenderer,
+
+ lazyEditView: false,
+
+ defaultViewText: "Click here to edit",
+
+ tooltipText: "Click item to edit",
+
+ tooltipId: "tooltip",
+
+ useTooltip: false,
+
+ tooltipDelay: 1000,
+
+ selectOnEdit: false
+ });
+
+
+ fluid.defaults("inlineEdits", {
+ selectors: {
+ editables: ".flc-inlineEditable"
+ }
+ });
+
+})(jQuery, fluid_1_1);
View
606 src/webapp/components/inlineEdit/js/InlineEditIntegrations.js
@@ -1,304 +1,304 @@
-/*
-Copyright 2008-2009 University of Cambridge
-Copyright 2008-2009 University of Toronto
-Copyright 2007-2009 University of California, Berkeley
-
-Licensed under the Educational Community License (ECL), Version 2.0 or the New
-BSD license. You may not use this file except in compliance with one these
-Licenses.
-
-You may obtain a copy of the ECL 2.0 License and BSD License at
-https://source.fluidproject.org/svn/LICENSE.txt
-*/
-
-/*global jQuery*/
-/*global fluid_1_1*/
-/*global tinyMCE*/
-/*global FCKeditor*/
-/*global FCKeditorAPI*/
-/*global fluid*/ //this global function will refer to whichever version of Fluid Infusion was first loaded
-
-fluid_1_1 = fluid_1_1 || {};
-
-(function ($, fluid) {
-
- var configureInlineEdit = function (configurationName, container, options) {
- var assembleOptions = $.extend({}, fluid.defaults(configurationName), options);
- return fluid.inlineEdit(container, assembleOptions);
- };
-
- // Configuration for integrating tinyMCE
-
- /**
- * Instantiate a rich-text InlineEdit component that uses an instance of TinyMCE.
- *
- * @param {Object} componentContainer the element containing the inline editors
- * @param {Object} options configuration options for the components
- */
- fluid.inlineEdit.tinyMCE = function (container, options) {
- return configureInlineEdit("fluid.inlineEdit.tinyMCE", container, options);
- };
-
- fluid.inlineEdit.tinyMCE.viewAccessor = function (editField) {
- return {
- value: function (newValue) {
- var editor = tinyMCE.get(editField.id);
- if (!editor) {
- return "";
- }
- if (newValue) {
- // without this, there is an intermittent race condition if the editor has been created on this event.
- $(editField).val(newValue);
- editor.setContent(newValue, {format : 'raw'});
- }
- else {
- return editor.getContent();
- }
- }
- };
- };
-
- fluid.inlineEdit.tinyMCE.blurHandlerBinder = function (that) {
- function focusEditor(editor) {
- setTimeout(function () {
- tinyMCE.execCommand('mceFocus', false, that.editField[0].id);
- if ($.browser.mozilla && $.browser.version.substring(0, 3) === "1.8") {
- // Have not yet found any way to make this work on FF2.x - best to do nothing,
- // for FLUID-2206
- //var body = editor.getBody();
- //fluid.setCaretToEnd(body.firstChild, "");
- return;
- }
- editor.selection.select(editor.getBody(), 1);
- editor.selection.collapse(0);
- }, 10);
- }
-
- that.events.afterInitEdit.addListener(function (editor) {
- focusEditor(editor);
- var editorBody = editor.getBody();
-
- // NB - this section has no effect - on most browsers no focus events
- // are delivered to the actual body
- fluid.deadMansBlur(that.editField, $(editorBody), function () {
- that.cancel();
- });
- });
-
- that.events.afterBeginEdit.addListener(function () {
- var editor = tinyMCE.get(that.editField[0].id);
- if (editor) {
- focusEditor(editor);
- }
- });
- };
-
-
- fluid.inlineEdit.tinyMCE.editModeRenderer = function (that) {
- var defaultOptions = {
- mode: "exact",
- theme: "simple"
- };
- var options = $.extend(true, defaultOptions, that.options.tinyMCE);
- options.elements = fluid.allocateSimpleId(that.editField);
- var oldinit = options.init_instance_callback;
-
- options.init_instance_callback = function (instance) {
- that.events.afterInitEdit.fire(instance);
- if (oldinit) {
- oldinit();
- }
- };
-
- tinyMCE.init(options);
- };
-
-
- fluid.defaults("fluid.inlineEdit.tinyMCE", {
- useTooltip: true,
- selectors: {
- edit: "textarea"
- },
-
- styles: {
- invitation: null // Override because it causes problems with flickering. Help?
- },
- displayAccessor: {
- type: "fluid.inlineEdit.richTextViewAccessor"
- },
- editAccessor: {
- type: "fluid.inlineEdit.tinyMCE.viewAccessor"
- },
- lazyEditView: true,
- blurHandlerBinder: fluid.inlineEdit.tinyMCE.blurHandlerBinder,
- editModeRenderer: fluid.inlineEdit.tinyMCE.editModeRenderer
- });
-
-
-
- // Configuration for integrating FCKEditor
-
- /**
- * Instantiate a rich-text InlineEdit component that uses an instance of FCKeditor.
- *
- * @param {Object} componentContainer the element containing the inline editors
- * @param {Object} options configuration options for the components
- */
- fluid.inlineEdit.FCKEditor = function (container, options) {
- return configureInlineEdit("fluid.inlineEdit.FCKEditor", container, options);
- };
-
- fluid.inlineEdit.FCKEditor.complete = fluid.event.getEventFirer();
-
- fluid.inlineEdit.FCKEditor.complete.addListener(function (editor) {
- var editField = editor.LinkedField;
- var that = $.data(editField, "fluid.inlineEdit.FCKEditor");
- that.events.afterInitEdit.fire(editor);
- });
-
- fluid.inlineEdit.FCKEditor.blurHandlerBinder = function (that) {
- function focusEditor(editor) {
- editor.Focus();
- }
-
- that.events.afterInitEdit.addListener(
- function (editor) {
- focusEditor(editor);
- var editorBody = editor.EditingArea.TargetElement;
-
- // NB - this section has no effect - on most browsers no focus events
- // are delivered to the actual body
- //fluid.deadMansBlur(that.editField,
- // $(editorBody),
- // function () {
- // that.cancel();
- // });
- }
- );
- that.events.afterBeginEdit.addListener(function () {
- var editor = fluid.inlineEdit.FCKEditor.byId(that.editField[0].id);
- if (editor) {
- focusEditor(editor);
- }
- });
-
- };
-
- fluid.inlineEdit.FCKEditor.byId = function (id) {
- var editor = typeof(FCKeditorAPI) === "undefined"? null: FCKeditorAPI.GetInstance(id);
- return editor;
- };
-
- fluid.inlineEdit.FCKEditor.editModeRenderer = function (that) {
- var id = fluid.allocateSimpleId(that.editField);
- $.data(fluid.unwrap(that.editField), "fluid.inlineEdit.FCKEditor", that);
- var oFCKeditor = new FCKeditor(id);
- // The Config object and the FCKEditor object itself expose different configuration sets,
- // which possess a member "BasePath" with different meanings. Solve FLUID-2452, FLUID-2438
- // by auto-inferring the inner path for Config (method from http://drupal.org/node/344230 )
- var opcopy = fluid.copy(that.options.FCKEditor);
- opcopy.BasePath = opcopy.BasePath + "editor/";
- $.extend(true, oFCKeditor.Config, opcopy);
- // somehow, some properties like Width and Height are set on the object itself
-
- $.extend(true, oFCKeditor, that.options.FCKEditor);
- oFCKeditor.Config.fluidInstance = that;
- oFCKeditor.ReplaceTextarea();
- };
-
- fluid.inlineEdit.FCKEditor.viewAccessor = function (editField) {
- return {
- value: function (newValue) {
- var editor = fluid.inlineEdit.FCKEditor.byId(editField.id);
- if (!editor) {
- if (newValue) {
- $(editField).val(newValue);
- }
- return "";
- }
- if (newValue) {
- editor.SetHTML(newValue);
- }
- else {
- return editor.GetHTML();
- }
- }
- };
- };
-
-
- fluid.defaults("fluid.inlineEdit.FCKEditor", {
- selectors: {
- edit: "textarea"
- },
-
- styles: {
- invitation: null // Override because it causes problems with flickering. Help?
- },
-
- displayAccessor: {
- type: "fluid.inlineEdit.richTextViewAccessor"
- },
- editAccessor: {
- type: "fluid.inlineEdit.FCKEditor.viewAccessor"
- },
- lazyEditView: true,
- blurHandlerBinder: fluid.inlineEdit.FCKEditor.blurHandlerBinder,
- editModeRenderer: fluid.inlineEdit.FCKEditor.editModeRenderer,
- FCKEditor: {
- BasePath: "fckeditor/"
- }
- });
-
-
- // Configuration for integrating a drop-down editor
-
- /**
- * Instantiate a drop-down InlineEdit component
- *
- * @param {Object} container
- * @param {Object} options
- */
- fluid.inlineEdit.dropdown = function (container, options) {
- return configureInlineEdit("fluid.inlineEdit.dropdown", container, options);
- };
-
- fluid.inlineEdit.dropdown.editModeRenderer = function (that) {
- var id = fluid.allocateSimpleId(that.editField);
- that.editField.selectbox({
- finishHandler: function () {
- that.finish();
- }
- });
- return {
- container: that.editContainer,
- field: $("input.selectbox", that.editContainer)
- };
- };
-
- fluid.inlineEdit.dropdown.blurHandlerBinder = function (that) {
- fluid.deadMansBlur(that.editField,
- $("div.selectbox-wrapper li", that.editContainer),
- function () {
- that.cancel();
- });
- };
-
-
-
- fluid.defaults("fluid.inlineEdit.dropdown", {
- applyEditPadding: false,
- blurHandlerBinder: fluid.inlineEdit.dropdown.blurHandlerBinder,
- editModeRenderer: fluid.inlineEdit.dropdown.editModeRenderer
- });
-
-
-})(jQuery, fluid_1_1);
-
-
-// This must be written outside any scope as a result of the FCKEditor event model.
-// Do not overwrite this function, if you wish to add your own listener to FCK completion,
-// register it with the standard fluid event firer at fluid.inlineEdit.FCKEditor.complete
-function FCKeditor_OnComplete(editorInstance) {
- fluid.inlineEdit.FCKEditor.complete.fire(editorInstance);
+/*
+Copyright 2008-2009 University of Cambridge
+Copyright 2008-2009 University of Toronto
+Copyright 2007-2009 University of California, Berkeley
+
+Licensed under the Educational Community License (ECL), Version 2.0 or the New
+BSD license. You may not use this file except in compliance with one these
+Licenses.
+
+You may obtain a copy of the ECL 2.0 License and BSD License at
+https://source.fluidproject.org/svn/LICENSE.txt
+*/
+
+/*global jQuery*/
+/*global fluid_1_1*/
+/*global tinyMCE*/
+/*global FCKeditor*/
+/*global FCKeditorAPI*/
+/*global fluid*/ //this global function will refer to whichever version of Fluid Infusion was first loaded
+
+fluid_1_1 = fluid_1_1 || {};
+
+(function ($, fluid) {
+
+ var configureInlineEdit = function (configurationName, container, options) {
+ var assembleOptions = $.extend({}, fluid.defaults(configurationName), options);
+ return fluid.inlineEdit(container, assembleOptions);
+ };
+
+ // Configuration for integrating tinyMCE
+
+ /**
+ * Instantiate a rich-text InlineEdit component that uses an instance of TinyMCE.
+ *
+ * @param {Object} componentContainer the element containing the inline editors
+ * @param {Object} options configuration options for the components
+ */
+ fluid.inlineEdit.tinyMCE = function (container, options) {
+ return configureInlineEdit("fluid.inlineEdit.tinyMCE", container, options);
+ };
+
+ fluid.inlineEdit.tinyMCE.viewAccessor = function (editField) {
+ return {
+ value: function (newValue) {
+ var editor = tinyMCE.get(editField.id);
+ if (!editor) {
+ return "";
+ }
+ if (newValue) {
+ // without this, there is an intermittent race condition if the editor has been created on this event.
+ $(editField).val(newValue);
+ editor.setContent(newValue, {format : 'raw'});
+ }
+ else {
+ return editor.getContent();
+ }
+ }
+ };
+ };
+
+ fluid.inlineEdit.tinyMCE.blurHandlerBinder = function (that) {
+ function focusEditor(editor) {
+ setTimeout(function () {
+ tinyMCE.execCommand('mceFocus', false, that.editField[0].id);
+ if ($.browser.mozilla && $.browser.version.substring(0, 3) === "1.8") {
+ // Have not yet found any way to make this work on FF2.x - best to do nothing,
+ // for FLUID-2206
+ //var body = editor.getBody();
+ //fluid.setCaretToEnd(body.firstChild, "");
+ return;
+ }
+ editor.selection.select(editor.getBody(), 1);
+ editor.selection.collapse(0);
+ }, 10);
+ }
+
+ that.events.afterInitEdit.addListener(function (editor) {
+ focusEditor(editor);
+ var editorBody = editor.getBody();
+
+ // NB - this section has no effect - on most browsers no focus events
+ // are delivered to the actual body
+ fluid.deadMansBlur(that.editField, $(editorBody), function () {
+ that.cancel();
+ });
+ });
+
+ that.events.afterBeginEdit.addListener(function () {
+ var editor = tinyMCE.get(that.editField[0].id);
+ if (editor) {
+ focusEditor(editor);
+ }
+ });
+ };
+
+
+ fluid.inlineEdit.tinyMCE.editModeRenderer = function (that) {
+ var defaultOptions = {
+ mode: "exact",
+ theme: "simple"
+ };
+ var options = $.extend(true, defaultOptions, that.options.tinyMCE);
+ options.elements = fluid.allocateSimpleId(that.editField);
+ var oldinit = options.init_instance_callback;
+
+ options.init_instance_callback = function (instance) {
+ that.events.afterInitEdit.fire(instance);
+ if (oldinit) {
+ oldinit();
+ }
+ };
+
+ tinyMCE.init(options);
+ };
+
+
+ fluid.defaults("fluid.inlineEdit.tinyMCE", {
+ useTooltip: true,
+ selectors: {
+ edit: "textarea"
+ },
+
+ styles: {
+ invitation: null // Override because it causes problems with flickering. Help?
+ },
+ displayAccessor: {
+ type: "fluid.inlineEdit.richTextViewAccessor"
+ },
+ editAccessor: {
+ type: "fluid.inlineEdit.tinyMCE.viewAccessor"
+ },
+ lazyEditView: true,
+ blurHandlerBinder: fluid.inlineEdit.tinyMCE.blurHandlerBinder,
+ editModeRenderer: fluid.inlineEdit.tinyMCE.editModeRenderer
+ });
+
+
+
+ // Configuration for integrating FCKEditor
+
+ /**
+ * Instantiate a rich-text InlineEdit component that uses an instance of FCKeditor.
+ *
+ * @param {Object} componentContainer the element containing the inline editors
+ * @param {Object} options configuration options for the components
+ */
+ fluid.inlineEdit.FCKEditor = function (container, options) {
+ return configureInlineEdit("fluid.inlineEdit.FCKEditor", container, options);
+ };
+
+ fluid.inlineEdit.FCKEditor.complete = fluid.event.getEventFirer();
+
+ fluid.inlineEdit.FCKEditor.complete.addListener(function (editor) {
+ var editField = editor.LinkedField;
+ var that = $.data(editField, "fluid.inlineEdit.FCKEditor");
+ that.events.afterInitEdit.fire(editor);
+ });
+
+ fluid.inlineEdit.FCKEditor.blurHandlerBinder = function (that) {
+ function focusEditor(editor) {
+ editor.Focus();
+ }
+
+ that.events.afterInitEdit.addListener(
+ function (editor) {
+ focusEditor(editor);
+ var editorBody = editor.EditingArea.TargetElement;
+
+ // NB - this section has no effect - on most browsers no focus events
+ // are delivered to the actual body
+ //fluid.deadMansBlur(that.editField,
+ // $(editorBody),
+ // function () {
+ // that.cancel();
+ // });
+ }
+ );
+ that.events.afterBeginEdit.addListener(function () {
+ var editor = fluid.inlineEdit.FCKEditor.byId(that.editField[0].id);
+ if (editor) {
+ focusEditor(editor);
+ }
+ });
+
+ };
+
+ fluid.inlineEdit.FCKEditor.byId = function (id) {
+ var editor = typeof(FCKeditorAPI) === "undefined"? null: FCKeditorAPI.GetInstance(id);
+ return editor;
+ };
+
+ fluid.inlineEdit.FCKEditor.editModeRenderer = function (that) {
+ var id = fluid.allocateSimpleId(that.editField);
+ $.data(fluid.unwrap(that.editField), "fluid.inlineEdit.FCKEditor", that);
+ var oFCKeditor = new FCKeditor(id);
+ // The Config object and the FCKEditor object itself expose different configuration sets,
+ // which possess a member "BasePath" with different meanings. Solve FLUID-2452, FLUID-2438
+ // by auto-inferring the inner path for Config (method from http://drupal.org/node/344230 )
+ var opcopy = fluid.copy(that.options.FCKEditor);
+ opcopy.BasePath = opcopy.BasePath + "editor/";
+ $.extend(true, oFCKeditor.Config, opcopy);
+ // somehow, some properties like Width and Height are set on the object itself
+
+ $.extend(true, oFCKeditor, that.options.FCKEditor);
+ oFCKeditor.Config.fluidInstance = that;
+ oFCKeditor.ReplaceTextarea();
+ };
+
+ fluid.inlineEdit.FCKEditor.viewAccessor = function (editField) {
+ return {
+ value: function (newValue) {
+ var editor = fluid.inlineEdit.FCKEditor.byId(editField.id);
+ if (!editor) {
+ if (newValue) {
+ $(editField).val(newValue);
+ }
+ return "";
+ }
+ if (newValue) {
+ editor.SetHTML(newValue);
+ }
+ else {
+ return editor.GetHTML();
+ }
+ }
+ };
+ };
+
+
+ fluid.defaults("fluid.inlineEdit.FCKEditor", {
+ selectors: {
+ edit: "textarea"
+ },
+
+ styles: {
+ invitation: null // Override because it causes problems with flickering. Help?
+ },
+
+ displayAccessor: {
+ type: "fluid.inlineEdit.richTextViewAccessor"
+ },
+ editAccessor: {
+ type: "fluid.inlineEdit.FCKEditor.viewAccessor"
+ },
+ lazyEditView: true,
+ blurHandlerBinder: fluid.inlineEdit.FCKEditor.blurHandlerBinder,
+ editModeRenderer: fluid.inlineEdit.FCKEditor.editModeRenderer,
+ FCKEditor: {
+ BasePath: "fckeditor/"
+ }
+ });
+
+
+ // Configuration for integrating a drop-down editor
+
+ /**
+ * Instantiate a drop-down InlineEdit component
+ *
+ * @param {Object} container
+ * @param {Object} options
+ */
+ fluid.inlineEdit.dropdown = function (container, options) {
+ return configureInlineEdit("fluid.inlineEdit.dropdown", container, options);
+ };
+
+ fluid.inlineEdit.dropdown.editModeRenderer = function (that) {
+ var id = fluid.allocateSimpleId(that.editField);
+ that.editField.selectbox({
+ finishHandler: function () {
+ that.finish();
+ }
+ });
+ return {
+ container: that.editContainer,
+ field: $("input.selectbox", that.editContainer)
+ };
+ };
+
+ fluid.inlineEdit.dropdown.blurHandlerBinder = function (that) {
+ fluid.deadMansBlur(that.editField,
+ $("div.selectbox-wrapper li", that.editContainer),
+ function () {
+ that.cancel();
+ });
+ };
+
+
+
+ fluid.defaults("fluid.inlineEdit.dropdown", {
+ applyEditPadding: false,
+ blurHandlerBinder: fluid.inlineEdit.dropdown.blurHandlerBinder,
+ editModeRenderer: fluid.inlineEdit.dropdown.editModeRenderer
+ });
+
+
+})(jQuery, fluid_1_1);
+
+
+// This must be written outside any scope as a result of the FCKEditor event model.
+// Do not overwrite this function, if you wish to add your own listener to FCK completion,
+// register it with the standard fluid event firer at fluid.inlineEdit.FCKEditor.complete
+function FCKeditor_OnComplete(editorInstance) {
+ fluid.inlineEdit.FCKEditor.complete.fire(editorInstance);
}
View
1,628 src/webapp/components/pager/js/Pager.js
@@ -1,814 +1,814 @@
-/*
-Copyright 2008-2009 University of Cambridge
-Copyright 2008-2009 University of Toronto
-Copyright 2007-2009 University of California, Berkeley
-
-Licensed under the Educational Community License (ECL), Version 2.0 or the New
-BSD license. You may not use this file except in compliance with one these
-Licenses.