Changeset 6632
- Timestamp:
- Nov 28, 2014, 11:28:38 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/dist/web.xml
r6629 r6632 369 369 <url-pattern>/csp-report</url-pattern> 370 370 </servlet-mapping> 371 372 <!-- A filter that remaps requests to images to skin-controlled variants --> 373 <filter> 374 <description> 375 This filter is used to support provide support for skins to re-map 376 images to their own versions. If this filter is disabled, skins will 377 not be able to remap images. Use the cachce-control parameter to control 378 the time client browsers are allowed to cache images. Skin changes 379 may not be visible until after this time (seconds) has passed. 380 </description> 381 <display-name>Image remap filter</display-name> 382 <filter-name>ImageRemap</filter-name> 383 <filter-class>net.sf.basedb.clients.web.servlet.ImageRemapFilter</filter-class> 384 <init-param> 385 <!-- max-age=time in seconds --> 386 <param-name>cache-control</param-name> 387 <param-value>max-age=3600</param-value> 388 </init-param> 389 </filter> 390 <filter-mapping> 391 <filter-name>ImageRemap</filter-name> 392 <url-pattern>*.png</url-pattern> 393 </filter-mapping> 394 <filter-mapping> 395 <filter-name>ImageRemap</filter-name> 396 <url-pattern>*.gif</url-pattern> 397 </filter-mapping> 371 398 372 399 </web-app> -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/ExtensionsControl.java
r6627 r6632 37 37 import net.sf.basedb.clients.web.extensions.list.ListColumnUtil; 38 38 import net.sf.basedb.clients.web.extensions.service.Services; 39 import net.sf.basedb.clients.web.extensions.skin.ImageRemapperUtil; 39 40 import net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil; 40 41 import net.sf.basedb.clients.web.servlet.ContentSecurityPolicyFilter; … … 167 168 scan(null, null); 168 169 initialised = true; 170 171 ImageRemapperUtil.init(context); 169 172 170 173 Services.init(); -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/skin/FixedSkinActionFactory.java
r6596 r6632 23 23 24 24 import net.sf.basedb.clients.web.extensions.AbstractJspActionFactory; 25 import net.sf.basedb.clients.web.extensions.ExtensionsControl; 25 26 import net.sf.basedb.util.extensions.InvokationContext; 26 27 import net.sf.basedb.util.extensions.xml.PathSetter; … … 29 30 /** 30 31 A simple action factory implementation that always include the 31 given skin on all pages. It supports dynamic attributes and 32 favicon. 32 given skin on all pages. It supports dynamic attributes, favicon 33 and image re-mapping. To use image remapping, set the 34 <image-remap-dir> parameter in the configuration file to 35 a path in the /resources dir in the JAR file but without the /resources 36 prefix. For example, if the images to remap are in the 37 /resources/images/remap directory set the parameter to /images/remap. 33 38 34 39 @author nicklas … … 37 42 public class FixedSkinActionFactory 38 43 extends AbstractJspActionFactory<SkinAction> 39 implements SkinAction40 44 { 41 45 … … 43 47 44 48 private String favicon; 49 50 private String remapDir; 45 51 46 52 /** … … 55 61 */ 56 62 /** 57 @return Always an array with a single element to this instance63 @return Always an array with a single element 58 64 */ 59 65 @Override 60 66 public SkinAction[] getActions(InvokationContext<? super SkinAction> context) 61 67 { 62 return new SkinAction[] { this};68 return new SkinAction[] { new MySkinAction(this, context.getExtension().getId()) }; 63 69 } 64 70 // ---------------------------------- 65 71 66 @Override67 72 public String getId() 68 73 { … … 75 80 } 76 81 77 @Override78 82 public String getFavicon() 79 83 { … … 87 91 this.favicon = favicon; 88 92 } 93 94 public void setImageRemapDir(String remapDir) 95 { 96 this.remapDir = remapDir; 97 } 98 99 public String getImageRemapDir() 100 { 101 return remapDir; 102 } 103 104 static class MySkinAction 105 implements SkinAction 106 { 107 private final FixedSkinActionFactory factory; 108 private final String xtId; 109 110 MySkinAction(FixedSkinActionFactory factory, String xtId) 111 { 112 this.factory = factory; 113 this.xtId = xtId; 114 } 115 116 @Override 117 public String getId() 118 { 119 return factory.getId(); 120 } 121 122 @Override 123 public String getFavicon() 124 { 125 return factory.getFavicon(); 126 } 127 128 @Override 129 public void remapImages(ImageRemapper mapper) 130 { 131 if (factory.getImageRemapDir() != null) 132 { 133 String path = ExtensionsControl.getHomeUrl(xtId) + factory.getImageRemapDir(); 134 ImageRemapperUtil.remapAllTo(mapper, path); 135 } 136 } 137 138 139 } 89 140 } -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/skin/SkinAction.java
r6596 r6632 58 58 public String getFavicon(); 59 59 60 /** 61 Remap images to another location. Use {@link ImageRemapper#map(String, String)} 62 to re-map an image from a source location to a destination location. Note that 63 this method is not called on every use of the skin, but only after 64 something has changed due to installation/uninstallation or enabling/disabled 65 skins. The re-mapped images are then cached. 66 */ 67 public void remapImages(ImageRemapper mapper); 68 60 69 } -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Page.java
r6626 r6632 32 32 import net.sf.basedb.clients.web.extensions.ExtensionsControl; 33 33 import net.sf.basedb.clients.web.extensions.JspContext; 34 import net.sf.basedb.clients.web.extensions.skin.ImageRemapper; 35 import net.sf.basedb.clients.web.extensions.skin.ImageRemapperUtil; 34 36 import net.sf.basedb.clients.web.extensions.skin.SkinAction; 35 37 import net.sf.basedb.util.Values; … … 373 375 ActionIterator<SkinAction> it = invoker.iterate(); 374 376 skinActions = new ArrayList<SkinAction>(); 377 ImageRemapper remapper = ImageRemapperUtil.getNewImageRemapperIfNeeded(pageContext.getServletContext()); 375 378 while (it.hasNext()) 376 379 { 377 380 SkinAction skin = it.next(); 381 if (remapper != null) skin.remapImages(remapper); 378 382 skinActions.add(skin); 379 383 if (favicon == null) … … 383 387 } 384 388 } 389 if (remapper != null) ImageRemapperUtil.setCurrentMapper(remapper); 385 390 386 391 StringBuilder sb = new StringBuilder(); -
trunk/www/exception/not_logged_in.jsp
r6617 r6632 116 116 <table style="width: 100%; margin-top: 1em; border-collapse: separate;"> 117 117 <tr> 118 <td class="base-logo">< /td>118 <td class="base-logo"><img src="images/baselogo.png" alt="BASE logo"></td> 119 119 <td style="width: 515px;"> 120 120 <div id="loginform"> -
trunk/www/include/styles/login.css
r6613 r6632 80 80 border-radius: 4px 0px 0px 4px; 81 81 background-color: #000000; 82 background-image: url('../../images/baselogo.png'); 83 background-repeat: no-repeat; 84 background-position: 50%; 82 text-align: center; 83 vertical-align: middle; 85 84 } 86 85 -
trunk/www/main.jsp
r6617 r6632 134 134 <table style="width: 100%; margin-top: 1em; border-collapse: separate;"> 135 135 <tr> 136 <td class="base-logo">< /td>136 <td class="base-logo"><img src="images/baselogo.png" alt="BASE logo"></td> 137 137 <td style="width: 515px;"> 138 138 <div id="loginform">
Note: See TracChangeset
for help on using the changeset viewer.