%PDF- %PDF-
Direktori : /proc/309157/root/home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/templates/ |
Current File : //proc/309157/root/home/waritko/jetty-distribution-9.4.21.v20190926/webapps/ROOT/templates/copy.vm |
### ### Copy document template ### #template('xwikivars.vm') ## Note: Checking only the view right because $hasCreatePage is not yet reliable. #if (!$xwiki.hasAccessLevel('view')) #template("accessdenied.vm") #elseif($doc.isNew()) $response.setStatus(404) #template("startpage.vm") <div class="main layoutsubsection"> <div id="mainContentArea"> #error($services.localization.render('core.rename.nonexistingDocument')) </div>## mainContentArea </div>## main #template("endpage.vm") #else #template("startpage.vm") <div class="main layoutsubsection"> <div id="mainContentArea"> <div id="document-title"><h1>$services.localization.render('core.copy.title', [$escapetool.xml($doc.plainTitle), $doc.getURL()])</h1></div> ##------------------------------------------------ ## Get source reference ##------------------------------------------------ #set($sourcewiki = "$!{request.sourceWikiName}") #if("$!sourcewiki" == "") #set($sourcewiki = $xcontext.database) #end #set($sourcespace = "$!{request.sourceSpaceName}") #set($sourcepage = "$!{request.sourcePageName}") ##------------------------------------------------ ## Get target reference ##------------------------------------------------ #set($targetwiki = "$!{request.targetWikiName}") #if("$!targetwiki" == "") #set($targetwiki = $xcontext.database) #end #set($targetspace = "$!{request.targetSpaceName}") #set($targetpage = "$!{request.targetPageName}") ##------------------------------------------------ ## Get which translated pages we need to copy ##------------------------------------------------ #if("$!request.language" != "" && "$!{request.language}" != 'ALL') #set($language = "$!{request.language}") #set($escapedLanguage = "$!{escapetool.xml($request.language)}") #end ##------------------------------------------------------------- ## Decide whether to perform the copy or display the copy form ##------------------------------------------------------------- #if($sourcewiki != "" && $sourcespace != "" && $sourcepage != "" && $targetwiki != "" && $targetspace != "" && $targetpage != "" && $!{services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) #set ($locale = $services.localization.toLocale($language)) #set ($sourceWikiReference = $services.model.createWikiReference($sourcewiki)) #set ($sourceSpaceReference = $services.model.resolveSpace($sourcespace, 'explicit', $sourceWikiReference)) #set ($sourceDocReference = $services.model.createEntityReference($sourcepage, 'DOCUMENT', $sourceSpaceReference)) #set ($sourceDocReference = $services.model.createDocumentReference($sourceDocReference, $locale)) #set ($targetWikiReference = $services.model.createWikiReference($targetwiki)) #set ($targetSpaceReference = $services.model.resolveSpace($targetspace, 'explicit', $targetWikiReference)) #set ($targetDocReference = $services.model.createEntityReference($targetpage, 'DOCUMENT', $targetSpaceReference)) #set ($targetDocReference = $services.model.createDocumentReference($targetDocReference, $locale)) ##----------------------------------------------------------- ## If the target document already exists and is not a redirect placeholder, warn the user. ##----------------------------------------------------------- #if ($xwiki.exists($targetDocReference) && "$!request.overwrite" != 'true' && !$xwiki.getDocument($targetDocReference).getObject('XWiki.RedirectClass')) #warning($services.localization.render('core.copy.alreadyExists', [$services.model.serialize($targetDocReference, 'compactwiki')])) <form action="$xwiki.relativeRequestURL" class="xform third"> ## CSRF prevention <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> <input type="hidden" name="xpage" value="copy" /> <input type="hidden" name="overwrite" value="true" /> <input type="hidden" name="sourceWikiName" value="$escapetool.xml($sourcewiki)" /> <input type="hidden" name="sourceSpaceName" value="$escapetool.xml($sourcespace)" /> <input type="hidden" name="sourcePageName" value="$escapetool.xml($sourcepage)" /> <input type="hidden" name="targetWikiName" value="$escapetool.xml($targetwiki)" /> <input type="hidden" name="targetSpaceName" value="$escapetool.xml($targetspace)" /> <input type="hidden" name="targetPageName" value="$escapetool.xml($targetpage)" /> <div class="buttons"> <span class="buttonwrapper"><input type="submit" value="$services.localization.render('core.copy.submit')" class="button"/></span> <span class="buttonwrapper"><a class="secondary button" href="$doc.getURL('view', 'xpage=copy')">$services.localization.render('core.copy.changeTarget')</a></span> <span class="buttonwrapper"><a class="secondary button" href="$doc.getURL()">$services.localization.render('core.copy.cancel')</a></span> </div> </form> #elseif (!$services.security.authorization.hasAccess('edit', $targetDocReference)) #warning($services.localization.render('core.copy.editRightsForbidden', [$services.model.serialize($targetDocReference, 'compactwiki')])) <div class="buttons"> <span class="buttonwrapper"> <a class="secondary button" href="$doc.getURL('view', 'xpage=copy')"> $services.localization.render('core.copy.changeTarget') </a> </span> <span class="buttonwrapper"> <a class="secondary button" href="$doc.getURL()">$services.localization.render('core.copy.cancel')</a> </span> </div> #else #set ($success = false) #set ($copyAsJob = $services.refactoring.copyAs($sourceDocReference, $targetDocReference)) #try() #set ($discard = $copyAsJob.join()) #set ($copyAsJobStatus = $services.job.getJobStatus($copyAsJob.request.id)) #set ($success = $copyAsJobStatus.log.getLogs('ERROR').isEmpty()) #end #if ($success) #if($escapedLanguage) #set($fromurl = $xwiki.getURL($sourceDocReference, "view", "language=${escapedLanguage}")) #set($tourl = $xwiki.getURL($targetDocReference, "view", "language=${escapedLanguage}")) #else #set($fromurl = $xwiki.getURL($sourceDocReference)) #set($tourl = $xwiki.getURL($targetDocReference)) #end #set($sourcelink = "<a href='${fromurl}'>$!{escapetool.xml($sourceDocReference.name)} #if($escapedLanguage)($escapedLanguage)#end</a>") #set($targetlink = "<a href='${tourl}'>$!{escapetool.xml($targetDocReference.name)}</a>") #info($services.localization.render('core.copy.copyingdoc', [$sourcelink, $targetlink])) #else #error($services.localization.render('core.rename.targetNotWritable')) #end #end #else <form action="$xwiki.relativeRequestURL" class="xform third"> <div class="hidden"> ## CSRF prevention <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> <input type="hidden" name="xpage" value="copy" /> </div> <dl> ##------------------ ## Wiki Source field ##------------------ #set ($displayWikiFields = ($xcontext.userReference.wikiReference.name == $xcontext.mainWikiName) && $xwiki.hasSubWikis()) #if ($displayWikiFields) <dt> <label for="sourceWikiName">$services.localization.render('core.copy.sourcewiki')</label> <span class="xHint">$services.localization.render('core.copy.sourcewiki.hint')</span> </dt> <dd>$!{escapetool.xml($doc.wiki)} <input type="hidden" id="sourceWikiName" name="sourceWikiName" value="$!{escapetool.xml($doc.wiki)}" size="60"/></dd> #end ##------------------ ## Space Source field ##------------------ <dt> <label for="sourceSpaceName">$services.localization.render('core.copy.sourcespace')</label> <span class="xHint">$services.localization.render('core.copy.sourcespace.hint')</span> </dt> <dd>$!{escapetool.xml($doc.space)} <input type="hidden" id="sourceSpaceName" name="sourceSpaceName" value="$!{escapetool.xml($doc.space)}" size="60"/></dd> ##------------------ ## Page Source field ##------------------ <dt> <label for="sourcePageName">$services.localization.render('core.copy.sourcepage')</label> <span class="xHint">$services.localization.render('core.copy.sourcepage.hint')</span> </dt> <dd>$!{escapetool.xml($doc.documentReference.name)} <input type="hidden" id="sourcePageName" name="sourcePageName" value="$!{escapetool.xml($doc.documentReference.name)}" size="60"/></dd> ##------------------ ## Translation field ##------------------ #set ($docTranslations = $doc.getTranslationList()) #if ($xwiki.isMultiLingual() && $docTranslations.size() > 0) <dt> <label for="language">$services.localization.render('language')</label> <span class="xHint">$services.localization.render('core.copy.language.hint')</span> </dt> <dd> <select id="language" name="language"> ## Add a special "All Translations" combo box entry to copy all translations. <option value="ALL" selected="selected">$services.localization.render('core.copy.allTranslations')</option> ## Add all the existing translations #foreach ($docTranslation in $docTranslations) <option>$docTranslation</option> #end </select> </dd> #end ##------------------ ## Wiki Target field ##------------------ #if ($displayWikiFields) <dt> <label for="targetWikiName">$services.localization.render('core.copy.targetwiki')</label> <span class="xHint">$services.localization.render('core.copy.targetwiki.hint')</span> </dt> <dd> <select id="targetWikiName" name="targetWikiName"> #set ($wikis = $xwiki.wikiNames) #foreach ($wiki in $wikis) <option #if ($wiki == $doc.wiki) selected="selected" #end>$!{escapetool.xml($wiki)}</option> #end </select> </dd> #end ##------------------- ## Space Target field ##------------------- <dt> <label for="targetSpaceName">$services.localization.render('core.copy.targetspace')</label> <span class="xHint">$services.localization.render('core.copy.targetspace.hint')</span> </dt> <dd> <input type="text" name="targetSpaceName" id="targetSpaceName" size="60" class="suggestSpaces" value="$!{escapetool.xml($doc.space)}"/> </dd> ##------------------ ## Page Target field ##------------------ <dt> <label for="targetPageName">$services.localization.render('core.copy.targetpage')</label> <span class="xHint">$services.localization.render('core.copy.targetpage.hint')</span> </dt> <dd><input type="text" id="targetPageName" name="targetPageName" value="$!{escapetool.xml($doc.documentReference.name)}" size="60" /></dd> </dl> <div class="buttons"> <span class="buttonwrapper"><input type="submit" value="$services.localization.render('core.copy.submit')" class="button"/></span> <span class="buttonwrapper"><a class="secondary button" href="$doc.getURL()">$services.localization.render('core.copy.cancel')</a></span> </div> </form> #end <div class="clearfloats"></div> </div>## mainContentArea </div>## main #template("endpage.vm") #end