<commit_before>
<#-- TODO: could remove output=true later and let accumulate in theme footer -->
<@script output=true>

    <#-- Common Ofbiz URIs for use in javascript -->
    <@requireScriptOfbizUrl uri="getJSONuiLabelArray" onlyIfExists=true/>
    <@requireScriptOfbizUrl uri="getJSONuiLabel" onlyIfExists=true/>
    <#-- This belongs in @progressScript, but Ofbiz FTL bug requires it here -->
    <@requireScriptOfbizUrl uri="getFileUploadProgressStatus" onlyIfExists=true/>
    
    <#-- NOTE: a screen that needs a URL in JS must call @requireScriptOfbizUrl 
         FTL macro, for now, see htmlUtilities.ftl -->
    function getOfbizUrl(url) {
        if (url in commonOfbizUrls) {
            return commonOfbizUrls[url];
        }
        else {
            return "";
        }
    }

    <#-- theme style variables 
         TODO?: could be optimized via static JS generated manually or cached -->
  <#if styles?has_content && styles.printStyleClassesOnPage!true>
    var scipioStyles = <@objectAsScript lang="js" object=styles />;
  </#if>  
  
  <#-- FIXME: DUPLICATED FROM messages.ftl; KEEP IN SYNC -->
  <#if requestAttributes.errorMessageList?has_content><#assign errorMessageList=requestAttributes.errorMessageList></#if>
  <#if requestAttributes.eventMessageList?has_content><#assign eventMessageList=requestAttributes.eventMessageList></#if>
  <#if requestAttributes.serviceValidationException??><#assign serviceValidationException = requestAttributes.serviceValidationException></#if>
  <#if requestAttributes.uiLabelMap?has_content><#assign uiLabelMap = requestAttributes.uiLabelMap></#if>
  
  <#if !errorMessage?has_content>
    <#assign errorMessage = requestAttributes._ERROR_MESSAGE_!>
  </#if>
  <#if !errorMessageList?has_content>
    <#assign errorMessageList = requestAttributes._ERROR_MESSAGE_LIST_!>
  </#if>
  <#if !eventMessage?has_content>
    <#assign eventMessage = requestAttributes._EVENT_MESSAGE_!>
  </#if>
  <#if !eventMessageList?has_content>
    <#assign eventMessageList = requestAttributes._EVENT_MESSAGE_LIST_!>
  </#if>
  
    
    function ScipioMessages(options) {
        if (!options) {
            options = {};
        }
        
        /* Public members */
        
        this.isError = options.isError;
        this.isErrorPage = options.isErrorPage;
        this.errorMessage = options.errorMessage;
        this.errorMessageList = options.errorMessageList;
        this.eventMessage = options.eventMessage;
        this.eventMessageList = options.eventMessageList;
        
        /* Public functions */
        
        this.hasErrorMsg = function() {
            return (this.errorMessage || this.errorMessageList);
        };
    }
    
    var scipioMsgs = new ScipioMessages({
        isError : ${(isError!false)?string},   <#-- NOTE: this is official context var set by ScreenRenderer -->
        isErrorPage : ${(isErrorPage!false)?string},   <#-- NOTE: this is some other check that was added in scipio at some point -->
        errorMessage : <#if errorMessage?has_content>"${escapeVal(errorMessage, 'js')}"<#else>null</#if>,
        errorMessageList : <#if errorMessageList?has_content><@objectAsScript object=errorMessageList lang='js'/><#else>[]</#if>,

        eventMessage : <#if eventMessage?has_content>"${escapeVal(eventMessage, 'js')}"<#else>null</#if>,
        eventMessageList : <#if eventMessageList?has_content><@objectAsScript object=eventMessageList lang='js'/><#else>[]</#if>
    });
    
