Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

您好,请问您之前发布的moodle programming 插件有可以适用新版本的么? #25

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
71a4735
Remove resource requirement in hard coded plugin gsp template
liling Dec 27, 2016
1a71d52
Merge remote-tracking branch 'origin/patch-1'
liling Dec 27, 2016
4a902a6
Merge remote-tracking branch 'origin/patch-2'
liling Dec 27, 2016
ca57982
Merge remote-tracking branch 'origin/patch-3'
liling Dec 27, 2016
64c4a58
Merge remote-tracking branch 'origin/patch-4'
liling Dec 28, 2016
a5ba0d4
Allow define a ui plugin that override view templates in grailsflow p…
liling Dec 28, 2016
bdec489
remove unused code
liling Dec 28, 2016
bd532ae
Merge remote-tracking branch 'origin/patch-5'
liling Dec 28, 2016
3a595a8
Change lang field length to 5 to support zh_CN
liling Dec 28, 2016
7fa22a1
Hacking chinese support
liling Dec 28, 2016
c8fde30
Add language zh_CN to suppported languages list
liling Dec 28, 2016
169038b
Add more chinese support hacking
liling Dec 28, 2016
6661294
Merge remote-tracking branch 'origin/patch-6'
liling Dec 28, 2016
141ae44
Customize JSON data for process node list
liling Dec 29, 2016
9ad7a82
Remove resource requirement in hard coded plugin gsp template
liling Dec 27, 2016
e121cfc
Allow define a ui plugin that override view templates in grailsflow p…
liling Dec 28, 2016
69dd814
remove unused code
liling Dec 28, 2016
73c23b4
Change lang field length to 5 to support zh_CN
liling Dec 28, 2016
b2e1a8d
Hacking chinese support
liling Dec 28, 2016
61601ca
Add language zh_CN to suppported languages list
liling Dec 28, 2016
c0f9e17
Add more chinese support hacking
liling Dec 28, 2016
f5740f1
Node assignees should be read from database
liling Dec 28, 2016
1736201
Customize JSON data for process node list
liling Dec 29, 2016
471e90a
Merge branch 'master' of github.com:liling/grailsflow-core-plugin
liling Dec 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions GrailsflowGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class GrailsflowGrailsPlugin {
}

// format patterns
datePatterns(java.util.HashMap, ['en':'MM/dd/yyyy', 'de':'dd.MM.yyyy'])
dateTimePatterns(java.util.HashMap, ['en':'MM/dd/yy HH:mm', 'de':'dd.MM.yy HH:mm'])
numberPatterns(java.util.HashMap, ['en':'0.00', 'de':'0.00'])
decimalSeparators(java.util.HashMap, ['en':'.', 'de':','])
datePatterns(java.util.HashMap, ['en':'MM/dd/yyyy', 'de':'dd.MM.yyyy', 'zh_CN': 'yyyy-MM-dd'])
dateTimePatterns(java.util.HashMap, ['en':'MM/dd/yy HH:mm', 'de':'dd.MM.yy HH:mm', 'zh_CN': 'yyyy-MM-dd HH:mm'])
numberPatterns(java.util.HashMap, ['en':'0.00', 'de':'0.00', 'zh_CN': '0.00'])
decimalSeparators(java.util.HashMap, ['en':'.', 'de':',', 'zh_CN': '.'])
defaultLocale(java.lang.String, "en")

// default workarea configuration
Expand Down Expand Up @@ -241,6 +241,9 @@ class GrailsflowGrailsPlugin {
processManagerService = ref('processManagerService')
}

// A plugin that override grailsflow ui
grailsflowUiPlugin(java.lang.String, '')

