<commit_before><!--
  Copyright (C) 2011 Orbeon, Inc.

  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU Lesser General Public License as published by the Free Software Foundation; either version
  2.1 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.

  The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  -->
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:frf="java:org.orbeon.oxf.fr.FormRunner"
         xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"
         xmlns:process="java:org.orbeon.oxf.fr.process.SimpleProcess"

         lang="{xxf:instance('fr-fr-language-instance')}"
         xml:lang="{xxf:instance('fr-fr-language-instance')}">

    <xh:head>
        <xh:title><xf:output ref="$fr-resources/home/title"/></xh:title>
        <xh:link rel="stylesheet" href="/apps/fr/style/form-runner-home.css" type="text/css" media="all"/>
        <!-- This page needs access to Form Builder permission -->
        <xi:include href="oxf:/apps/fr/includes/permissions-model.xml" xxi:omit-xml-base="true"/>
        <!-- FR Home page XForms model -->
        <xf:model id="fr-form-model" xxf:xpath-analysis="true">

            <!-- Entry point -->
            <xf:action event="xforms-ready fr-initialize">

                <xf:var name="remote-servers" value="frf:remoteServersXPath()"/>

                <xf:dispatch name="fr-clear" targetid="fr-form-model"/>

                <xf:action if="exists($remote-servers)">
                    <!-- Set the first available remote server label/URL when present. If we only have one item, it is
                         just one URL. If we have two or more, it's one label, one URL, etc. -->
                    <xf:setvalue
                        if="count($remote-servers) ge 2"
                        ref="instance()/remote-server/label"
                        value="$remote-servers[1]"/>

                    <xf:setvalue
                        ref="instance()/remote-server/url"
                        value="$remote-servers[if (count($remote-servers) ge 2) then 2 else 1]"/>
                </xf:action>

                <xf:action type="xpath" xmlns:version="java:org.orbeon.oxf.common.Version">
                    if (not(version:isPE()) or empty($remote-servers)) then
                        process:runProcessByName('oxf.fr.home.process', 'load-local')
                    else
                        process:runProcessByName('oxf.fr.home.process', 'ask-credentials')
                </xf:action>
            </xf:action><commit_msg>For #1792: Don’t ask credentials upon each action<commit_after><!--
  Copyright (C) 2011 Orbeon, Inc.

  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU Lesser General Public License as published by the Free Software Foundation; either version
  2.1 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.

  The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  -->
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:frf="java:org.orbeon.oxf.fr.FormRunner"
         xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"
         xmlns:process="java:org.orbeon.oxf.fr.process.SimpleProcess"

         lang="{xxf:instance('fr-fr-language-instance')}"
         xml:lang="{xxf:instance('fr-fr-language-instance')}">

    <xh:head>
        <xh:title><xf:output ref="$fr-resources/home/title"/></xh:title>
        <xh:link rel="stylesheet" href="/apps/fr/style/form-runner-home.css" type="text/css" media="all"/>
        <!-- This page needs access to Form Builder permission -->
        <xi:include href="oxf:/apps/fr/includes/permissions-model.xml" xxi:omit-xml-base="true"/>
        <!-- FR Home page XForms model -->
        <xf:model id="fr-form-model" xxf:xpath-analysis="true">

            <!-- Entry point -->
            <xf:action event="xforms-ready fr-initialize">

                <xf:var
                    name="remote-servers"
                    value="frf:remoteServersXPath()"/>

                <xf:var
                    name="has-remote"
                    value="normalize-space(instance()/remote-server/url)
                       and normalize-space(instance()/remote-server/username)
                       and normalize-space(instance()/remote-server/password)"/>

                <xf:dispatch name="fr-clear" targetid="fr-form-model"/>

                <xf:action if="exists($remote-servers)">
                    <!-- Set the first available remote server label/URL when present. If we only have one item, it is
                         just one URL. If we have two or more, it's one label, one URL, etc. -->
                    <xf:setvalue
                        if="count($remote-servers) ge 2"
                        ref="instance()/remote-server/label"
                        value="$remote-servers[1]"/>

                    <xf:setvalue
                        ref="instance()/remote-server/url"
                        value="$remote-servers[if (count($remote-servers) ge 2) then 2 else 1]"/>
                </xf:action>

                <xf:action type="xpath" xmlns:version="java:org.orbeon.oxf.common.Version">
                    if (not(version:isPE()) or empty($remote-servers)) then
                        process:runProcessByName('oxf.fr.home.process', 'load-local')
                    else if ($has-remote) then
                        process:runProcess('oxf.fr.home.process', 'load-remote')
                    else
                        process:runProcessByName('oxf.fr.home.process', 'ask-credentials')
                </xf:action>
            </xf:action>
{'fraction_non_alphanumeric': 0.13838835231368027, 'fraction_numerical': 0.009514199221565519, 'mean_word_length': 2.1042505592841163, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 36}, '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': '959433', 'n_tokens_mistral': 2120, 'n_tokens_neox': 2001, 'n_words': 449}