一般动作
登录
Wiki:
BROPEN
▼
:
Document Index
»
Space:
ColorThemes
▼
:
Document Index
»
Page:
WebHome
搜索
default
页面动作
导出
▼
:
以PDF格式导出
以RTF格式导出
以HTML格式导出
更多动作
▼
:
打印预览
察看源码
欢迎进入Wiki
»
Color Themes
Wiki源代码
Color Themes
在2013-10-09 15:03上被
Administrator
修改
内容
·
评论
(0)
·
附件
(0)
·
记录
·
信息
显示行号
{{velocity output="false"}} #if("$!request.xaction" == 'setTheme' && "$!request.theme" != '' && $hasAdmin && ${services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) #set($preferencesDoc = $xwiki.getDocument('XWiki.XWikiPreferences')) #set($preferencesObj = $preferencesDoc.getObject('XWiki.XWikiPreferences')) $preferencesObj.set('colorTheme', $request.theme) $preferencesDoc.save() ## Redirect without xaction, so that refreshing doesn't set the same theme again. $response.sendRedirect($doc.getURL('view', "theme=$escapetool.url($request.theme)")) #stop #elseif("$!request.xaction" == 'create' && "$!request.newThemeName" != '' && ${services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) $response.sendRedirect($xwiki.getDocument($services.model.createDocumentReference($doc.wiki, 'ColorThemes', $request.newThemeName)).getURL('inline', "template=ColorThemes.ColorThemeTemplate&title=$escapetool.url($request.newThemeName)")) #stop #end $xwiki.ssx.use($doc.fullName) ## ## Page mockup, for displaying the theme colors ## #macro(themeMiniDemo $theme) <div class="x-demo-page" style="background-color: $theme.pageBackgroundColor"> <div class="x-demo-top-menu" style="background-color: $theme.menuBackgroundColor"> </div> <div class="x-demo-header" style="background-color: $theme.pageHeaderBackgroundColor"> </div> <div class="x-demo-page-content" style="background-color: $theme.pageContentBackgroundColor"> <div class="x-demo-title" style="background-color: $theme.titleColor; border-color: $theme.borderColor"> </div> <div class="x-demo-text1" style="background-color: $theme.textColor"></div> <div class="x-demo-text2" style="background-color: $theme.textColor"></div> <div class="x-demo-text3" style="background-color: $theme.textColor"></div> <div class="x-demo-text4" style="background-color: $theme.linkColor"></div> <div class="x-demo-text5" style="background-color: $theme.textColor"></div> </div> <div class="x-demo-right-panel"> <div class="x-demo-panel-header" style="background-color: $theme.panelHeaderBackgroundColor; border-color: $theme.borderColor"> <div class="x-demo-panel-header-text" style="background-color: $theme.panelHeaderTextColor"> </div> </div> <div class="x-demo-panel-contents" style="background-color: $theme.panelBackgroundColor"> <div class="x-demo-panel-text1" style="background-color: $theme.panelTextColor"> </div> <div class="x-demo-panel-text2" style="background-color: $theme.panelTextColor"> </div> <div class="x-demo-panel-text3" style="background-color: $theme.panelTextColor"> </div> </div> </div> </div> #end ## ## ## Theme information: title, creator, mockup ## #macro(displayTheme $themeDocName) #if($xwiki.getXWikiPreference('colorTheme') == $themeDocName) #set($isCurrentTheme = true) #else #set($isCurrentTheme = false) #end #set($themeDoc = $xwiki.getDocument($themeDocName)) #set($themeObj = $themeDoc.getObject('ColorThemes.ColorThemeClass', true)) #template('colorThemeInit.vm') <div class="x-theme#if($isCurrentTheme) current-theme#end"> #themeMiniDemo($theme) <div class="x-theme-info"> <div class="x-theme-title">[[$themeDoc.displayTitle>>$themeDocName]]</div> {{html wiki="false"}} <span class="theme-info">$services.localization.render('core.footer.creation', [$xwiki.getUserName($themeDoc.creator), $xwiki.formatDate($themeDoc.creationDate)])</span> #if($hasAdmin && !$isCurrentTheme) <div class="x-theme-set" id="$themeDoc.fullName"> <a href="$doc.getURL('view', "xaction=setTheme&theme=${themeDoc.fullName}&form_token=$!{services.csrf.getToken()}")" class="use-theme">$services.localization.render('xe.themes.useTheme')</a> </div> #end {{/html}} </div> </div> #end ## ## End macros ## ## {{/velocity}} {{velocity}} #if("$!request.theme" != '') {{info}}$services.localization.render('xe.themes.themeSet', [$xwiki.getDocument($request.theme).displayTitle]){{/info}} #end {{html wiki="true"}} #set($currentTheme = $xwiki.getDocument('XWiki.XWikiPreferences').getObject('XWiki.XWikiPreferences').getProperty('colorTheme').value) #if("$!currentTheme" == '') #set($currentTheme = 'ColorThemes.DefaultColorTheme') #end == $services.localization.render('xe.themes.current') == #displayTheme($currentTheme) <div class="clearfloats"></div> #set($query = ", BaseObject as theme where doc.fullName=theme.name and theme.className='ColorThemes.ColorThemeClass' and doc.fullName<>'ColorThemes.ColorThemeTemplate' and doc.fullName<>? and doc.fullName<>'ColorThemes.ColorThemeSheet' order by doc.title") #set($params = ["$!currentTheme"]) #set($themeList = $services.query.hql($query).bindValues($params).execute()) #if($themeList.size() > 0) == $services.localization.render('xe.themes.others') == #end #if(!$isGuest && $xcontext.action != 'inline') <form action="$doc.getURL()" method="post" class="xformInline"> <div class="x-theme-create"> <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> <input type="hidden" name="xaction" value="create"/> <label for="newThemeName" class="hidden">$services.localization.render('xe.themes.create.nameLabel')</label> <input type="text" name="newThemeName" id="newThemeName" value="$services.localization.render('xe.themes.create.nameTip')" class="withTip" size="30"/> <span class="buttonwrapper"><input type="submit" value="$services.localization.render('xe.themes.create')" class="button"/></span> </div> </form> #end <div class="clearfloats"></div> #foreach($themeDocName in $themeList) #displayTheme($themeDocName) #end <div class="clearfloats"></div> {{/html}} {{/velocity}}
快速链接
首页
新闻动态
FAQ