rice-framework/krad-web/src/main/webapp/krad/scripts/krad.validate.js
/**
 * Generates a field link sub list summary that generates a list item which contains a sublist of items.  The text
 * of this li will be similar to: "3 errors before 'Section Name' section" (actual text dependant on what messages
 * are present) followed by an ul - the sublist - of field link items for each field specified in currentFields.
 *
 * @param parentSectionData - the data of the section this sublist will be provided for
 * @param currentFields - the fields to generate field links for by id
 * @param messageMap - map of the messageData associated with the fields; currentFields specifies a subset of these
 * @param sectionId - the id of the section that occurs after (or in some cases) before the fields to be contained in
 * the sublist
 * @param before - true if these field are before the section specified by id, false otherwise
 */
Generates a field link sub list summary that generates a list item which contains a sublist of items.  The text
of this li will be similar to: "3 errors before 'Section Name' section" (actual text dependant on what messages
are present) followed by an ul - the sublist - of field link items for each field specified in currentFields.


Generates a field link sub list summary that generates a list item which contains a sublist of items . The text of this li will be similar to : " 3 errors before ' Section Name ' section " ( actual text dependant on what messages are present ) followed by an ul - the sublist - of field link items for each field specified in currentFields .
function generateFieldLinkSublist(parentSectionData, currentFields, messageMap, sectionId, before) {
    var sectionTitle = getGroupHeaderElement(sectionId).find(".uif-headerText-span").text();
    if (sectionTitle == null || sectionTitle == "") {
        sectionTitle = jQuery("#" + sectionId).data("label");
    }
    if (sectionTitle == null || sectionTitle == undefined) {
        sectionTitle = "group";
    }
    var disclosureText = "";
    var links = [];
    var errorCount = 0;
    var warningCount = 0;
    var infoCount = 0;
    var disclosureLink = null;
    var image = "";
    var linkType = "";
    for (var i in currentFields) {
        if (currentFields[i] != null) {
            var fieldId = currentFields[i];
            var messageData = messageMap[fieldId];
            if (messageData != undefined && messageData != null) {
                errorCount = errorCount + messageData.serverErrors.length + messageData.errors.length;
                warningCount = warningCount + messageData.serverWarnings.length + messageData.warnings.length;
                infoCount = infoCount + messageData.serverInfo.length + messageData.info.length;
                var link = generateFieldLink(messageData, fieldId, parentSectionData.collapseFieldMessages,
                        parentSectionData.displayLabel);
                if (link != null) {
                    links.push(link);
                }
            }
        }
    }
    if (errorCount || warningCount || infoCount) {
        var locationText = getMessage(kradVariables.MESSAGE_BEFORE);
        if (!before) {
            locationText = getMessage(kradVariables.MESSAGE_AFTER);
        }
        if (errorCount) {
            image = errorImage;
            linkType = "uif-errorMessageItem";
        }
        else if (warningCount) {
            image = warningImage;
            linkType = "uif-warningMessageItem";
        }
        else if (infoCount) {
            image = infoImage;
            linkType = "uif-infoMessageItem";
        }
        var countMessage = generateCountString(errorCount, warningCount, infoCount);
        sectionTitle = sectionTitle.replace(/\r?\n/g, "");
        disclosureText = countMessage + " " + locationText + " " + sectionTitle;
        if (links.length) {
            var subSummary = jQuery("<ul></ul>");
            for (var j in links) {
                jQuery(links[j]).appendTo(subSummary)
            }
        }
        disclosureLink = jQuery("<li tabindex='0' class='" + linkType + "'>" + disclosureText + "</li>");
        jQuery(subSummary).appendTo(disclosureLink);
    }
    return disclosureLink;
}
function generateFieldLinkSublist ( parentSectionData , currentFields , messageMap , sectionId , before ) { var sectionTitle = getGroupHeaderElement ( sectionId ) . find ( ".uif-headerText-span" ) . text ( ) ; if ( sectionTitle == null || sectionTitle == "" ) { sectionTitle = jQuery ( "#" + sectionId ) . data ( "label" ) ; } if ( sectionTitle == null || sectionTitle == undefined ) { sectionTitle = "group" ; } var disclosureText = "" ; var links = [ ] ; var errorCount = 0 ; var warningCount = 0 ; var infoCount = 0 ; var disclosureLink = null ; var image = "" ; var linkType = "" ; for ( var i in currentFields ) { if ( currentFields [ i ] != null ) { var fieldId = currentFields [ i ] ; var messageData = messageMap [ fieldId ] ; if ( messageData != undefined && messageData != null ) { errorCount = errorCount + messageData . serverErrors . length + messageData . errors . length ; warningCount = warningCount + messageData . serverWarnings . length + messageData . warnings . length ; infoCount = infoCount + messageData . serverInfo . length + messageData . info . length ; var link = generateFieldLink ( messageData , fieldId , parentSectionData . collapseFieldMessages , parentSectionData . displayLabel ) ; if ( link != null ) { links . push ( link ) ; } } } } if ( errorCount || warningCount || infoCount ) { var locationText = getMessage ( kradVariables . MESSAGE_BEFORE ) ; if ( ! before ) { locationText = getMessage ( kradVariables . MESSAGE_AFTER ) ; } if ( errorCount ) { image = errorImage ; linkType = "uif-errorMessageItem" ; } else if ( warningCount ) { image = warningImage ; linkType = "uif-warningMessageItem" ; } else if ( infoCount ) { image = infoImage ; linkType = "uif-infoMessageItem" ; } var countMessage = generateCountString ( errorCount , warningCount , infoCount ) ; sectionTitle = sectionTitle . replace ( / \r?\n / g , "" ) ; disclosureText = countMessage + " " + locationText + " " + sectionTitle ; if ( links . length ) { var subSummary = jQuery ( "<ul></ul>" ) ; for ( var j in links ) { jQuery ( links [ j ] ) . appendTo ( subSummary ) } } disclosureLink = jQuery ( "<li tabindex='0' class='" + linkType + "'>" + disclosureText + "</li>" ) ; jQuery ( subSummary ) . appendTo ( disclosureLink ) ; } return disclosureLink ; }
Generates a field link sub list summary that generates a list item which contains a sublist of items.
Generates a field link sub list summary that generates a list item which contains a sublist of items .
//field group case
 // for empty section titles (should not happen in unless we force it to)
 //jQuery(subSummary).hide();
 //write disclosure link and div
