<commit_before><?xml version="1.0" encoding="UTF-8"?>

<xwikidoc>
  <web>XWiki</web>
  <name>OfficeImporter</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <parent>XWiki.WebHome</parent>
  <creator>xwiki:XWiki.Admin</creator>
  <author>xwiki:XWiki.Admin</author>
  <customClass/>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <creationDate>1364889339000</creationDate>
  <date>1364920930000</date>
  <contentUpdateDate>1364920930000</contentUpdateDate>
  <version>1.1</version>
  <title>$services.localization.render('xe.officeimporter.import.title')</title>
  <defaultTemplate/>
  <validationScript/>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.1</syntaxId>
  <hidden>true</hidden>
  <object>
    <class>
      <name>XWiki.JavaScriptExtension</name>
      <customClass/>
      <customMapping/>
      <defaultViewSheet/>
      <defaultEditSheet/>
      <defaultWeb/>
      <nameField/>
      <validationScript/>
      <cache>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <multiSelect>0</multiSelect>
        <name>cache</name>
        <number>5</number>
        <prettyName>Caching policy</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators> ,|</separators>
        <size>1</size>
        <unmodifiable>0</unmodifiable>
        <values>long|short|default|forbid</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </cache>
      <code>
        <disabled>0</disabled>
        <name>code</name>
        <number>2</number>
        <prettyName>Code</prettyName>
        <rows>20</rows>
        <size>50</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
      </code>
      <name>
        <disabled>0</disabled>
        <name>name</name>
        <number>1</number>
        <prettyName>Name</prettyName>
        <size>30</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.StringClass</classType>
      </name>
      <parse>
        <disabled>0</disabled>
        <displayFormType>select</displayFormType>
        <displayType>yesno</displayType>
        <name>parse</name>
        <number>4</number>
        <prettyName>Parse content</prettyName>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
      </parse>
      <use>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <multiSelect>0</multiSelect>
        <name>use</name>
        <number>3</number>
        <prettyName>Use this extension</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators> ,|</separators>
        <size>1</size>
        <unmodifiable>0</unmodifiable>
        <values>currentPage=Always on this page|onDemand=On demand|always=Always on this wiki</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </use>
    </class>
    <name>XWiki.OfficeImporter</name>
    <number>0</number>
    <className>XWiki.JavaScriptExtension</className>
    <guid>aecb3d07-9c3e-4a75-a1d5-026d8c0e91c5</guid>
    <property>
      <cache>long</cache>
    </property>
    <property>
      <code>(function() {
  var onFilePathChange = function() {
    var targetPageInput = $('targetPageInputId');
    if (targetPageInput.value != '' &amp;&amp; targetPageInput.value != targetPageInput.__defaultValue) {
      return;
    }

    var fileName = XWiki.extractFileName('filepath');
    var dotIndex = fileName.lastIndexOf(".");
    if (dotIndex &gt;= 0) {
      fileName = fileName.substring(0, dotIndex);
    }
    targetPageInput.value = fileName;
    // Save the default value to be able to distinguish it from the value set by the user.
    targetPageInput.__defaultValue = fileName;
  }

  var onSubmit = function(event) {
    if ($('appendContentInputId').checked || $('targetPageInputId').value == '' || $('targetSpaceInputId').value == '') {
      return
    }
    // Check if the target document exists.
    event.stop();
    event.element().disable();
    var url = new XWiki.Document($('targetPageInputId').value, $('targetSpaceInputId').value).getRestURL();
    new Ajax.Request(url, {
      // Would be nice to use the HEAD method, but it's not supported currently..
      method: 'get',
      onSuccess: function() {
        // The target document exists.
        new XWiki.widgets.ConfirmationBox({
          onYes: function() {
            // Overwrite the target document.
            $('targetPageInputId').form.enable().submit();
          },
          onNo: function() {
            // Allow the user to change the target document.
            $('targetPageInputId').form.enable();
          }
        }, {
          confirmationText: "$escapetool.javascript($services.localization.render('platform.office.importDocumentOverwriteConfirmation'))"
        });
      },
      onFailure: function() {
        // The target page doesn't exist so we can safely proceed with the import.
        $('targetPageInputId').form.enable().submit();
      }
    });
  }

  function init() {
    var filePath = $('filepath');
    if (filePath) {
      filePath.observe('change', onFilePathChange);
      filePath.form.observe('submit', onSubmit);
      return true;
    }
    return false;
  }

  (XWiki.domIsLoaded &amp;&amp; init()) || document.observe('xwiki:dom:loaded', init);
})()</code>
    </property>
    <property>
      <name>Code</name>
    </property>
    <property><commit_msg>XWIKI-9005: The "Target page" isn't automatically set when importing an Office document on IE9 * Small refactoring.<commit_after><?xml version="1.0" encoding="UTF-8"?>