if(!application.config.grails.converters.json.circular.reference.behaviour) {
def jsonConverterConfig = new ConfigObject()
jsonConverterConfig.grails.converters.json.circular.reference.behaviour = "INSERT_NULL"
Expand Down
24 changes: 23 additions & 1 deletion grails-app/controllers/ProcessController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class ProcessController extends GrailsFlowSecureController {
forward(action: "list", params: params)
}

static processNodeJsonProperties = [
'id', 'branchID', 'caller', 'description', 'dueOn', 'event', 'exception',
'finishedOn', 'nodeID', 'protocolGroup', 'startedExecutionOn', 'startedOn', 'status', 'type']

/**
* ProcessList UI
*/
Expand Down Expand Up @@ -224,6 +228,7 @@ class ProcessController extends GrailsFlowSecureController {

// Build nodes Details
def processNodes = []
def worklistNodeDetails = [:]
worklist?.each { processNode ->
def process = processNode.process
def processInstance = processManagerService.getRunningProcessInstance(process.id)
Expand All @@ -237,6 +242,7 @@ class ProcessController extends GrailsFlowSecureController {
additionalColumns[name] += varDetails.label
}
}
worklistNodeDetails.put(processNode, nodeDetails)
}
}
if (params.sort == "nodeLabel") {
Expand Down Expand Up @@ -270,7 +276,23 @@ class ProcessController extends GrailsFlowSecureController {
withFormat {
html { render(view: 'showWorklist',model: model, params: params) }
json {
model.processNodeList = worklist
model.processNodeList = []
// Customize JSON data for process node
worklist.each { ProcessNode processNode ->
def nodeDetails = worklistNodeDetails.get(processNode)

def jsonNode = [:]
processNodeJsonProperties.each { jsonNode.put(it, processNode."${it}") }
jsonNode.label = gf.translatedValue(translations: nodeDetails.label, default: nodeDetails.nodeID)
jsonNode.description = gf.translatedValue(translations: nodeDetails.description, default: '')
jsonNode.status = processNode?.status?.statusID
jsonNode.process = [
id: processNode.process.id,
label: gf.translatedValue(translations: nodeDetails.process.label, default: nodeDetails.process.type),
description: gf.translatedValue(translations: nodeDetails.process.description, default: '')]

model.processNodeList << jsonNode
}
render model as JSON
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class ProcessDef {
nodes cascade: "all,delete-orphan"
variables cascade: "all,delete-orphan"
assignees cascade: "all,delete-orphan"
label indexColumn:[name:"language", type:String, length:2],joinTable:[key:'process_def_id' ,column:'label'],length:255
description indexColumn:[name:"language", type:String, length:2],joinTable:[key:'process_def_id' ,column:'description'],length:255
label indexColumn:[name:"language", type:String, length:5],joinTable:[key:'process_def_id' ,column:'label'],length:255
description indexColumn:[name:"language", type:String, length:5],joinTable:[key:'process_def_id' ,column:'description'],length:255
}

static transients = [ "startNode", "processAssignees" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class ProcessNodeDef {
static mapping = {
processDef index: 'IDX_PROCESS_NODE_DEF_2'
assignees cascade: "all,delete-orphan"
label indexColumn:[name:"language", type:String, length:2],joinTable:[key:'process_node_def_id' ,column:'label'],length:255
description indexColumn:[name:"language", type:String, length:2],joinTable:[key:'process_node_def_id' ,column:'description'],length:255
label indexColumn:[name:"language", type:String, length:5],joinTable:[key:'process_node_def_id' ,column:'label'],length:255
description indexColumn:[name:"language", type:String, length:5],joinTable:[key:'process_node_def_id' ,column:'description'],length:255
actionStatements cascade: "all,delete-orphan"
transitions cascade: "all,delete-orphan"
transitions2DestinationNode: cascade: "all,delete-orphan"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ProcessTransitionDef {

static mapping = {
transition2DestinationNodes cascade: "all,delete-orphan"
label indexColumn:[name:"language", type:String, length:2],joinTable:[key:'process_transition_def_id', column:'label'],length:20
label indexColumn:[name:"language", type:String, length:5],joinTable:[key:'process_transition_def_id', column:'label'],length:20
}

// Used to write and parse process class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ class ProcessVariableDef {
isProcessIdentifier type:YesNoType
required type:YesNoType
}
label indexColumn:[name:"language", type:String, length:2],joinTable:[key:'process_variable_def_id', column:'label'],length:255
label indexColumn:[name:"language", type:String, length:5],joinTable:[key:'process_variable_def_id', column:'label'],length:255
// TODO: enable when table name generation will work
//description indexColumn:[name:"language", type:String, length:2],joinTable:[name:'process_variable_def_desc', key:'process_variable_def_id', column:'description'],length:255
desc indexColumn:[name:"language", type:String, length:2],joinTable:[key:'process_variable_def_id', column:'description'],length:255
//description indexColumn:[name:"language", type:String, length:5],joinTable:[name:'process_variable_def_desc', key:'process_variable_def_id', column:'description'],length:255
desc indexColumn:[name:"language", type:String, length:5],joinTable:[key:'process_variable_def_id', column:'description'],length:255
variable2NodesVisibility cascade: "all,delete-orphan"
items cascade: "all,delete-orphan"
}
Expand Down
2 changes: 1 addition & 1 deletion grails-app/taglib/GrailsflowFormatTagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class GrailsflowFormatTagLib {
*/
def dateTimePattern = { attrs ->
def locale = attrs.locale ? attrs.locale : RCU.getLocale(request)
def pattern = dateTimePatterns?.get(locale.language)
def pattern = dateTimePatterns?.get(locale.language == 'zh' ? locale.toString() : locale.language)

// if no pattern for specified locale, then use default
if (pattern == null && defaultLocale) {
Expand Down
13 changes: 11 additions & 2 deletions grails-app/taglib/GrailsflowTagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class GrailsflowTagLib {
static namespace = "gf"
def processManagerService
def workareaPathProvider
def grailsflowUiPlugin

/**
* TODO: use g:sortableColumn instead as soos
Expand Down Expand Up @@ -375,15 +376,20 @@ class GrailsflowTagLib {
def defaultTemplate = attrs.defaultTemplate
def notFoundMessage = attrs.notFoundMessage


// Paths to look for template. Sorted by priority of searching.
List parameters = new ArrayList()
if (template) {
parameters.add([contextPath: "", template: template])
if (grailsflowUiPlugin) {
parameters.add([contextPath: "", template: template, plugin: grailsflowUiPlugin])
}
parameters.add([contextPath: "", template: template, plugin: 'grailsflow'])
}
if (defaultTemplate) {
parameters.add([contextPath: "", template: defaultTemplate])
if (grailsflowUiPlugin) {
parameters.add([contextPath: "", template: defaultTemplate, plugin: grailsflowUiPlugin])
}
parameters.add([contextPath: "", template: defaultTemplate, plugin: 'grailsflow'])
}

Expand Down Expand Up @@ -433,7 +439,10 @@ class GrailsflowTagLib {
def translations = attrs.translations
def defaultValue = attrs.default
def lang = attrs.lang ? attrs.lang : RCU.getLocale(request)?.language.toString()


// this is an ugly hack, which change zh to zh_CN or zh_TW
if (lang == 'zh') lang = RCU.getLocale(request)?.toString()

out << TranslationUtils.getTranslatedValue(translations, defaultValue, lang)
}

Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/common/_translationsEditor.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

</r:script>

<g:set var="langs" value="${supportedLanguages != null ? supportedLanguages : ['en', 'de']}"/>
<g:set var="langs" value="${supportedLanguages != null ? supportedLanguages : ['en', 'de', 'zh_CN']}"/>
<g:set var="visible_langs" value="${langs - translations?.keySet()}"/>
<g:set var="textarea" value="${textarea != null ? textarea : false}"/>

Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/commons/_global.gsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<r:require modules="grailsflow"/>
<r:require modules="bootstrap"/>
%{--<r:require modules="bootstrap"/>--}%

<g:set var='grailsFlowCoreConfig' value="${grailsApplication.config.grailsFlowCoreConfig}"/>
<g:if test="${grailsFlowCoreConfig?.cssFile}">
Expand Down
1 change: 1 addition & 0 deletions grails-app/views/userRole/listGroups.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<g:render plugin="grailsflow" template="/commons/global"/>
<title><g:message code="plugin.grailsflow.title.groups"/></title>
<r:require modules="jquery" />
<r:require modules="bootstrap"/>
<r:script>
function addGroup(group) {
opener.addGroups(group)
Expand Down
1 change: 1 addition & 0 deletions grails-app/views/userRole/listRoles.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<g:render plugin="grailsflow" template="/commons/global"/>
<title><g:message code="plugin.grailsflow.title.roles"/></title>
<r:require modules="jquery" />
<r:require modules="bootstrap"/>
<r:script>
function addRole(role) {
opener.addRoles(role)
Expand Down
1 change: 1 addition & 0 deletions grails-app/views/userRole/listUsers.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<g:render plugin="grailsflow" template="/commons/global"/>
<title><g:message code="plugin.grailsflow.title.users"/></title>
<r:require modules="jquery" />
<r:require modules="bootstrap"/>
<r:script>
function addUser(user) {
opener.addUsers(user)
Expand Down