Permalink
Browse files

first init

  • Loading branch information...
1 parent 0b2a313 commit a075013834274b76158f06fe638e8761528af21c @gonzalogarciajaubert committed Nov 29, 2012
Showing with 3,049 additions and 0 deletions.
  1. +6 −0 application.properties
  2. +5 −0 grails-app/conf/ApplicationResources.groovy
  3. +106 −0 grails-app/conf/BootStrap.groovy
  4. +56 −0 grails-app/conf/BuildConfig.groovy
  5. +105 −0 grails-app/conf/Config.groovy
  6. +43 −0 grails-app/conf/DataSource.groovy
  7. +13 −0 grails-app/conf/UrlMappings.groovy
  8. +3 −0 grails-app/conf/spring/resources.groovy
  9. +99 −0 grails-app/controllers/com/dynamicthemesexample/ExampleController.groovy
  10. +55 −0 grails-app/i18n/messages.properties
  11. +55 −0 grails-app/i18n/messages_cs_CZ.properties
  12. +56 −0 grails-app/i18n/messages_da.properties
  13. +55 −0 grails-app/i18n/messages_de.properties
  14. +55 −0 grails-app/i18n/messages_es.properties
  15. +19 −0 grails-app/i18n/messages_fr.properties
  16. +55 −0 grails-app/i18n/messages_it.properties
  17. +55 −0 grails-app/i18n/messages_ja.properties
  18. +55 −0 grails-app/i18n/messages_nl.properties
  19. +59 −0 grails-app/i18n/messages_pl.properties
  20. +59 −0 grails-app/i18n/messages_pt_BR.properties
  21. +34 −0 grails-app/i18n/messages_pt_PT.properties
  22. +31 −0 grails-app/i18n/messages_ru.properties
  23. +55 −0 grails-app/i18n/messages_sv.properties
  24. +55 −0 grails-app/i18n/messages_th.properties
  25. +18 −0 grails-app/i18n/messages_zh_CN.properties
  26. 0 grails-app/migrations/changelog.groovy
  27. +11 −0 grails-app/views/error.gsp
  28. +33 −0 grails-app/views/example/css.gsp
  29. +46 −0 grails-app/views/example/index.gsp
  30. +135 −0 grails-app/views/index.gsp
  31. +29 −0 grails-app/views/layouts/main.gsp
  32. +19 −0 test/unit/com/dynamicthemesexample/ExampleControllerTests.groovy
  33. +689 −0 web-app/css/bootstrap.min.css
  34. +109 −0 web-app/css/errors.css
  35. +596 −0 web-app/css/main.css
  36. +82 −0 web-app/css/mobile.css
  37. BIN web-app/images/apple-touch-icon-retina.png
  38. BIN web-app/images/apple-touch-icon.png
  39. BIN web-app/images/default.zip
  40. BIN web-app/images/favicon.ico
  41. BIN web-app/images/grails_logo.jpg
  42. BIN web-app/images/grails_logo.png
  43. BIN web-app/images/leftnav_btm.png
  44. BIN web-app/images/leftnav_midstretch.png
  45. BIN web-app/images/leftnav_top.png
  46. BIN web-app/images/skin/database_add.png
  47. BIN web-app/images/skin/database_delete.png
  48. BIN web-app/images/skin/database_edit.png
  49. BIN web-app/images/skin/database_save.png
  50. BIN web-app/images/skin/database_table.png
  51. BIN web-app/images/skin/exclamation.png
  52. BIN web-app/images/skin/house.png
  53. BIN web-app/images/skin/information.png
  54. BIN web-app/images/skin/shadow.jpg
  55. BIN web-app/images/skin/sorted_asc.gif
  56. BIN web-app/images/skin/sorted_desc.gif
  57. BIN web-app/images/spinner.gif
  58. BIN web-app/images/springsource.png
  59. +9 −0 web-app/js/application.js
  60. +12 −0 web-app/themes/default/default.css
  61. +27 −0 web-app/themes/default/default.html
  62. BIN web-app/themes/default/default.snapshot.png
  63. BIN web-app/themes/default/images/grails_logo.png
  64. BIN web-app/themes/default/images/jabber_protocol.png
  65. +11 −0 web-app/themes/default2/default2.css
  66. +34 −0 web-app/themes/default2/default2.html
  67. BIN web-app/themes/default2/default2.snapshot.png
  68. BIN web-app/themes/default2/images/springsource.png
