Holger Knublauch

Generalized type selection on search forms

......@@ -951,9 +951,31 @@ app:CustomEditForm
[ rdf:type ui:setContext ;
ui:child
[ rdf:type app:FormHeader ;
arg:label "Edit"^^xsd:string ;
arg:resource
[ sp:varName "resource"^^xsd:string
arg:label
[ rdf:type ui:concat ;
sp:arg1 "Edit "^^xsd:string ;
sp:arg2 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "resource"^^xsd:string
]
] ;
sp:arg2 [ rdf:type fn:concat ;
sp:arg1 [ rdf:type ui:label ;
sp:arg1 [ sp:varName "resource"^^xsd:string
]
] ;
sp:arg2 " - "
] ;
sp:arg3 [ sp:varName "none"^^xsd:string
]
] ;
sp:arg3 [ rdf:type ui:label ;
sp:arg1 [ rdf:type app:resourceType ;
arg:resource
[ sp:varName "resource"^^xsd:string
]
]
]
] ;
ui:child
[ rdf:type ui:insert ;
......@@ -1670,22 +1692,9 @@ app:FormHeader
spl:predicate arg:label ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The resource being displayed."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:resource ;
spl:valueType rdfs:Resource
] ;
ui:prototype
[ rdf:type html:Div ;
html:class "appHeader"^^xsd:string ;
let:type
[ rdf:type app:resourceType ;
arg:resource
[ sp:varName "resource"^^xsd:string
]
] ;
ui:child
[ rdf:type html:Div ;
html:class "appTop"^^xsd:string ;
......@@ -1702,11 +1711,6 @@ app:FormHeader
ui:text [ sp:varName "label"^^xsd:string
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text " "^^xsd:string
] ;
ui:childIndex 0
] ;
ui:childIndex 0 ;
......@@ -1716,36 +1720,6 @@ app:FormHeader
]
]
] ;
ui:child
[ rdf:type ui:if ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text [ rdf:type ui:label ;
sp:arg1 [ sp:varName "resource"^^xsd:string
]
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text " - "^^xsd:string
] ;
ui:childIndex 1 ;
ui:condition
[ rdf:type sp:bound ;
sp:arg1 [ sp:varName "resource"^^xsd:string
]
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text [ rdf:type ui:label ;
sp:arg1 [ sp:varName "type"^^xsd:string
]
]
] ;
ui:childIndex 0
] ;
ui:child
......@@ -3155,7 +3129,7 @@ app:ObjectFacetRow
ui:child
[ rdf:type html:Input ;
html:name
[ rdf:type fn:concat ;
[ rdf:type ui:concat ;
sp:arg1 "facet"^^xsd:string ;
sp:arg2 [ sp:varName "uid"^^xsd:string
]
......@@ -4325,6 +4299,13 @@ app:SearchForm
spl:predicate arg:resultsId ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "If set to true, the form will have a drop down selection in the top where users can switch to a subclass of the resource type."^^xsd:string ;
spl:optional "true"^^xsd:boolean ;
spl:predicate arg:typeSelectable ;
spl:valueType xsd:boolean
] ;
ui:prototype
[ rdf:type ui:setContext ;
let:fid [ rdf:type sp:if ;
......@@ -4337,200 +4318,411 @@ app:SearchForm
sp:arg3 [ rdf:type ui:uniqueId
]
] ;
let:lid [ rdf:type ui:uniqueId
] ;
ui:child
[ rdf:type ui:setContext ;
[ rdf:type app:FormHeader ;
arg:label "Search"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type ui:if ;
ui:child
[ rdf:type ui:setContext ;
ui:child
[ rdf:type app:FormHeader ;
arg:label "Search"^^xsd:string ;
ui:childIndex 0
[ rdf:type app:SearchFormTypeSwitch ;
arg:loadId
[ sp:varName "lid"^^xsd:string
] ;
arg:resourceType
[ sp:varName "resourceType"^^xsd:string
] ;
ui:childIndex 0
] ;
ui:childIndex 1 ;
ui:condition
[ sp:varName "typeSelectable"^^xsd:string
]
] ;
ui:child
[ rdf:type ui:loadable ;
html:class "ui-layout-content"^^xsd:string ;
ui:cache "true"^^xsd:boolean ;
ui:child
[ rdf:type ui:setContext ;
ui:child
[ rdf:type html:Form ;
html:autocomplete "off"^^xsd:string ;
html:class
[ rdf:type ui:concat ;
sp:arg1 "appForm ui-layout-content "^^xsd:string ;
sp:arg2 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:or ;
sp:arg1 [ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "noBorder"^^xsd:string
[ rdf:type ui:setContext ;
ui:child
[ rdf:type html:Form ;
html:autocomplete "off"^^xsd:string ;
html:class
[ rdf:type ui:concat ;
sp:arg1 "appForm "^^xsd:string ;
sp:arg2 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:or ;
sp:arg1 [ rdf:type sp:not ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "noBorder"^^xsd:string
]
]
] ;
sp:arg2 [ rdf:type sp:eq ;
sp:arg1 [ sp:varName "noBorder"^^xsd:string
] ;
sp:arg2 "false"^^xsd:boolean
]
] ;
sp:arg2 [ rdf:type sp:eq ;
sp:arg1 [ sp:varName "noBorder"^^xsd:string
sp:arg2 " appFormBorder" ;
sp:arg3 ""
]
] ;
html:id [ sp:varName "fid"^^xsd:string
] ;
let:kp [ rdf:type app:getKeyProperties ;
arg:class
[ sp:varName "resourceType"^^xsd:string
]
] ;
ui:child
[ rdf:type html:Input ;
html:name "type"^^xsd:string ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:concat ;
sp:arg1 "<"^^xsd:string ;
sp:arg2 [ sp:varName "resourceType"^^xsd:string
] ;
sp:arg3 ">"^^xsd:string
] ;
ui:childIndex 0
] ;
ui:child
[ rdf:type html:Input ;
html:name "_base"^^xsd:string ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:encodeNode ;
sp:arg1 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "queryGraph"^^xsd:string
]
] ;
sp:arg2 [ sp:varName "queryGraph"^^xsd:string
] ;
sp:arg2 "false"^^xsd:boolean
sp:arg3 [ rdf:type ui:currentQueryGraph
]
]
] ;
sp:arg2 " appFormBorder" ;
sp:arg3 ""
]
ui:childIndex 1
] ;
ui:child
[ rdf:type html:Input ;
html:name "schema"^^xsd:string ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:encodeNode ;
sp:arg1 [ rdf:type ui:currentQueryGraph
]
] ;
ui:childIndex 2
] ;
ui:child
[ rdf:type ui:if ;
ui:child
[ rdf:type ui:forEach ;
ui:child
[ rdf:type html:Input ;
html:name
[ rdf:type ui:concat ;
sp:arg1 "keyProperty"^^xsd:string ;
sp:arg2 [ sp:varName "index"^^xsd:string
]
] ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:encodeNode ;
sp:arg1 [ sp:varName "keyProperty"^^xsd:string
]
] ;
ui:childIndex 0
] ;
ui:childIndex 0 ;
ui:indexVar "index"^^xsd:string ;
ui:resultSet
[ rdf:type sp:Select ;
sp:resultVariables ([ sp:varName "keyProperty"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "keyProperty"^^xsd:string
] ;
sp:predicate list:member ;
sp:subject
[ sp:varName "kp"^^xsd:string
]
]) ;
sp:graphNameNode ui:graph
])
]
] ;
ui:childIndex 3 ;
ui:condition
[ rdf:type sp:bound ;
sp:arg1 [ sp:varName "kp"^^xsd:string
]
]
] ;
ui:child
[ rdf:type html:Div ;
html:class "appFormBody"^^xsd:string ;
ui:child
[ rdf:type ui:classView ;
ui:childIndex 0 ;
ui:class
[ rdf:type app:resourceType
] ;
ui:matchIds "search,*"^^xsd:string
] ;
ui:childIndex 4
] ;
ui:childIndex 0
] ;
html:id [ sp:varName "fid"^^xsd:string
ui:childIndex 0 ;
ui:varName "createLinkFunction"^^xsd:string ;
ui:varValue app:createNewTabLink
] ;
ui:childIndex 0 ;
ui:varName "resourceType"^^xsd:string ;
ui:varValue
[ sp:varName "resourceType"^^xsd:string
]
] ;
ui:childIndex 2 ;
ui:loadId
[ sp:varName "lid"^^xsd:string
]
] ;
ui:child
[ rdf:type html:Div ;
html:class "appFormFooter"^^xsd:string ;
ui:child
[ rdf:type html:Input ;
html:onclick
[ rdf:type ui:concat ;
sp:arg1 "appLoadSearchResultsGrid('"^^xsd:string ;
sp:arg2 [ sp:varName "fid"^^xsd:string
] ;
let:kp [ rdf:type app:getKeyProperties ;
arg:class
[ sp:varName "resourceType"^^xsd:string
sp:arg3 "', '"^^xsd:string ;
sp:arg4 [ sp:varName "resultsId"^^xsd:string
] ;
sp:arg5 "', '"^^xsd:string ;
sp:arg6 [ rdf:type ui:escapeJSON ;
sp:arg1 [ sp:varName "onSelect"^^xsd:string
]
] ;
sp:arg7 "')"^^xsd:string
] ;
html:type "button"^^xsd:string ;
html:value "Search"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text """ 
"""^^xsd:string
] ;
ui:child
[ rdf:type html:Input ;
html:type "reset"^^xsd:string ;
html:value "Reset"^^xsd:string ;
ui:childIndex 2
] ;
ui:childIndex 3
] ;
ui:varName "mode"^^xsd:string ;
ui:varValue "search"^^xsd:string
] .
app:SearchFormTypeSwitch
rdf:type ui:NodeClass ;
rdfs:comment "If the given resource type has at least one subclass, then this will display a drop down box where the user can select a class. This will reload the ui:loadable (form body) with the selected type. Future versions may also display a button that opens a tree dialog."^^xsd:string ;
rdfs:label "Search form type switch"^^xsd:string ;
rdfs:subClassOf app:FormElements ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The ui:loadId of the body of the form."^^xsd:string ;
spl:predicate arg:loadId ;
spl:valueType xsd:string
] ;
spin:constraint
[ rdf:type spl:Argument ;
rdfs:comment "The root class for the search form."^^xsd:string ;
spl:predicate arg:resourceType ;
spl:valueType rdfs:Class
] ;
ui:private "true"^^xsd:boolean ;
ui:prototype
[ rdf:type ui:if ;
ui:child
[ rdf:type html:Table ;
html:class "appLabeledObjectsTable appSearchFormTypeSwitch"^^xsd:string ;
ui:child
[ rdf:type html:Tr ;
html:class "appLabeledObjectsTR"^^xsd:string ;
ui:child
[ rdf:type html:Td ;
html:class "appLabeledObjectsLabelTD appLabeledObjectsTabularLabel"^^xsd:string ;
html:style "padding-top: 2px"^^xsd:string ;
ui:child
[ rdf:type html:Input ;
html:name "type"^^xsd:string ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:concat ;
sp:arg1 "<"^^xsd:string ;
sp:arg2 [ sp:varName "resourceType"^^xsd:string
] ;
sp:arg3 ">"^^xsd:string
] ;
[ rdf:type app:PropertyLabel ;
arg:label "Search for Type"^^xsd:string ;
ui:childIndex 0
] ;
ui:childIndex 0
] ;
ui:child
[ rdf:type html:Td ;
html:class "appLabeledObjectsIconsTD"^^xsd:string ;
ui:child
[ rdf:type html:Input ;
html:name "_base"^^xsd:string ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:encodeNode ;
sp:arg1 [ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:bound ;
sp:arg1 [ sp:varName "queryGraph"^^xsd:string
]
] ;
sp:arg2 [ sp:varName "queryGraph"^^xsd:string
] ;
sp:arg3 [ rdf:type ui:currentQueryGraph
]
]
] ;
ui:childIndex 1
[ rdf:type html:Span ;
html:class "appIcon"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type html:Input ;
html:name "schema"^^xsd:string ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:encodeNode ;
sp:arg1 [ rdf:type ui:currentQueryGraph
]
] ;
ui:childIndex 2
ui:childIndex 1
] ;
ui:child
[ rdf:type html:Td ;
html:class "appLabeledObjectsBodyTD"^^xsd:string ;
let:id [ rdf:type ui:uniqueId
] ;
ui:child
[ rdf:type ui:if ;
[ rdf:type html:Select ;
html:autocomplete "off"^^xsd:string ;
html:id [ sp:varName "id"^^xsd:string
] ;
ui:child
[ rdf:type ui:forEach ;
ui:child
[ rdf:type html:Input ;
html:name
[ rdf:type ui:concat ;
sp:arg1 "keyProperty"^^xsd:string ;
sp:arg2 [ sp:varName "index"^^xsd:string
[ rdf:type html:Option ;
html:selected
[ rdf:type sp:if ;
sp:arg1 [ rdf:type sp:eq ;
sp:arg1 [ sp:varName "resourceType"^^xsd:string
] ;
sp:arg2 [ sp:varName "class"^^xsd:string
]
] ;
sp:arg2 "selected" ;
sp:arg3 [ sp:varName "none"^^xsd:string
]
] ;
html:type "hidden"^^xsd:string ;
html:value
[ rdf:type ui:encodeNode ;
sp:arg1 [ sp:varName "keyProperty"^^xsd:string
[ sp:varName "class"^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:text [ sp:varName "label"^^xsd:string
]
] ;
ui:childIndex 0
] ;
ui:childIndex 0 ;
ui:indexVar "index"^^xsd:string ;
ui:resultSet
[ rdf:type sp:Select ;
sp:resultVariables ([ sp:varName "keyProperty"^^xsd:string
sp:distinct "true"^^xsd:boolean ;
sp:orderBy ([ sp:varName "label"^^xsd:string
]) ;
sp:where ([ rdf:type sp:NamedGraph ;
sp:elements ([ sp:object
[ sp:varName "keyProperty"^^xsd:string
] ;
sp:predicate list:member ;
sp:subject
[ sp:varName "kp"^^xsd:string
]
]) ;
sp:graphNameNode ui:graph
sp:resultVariables ([ sp:varName "label"^^xsd:string
] [ sp:varName "class"^^xsd:string
]) ;
sp:where ([ rdf:type sp:TriplePath ;
sp:object
[ sp:varName "resourceType"^^xsd:string
] ;
sp:path [ rdf:type sp:ModPath ;
sp:modMax -2 ;
sp:modMin 0 ;
sp:subPath rdfs:subClassOf
] ;
sp:subject
[ sp:varName "class"^^xsd:string
]
] [ rdf:type sp:Bind ;
sp:expression
[ rdf:type ui:label ;
sp:arg1 [ sp:varName "class"^^xsd:string
]
] ;
sp:variable
[ sp:varName "label"^^xsd:string
]
])
]
] ;
ui:childIndex 3 ;
ui:condition
[ rdf:type sp:bound ;
sp:arg1 [ sp:varName "kp"^^xsd:string
]
]
ui:childIndex 0
] ;
ui:child
[ rdf:type html:Div ;
html:class "appFormBody"^^xsd:string ;
[ rdf:type html:Script ;
ui:child
[ rdf:type ui:classView ;
[ rdf:type ui:TextNode ;
ui:childIndex 0 ;
ui:class
[ rdf:type app:resourceType
] ;
ui:matchIds "search,*"^^xsd:string
ui:text "$('#"^^xsd:string
] ;
ui:childIndex 4
] ;
ui:childIndex 1
] ;
ui:child
[ rdf:type html:Div ;
html:class "appFormFooter"^^xsd:string ;
ui:child
[ rdf:type html:Input ;
html:onclick
[ rdf:type ui:concat ;
sp:arg1 "appLoadSearchResultsGrid('"^^xsd:string ;
sp:arg2 [ sp:varName "fid"^^xsd:string
] ;
sp:arg3 "', '"^^xsd:string ;
sp:arg4 [ sp:varName "resultsId"^^xsd:string
] ;
sp:arg5 "', '"^^xsd:string ;
sp:arg6 [ rdf:type ui:escapeJSON ;
sp:arg1 [ sp:varName "onSelect"^^xsd:string
]
] ;
sp:arg7 "')"^^xsd:string
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text [ sp:varName "id"^^xsd:string
]
] ;
html:type "button"^^xsd:string ;
html:value "Search"^^xsd:string ;
ui:childIndex 0
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 1 ;
ui:text """ 
"""^^xsd:string
] ;
ui:child
[ rdf:type html:Input ;
html:type "reset"^^xsd:string ;
html:value "Reset"^^xsd:string ;
ui:childIndex 2
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 2 ;
ui:text """').change(function() {
var newType = '<' + $('#"""^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 3 ;
ui:text [ sp:varName "id"^^xsd:string
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 4 ;
ui:text """').val() + '>';
appLoad('"""^^xsd:string
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 5 ;
ui:text [ sp:varName "loadId"^^xsd:string
]
] ;
ui:child
[ rdf:type ui:TextNode ;
ui:childIndex 6 ;
ui:text """', { resourceType: newType });
});"""^^xsd:string
] ;
ui:childIndex 1
] ;
ui:childIndex 2
] ;
ui:childIndex 0 ;
ui:varName "createLinkFunction"^^xsd:string ;
ui:varValue app:createNewTabLink
ui:childIndex 0
] ;
ui:childIndex 0 ;
ui:varName "resourceType"^^xsd:string ;
ui:varValue
[ sp:varName "resourceType"^^xsd:string
]
ui:childIndex 0
] ;
ui:varName "mode"^^xsd:string ;
ui:varValue "search"^^xsd:string
ui:condition
[ rdf:type sp:Ask ;
sp:where ([ sp:object
[ sp:varName "resourceType"^^xsd:string
] ;
sp:predicate rdfs:subClassOf ;
sp:subject
[ sp:varName "subClass"^^xsd:string
]
])
]
] .
app:SearchMode
......@@ -6425,8 +6617,21 @@ app:ViewForm
[ rdf:type ui:setContext ;
ui:child
[ rdf:type app:FormHeader ;
arg:resource
[ sp:varName "resource"^^xsd:string
arg:label
[ rdf:type ui:concat ;
sp:arg1 [ rdf:type ui:label ;
sp:arg1 [ sp:varName "resource"^^xsd:string
]
] ;
sp:arg2 " ("^^xsd:string ;
sp:arg3 [ rdf:type ui:label ;
sp:arg1 [ rdf:type app:resourceType ;
arg:resource
[ sp:varName "resource"^^xsd:string
]
]
] ;
sp:arg4 ")"^^xsd:string
] ;
ui:childIndex 0
] ;
......@@ -7922,6 +8127,11 @@ arg:type
rdfs:label "type"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:typeSelectable
rdf:type rdf:Property ;
rdfs:label "type selectable"^^xsd:string ;
rdfs:subPropertyOf sp:arg .
arg:uid
rdf:type rdf:Property ;
rdfs:label "uid"^^xsd:string ;
......
......@@ -110,10 +110,6 @@ body {
margin-bottom: 16px;
}
.appShiftedLabel {
padding-top: 5px;
}
.appEditorHiddenField {
}
......@@ -137,7 +133,7 @@ body {
border-top-style: solid;
border-top-color: #b0b0b0;
background-color: #f0f0f0;
padding-top: 2px;
padding-top: 4px;
padding-left: 4px;
padding-right: 4px;
padding-bottom: 4px;
......@@ -241,6 +237,21 @@ td.appPropertyWidgetObjectTD {
vertical-align: middle;
}
.appSearchFormTypeSwitch {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #b0b0b0;
background-color: #f0f0f0;
padding-bottom: 4px;
padding-left: 4px;
padding-top: 5px;
width: 100%;
}
.appShiftedLabel {
padding-top: 5px;
}
.appSubTitle {
color: gray;
font-size: 15px;
......