<xwikidoc>
  <web>XWiki</web>
  <name>OfficeImporter</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <parent>XWiki.WebHome</parent>
  <creator>xwiki:XWiki.Admin</creator>
  <author>xwiki:XWiki.Admin</author>
  <customClass/>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <creationDate>1364889339000</creationDate>
  <date>1364920930000</date>
  <contentUpdateDate>1364920930000</contentUpdateDate>
  <version>1.1</version>
  <title>$services.localization.render('xe.officeimporter.import.title')</title>
  <defaultTemplate/>
  <validationScript/>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.1</syntaxId>
  <hidden>true</hidden>
  <object>
    <class>
      <name>XWiki.JavaScriptExtension</name>
      <customClass/>
      <customMapping/>
      <defaultViewSheet/>
      <defaultEditSheet/>
      <defaultWeb/>
      <nameField/>
      <validationScript/>
      <cache>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <multiSelect>0</multiSelect>
        <name>cache</name>
        <number>5</number>
        <prettyName>Caching policy</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators> ,|</separators>
        <size>1</size>
        <unmodifiable>0</unmodifiable>
        <values>long|short|default|forbid</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </cache>
      <code>
        <disabled>0</disabled>
        <name>code</name>
        <number>2</number>
        <prettyName>Code</prettyName>
        <rows>20</rows>
        <size>50</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
      </code>
      <name>
        <disabled>0</disabled>
        <name>name</name>
        <number>1</number>
        <prettyName>Name</prettyName>
        <size>30</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.StringClass</classType>
      </name>
      <parse>
        <disabled>0</disabled>
        <displayFormType>select</displayFormType>
        <displayType>yesno</displayType>
        <name>parse</name>
        <number>4</number>
        <prettyName>Parse content</prettyName>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
      </parse>
      <use>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <multiSelect>0</multiSelect>
        <name>use</name>
        <number>3</number>
        <prettyName>Use this extension</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators> ,|</separators>
        <size>1</size>
        <unmodifiable>0</unmodifiable>
        <values>currentPage=Always on this page|onDemand=On demand|always=Always on this wiki</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </use>
    </class>
    <name>XWiki.OfficeImporter</name>
    <number>0</number>
    <className>XWiki.JavaScriptExtension</className>
    <guid>aecb3d07-9c3e-4a75-a1d5-026d8c0e91c5</guid>
    <property>
      <cache>long</cache>
    </property>
    <property>
      <code>(function() {
  var onFilePathChange = function() {
    var targetPageInput = $('targetPageInputId');
    if (targetPageInput.value != '' &amp;&amp; targetPageInput.value != targetPageInput.__defaultValue) {
      return;
    }

    var fileName = XWiki.extractFileName('filepath');
    var dotIndex = fileName.lastIndexOf(".");
    if (dotIndex &gt;= 0) {
      fileName = fileName.substring(0, dotIndex);
    }
    targetPageInput.value = fileName;
    // Save the default value to be able to distinguish it from the value set by the user.
    targetPageInput.__defaultValue = fileName;
  };

  var onSubmit = function(event) {
    if ($('appendContentInputId').checked || $('targetPageInputId').value == '' || $('targetSpaceInputId').value == '') {
      return
    }
    // Check if the target document exists.
    event.stop();
    event.element().disable();
    var url = new XWiki.Document($('targetPageInputId').value, $('targetSpaceInputId').value).getRestURL();
    new Ajax.Request(url, {
      // Would be nice to use the HEAD method, but it's not supported currently..
      method: 'get',
      onSuccess: function() {
        // The target document exists.
        new XWiki.widgets.ConfirmationBox({
          onYes: function() {
            // Overwrite the target document.
            $('targetPageInputId').form.enable().submit();
          },
          onNo: function() {
            // Allow the user to change the target document.
            $('targetPageInputId').form.enable();
          }
        }, {
          confirmationText: "$escapetool.javascript($services.localization.render('platform.office.importDocumentOverwriteConfirmation'))"
        });
      },
      onFailure: function() {
        // The target page doesn't exist so we can safely proceed with the import.
        $('targetPageInputId').form.enable().submit();
      }
    });
  };

  var init = function() {
    var filePath = $('filepath');
    if (filePath) {
      filePath.observe('change', onFilePathChange);
      filePath.form.observe('submit', onSubmit);
      return true;
    }
    return false;
  };

  (XWiki.domIsLoaded &amp;&amp; init()) || document.observe('xwiki:dom:loaded', init);
})()</code>
    </property>
    <property>
      <name>Code</name>
    </property>
    <property>
{'fraction_non_alphanumeric': 0.14964742752676938, 'fraction_numerical': 0.017323931400713852, 'mean_word_length': 2.8331664998331667, 'pattern_counts': {'":': 0, '<': 369, '<?xml version=': 2, '>': 369, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4639141', 'n_tokens_mistral': 3721, 'n_tokens_neox': 3572, 'n_words': 565}