一般动作
登录
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)
·
记录
·
信息
隐藏行号
1: {{velocity output="false"}} 2: #if("$!request.xaction" == 'setTheme' && "$!request.theme" != '' && $hasAdmin && ${services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 3: #set($preferencesDoc = $xwiki.getDocument('XWiki.XWikiPreferences')) 4: #set($preferencesObj = $preferencesDoc.getObject('XWiki.XWikiPreferences')) 5: $preferencesObj.set('colorTheme', $request.theme) 6: $preferencesDoc.save() 7: ## Redirect without xaction, so that refreshing doesn't set the same theme again. 8: $response.sendRedirect($doc.getURL('view', "theme=$escapetool.url($request.theme)")) 9: #stop 10: #elseif("$!request.xaction" == 'create' && "$!request.newThemeName" != '' && ${services.csrf.isTokenValid("$!{request.getParameter('form_token')}")}) 11: $response.sendRedirect($xwiki.getDocument($services.model.createDocumentReference($doc.wiki, 'ColorThemes', $request.newThemeName)).getURL('inline', "template=ColorThemes.ColorThemeTemplate&title=$escapetool.url($request.newThemeName)")) 12: #stop 13: #end 14: 15: $xwiki.ssx.use($doc.fullName) 16: 17: 18: ## 19: ## Page mockup, for displaying the theme colors 20: ## 21: #macro(themeMiniDemo $theme) 22: <div class="x-demo-page" style="background-color: $theme.pageBackgroundColor"> 23: <div class="x-demo-top-menu" style="background-color: $theme.menuBackgroundColor"> </div> 24: <div class="x-demo-header" style="background-color: $theme.pageHeaderBackgroundColor"> </div> 25: <div class="x-demo-page-content" style="background-color: $theme.pageContentBackgroundColor"> 26: <div class="x-demo-title" style="background-color: $theme.titleColor; border-color: $theme.borderColor"> </div> 27: <div class="x-demo-text1" style="background-color: $theme.textColor"></div> 28: <div class="x-demo-text2" style="background-color: $theme.textColor"></div> 29: <div class="x-demo-text3" style="background-color: $theme.textColor"></div> 30: <div class="x-demo-text4" style="background-color: $theme.linkColor"></div> 31: <div class="x-demo-text5" style="background-color: $theme.textColor"></div> 32: </div> 33: <div class="x-demo-right-panel"> 34: <div class="x-demo-panel-header" style="background-color: $theme.panelHeaderBackgroundColor; border-color: $theme.borderColor"> 35: <div class="x-demo-panel-header-text" style="background-color: $theme.panelHeaderTextColor"> </div> 36: </div> 37: <div class="x-demo-panel-contents" style="background-color: $theme.panelBackgroundColor"> 38: <div class="x-demo-panel-text1" style="background-color: $theme.panelTextColor"> </div> 39: <div class="x-demo-panel-text2" style="background-color: $theme.panelTextColor"> </div> 40: <div class="x-demo-panel-text3" style="background-color: $theme.panelTextColor"> </div> 41: </div> 42: </div> 43: </div> 44: #end 45: ## 46: ## 47: ## Theme information: title, creator, mockup 48: ## 49: #macro(displayTheme $themeDocName) 50: #if($xwiki.getXWikiPreference('colorTheme') == $themeDocName) 51: #set($isCurrentTheme = true) 52: #else 53: #set($isCurrentTheme = false) 54: #end 55: #set($themeDoc = $xwiki.getDocument($themeDocName)) 56: #set($themeObj = $themeDoc.getObject('ColorThemes.ColorThemeClass', true)) 57: #template('colorThemeInit.vm') 58: <div class="x-theme#if($isCurrentTheme) current-theme#end"> 59: #themeMiniDemo($theme) 60: <div class="x-theme-info"> 61: <div class="x-theme-title">[[$themeDoc.displayTitle>>$themeDocName]]</div> 62: {{html wiki="false"}} 63: <span class="theme-info">$services.localization.render('core.footer.creation', [$xwiki.getUserName($themeDoc.creator), $xwiki.formatDate($themeDoc.creationDate)])</span> 64: #if($hasAdmin && !$isCurrentTheme) 65: <div class="x-theme-set" id="$themeDoc.fullName"> 66: <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> 67: </div> 68: #end 69: {{/html}} 70: </div> 71: </div> 72: #end 73: ## 74: ## End macros 75: ## 76: ## 77: {{/velocity}} 78: 79: {{velocity}} 80: #if("$!request.theme" != '') 81: {{info}}$services.localization.render('xe.themes.themeSet', [$xwiki.getDocument($request.theme).displayTitle]){{/info}} 82: 83: #end 84: {{html wiki="true"}} 85: #set($currentTheme = $xwiki.getDocument('XWiki.XWikiPreferences').getObject('XWiki.XWikiPreferences').getProperty('colorTheme').value) 86: #if("$!currentTheme" == '') 87: #set($currentTheme = 'ColorThemes.DefaultColorTheme') 88: #end 89: == $services.localization.render('xe.themes.current') == 90: #displayTheme($currentTheme) 91: <div class="clearfloats"></div> 92: #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") 93: #set($params = ["$!currentTheme"]) 94: #set($themeList = $services.query.hql($query).bindValues($params).execute()) 95: #if($themeList.size() > 0) 96: == $services.localization.render('xe.themes.others') == 97: #end 98: #if(!$isGuest && $xcontext.action != 'inline') 99: <form action="$doc.getURL()" method="post" class="xformInline"> 100: <div class="x-theme-create"> 101: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 102: <input type="hidden" name="xaction" value="create"/> 103: <label for="newThemeName" class="hidden">$services.localization.render('xe.themes.create.nameLabel')</label> 104: <input type="text" name="newThemeName" id="newThemeName" value="$services.localization.render('xe.themes.create.nameTip')" class="withTip" size="30"/> 105: <span class="buttonwrapper"><input type="submit" value="$services.localization.render('xe.themes.create')" class="button"/></span> 106: </div> 107: </form> 108: #end 109: <div class="clearfloats"></div> 110: #foreach($themeDocName in $themeList) 111: #displayTheme($themeDocName) 112: #end 113: <div class="clearfloats"></div> 114: {{/html}} 115: {{/velocity}}
快速链接
首页
新闻动态
FAQ