Skip to content

Commit

Permalink
v1.0.6: various improvements and bug fixes.
Browse files Browse the repository at this point in the history
mfakih committed Dec 4, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 057fe33 commit cc4a143
Showing 37 changed files with 3,356 additions and 705 deletions.
45 changes: 12 additions & 33 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
# .gitignore for Grails 1.2 and 1.3
# Although this should work for most versions of grails, it is
# suggested that you use the "grails integrate-with --git" command
# to generate your .gitignore file.

# web application files
/web-app/WEB-INF/classes

# default HSQL database files for production mode
/prodDb.*

# general HSQL database files
*Db.properties
*Db.script

# logs
/stacktrace.log
/test/reports
/logs

# project release file
/*.war

# plugin release files
/*.zip
/plugin.xml

# older plugin install locations
/plugins
/web-app/plugins

# "temporary" build files
/target
Thumbs.db
.DS_Store
.gradle
build/
out/
.idea
*.iml
*.ipr
*.iws
.project
.settings
.classpath
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -4,4 +4,4 @@ set GRAILS_HOME=D:\dev\grails-3.3.10
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
set CATALINA=-server -Xmx780m

grails war --offline
grails war
2 changes: 1 addition & 1 deletion grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ grails:
info:
app:
name: nibras
version: 1.0.5
version: 1.0.6
grailsVersion: '@info.app.grailsVersion@'
server:
contextPath: '/nibras'
82 changes: 47 additions & 35 deletions grails-app/controllers/ker/GenericsController.groovy
Original file line number Diff line number Diff line change
@@ -1242,6 +1242,7 @@ ll

if (!record.bookmarked) {
record.bookmarked = true

} else
record.bookmarked = false

@@ -2668,8 +2669,9 @@ ll
}

def findRecords(String input) {
if (input.contains('++')) {

if (input.contains(' ++')) {
params.max = Setting.findByNameLike('savedSearch.pagination.max.link') ? Setting.findByNameLike('savedSearch.pagination.max.link').value.toInteger() : 5
def entityCode = input.split(/[ ]+/)[0]?.toUpperCase()

def queryHead = 'from ' + entityMapping[entityCode]
@@ -2684,45 +2686,54 @@ ll
s.queryType = 'hql'
s.save(flush: true)
render(template: '/gTemplates/recordSummary', model: [record: s])
} else if (input.endsWith('+')) {
def entityCode = input.split(/[ ]+/)[0]?.toUpperCase()

def queryHead = 'from ' + entityMapping[entityCode]
def queryCriteria = transformMcsNotation(input.split(/\+\+/)[0])['queryCriteria']
}

def fullquery = queryHead + (queryCriteria ? ' where ' + queryCriteria : '')
else if (input.endsWith(' +')) {
try {
println new Date().format('HH:mm:ss')
def entityCode = input.split(/[ ]+/)[0]?.toUpperCase()

def list = Task.executeQuery(fullquery + ' order by lastUpdated desc')
def r
def limit = ker.OperationController.getPath('updateResultSet.max-items')?.toInteger() ?: 100
if (list.size() < limit) {
list.each() {
r = it.entityCode() + it.id
if (!selectedRecords[r] || selectedRecords[r] == 0) {
selectedRecords[r] = 1
session[r] = 1
} else {
selectedRecords[r] = 0
session[r] = 0
def queryHead = 'from ' + entityMapping[entityCode]
def queryCriteria = transformMcsNotation(input.substring(0, input.length() - 2))['queryCriteria']

def fullquery = queryHead + (queryCriteria ? ' where ' + queryCriteria : '')
println 'fq ' + fullquery
def list = Task.executeQuery(fullquery + ' order by lastUpdated desc',[], params)
def r
def limit = ker.OperationController.getPath('updateResultSet.max-items')?.toInteger() ?: 100
if (list.size() < limit) {
list.each() {
r = it.entityCode() + it.id
if (!selectedRecords[r] || selectedRecords[r] == 0) {
selectedRecords[r] = 1
session[r] = 1
} else {
selectedRecords[r] = 0
session[r] = 0
}
}
}
def fullquerySort = 'select count(*) ' + queryHead + (queryCriteria ? ' where ' + queryCriteria : '')
def queryKey = '_' + new Date().format('ddMMyyHHmmss')
session[queryKey] = fullquery
def fullquerySort = 'select count(*) ' + queryHead + (queryCriteria ? ' where ' + queryCriteria : '')
def queryKey = '_' + new Date().format('ddMMyyHHmmss')
session[queryKey] = fullquery

render(template: '/gTemplates/recordListing', model: [
totalHits: Task.executeQuery(fullquerySort)[0], //.size(),
list : list,
queryKey : queryKey,
fullquery: fullquery,
title : fullquery
])
} else {
render 'Result set size is greater than ' + limit + '. Please narrow your search'
println '-> ' + Task.executeQuery(fullquerySort)[0]
params.max = Setting.findByNameLike('savedSearch.pagination.max.link') ? Setting.findByNameLike('savedSearch.pagination.max.link').value.toInteger() : 5
render(template: '/gTemplates/recordListing', model: [
totalHits: Task.executeQuery(fullquerySort)[0].toLong(), //.size(),
list : list,
queryKey : queryKey,
fullquery: fullquery,
title : fullquery
])
} else {
render 'Result set size is greater than ' + limit + '. Please narrow your search'
}
} catch(Exception e){
println e.printStackTrace()
}


} else {
params.max = Setting.findByNameLike('savedSearch.pagination.max.link') ? Setting.findByNameLike('savedSearch.pagination.max.link').value.toInteger() : 5
if (input.contains(' {')) {

def groupBy = input.split(/ \{/)[1]
@@ -2803,7 +2814,8 @@ ll
fullquery = session[input]
fullquerySort = 'select count(*) ' + fullquery
queryKey = input
} else {
}
else {
def entityCode = input.split(/[ ]+/)[0]?.toUpperCase()

// input = params.input.substring(params.input.indexOf(' '))
@@ -2819,7 +2831,7 @@ ll
session[queryKey] = fullquery

}
params.max = Setting.findByNameLike('savedSearch.pagination.max.link') ? Setting.findByNameLike('savedSearch.pagination.max.link').value.toInteger() : 5

def list = Task.executeQuery(fullquery + ' order by lastUpdated desc', [], params)
// if (OperationController.getPath('enable.autoselectResults') == 'yes'){
// selectedRecords.keySet().each() {
111 changes: 78 additions & 33 deletions grails-app/controllers/ker/OperationController.groovy
Original file line number Diff line number Diff line change
@@ -1327,61 +1327,106 @@ def record = grailsApplication.classLoader.loadClass(entityMapping[params.module
def typeRepositoryPath
def filesCount
def filesList = ''
def filesList = []
def folders
def list
if (params.id)
list = [Book.get(params.id)]
else list = [Book.get(1)]
for (b in list) {
filesCount = 0
folders = []
typeSandboxPath = OperationController.getPath('root.rps1.path') + '/R/' + b.type?.code
typeLibraryPath = OperationController.getPath('root.rps3.path') + 'R/' + b.type?.code
//ResourceType.findByCode(type).libraryPath
typeRepositoryPath = OperationController.getPath('root.rps2.path') + 'R/' + b.type?.code
folders = [
typeSandboxPath + '/' + (b.id / 100).toInteger(),
typeRepositoryPath + '/' + (b.id / 100).toInteger(),
typeLibraryPath + '/' + (b.id / 100).toInteger()
]
folders.each() { folder ->
if (new File(folder).exists()) {
new File(folder).eachFileMatch(~/${b.id}[a-z][\S\s]*\.[\S\s]*/) {
filesCount++
filesList += it.name + '\n'
if (params.entityCode == 'R') {
if (params.id)
list = [Book.get(params.id)]
else list = [Book.get(1)] //Todo
for (b in list) {
filesCount = 0
folders = []
typeSandboxPath = OperationController.getPath('root.rps1.path') + '/R/' + b.type?.code
// typeLibraryPath = OperationController.getPath('root.rps3.path') + 'R/' + b.type?.code
//ResourceType.findByCode(type).libraryPath
typeRepositoryPath = OperationController.getPath('root.rps2.path') + '/R/' + b.type?.code
folders.add(
[typeSandboxPath + '/' + (b.id / 100).toInteger()])
if (!b.bookmarked)
folders.add(
[typeRepositoryPath + '/' + (b.id / 100).toInteger()])
// typeLibraryPath + '/' + (b.id / 100).toInteger()
// ]
folders.each() { folder ->

if (new File(folder[0]).exists()) {
new File(folder[0]).eachFileMatch(~/${b.id}[a-z][\S\s]*\.[\S\s]*/) {
filesCount++
filesList += it.name// + '\n'
}
}
}
folders = []
folders.add(
[typeSandboxPath + '/' + (b.id / 100).toInteger() + '/' + b.id])
// typeLibraryPath + '/' + (b.id / 100).toInteger() + '/' + b.id,
if (!b.bookmarked)
folders.add([typeRepositoryPath + '/' + (b.id / 100).toInteger() + '/' + b.id])
// ]
folders.each() { folder ->
// println 'fld ' + folder + ' class ' + folder.class
if (new File(folder[0]).exists()) {
new File(folder[0]).eachFileRecurse() {
//Match(~/[\S\s]*\.[\S\s]*/) { //ToDo: only files with extensions!
if (!it.isFile())
filesList += '*** ' + it.name
else {
filesCount++
filesList += it.name
}
}
}
}
//println filesCount
b.nbFiles = filesCount
b.filesList = filesList.join('\n')
}
folders = [
typeSandboxPath + '/' + (b.id / 100).toInteger() + '/' + b.id,
typeLibraryPath + '/' + (b.id / 100).toInteger() + '/' + b.id,
typeRepositoryPath + '/' + (b.id / 100).toInteger() + '/' + b.id
]
}
else {
list =
[grailsApplication.classLoader.loadClass(entityMapping[params.entityCode]).get(params.id)]
for (b in list) {
filesCount = 0
folders = []
typeSandboxPath = OperationController.getPath('root.rps1.path') + '/' + params.entityCode + '/'
typeRepositoryPath = OperationController.getPath('root.rps2.path') + '/' + params.entityCode + '/'
folders.add([typeSandboxPath + '/' + (b.id)])
if (!b.bookmarked)
folders.add([typeRepositoryPath + '/' + (b.id)])
folders.each() { folder ->
if (new File(folder).exists()) {
new File(folder).eachFileRecurse() {
if (new File(folder[0]).exists()) {
new File(folder[0]).eachFileRecurse() {
//Match(~/[\S\s]*\.[\S\s]*/) { //ToDo: only files with extensions!
if (!it.isFile())
filesList += '*** ' + it.name + ': \n'
filesList += '*** ' + it.name
else {
filesCount++
filesList += it.name + '\n'
filesList += it.name
}
}
}
}
//println filesCount
b.nbFiles = filesCount
b.filesList = filesList
b.filesList = filesList.join('\n')
}
}
render '<br/>' + filesCount + ' files: <br/>' + filesList.replace('\n', '<br/>')
render '<br/>' + filesCount + ' files: <br/>' + filesList.join('\n').replace('\n', '<br/>')
}
9 changes: 9 additions & 0 deletions grails-app/controllers/ker/PageController.groovy
Original file line number Diff line number Diff line change
@@ -294,6 +294,15 @@ class PageController {
render(view: '/appMihrab/main', model: [
])
}

def appCourse() {
render(view: '/appCourse/main', model: [ record: mcs.Course.get(params.id)
])
}

def appDaftar(){
render(view: '/appMain/daftar', model: [])
}
def appCalendar() {
render(view: '/appCalendar/main', model: [
])
Loading

0 comments on commit cc4a143

Please sign in to comment.