Re: Save CSS/StyleSheet in Database ?
Can you please send me the sample codes of your implementation for Images ? I also want dynamic images to be displayed on my web page. Thanks, Farhan From: Michael O'Cleirigh michael.ocleir...@rivulet.ca To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 8:04:00 PM Subject: Re: Save CSS/StyleSheet in Database ? Hi Farhan, You should create an IRequestTargetUrlCodingStrategy implementation to serve the CSS from the database. It should work to mount the strategy on something like '/custom-user-css' and then user the rest of the path as the options for say the user and version of the css to load. The version number may be needed to get around browser caching of the CSS if changes are made. You get look at the other implementations to see how they do this but yours will be slightly different since you are serving CSS not Pages. You can then add in the CSS resource link to the pages that need it only customizing the user parameter part of the url. I've done something similar for generating user specific images (custom images stamped with user specific details) so I know it will work. Regards, Mike Thanks for quick response. Obviously, styles can be loaded from database after Login. But i want to make a separate css file and dont want ot add it in the java code, for sake of simplicity. Is there any way to store css styles directly from css file for a specific user, and then load styles directly to css file after user Login ? Or can we make css file dynamic by introducing variables in it (like in PHP) ? Thanks... From: Mathias Nilsson wicket.program...@gmail.com To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 4:59:53 PM Subject: Re: Save CSS/StyleSheet in Database ? You would probably have to use cookies to save which style the users would have. There is no way knowing this without login or cookie. There are probably a better way of doing this but if you save style and classes in a database like this *{ font-family: verdana; } // a row in the database a{ color: red; } // a row in the database you could implement the IHeaderContributor and override the renderHead public void renderHead(IHeaderResponse response) { StringBuffer buf = new StringBuffer(); buf.append( style type=\text/css\ ); buf.append( *{ font-size: 9px; } ); buf.append( /style ); response.renderString(buf); } of couse you should the get it from a service or directly from a dao. public void renderHead(IHeaderResponse response) { BradningService service = getBrandingService(); // get this using @SpringBean or whatever ListString styles = service.getStyles( user ); // get the style for a user iterate here and add the style } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Save CSS/StyleSheet in Database ?
Hi Farhan, Can you please send me the sample codes of your implementation for Images ? I also want dynamic images to be displayed on my web page. I tried to condense what I did into an email but that grew too big. I've put up the important classes onto the Wicket Wiki here: http://cwiki.apache.org/confluence/display/WICKET/How+to+Stamp+an+Image+Template+with+Context+Specific+Details. You can see that is much more limited than what you are talking about implementing but perhaps it can be a place to start from. Regards, Mike - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Save CSS/StyleSheet in Database ?
Hi, Is there any way to store CSS settings and classes into a database. I have a css file describing styles for whole website. I want to give user an option, to modify styles (background color, font, table header font, etc.) of thier own choices (at run-time). When user selects from the given options and hit save, then these values store in the database, so that when user visits the website next time then customized styles (theme) should be displayed on the web pages rather than default styles. I know this can be done by using cookies (through javascript) but the problem arises when user visits the website after deleting private data of browser. In this way, again default styles applies to all web pages. Is there any way to make css file dynamic (using variables in css file), or to save css classes (styles) into database ? Thanks, Farhan.
Re: Save CSS/StyleSheet in Database ?
You would probably have to use cookies to save which style the users would have. There is no way knowing this without login or cookie. There are probably a better way of doing this but if you save style and classes in a database like this *{ font-family: verdana; } // a row in the database a{ color: red; } // a row in the database you could implement the IHeaderContributor and override the renderHead public void renderHead(IHeaderResponse response) { StringBuffer buf = new StringBuffer(); buf.append( style type=\text/css\ ); buf.append( *{ font-size: 9px; } ); buf.append( /style ); response.renderString(buf); } of couse you should the get it from a service or directly from a dao. public void renderHead(IHeaderResponse response) { BradningService service = getBrandingService(); // get this using @SpringBean or whatever ListString styles = service.getStyles( user ); // get the style for a user iterate here and add the style } -- View this message in context: http://www.nabble.com/Save-CSS-StyleSheet-in-Database---tp24604324p24604928.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Save CSS/StyleSheet in Database ?
Thanks for quick response. Obviously, styles can be loaded from database after Login. But i want to make a separate css file and dont want ot add it in the java code, for sake of simplicity. Is there any way to store css styles directly from css file for a specific user, and then load styles directly to css file after user Login ? Or can we make css file dynamic by introducing variables in it (like in PHP) ? Thanks... From: Mathias Nilsson wicket.program...@gmail.com To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 4:59:53 PM Subject: Re: Save CSS/StyleSheet in Database ? You would probably have to use cookies to save which style the users would have. There is no way knowing this without login or cookie. There are probably a better way of doing this but if you save style and classes in a database like this *{ font-family: verdana; } // a row in the database a{ color: red; } // a row in the database you could implement the IHeaderContributor and override the renderHead public void renderHead(IHeaderResponse response) { StringBuffer buf = new StringBuffer(); buf.append( style type=\text/css\ ); buf.append( *{ font-size: 9px; } ); buf.append( /style ); response.renderString(buf); } of couse you should the get it from a service or directly from a dao. public void renderHead(IHeaderResponse response) { BradningService service = getBrandingService(); // get this using @SpringBean or whatever ListString styles = service.getStyles( user ); // get the style for a user iterate here and add the style } -- View this message in context: http://www.nabble.com/Save-CSS-StyleSheet-in-Database---tp24604324p24604928.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Save CSS/StyleSheet in Database ?
I have not done this myself, but I think you might get what you want using the SimpleAttributeModifier. Say you were doing a css style: link rel=stylesheet type=text/css href=css/standard.css wicket:id=userStyles:/ Then in your javacode you can have: userCss.add(new SimpleAttributeModifier(href, css/ + LOGGEDINUSER.getUserId() + .css)); You could always do something similar in javascript with cookies. Russ Date: Wed, 22 Jul 2009 05:12:45 -0700 From: farhan.ba...@ymail.com Subject: Re: Save CSS/StyleSheet in Database ? To: users@wicket.apache.org Thanks for quick response. Obviously, styles can be loaded from database after Login. But i want to make a separate css file and dont want ot add it in the java code, for sake of simplicity. Is there any way to store css styles directly from css file for a specific user, and then load styles directly to css file after user Login ? Or can we make css file dynamic by introducing variables in it (like in PHP) ? Thanks... From: Mathias Nilsson wicket.program...@gmail.com To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 4:59:53 PM Subject: Re: Save CSS/StyleSheet in Database ? You would probably have to use cookies to save which style the users would have. There is no way knowing this without login or cookie. There are probably a better way of doing this but if you save style and classes in a database like this *{ font-family: verdana; } // a row in the database a{ color: red; } // a row in the database you could implement the IHeaderContributor and override the renderHead public void renderHead(IHeaderResponse response) { StringBuffer buf = new StringBuffer(); buf.append( style type=\text/css\ ); buf.append( *{ font-size: 9px; } ); buf.append( /style ); response.renderString(buf); } of couse you should the get it from a service or directly from a dao. public void renderHead(IHeaderResponse response) { BradningService service = getBrandingService(); // get this using @SpringBean or whatever ListString styles = service.getStyles( user ); // get the style for a user iterate here and add the style } -- View this message in context: http://www.nabble.com/Save-CSS-StyleSheet-in-Database---tp24604324p24604928.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org _ Windows Live™ SkyDrive™: Store, access, and share your photos. See how. http://windowslive.com/Online/SkyDrive?ocid=TXT_TAGLM_WL_CS_SD_photos_072009
Re: Save CSS/StyleSheet in Database ?
Hi Farhan, You should create an IRequestTargetUrlCodingStrategy implementation to serve the CSS from the database. It should work to mount the strategy on something like '/custom-user-css' and then user the rest of the path as the options for say the user and version of the css to load. The version number may be needed to get around browser caching of the CSS if changes are made. You get look at the other implementations to see how they do this but yours will be slightly different since you are serving CSS not Pages. You can then add in the CSS resource link to the pages that need it only customizing the user parameter part of the url. I've done something similar for generating user specific images (custom images stamped with user specific details) so I know it will work. Regards, Mike Thanks for quick response. Obviously, styles can be loaded from database after Login. But i want to make a separate css file and dont want ot add it in the java code, for sake of simplicity. Is there any way to store css styles directly from css file for a specific user, and then load styles directly to css file after user Login ? Or can we make css file dynamic by introducing variables in it (like in PHP) ? Thanks... From: Mathias Nilsson wicket.program...@gmail.com To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 4:59:53 PM Subject: Re: Save CSS/StyleSheet in Database ? You would probably have to use cookies to save which style the users would have. There is no way knowing this without login or cookie. There are probably a better way of doing this but if you save style and classes in a database like this *{ font-family: verdana; } // a row in the database a{ color: red; } // a row in the database you could implement the IHeaderContributor and override the renderHead public void renderHead(IHeaderResponse response) { StringBuffer buf = new StringBuffer(); buf.append( style type=\text/css\ ); buf.append( *{ font-size: 9px; } ); buf.append( /style ); response.renderString(buf); } of couse you should the get it from a service or directly from a dao. public void renderHead(IHeaderResponse response) { BradningService service = getBrandingService(); // get this using @SpringBean or whatever ListString styles = service.getStyles( user ); // get the style for a user iterate here and add the style } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Save CSS/StyleSheet in Database ?
It means there will be a separate CSS file for each user. This will impose heavy load on the application, and where is database involved in that case, as i want to save and load css styles from database ? Is there any other way to do that ? Can we make CSS file dynamic e.g. body{background: {$color};} and then modify that color variable in our javacode (like inPHP) ? From: Russell Simpkins russellsimpk...@hotmail.com To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 6:23:09 PM Subject: RE: Save CSS/StyleSheet in Database ? I have not done this myself, but I think you might get what you want using the SimpleAttributeModifier. Say you were doing a css style: link rel=stylesheet type=text/css href=css/standard.css wicket:id=userStyles:/ Then in your javacode you can have: userCss.add(new SimpleAttributeModifier(href, css/ + LOGGEDINUSER.getUserId() + .css)); You could always do something similar in javascript with cookies. Russ Date: Wed, 22 Jul 2009 05:12:45 -0700 From: farhan.ba...@ymail.com Subject: Re: Save CSS/StyleSheet in Database ? To: users@wicket.apache.org Thanks for quick response. Obviously, styles can be loaded from database after Login. But i want to make a separate css file and dont want ot add it in the java code, for sake of simplicity. Is there any way to store css styles directly from css file for a specific user, and then load styles directly to css file after user Login ? Or can we make css file dynamic by introducing variables in it (like in PHP) ? Thanks... From: Mathias Nilsson wicket.program...@gmail.com To: users@wicket.apache.org Sent: Wednesday, July 22, 2009 4:59:53 PM Subject: Re: Save CSS/StyleSheet in Database ? You would probably have to use cookies to save which style the users would have. There is no way knowing this without login or cookie. There are probably a better way of doing this but if you save style and classes in a database like this *{ font-family: verdana; } // a row in the database a{ color: red; } // a row in the database you could implement the IHeaderContributor and override the renderHead public void renderHead(IHeaderResponse response) { StringBuffer buf = new StringBuffer(); buf.append( style type=\text/css\ ); buf.append( *{ font-size: 9px; } ); buf.append( /style ); response.renderString(buf); } of couse you should the get it from a service or directly from a dao. public void renderHead(IHeaderResponse response) { BradningService service = getBrandingService(); // get this using @SpringBean or whatever ListString styles = service.getStyles( user ); // get the style for a user iterate here and add the style } -- View this message in context: http://www.nabble.com/Save-CSS-StyleSheet-in-Database---tp24604324p24604928.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org _ Windows Live™ SkyDrive™: Store, access, and share your photos. See how. http://windowslive.com/Online/SkyDrive?ocid=TXT_TAGLM_WL_CS_SD_photos_072009
Save CSS/Stylesheet in Database
hi, i want to save all the CSS Data for each component in the database. That's no problem, i save the key and values for the component in a table. But, i don't know how i can provide the Page and the components the CSS Information. Is there an easy way to have a complete dynamic Stylesheet which gets the Data from the database? thanks markus
Re: Save CSS/Stylesheet in Database
why do you want to do this? why not using HeaderContributors and css files analog to your html files? Markus Haspl wrote: hi, i want to save all the CSS Data for each component in the database. That's no problem, i save the key and values for the component in a table. But, i don't know how i can provide the Page and the components the CSS Information. Is there an easy way to have a complete dynamic Stylesheet which gets the Data from the database? thanks markus - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/Save-CSS-Stylesheet-in-Database-tp19159504p19160485.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Save CSS/Stylesheet in Database
because every component has his own css styles, but the users (registered users in the database) should change the look feel of their own page. On Tue, Aug 26, 2008 at 1:53 PM, Michael Sparer [EMAIL PROTECTED]wrote: why do you want to do this? why not using HeaderContributors and css files analog to your html files? Markus Haspl wrote: hi, i want to save all the CSS Data for each component in the database. That's no problem, i save the key and values for the component in a table. But, i don't know how i can provide the Page and the components the CSS Information. Is there an easy way to have a complete dynamic Stylesheet which gets the Data from the database? thanks markus - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/Save-CSS-Stylesheet-in-Database-tp19159504p19160485.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]