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

<xwikidoc>
  <web>WorkspaceManager</web>
  <name>Install</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <parent>WorkspaceManager.WebHome</parent>
  <creator>xwiki:XWiki.Admin</creator>
  <author>xwiki:XWiki.Admin</author>
  <customClass/>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <creationDate>1187017247000</creationDate>
  <date>1316551734000</date>
  <contentUpdateDate>1316551734000</contentUpdateDate>
  <version>1.1</version>
  <title/>
  <template/>
  <defaultTemplate/>
  <validationScript/>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.0</syntaxId>
  <hidden>true</hidden>
  <content>{{velocity}}
#set ($needsAdminRights = false)
##
## 1. Register translations
##
#set ($xwikiPreferencesDocumentReference = $services.model.createDocumentReference($xcontext.database, 'XWiki', 'XWikiPreferences'))
#set ($xwikiPreferencesDocument = $xwiki.getDocument($xwikiPreferencesDocumentReference))
#set ($xwikiPreferencesObject = $xwikiPreferencesDocument.getObject('XWiki.XWikiPreferences'))
#set ($documentBundles = "$!xwikiPreferencesObject.getProperty('documentBundles').value")
#if (!$documentBundles.contains('WorkspaceManager.Translations'))
  #if ($hasGlobalAdmin)
    #set ($discard = $xwikiPreferencesObject.set('documentBundles', "$documentBundles, WorkspaceManager.Translations"))
    #set ($discard = $xwikiPreferencesDocument.save($msg.get('platform.workspace.translationsInstallSaveComment'), true))
    {{success}}$msg.get('workspacemanager.translations.install.success'){{/success}}
  #else
    #set ($needsAdminRights = true)
  #end
#else
  ##
  ## Don't display this information if the code is included from somewhere else.
  ##
  #if ($context.doc == $context.tdoc)
    {{success}}$msg.get('workspacemanager.translations.install.success'){{/success}}
  #end
#end
##
## 2. Register workspace search suggestions
##
#macro (registerWorkspaceSearchSuggestions $wikiName $skipSuccessMessage $skipNeedsAdminRightsCheck)
  #set ($searchSuggestConfigDocumentReference = $services.model.createDocumentReference($wikiName, 'XWiki', 'SearchSuggestConfig'))
  #set ($searchSuggestConfigDocument = $xwiki.getDocument($searchSuggestConfigDocumentReference))
  #set ($searchSuggestConfigObject = $searchSuggestConfigDocument.getObject('XWiki.SearchSuggestSourceClass', 'name', 'Workspaces'))
  #if (!$searchSuggestConfigObject)
    #if ($hasGlobalAdmin)
      #set ($searchSuggestConfigObject = $searchSuggestConfigDocument.newObject('XWiki.SearchSuggestSourceClass'))
      #set ($discard = $searchSuggestConfigObject.set('name', 'Workspaces'))
      #set ($discard = $searchSuggestConfigObject.set('query', 'XWiki.XWikiServerClass.wikiprettyname:__INPUT__* AND object:WorkspaceManager.WorkspaceClass'))
      #set ($discard = $searchSuggestConfigObject.set('resultsNumber', '3'))
      #set ($suggestUrl = '$xwiki.getURL(' + $escapetool.quote + '${xcontext.mainWikiName}:WorkspaceManager.WorkspacesSuggestLuceneService' + $escapetool.quote + ', ' + $escapetool.singleQuote + 'get' + $escapetool.singleQuote + ', ' + $escapetool.singleQuote + 'outputSyntax=plain' + $escapetool.singleQuote + ')')
      #set ($discard = $searchSuggestConfigObject.set('url', $suggestUrl))
      #set ($discard = $searchSuggestConfigObject.set('activated', 1))
      #set ($discard = $searchSuggestConfigObject.set('highlight', 1))
      #set ($suggestIcon = '$xwiki.getSkinFile(' + $escapetool.singleQuote + 'icons/silk/chart_organisation.png' + $escapetool.singleQuote + ')')
      #set ($discard = $searchSuggestConfigObject.set('icon', $suggestIcon))
      ##
      #set ($discard = $searchSuggestConfigDocument.save($msg.get('platform.workspace.searchSuggestionsInstallSaveComment'), true))
      #if (!$skipSuccessMessage)

        {{success}}$msg.get('workspacemanager.searchSuggestions.install.success'){{/success}}
      #end
    #elseif (!$skipNeedsAdminRightsCheck)
      #set ($needsAdminRights = true)
    #end
  #elseif (!$skipSuccessMessage)
    ##
    ## Don't display this information if the code is included from somewhere else.
    ##
    #if ($context.doc == $context.tdoc)

      {{success}}$msg.get('workspacemanager.searchSuggestions.install.success'){{/success}}
    #end
  #end
#end
#registerWorkspaceSearchSuggestions($xcontext.database)
##
## 3. Install template
##
#if (!$WikiManager)
  #set ($WikiManager = $services.wikimanager)
  #if (!$WikiManager)

    {{error}}$msg.get('workspacemanager.dependencies.wikimanager.missing'){{/error}}
  #end
