General Actions:
Log-in
Wiki:
Courses
▼
:
Document Index
»
Space:
ColorThemes
▼
:
Document Index
»
Page:
WebHome
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to L3D's XWiki for Courses
»
Color Themes
Wiki source code of
Color Themes
Last modified by
Administrator
on 2011/03/03 00:17
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
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('ColorThemes', $request.newThemeName).getURL('inline', 'template=ColorThemes.ColorThemeTemplate')) 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">$msg.get('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">$msg.get('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}}$msg.get('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: == $msg.get('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<>'$currentTheme' and doc.fullName<>'ColorThemes.ColorThemeSheet' order by doc.title") 93: #set($themeList = $xwiki.searchDocuments($query, 0, 0)) 94: #if($themeList.size() > 0) 95: == $msg.get('xe.themes.others') == 96: #end 97: #if(!$isGuest) 98: <form action="$doc.getURL()" method="post"> 99: <div class="x-theme-create"> 100: <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 101: <input type="hidden" name="xaction" value="create"/> 102: <label for="newThemeName" class="hidden">$msg.get('xe.themes.create.nameLabel')</label> 103: <input type="text" name="newThemeName" id="newThemeName" value="$msg.get('xe.themes.create.nameTip')" class="withTip"/> 104: <span class="buttonwrapper"><input type="submit" value="$msg.get('xe.themes.create')" class="button"/></span> 105: </div> 106: </form> 107: #end 108: <div class="clearfloats"></div> 109: #foreach($themeDocName in $themeList) 110: #displayTheme($themeDocName) 111: #end 112: <div class="clearfloats"></div> 113: {{/html}} 114: {{/velocity}}
Welcome
Welcome to this XWiki!
Quick Links
DSSF 2008
DCNM 2009
HCCF 2010
Document Index
Sandbox
My Recent Modifications
ASSIGNMENTNAME