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 <[email protected]>
To: [email protected]
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
   List<String> 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: [email protected]
For additional commands, e-mail: [email protected]


      

Reply via email to