#end
#if (!$services.applicationmanager)

  {{error}}$msg.get('workspacemanager.dependencies.applicationmanager.missing'){{/error}}
#end
##
## Constants
#set ($TEMPLATE_NAME = 'workspacetemplate')
#set ($TEMPLATE_PACKAGE = 'workspace-template.xar')
##
#set ($Exception = $WikiManager.DefaultException)
#set ($template = $WikiManager.getWikiTemplateDocument($TEMPLATE_NAME))
#if ("$!template" == '')
  #if ($hasGlobalAdmin)
    #if ($doc.getAttachment($TEMPLATE_PACKAGE))
      #if ("$!request.confirmTemplateInstall" == '1')
        #set ($result = $WikiManager.createWikiTemplate($TEMPLATE_NAME, $msg.get('platform.workspace.templateWikiTitle'), $TEMPLATE_PACKAGE))
        #if ($result == $Exception.ERROR_NOERROR)
          #set($wikiTemplateDocument = $WikiManager.getWikiDocument($TEMPLATE_NAME))
          #set($workspaceObj = $wikiTemplateDocument.getObject('WorkspaceManager.WorkspaceClass'))
          #if(!$workspaceObj)
            #set($discard = $wikiTemplateDocument.createNewObject('WorkspaceManager.WorkspaceClass'))
            #set($discard = $wikiTemplateDocument.save())
          #end          
          ## Use a redirect so that the page can be refreshed after the form's POST.
          #set ($discard = $response.sendRedirect($doc.getURL()))

          {{success}}$msg.get('workspacemanager.template.install.success'){{/success}}
        #elseif ($result == $Exception.ERROR_XWIKI_ACCESS_DENIED)
          #set ($needsAdminRights = true)
        #else

          {{error}}$msg.get('workspacemanager.template.install.error', [$xcontext.lastexception]){{/error}}
        #end
      #else

        {{warning}}
          $msg.get('platform.workspace.templateNotInstalledInstallNow')

          {{html}}
          &lt;form method='post' action="$doc.getURL()"&gt;
            &lt;div&gt;
              &lt;input type='hidden' name='form_token' value="$!{services.csrf.getToken()}" /&gt;<commit_msg>XWIKI-8612: More workspace template issues (pretty name and membership type)<commit_after><?xml version="1.0" encoding="UTF-8"?>

<xwikidoc>
  <web>WorkspaceManager</web>
  <name>Install</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <parent>WorkspaceManager.WebHome</parent>
  <creator>xwiki:XWiki.Admin</creator>
  <author>xwiki:XWiki.Admin</author>
  <customClass/>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <creationDate>1187017247000</creationDate>
  <date>1316551734000</date>
  <contentUpdateDate>1316551734000</contentUpdateDate>
  <version>1.1</version>
  <title/>
  <template/>
  <defaultTemplate/>
  <validationScript/>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.0</syntaxId>
  <hidden>true</hidden>
  <content>{{velocity}}
#set ($needsAdminRights = false)
##
## 1. Register translations
##
#set ($xwikiPreferencesDocumentReference = $services.model.createDocumentReference($xcontext.database, 'XWiki', 'XWikiPreferences'))
#set ($xwikiPreferencesDocument = $xwiki.getDocument($xwikiPreferencesDocumentReference))
#set ($xwikiPreferencesObject = $xwikiPreferencesDocument.getObject('XWiki.XWikiPreferences'))
#set ($documentBundles = "$!xwikiPreferencesObject.getProperty('documentBundles').value")
#if (!$documentBundles.contains('WorkspaceManager.Translations'))
  #if ($hasGlobalAdmin)
    #set ($discard = $xwikiPreferencesObject.set('documentBundles', "$documentBundles, WorkspaceManager.Translations"))
    #set ($discard = $xwikiPreferencesDocument.save($msg.get('platform.workspace.translationsInstallSaveComment'), true))
    {{success}}$msg.get('workspacemanager.translations.install.success'){{/success}}
  #else
    #set ($needsAdminRights = true)
  #end
#else
  ##
  ## Don't display this information if the code is included from somewhere else.
  ##
  #if ($context.doc == $context.tdoc)
    {{success}}$msg.get('workspacemanager.translations.install.success'){{/success}}
  #end
