Repository: Products.CMFPlone
Branch: refs/heads/master
Date: 2014-11-25T15:25:31+01:00
Author: Johannes Raggam (thet) <raggam-nl@adm.at>
Commit: https://github.com/plone/Products.CMFPlone/commit/03ffea0bc5f5983b5f5086d12f373f6c76af7f52

remove js replaced by inlinevalidation pattern

Files changed:
M Products/CMFPlone/profiles/dependencies/registry.xml
D Products/CMFPlone/skins/plone_ecmascript/inline_validation.js

diff --git a/Products/CMFPlone/profiles/dependencies/registry.xml b/Products/CMFPlone/profiles/dependencies/registry.xml
index af9c725..3aeba64 100644
--- a/Products/CMFPlone/profiles/dependencies/registry.xml
+++ b/Products/CMFPlone/profiles/dependencies/registry.xml
@@ -831,10 +831,6 @@
             interface='Products.CMFPlone.interfaces.IResourceRegistry'>
       <value key="js">jquery.highlightsearchterms.js</value>
   </records>
-  <records prefix="plone.resources/inline-validation"
-            interface='Products.CMFPlone.interfaces.IResourceRegistry'>
-      <value key="js">inline_validation.js</value>
-  </records>
   <records prefix="plone.resources/table_sorter"
             interface='Products.CMFPlone.interfaces.IResourceRegistry'>
       <value key="js">table_sorter.js</value>
@@ -936,7 +932,6 @@
       <element>plone_javascript_variables</element>
       <element>unlockOnFormUnload</element>
       <element>table_sorter</element>
-      <element>inline-validation</element>
       <element>jquery-highlightsearchterms</element>
     </value>
     <value key="depends">plone</value>
diff --git a/Products/CMFPlone/skins/plone_ecmascript/inline_validation.js b/Products/CMFPlone/skins/plone_ecmascript/inline_validation.js
deleted file mode 100644
index 0e017a1..0000000
--- a/Products/CMFPlone/skins/plone_ecmascript/inline_validation.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Validate form fields when they lose focus.
-*/
-
-/*jslint white:false, onevar:true, undef:true, nomen:true, eqeqeq:true, plusplus:true, bitwise:true, regexp:true, newcap:true, immed:true, strict:false, browser:true */
-/*global jQuery:false, document:false, window:false, location:false */
-
-jQuery(function ($) {
-
-    var render_error = function ($field, errmsg) {
-        var $errbox = $('div.fieldErrorBox', $field);
-        if (errmsg !== '') {
-            $field.addClass('error');
-            $errbox.html(errmsg);
-        } else {
-            $field.removeClass('error');
-            $errbox.html('');
-        }
-    };
-
-    // Add '/extra' on to the end of the URL, respecting querystring
-    var append_url_path = function (url, extra) {
-        var i, ret, urlParts = url.split(/\?/);
-
-        ret = urlParts[0];
-        if (ret[ret.length - 1] !== '/') { ret += '/'; }
-        ret += extra;
-        for (i = 1; i < urlParts.length; i++) {
-            ret += '?' + urlParts[i];
-        }
-        return ret;
-    };
-
-    // Archetypes
-    $(document).on(
-            'blur',
-            '.field input.blurrable, ' +
-            '.field select.blurrable, ' +
-            '.field textarea.blurrable',
-            function () {
-        var $input = $(this),
-            $field = $input.closest('.field'),
-            uid = $field.attr('data-uid'),
-            fname = $field.attr('data-fieldname'),
-            value = $input.val();
-
-        // value is null for empty multiSelection select, turn it into a [] instead
-        // so it does not break at_validate_field
-        if ($input.attr('multiple') === 'multiple' && value === null) {
-            value = $([]).serialize();
-        }
-
-        // if value is an Array, it will be send as value[]=value1&value[]=value2 by $.post
-        // turn it into something that will be useable or value will be omitted from the request
-        params = $.param({uid: uid, fname: fname, value: value}, traditional = true);
-
-        if ($field && uid && fname) {
-            $.post($('base').attr('href') + '/at_validate_field', params, function (data) {
-                render_error($field, data.errmsg);
-            });
-        }
-    });
-
-    // formlib
-    var formlib_validate_field = function (input) {
-        var $input = $(input),
-            $field = $input.closest('.field'),
-            $form = $field.closest('form'),
-            fname = $field.attr('data-fieldname');
-
-        $form.ajaxSubmit({
-            url: append_url_path($form.attr('action'), '@@formlib_validate_field'),
-            data: {fname: fname},
-            iframe: false,
-            success: function (data) {
-                render_error($field, data.errmsg);
-            },
-            dataType: 'json'
-        });
-    };
-    $(document).on(
-        'blur',
-        '.formlibInlineValidation input[type="text"], ' +
-        '.formlibInlineValidation input[type="password"], ' +
-        '.formlibInlineValidation input[type="checkbox"], ' +
-        '.formlibInlineValidation input[type="radio"], ' +
-        '.formlibInlineValidation select, ' +
-        '.formlibInlineValidation textarea',
-        function () { formlib_validate_field(this); });
-
-    // z3c.form
-    var z3cform_validate_field = function (input) {
-        var $input = $(input),
-            $field = $input.closest('.field'),
-            $form = $field.closest('form'),
-            fset = $input.closest('fieldset').attr('data-fieldset'),
-            fname = $field.attr('data-fieldname');
-
-        if (fname) {
-            $form.ajaxSubmit({
-                url: append_url_path($form.attr('action'), '@@z3cform_validate_field'),
-                data: {fname: fname, fset: fset},
-                iframe: false,
-                success: function (data) {
-                    render_error($field, data.errmsg);
-                },
-                dataType: 'json'
-            });
-        }
-    };
-    $(document).on(
-        'blur',
-        '.z3cformInlineValidation input[type="text"], ' +
-        '.z3cformInlineValidation input[type="password"], ' +
-        '.z3cformInlineValidation input[type="checkbox"], ' +
-        '.z3cformInlineValidation input[type="radio"], ' +
-        '.z3cformInlineValidation select, ' +
-        '.z3cformInlineValidation textarea',
-        function () { z3cform_validate_field(this); });
-
-});