</@script><commit_msg>Added option for themes to override if the scipio specific javascript should be loaded or not.<commit_after>
<#-- TODO: could remove output=true later and let accumulate in theme footer -->
<#if !styles.render_common_head_script?has_content || (styles.render_common_head_script)>
        <@script output=true compress=true>
            <@utilCache cacheName="commonHeadScripts.ftl" key="general::${globalContext.visualThemeId!}" expireTime=86400000>
                <#-- Common Ofbiz URIs for use in javascript -->
                <@requireScriptOfbizUrl uri="getJSONuiLabelArray" onlyIfExists=true/>
                <@requireScriptOfbizUrl uri="getJSONuiLabel" onlyIfExists=true/>
                <#-- This belongs in @progressScript, but Ofbiz FTL bug requires it here -->
                <@requireScriptOfbizUrl uri="getFileUploadProgressStatus" onlyIfExists=true/>

                <#-- NOTE: a screen that needs a URL in JS must call @requireScriptOfbizUrl
                     FTL macro, for now, see htmlUtilities.ftl -->
                function getOfbizUrl(url) {
                    if (url in commonOfbizUrls) {
                        return commonOfbizUrls[url];
                    }
                    else {
                        return "";
                    }
                }

                <#-- theme style variables
                     TODO?: could be optimized via static JS generated manually or cached -->
              <#if styles?has_content && styles.printStyleClassesOnPage!true>
                var scipioStyles = <@objectAsScript lang="js" object=styles />;
              </#if>
            </@utilCache>
              <#-- FIXME: DUPLICATED FROM messages.ftl; KEEP IN SYNC -->
              <#if requestAttributes.errorMessageList?has_content><#assign errorMessageList=requestAttributes.errorMessageList></#if>
              <#if requestAttributes.eventMessageList?has_content><#assign eventMessageList=requestAttributes.eventMessageList></#if>
              <#if requestAttributes.serviceValidationException??><#assign serviceValidationException = requestAttributes.serviceValidationException></#if>
              <#if requestAttributes.uiLabelMap?has_content><#assign uiLabelMap = requestAttributes.uiLabelMap></#if>

              <#if !errorMessage?has_content>
                <#assign errorMessage = requestAttributes._ERROR_MESSAGE_!>
              </#if>
              <#if !errorMessageList?has_content>
                <#assign errorMessageList = requestAttributes._ERROR_MESSAGE_LIST_!>
              </#if>
              <#if !eventMessage?has_content>
                <#assign eventMessage = requestAttributes._EVENT_MESSAGE_!>
              </#if>
              <#if !eventMessageList?has_content>
                <#assign eventMessageList = requestAttributes._EVENT_MESSAGE_LIST_!>
              </#if>


                function ScipioMessages(options) {
                    if (!options) {
                        options = {};
                    }

                    /* Public members */

                    this.isError = options.isError;
                    this.isErrorPage = options.isErrorPage;
                    this.errorMessage = options.errorMessage;
                    this.errorMessageList = options.errorMessageList;
                    this.eventMessage = options.eventMessage;
                    this.eventMessageList = options.eventMessageList;

                    /* Public functions */

                    this.hasErrorMsg = function() {
                        return (this.errorMessage || this.errorMessageList);
                    };
                }

                var scipioMsgs = new ScipioMessages({
                    isError : ${(isError!false)?string},   <#-- NOTE: this is official context var set by ScreenRenderer -->
                    isErrorPage : ${(isErrorPage!false)?string},   <#-- NOTE: this is some other check that was added in scipio at some point -->
                    errorMessage : <#if errorMessage?has_content>"${escapeVal(errorMessage, 'js')}"<#else>null</#if>,
                    errorMessageList : <#if errorMessageList?has_content><@objectAsScript object=errorMessageList lang='js'/><#else>[]</#if>,

                    eventMessage : <#if eventMessage?has_content>"${escapeVal(eventMessage, 'js')}"<#else>null</#if>,
                    eventMessageList : <#if eventMessageList?has_content><@objectAsScript object=eventMessageList lang='js'/><#else>[]</#if>
                });
        </@script>
</#if>
{'fraction_non_alphanumeric': 0.1134354376789939, 'fraction_numerical': 0.0009961399576640518, 'mean_word_length': 2.4906562364189484, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7246724', 'n_tokens_mistral': 2211, 'n_tokens_neox': 2114, 'n_words': 450}