#end
##
## 2. Register workspace search suggestions
##
#macro (registerWorkspaceSearchSuggestions $wikiName $skipSuccessMessage $skipNeedsAdminRightsCheck)
  #set ($searchSuggestConfigDocumentReference = $services.model.createDocumentReference($wikiName, 'XWiki', 'SearchSuggestConfig'))
  #set ($searchSuggestConfigDocument = $xwiki.getDocument($searchSuggestConfigDocumentReference))
  #set ($searchSuggestConfigObject = $searchSuggestConfigDocument.getObject('XWiki.SearchSuggestSourceClass', 'name', 'Workspaces'))
  #if (!$searchSuggestConfigObject)
    #if ($hasGlobalAdmin)
      #set ($searchSuggestConfigObject = $searchSuggestConfigDocument.newObject('XWiki.SearchSuggestSourceClass'))
      #set ($discard = $searchSuggestConfigObject.set('name', 'Workspaces'))
      #set ($discard = $searchSuggestConfigObject.set('query', 'XWiki.XWikiServerClass.wikiprettyname:__INPUT__* AND object:WorkspaceManager.WorkspaceClass'))
      #set ($discard = $searchSuggestConfigObject.set('resultsNumber', '3'))
      #set ($suggestUrl = '$xwiki.getURL(' + $escapetool.quote + '${xcontext.mainWikiName}:WorkspaceManager.WorkspacesSuggestLuceneService' + $escapetool.quote + ', ' + $escapetool.singleQuote + 'get' + $escapetool.singleQuote + ', ' + $escapetool.singleQuote + 'outputSyntax=plain' + $escapetool.singleQuote + ')')
      #set ($discard = $searchSuggestConfigObject.set('url', $suggestUrl))
      #set ($discard = $searchSuggestConfigObject.set('activated', 1))
      #set ($discard = $searchSuggestConfigObject.set('highlight', 1))
      #set ($suggestIcon = '$xwiki.getSkinFile(' + $escapetool.singleQuote + 'icons/silk/chart_organisation.png' + $escapetool.singleQuote + ')')
      #set ($discard = $searchSuggestConfigObject.set('icon', $suggestIcon))
      ##
      #set ($discard = $searchSuggestConfigDocument.save($msg.get('platform.workspace.searchSuggestionsInstallSaveComment'), true))
      #if (!$skipSuccessMessage)

        {{success}}$msg.get('workspacemanager.searchSuggestions.install.success'){{/success}}
      #end
    #elseif (!$skipNeedsAdminRightsCheck)
      #set ($needsAdminRights = true)
    #end
  #elseif (!$skipSuccessMessage)
    ##
    ## Don't display this information if the code is included from somewhere else.
    ##
    #if ($context.doc == $context.tdoc)

      {{success}}$msg.get('workspacemanager.searchSuggestions.install.success'){{/success}}
    #end
  #end
#end
#registerWorkspaceSearchSuggestions($xcontext.database)
##
## 3. Install template
##
#if (!$WikiManager)
  #set ($WikiManager = $services.wikimanager)
  #if (!$WikiManager)

    {{error}}$msg.get('workspacemanager.dependencies.wikimanager.missing'){{/error}}
  #end
#end
#if (!$services.applicationmanager)

  {{error}}$msg.get('workspacemanager.dependencies.applicationmanager.missing'){{/error}}
#end
##
## Constants
#set ($TEMPLATE_NAME = 'workspacetemplate')
#set ($TEMPLATE_PACKAGE = 'workspace-template.xar')
##
#set ($Exception = $WikiManager.DefaultException)
#set ($template = $WikiManager.getWikiTemplateDocument($TEMPLATE_NAME))
#if ("$!template" == '')
  #if ($hasGlobalAdmin)
    #if ($doc.getAttachment($TEMPLATE_PACKAGE))
      #if ("$!request.confirmTemplateInstall" == '1')
        #set ($result = $WikiManager.createWikiTemplate($TEMPLATE_NAME, '', $TEMPLATE_PACKAGE))
        #if ($result == $Exception.ERROR_NOERROR)
          ## Set the template's pretty name.
          #set($wikiTemplateDocument = $WikiManager.getWikiDocument($TEMPLATE_NAME))
          #set($discard = $wikiTemplateDocument.setWikiPrettyName($msg.get('platform.workspace.templateWikiTitle')))
          ##
          ## Mark the template as a workspace to differentiate it from other regular wiki templates.
          #set($workspaceObj = $wikiTemplateDocument.getObject('WorkspaceManager.WorkspaceClass', true))
          #set($discard = $workspaceObj.set('membershipType', 'open'))
          #set($discard = $wikiTemplateDocument.save('Marked the template as a workspace.', true))
          ##
          ## Use a redirect so that the page can be refreshed after the form's POST.
          #set ($discard = $response.sendRedirect($doc.getURL()))

          {{success}}$msg.get('workspacemanager.template.install.success'){{/success}}
        #elseif ($result == $Exception.ERROR_XWIKI_ACCESS_DENIED)
          #set ($needsAdminRights = true)
        #else

          {{error}}$msg.get('workspacemanager.template.install.error', [$xcontext.lastexception]){{/error}}
        #end
      #else

        {{warning}}
          $msg.get('platform.workspace.templateNotInstalledInstallNow')

          {{html}}
          &lt;form method='post' action="$doc.getURL()"&gt;
            &lt;div&gt;
              &lt;input type='hidden' name='form_token' value="$!{services.csrf.getToken()}" /&gt;
{'fraction_non_alphanumeric': 0.15598822730359974, 'fraction_numerical': 0.008452192287374538, 'mean_word_length': 5.1809701492537314, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 2, '>': 81, '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': '7666543', 'n_tokens_mistral': 4224, 'n_tokens_neox': 4048, 'n_words': 628}