View
@@ -0,0 +1,6 @@
+#Grails Metadata file
+#Thu Nov 29 13:12:52 GMT 2012
+app.grails.version=2.1.1
+app.name=DynamicThemesExample
+app.version=0.1
+plugins.dynamic-themes=0.1
@@ -0,0 +1,5 @@
+modules = {
+ application {
+ resource url:'js/application.js'
+ }
+}
@@ -0,0 +1,106 @@
+import java.util.zip.ZipEntry
+import java.util.zip.ZipInputStream
+import java.util.zip.ZipOutputStream
+
+class BootStrap {
+
+ def init = { servletContext ->
+ zipUtils.crearClausura()
+ }
+ def destroy = {
+ }
+
+ /**
+ *
+ * @author Gonzalo Garcia Jaubert
+ * FROM: http://blog.xebia.com/2008/05/25/powerful-groovy/ AND http://grooveek.blogspot.com.es/2009/09/adding-zipping-and-unzipping.html
+ *
+ */
+ static class zipUtils {
+
+ //define zip closure first, then allocate it
+ // it is needed to make the recursion work
+ static zip
+
+
+ /**
+ * METODOS ZIP Recursivo para descomprimir carpetas
+ *
+ * FROM: http://blog.xebia.com/2008/05/25/powerful-groovy/ AND http://grooveek.blogspot.com.es/2009/09/adding-zipping-and-unzipping.html
+ *
+ */
+ private static void crearClausura() {
+ zip = { ZipOutputStream zipOutStream,File f , String path->
+ def name = (path.equals(""))?f.name:path + File.separator + f.name
+ if(!f.isDirectory() ){
+ def entry = new ZipEntry(name)
+ zipOutStream.putNextEntry(entry)
+ new FileInputStream(f).withStream { inStream ->
+ def buffer = new byte[1024]
+ def count
+ while((count = inStream.read(buffer, 0, 1024)) != -1) {
+ zipOutStream.write(buffer,0,count)
+ }
+ }
+ zipOutStream.closeEntry()
+ }
+ else {
+ //write the directory first, in order to allow empty directories
+ def entry = new ZipEntry(name + File.separator)
+ zipOutStream.putNextEntry(entry)
+ zipOutStream.closeEntry()
+ f.eachFile{
+ //recurse
+ zip(zipOutStream,it,name)
+ }
+ }
+ }
+
+
+ // Añadimos el descomprimir recursivo
+ File.metaClass.unzip = { String dest ->
+ //in metaclass added methods, 'delegate' is the object on which
+ //the method is called. Here it's the file to unzip
+ def result = new ZipInputStream(new FileInputStream(delegate))
+ def destFile = new File(dest)
+ if(!destFile.exists()){
+ destFile.mkdir();
+ }
+ result.withStream{
+ def entry
+ while(entry = result.nextEntry){
+ if (!entry.isDirectory()){
+ new File(dest + File.separator + entry.name).parentFile?.mkdirs()
+ def output = new FileOutputStream(dest + File.separator
+ + entry.name)
+ output.withStream{
+ int len = 0;
+ byte[] buffer = new byte[4096]
+ while ((len = result.read(buffer)) > 0){
+ output.write(buffer, 0, len);
+ }
+ }
+ }
+ else {
+ new File(dest + File.separator + entry.name).mkdir()
+ }
+ }
+ }
+ }
+
+
+ // Añadimos el comprimir
+ File.metaClass.zip = { String destination ->
+ //cache the delegate (the File Object) as it will be modified
+ //in the withStream closure
+ def input = delegate
+ def result = new ZipOutputStream(new FileOutputStream(destination))
+ result.withStream {zipOutStream->
+ //recursively zip files
+ zip(zipOutStream,input,"")
+ }
+ }
+ }
+
+ }
+}
@@ -0,0 +1,56 @@
+grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
+grails.project.class.dir = "target/classes"
+grails.project.test.class.dir = "target/test-classes"
+grails.project.test.reports.dir = "target/test-reports"
+grails.project.target.level = 1.6
+grails.project.source.level = 1.6
+//grails.project.war.file = "target/${appName}-${appVersion}.war"
+
+grails.project.dependency.resolution = {
+ // inherit Grails' default dependencies
+ inherits("global") {
+ // specify dependency exclusions here; for example, uncomment this to disable ehcache:
+ // excludes 'ehcache'
+ }
+ log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
+ checksums true // Whether to verify checksums on resolve
+
+ repositories {
+ inherits true // Whether to inherit repository definitions from plugins
+
+ grailsPlugins()
+ grailsHome()
+ grailsCentral()
+
+ mavenLocal()
+ mavenCentral()
+
+ // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
+ //mavenRepo "http://snapshots.repository.codehaus.org"
+ //mavenRepo "http://repository.codehaus.org"
+ //mavenRepo "http://download.java.net/maven/2/"
+ //mavenRepo "http://repository.jboss.com/maven2/"
+ }
+ dependencies {
+ // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
+
+ // runtime 'mysql:mysql-connector-java:5.1.20'
+ }
+
+ plugins {
+ runtime ":hibernate:$grailsVersion"
+ runtime ":jquery:1.8.0"
+ runtime ":resources:1.1.6"
+
+ // Uncomment these (or add new ones) to enable additional resources capabilities
+ //runtime ":zipped-resources:1.0"
+ //runtime ":cached-resources:1.0"
+ //runtime ":yui-minify-resources:0.1.4"
+
+ build ":tomcat:$grailsVersion"
+
+ runtime ":database-migration:1.1"
+
+ compile ':cache:1.0.0'
+ }
+}
@@ -0,0 +1,105 @@
+// locations to search for config files that get merged into the main config;
+// config files can be ConfigSlurper scripts, Java properties files, or classes
+// in the classpath in ConfigSlurper format
+
+// grails.config.locations = [ "classpath:${appName}-config.properties",
+// "classpath:${appName}-config.groovy",
+// "file:${userHome}/.grails/${appName}-config.properties",
+// "file:${userHome}/.grails/${appName}-config.groovy"]
+
+// if (System.properties["${appName}.config.location"]) {
+// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
+// }
+
+grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
+grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
+grails.mime.use.accept.header = false
+grails.mime.types = [
+ all: '*/*',
+ atom: 'application/atom+xml',
+ css: 'text/css',
+ csv: 'text/csv',
+ form: 'application/x-www-form-urlencoded',
+ html: ['text/html','application/xhtml+xml'],
+ js: 'text/javascript',
+ json: ['application/json', 'text/json'],
+ multipartForm: 'multipart/form-data',
+ rss: 'application/rss+xml',
+ text: 'text/plain',
+ xml: ['text/xml', 'application/xml']
+]
+
+// URL Mapping Cache Max Size, defaults to 5000
+//grails.urlmapping.cache.maxsize = 1000
+
+// What URL patterns should be processed by the resources plugin
+grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']
+
+// The default codec used to encode data with ${}
+grails.views.default.codec = "none" // none, html, base64
+grails.views.gsp.encoding = "UTF-8"
+grails.converters.encoding = "UTF-8"
+// enable Sitemesh preprocessing of GSP pages
+grails.views.gsp.sitemesh.preprocess = true
+// scaffolding templates configuration
+grails.scaffolding.templates.domainSuffix = 'Instance'
+
+// Set to false to use the new Grails 1.2 JSONBuilder in the render method
+grails.json.legacy.builder = false
+// enabled native2ascii conversion of i18n properties files
+grails.enable.native2ascii = true
+// packages to include in Spring bean scanning
+grails.spring.bean.packages = []
+// whether to disable processing of multi part requests
+grails.web.disable.multipart=false
+
+// request parameters to mask when logging exceptions
+grails.exceptionresolver.params.exclude = ['password']
+
+// configure auto-caching of queries by default (if false you can cache individual queries with 'cache: true')
+grails.hibernate.cache.queries = false
+
+environments {
+ development {
+ grails.logging.jul.usebridge = true
+ }
+ production {
+ grails.logging.jul.usebridge = false
+ // TODO: grails.serverURL = "http://www.changeme.com"
+ }
+}
+
+// log4j configuration
+log4j = {
+ // Example of changing the log pattern for the default console appender:
+ //
+ //appenders {
+ // console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
+ //}
+
+ error 'org.codehaus.groovy.grails.web.servlet', // controllers
+ 'org.codehaus.groovy.grails.web.pages', // GSP
+ 'org.codehaus.groovy.grails.web.sitemesh', // layouts
+ 'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
+ 'org.codehaus.groovy.grails.web.mapping', // URL mapping
+ 'org.codehaus.groovy.grails.commons', // core / classloading
+ 'org.codehaus.groovy.grails.plugins', // plugins
+ 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
+ 'org.springframework',
+ 'org.hibernate',
+ 'net.sf.ehcache.hibernate'
+}
+
+// DynamicThemes
+dynamicThemes {
+ development {
+ resourceController.useCacheControl = true // Override to control the css cached
+ preprocessor.urlThemes = 'themes' // Relative url for themes.
+ preprocessor.fileSystemPath = 'web-app/themes' // Relative file system path for themes. Default is web-app/themes
+ }
+ production {
+ resourceController.useCacheControl = true // Override to control the css cached
+ preprocessor.urlThemes = 'themes' // Relative url for themes.
+ preprocessor.fileSystemPath = "themes" // Relative file system path for themes (servletContext)
+ }
+}
@@ -0,0 +1,43 @@
+dataSource {
+ pooled = true
+ driverClassName = "org.h2.Driver"
+ username = "sa"
+ password = ""
+}
+hibernate {
+ cache.use_second_level_cache = true
+ cache.use_query_cache = false
+ cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
+}
+// environment specific settings
+environments {
+ development {
+ dataSource {
+ dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
+ url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
+ }
+ }
+ test {
+ dataSource {
+ dbCreate = "update"
+ url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
+ }
+ }
+ production {
+ dataSource {
+ dbCreate = "update"
+ url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
+ pooled = true
+ properties {
+ maxActive = -1
+ minEvictableIdleTimeMillis=1800000
+ timeBetweenEvictionRunsMillis=1800000
+ numTestsPerEvictionRun=3
+ testOnBorrow=true
+ testWhileIdle=true
+ testOnReturn=true
+ validationQuery="SELECT 1"
+ }
+ }
+ }
+}
@@ -0,0 +1,13 @@
+class UrlMappings {
+
+ static mappings = {
+ "/$controller/$action?/$id?"{
+ constraints {
+ // apply constraints here
+ }
+ }
+
+ "/"(view:"/index")
+ "500"(view:'/error')
+ }
+}
@@ -0,0 +1,3 @@
+// Place your Spring DSL code here
+beans = {
+}
Oops, something went wrong.

0 comments on commit a075013

Please sign in to comment.