Holger Knublauch

Generalized type selection on search forms

...@@ -951,9 +951,31 @@ app:CustomEditForm ...@@ -951,9 +951,31 @@ app:CustomEditForm
951 [ rdf:type ui:setContext ; 951 [ rdf:type ui:setContext ;
952 ui:child 952 ui:child
953 [ rdf:type app:FormHeader ; 953 [ rdf:type app:FormHeader ;
954 - arg:label "Edit"^^xsd:string ; 954 + arg:label
955 + [ rdf:type ui:concat ;
956 + sp:arg1 "Edit "^^xsd:string ;
957 + sp:arg2 [ rdf:type sp:if ;
958 + sp:arg1 [ rdf:type sp:bound ;
959 + sp:arg1 [ sp:varName "resource"^^xsd:string
960 + ]
961 + ] ;
962 + sp:arg2 [ rdf:type fn:concat ;
963 + sp:arg1 [ rdf:type ui:label ;
964 + sp:arg1 [ sp:varName "resource"^^xsd:string
965 + ]
966 + ] ;
967 + sp:arg2 " - "
968 + ] ;
969 + sp:arg3 [ sp:varName "none"^^xsd:string
970 + ]
971 + ] ;
972 + sp:arg3 [ rdf:type ui:label ;
973 + sp:arg1 [ rdf:type app:resourceType ;
955 arg:resource 974 arg:resource
956 [ sp:varName "resource"^^xsd:string 975 [ sp:varName "resource"^^xsd:string
976 + ]
977 + ]
978 + ]
957 ] ; 979 ] ;
958 ui:child 980 ui:child
959 [ rdf:type ui:insert ; 981 [ rdf:type ui:insert ;
...@@ -1670,22 +1692,9 @@ app:FormHeader ...@@ -1670,22 +1692,9 @@ app:FormHeader
1670 spl:predicate arg:label ; 1692 spl:predicate arg:label ;
1671 spl:valueType xsd:string 1693 spl:valueType xsd:string
1672 ] ; 1694 ] ;
1673 - spin:constraint
1674 - [ rdf:type spl:Argument ;
1675 - rdfs:comment "The resource being displayed."^^xsd:string ;
1676 - spl:optional "true"^^xsd:boolean ;
1677 - spl:predicate arg:resource ;
1678 - spl:valueType rdfs:Resource
1679 - ] ;
1680 ui:prototype 1695 ui:prototype
1681 [ rdf:type html:Div ; 1696 [ rdf:type html:Div ;
1682 html:class "appHeader"^^xsd:string ; 1697 html:class "appHeader"^^xsd:string ;
1683 - let:type
1684 - [ rdf:type app:resourceType ;
1685 - arg:resource
1686 - [ sp:varName "resource"^^xsd:string
1687 - ]
1688 - ] ;
1689 ui:child 1698 ui:child
1690 [ rdf:type html:Div ; 1699 [ rdf:type html:Div ;
1691 html:class "appTop"^^xsd:string ; 1700 html:class "appTop"^^xsd:string ;
...@@ -1702,11 +1711,6 @@ app:FormHeader ...@@ -1702,11 +1711,6 @@ app:FormHeader
1702 ui:text [ sp:varName "label"^^xsd:string 1711 ui:text [ sp:varName "label"^^xsd:string
1703 ] 1712 ]
1704 ] ; 1713 ] ;
1705 - ui:child
1706 - [ rdf:type ui:TextNode ;
1707 - ui:childIndex 1 ;
1708 - ui:text " "^^xsd:string
1709 - ] ;
1710 ui:childIndex 0 1714 ui:childIndex 0
1711 ] ; 1715 ] ;
1712 ui:childIndex 0 ; 1716 ui:childIndex 0 ;
...@@ -1716,36 +1720,6 @@ app:FormHeader ...@@ -1716,36 +1720,6 @@ app:FormHeader
1716 ] 1720 ]
1717 ] 1721 ]
1718 ] ; 1722 ] ;
1719 - ui:child
1720 - [ rdf:type ui:if ;
1721 - ui:child
1722 - [ rdf:type ui:TextNode ;
1723 - ui:childIndex 0 ;
1724 - ui:text [ rdf:type ui:label ;
1725 - sp:arg1 [ sp:varName "resource"^^xsd:string
1726 - ]
1727 - ]
1728 - ] ;
1729 - ui:child
1730 - [ rdf:type ui:TextNode ;
1731 - ui:childIndex 1 ;
1732 - ui:text " - "^^xsd:string
1733 - ] ;
1734 - ui:childIndex 1 ;
1735 - ui:condition
1736 - [ rdf:type sp:bound ;
1737 - sp:arg1 [ sp:varName "resource"^^xsd:string
1738 - ]
1739 - ]
1740 - ] ;
1741 - ui:child
1742 - [ rdf:type ui:TextNode ;
1743 - ui:childIndex 2 ;
1744 - ui:text [ rdf:type ui:label ;
1745 - sp:arg1 [ sp:varName "type"^^xsd:string
1746 - ]
1747 - ]
1748 - ] ;
1749 ui:childIndex 0 1723 ui:childIndex 0
1750 ] ; 1724 ] ;
1751 ui:child 1725 ui:child
...@@ -3155,7 +3129,7 @@ app:ObjectFacetRow ...@@ -3155,7 +3129,7 @@ app:ObjectFacetRow
3155 ui:child 3129 ui:child
3156 [ rdf:type html:Input ; 3130 [ rdf:type html:Input ;
3157 html:name 3131 html:name
3158 - [ rdf:type fn:concat ; 3132 + [ rdf:type ui:concat ;
3159 sp:arg1 "facet"^^xsd:string ; 3133 sp:arg1 "facet"^^xsd:string ;
3160 sp:arg2 [ sp:varName "uid"^^xsd:string 3134 sp:arg2 [ sp:varName "uid"^^xsd:string
3161 ] 3135 ]
...@@ -4325,6 +4299,13 @@ app:SearchForm ...@@ -4325,6 +4299,13 @@ app:SearchForm
4325 spl:predicate arg:resultsId ; 4299 spl:predicate arg:resultsId ;
4326 spl:valueType xsd:string 4300 spl:valueType xsd:string
4327 ] ; 4301 ] ;
4302 + spin:constraint
4303 + [ rdf:type spl:Argument ;
4304 + 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 ;
4305 + spl:optional "true"^^xsd:boolean ;
4306 + spl:predicate arg:typeSelectable ;
4307 + spl:valueType xsd:boolean
4308 + ] ;
4328 ui:prototype 4309 ui:prototype
4329 [ rdf:type ui:setContext ; 4310 [ rdf:type ui:setContext ;
4330 let:fid [ rdf:type sp:if ; 4311 let:fid [ rdf:type sp:if ;
...@@ -4337,21 +4318,44 @@ app:SearchForm ...@@ -4337,21 +4318,44 @@ app:SearchForm
4337 sp:arg3 [ rdf:type ui:uniqueId 4318 sp:arg3 [ rdf:type ui:uniqueId
4338 ] 4319 ]
4339 ] ; 4320 ] ;
4340 - ui:child 4321 + let:lid [ rdf:type ui:uniqueId
4341 - [ rdf:type ui:setContext ; 4322 + ] ;
4342 - ui:child
4343 - [ rdf:type ui:setContext ;
4344 ui:child 4323 ui:child
4345 [ rdf:type app:FormHeader ; 4324 [ rdf:type app:FormHeader ;
4346 arg:label "Search"^^xsd:string ; 4325 arg:label "Search"^^xsd:string ;
4347 ui:childIndex 0 4326 ui:childIndex 0
4348 ] ; 4327 ] ;
4349 ui:child 4328 ui:child
4329 + [ rdf:type ui:if ;
4330 + ui:child
4331 + [ rdf:type app:SearchFormTypeSwitch ;
4332 + arg:loadId
4333 + [ sp:varName "lid"^^xsd:string
4334 + ] ;
4335 + arg:resourceType
4336 + [ sp:varName "resourceType"^^xsd:string
4337 + ] ;
4338 + ui:childIndex 0
4339 + ] ;
4340 + ui:childIndex 1 ;
4341 + ui:condition
4342 + [ sp:varName "typeSelectable"^^xsd:string
4343 + ]
4344 + ] ;
4345 + ui:child
4346 + [ rdf:type ui:loadable ;
4347 + html:class "ui-layout-content"^^xsd:string ;
4348 + ui:cache "true"^^xsd:boolean ;
4349 + ui:child
4350 + [ rdf:type ui:setContext ;
4351 + ui:child
4352 + [ rdf:type ui:setContext ;
4353 + ui:child
4350 [ rdf:type html:Form ; 4354 [ rdf:type html:Form ;
4351 html:autocomplete "off"^^xsd:string ; 4355 html:autocomplete "off"^^xsd:string ;
4352 html:class 4356 html:class
4353 [ rdf:type ui:concat ; 4357 [ rdf:type ui:concat ;
4354 - sp:arg1 "appForm ui-layout-content "^^xsd:string ; 4358 + sp:arg1 "appForm "^^xsd:string ;
4355 sp:arg2 [ rdf:type sp:if ; 4359 sp:arg2 [ rdf:type sp:if ;
4356 sp:arg1 [ rdf:type sp:or ; 4360 sp:arg1 [ rdf:type sp:or ;
4357 sp:arg1 [ rdf:type sp:not ; 4361 sp:arg1 [ rdf:type sp:not ;
...@@ -4479,7 +4483,22 @@ app:SearchForm ...@@ -4479,7 +4483,22 @@ app:SearchForm
4479 ] ; 4483 ] ;
4480 ui:childIndex 4 4484 ui:childIndex 4
4481 ] ; 4485 ] ;
4482 - ui:childIndex 1 4486 + ui:childIndex 0
4487 + ] ;
4488 + ui:childIndex 0 ;
4489 + ui:varName "createLinkFunction"^^xsd:string ;
4490 + ui:varValue app:createNewTabLink
4491 + ] ;
4492 + ui:childIndex 0 ;
4493 + ui:varName "resourceType"^^xsd:string ;
4494 + ui:varValue
4495 + [ sp:varName "resourceType"^^xsd:string
4496 + ]
4497 + ] ;
4498 + ui:childIndex 2 ;
4499 + ui:loadId
4500 + [ sp:varName "lid"^^xsd:string
4501 + ]
4483 ] ; 4502 ] ;
4484 ui:child 4503 ui:child
4485 [ rdf:type html:Div ; 4504 [ rdf:type html:Div ;
...@@ -4517,20 +4536,193 @@ app:SearchForm ...@@ -4517,20 +4536,193 @@ app:SearchForm
4517 html:value "Reset"^^xsd:string ; 4536 html:value "Reset"^^xsd:string ;
4518 ui:childIndex 2 4537 ui:childIndex 2
4519 ] ; 4538 ] ;
4520 - ui:childIndex 2 4539 + ui:childIndex 3
4540 + ] ;
4541 + ui:varName "mode"^^xsd:string ;
4542 + ui:varValue "search"^^xsd:string
4543 + ] .
4544 +
4545 +app:SearchFormTypeSwitch
4546 + rdf:type ui:NodeClass ;
4547 + 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 ;
4548 + rdfs:label "Search form type switch"^^xsd:string ;
4549 + rdfs:subClassOf app:FormElements ;
4550 + spin:constraint
4551 + [ rdf:type spl:Argument ;
4552 + rdfs:comment "The ui:loadId of the body of the form."^^xsd:string ;
4553 + spl:predicate arg:loadId ;
4554 + spl:valueType xsd:string
4555 + ] ;
4556 + spin:constraint
4557 + [ rdf:type spl:Argument ;
4558 + rdfs:comment "The root class for the search form."^^xsd:string ;
4559 + spl:predicate arg:resourceType ;
4560 + spl:valueType rdfs:Class
4561 + ] ;
4562 + ui:private "true"^^xsd:boolean ;
4563 + ui:prototype
4564 + [ rdf:type ui:if ;
4565 + ui:child
4566 + [ rdf:type html:Table ;
4567 + html:class "appLabeledObjectsTable appSearchFormTypeSwitch"^^xsd:string ;
4568 + ui:child
4569 + [ rdf:type html:Tr ;
4570 + html:class "appLabeledObjectsTR"^^xsd:string ;
4571 + ui:child
4572 + [ rdf:type html:Td ;
4573 + html:class "appLabeledObjectsLabelTD appLabeledObjectsTabularLabel"^^xsd:string ;
4574 + html:style "padding-top: 2px"^^xsd:string ;
4575 + ui:child
4576 + [ rdf:type app:PropertyLabel ;
4577 + arg:label "Search for Type"^^xsd:string ;
4578 + ui:childIndex 0
4579 + ] ;
4580 + ui:childIndex 0
4521 ] ; 4581 ] ;
4582 + ui:child
4583 + [ rdf:type html:Td ;
4584 + html:class "appLabeledObjectsIconsTD"^^xsd:string ;
4585 + ui:child
4586 + [ rdf:type html:Span ;
4587 + html:class "appIcon"^^xsd:string ;
4588 + ui:childIndex 0
4589 + ] ;
4590 + ui:childIndex 1
4591 + ] ;
4592 + ui:child
4593 + [ rdf:type html:Td ;
4594 + html:class "appLabeledObjectsBodyTD"^^xsd:string ;
4595 + let:id [ rdf:type ui:uniqueId
4596 + ] ;
4597 + ui:child
4598 + [ rdf:type html:Select ;
4599 + html:autocomplete "off"^^xsd:string ;
4600 + html:id [ sp:varName "id"^^xsd:string
4601 + ] ;
4602 + ui:child
4603 + [ rdf:type ui:forEach ;
4604 + ui:child
4605 + [ rdf:type html:Option ;
4606 + html:selected
4607 + [ rdf:type sp:if ;
4608 + sp:arg1 [ rdf:type sp:eq ;
4609 + sp:arg1 [ sp:varName "resourceType"^^xsd:string
4610 + ] ;
4611 + sp:arg2 [ sp:varName "class"^^xsd:string
4612 + ]
4613 + ] ;
4614 + sp:arg2 "selected" ;
4615 + sp:arg3 [ sp:varName "none"^^xsd:string
4616 + ]
4617 + ] ;
4618 + html:value
4619 + [ sp:varName "class"^^xsd:string
4620 + ] ;
4621 + ui:child
4622 + [ rdf:type ui:TextNode ;
4522 ui:childIndex 0 ; 4623 ui:childIndex 0 ;
4523 - ui:varName "createLinkFunction"^^xsd:string ; 4624 + ui:text [ sp:varName "label"^^xsd:string
4524 - ui:varValue app:createNewTabLink 4625 + ]
4626 + ] ;
4627 + ui:childIndex 0
4525 ] ; 4628 ] ;
4526 ui:childIndex 0 ; 4629 ui:childIndex 0 ;
4527 - ui:varName "resourceType"^^xsd:string ; 4630 + ui:resultSet
4528 - ui:varValue 4631 + [ rdf:type sp:Select ;
4632 + sp:distinct "true"^^xsd:boolean ;
4633 + sp:orderBy ([ sp:varName "label"^^xsd:string
4634 + ]) ;
4635 + sp:resultVariables ([ sp:varName "label"^^xsd:string
4636 + ] [ sp:varName "class"^^xsd:string
4637 + ]) ;
4638 + sp:where ([ rdf:type sp:TriplePath ;
4639 + sp:object
4529 [ sp:varName "resourceType"^^xsd:string 4640 [ sp:varName "resourceType"^^xsd:string
4641 + ] ;
4642 + sp:path [ rdf:type sp:ModPath ;
4643 + sp:modMax -2 ;
4644 + sp:modMin 0 ;
4645 + sp:subPath rdfs:subClassOf
4646 + ] ;
4647 + sp:subject
4648 + [ sp:varName "class"^^xsd:string
4649 + ]
4650 + ] [ rdf:type sp:Bind ;
4651 + sp:expression
4652 + [ rdf:type ui:label ;
4653 + sp:arg1 [ sp:varName "class"^^xsd:string
4530 ] 4654 ]
4531 ] ; 4655 ] ;
4532 - ui:varName "mode"^^xsd:string ; 4656 + sp:variable
4533 - ui:varValue "search"^^xsd:string 4657 + [ sp:varName "label"^^xsd:string
4658 + ]
4659 + ])
4660 + ]
4661 + ] ;
4662 + ui:childIndex 0
4663 + ] ;
4664 + ui:child
4665 + [ rdf:type html:Script ;
4666 + ui:child
4667 + [ rdf:type ui:TextNode ;
4668 + ui:childIndex 0 ;
4669 + ui:text "$('#"^^xsd:string
4670 + ] ;
4671 + ui:child
4672 + [ rdf:type ui:TextNode ;
4673 + ui:childIndex 1 ;
4674 + ui:text [ sp:varName "id"^^xsd:string
4675 + ]
4676 + ] ;
4677 + ui:child
4678 + [ rdf:type ui:TextNode ;
4679 + ui:childIndex 2 ;
4680 + ui:text """').change(function() {
4681 + var newType = '<' + $('#"""^^xsd:string
4682 + ] ;
4683 + ui:child
4684 + [ rdf:type ui:TextNode ;
4685 + ui:childIndex 3 ;
4686 + ui:text [ sp:varName "id"^^xsd:string
4687 + ]
4688 + ] ;
4689 + ui:child
4690 + [ rdf:type ui:TextNode ;
4691 + ui:childIndex 4 ;
4692 + ui:text """').val() + '>';
4693 + appLoad('"""^^xsd:string
4694 + ] ;
4695 + ui:child
4696 + [ rdf:type ui:TextNode ;
4697 + ui:childIndex 5 ;
4698 + ui:text [ sp:varName "loadId"^^xsd:string
4699 + ]
4700 + ] ;
4701 + ui:child
4702 + [ rdf:type ui:TextNode ;
4703 + ui:childIndex 6 ;
4704 + ui:text """', { resourceType: newType });
4705 + });"""^^xsd:string
4706 + ] ;
4707 + ui:childIndex 1
4708 + ] ;
4709 + ui:childIndex 2
4710 + ] ;
4711 + ui:childIndex 0
4712 + ] ;
4713 + ui:childIndex 0
4714 + ] ;
4715 + ui:condition
4716 + [ rdf:type sp:Ask ;
4717 + sp:where ([ sp:object
4718 + [ sp:varName "resourceType"^^xsd:string
4719 + ] ;
4720 + sp:predicate rdfs:subClassOf ;
4721 + sp:subject
4722 + [ sp:varName "subClass"^^xsd:string
4723 + ]
4724 + ])
4725 + ]
4534 ] . 4726 ] .
4535 4727
4536 app:SearchMode 4728 app:SearchMode
...@@ -6425,8 +6617,21 @@ app:ViewForm ...@@ -6425,8 +6617,21 @@ app:ViewForm
6425 [ rdf:type ui:setContext ; 6617 [ rdf:type ui:setContext ;
6426 ui:child 6618 ui:child
6427 [ rdf:type app:FormHeader ; 6619 [ rdf:type app:FormHeader ;
6620 + arg:label
6621 + [ rdf:type ui:concat ;
6622 + sp:arg1 [ rdf:type ui:label ;
6623 + sp:arg1 [ sp:varName "resource"^^xsd:string
6624 + ]
6625 + ] ;
6626 + sp:arg2 " ("^^xsd:string ;
6627 + sp:arg3 [ rdf:type ui:label ;
6628 + sp:arg1 [ rdf:type app:resourceType ;
6428 arg:resource 6629 arg:resource
6429 [ sp:varName "resource"^^xsd:string 6630 [ sp:varName "resource"^^xsd:string
6631 + ]
6632 + ]
6633 + ] ;
6634 + sp:arg4 ")"^^xsd:string
6430 ] ; 6635 ] ;
6431 ui:childIndex 0 6636 ui:childIndex 0
6432 ] ; 6637 ] ;
...@@ -7922,6 +8127,11 @@ arg:type ...@@ -7922,6 +8127,11 @@ arg:type
7922 rdfs:label "type"^^xsd:string ; 8127 rdfs:label "type"^^xsd:string ;
7923 rdfs:subPropertyOf sp:arg . 8128 rdfs:subPropertyOf sp:arg .
7924 8129
8130 +arg:typeSelectable
8131 + rdf:type rdf:Property ;
8132 + rdfs:label "type selectable"^^xsd:string ;
8133 + rdfs:subPropertyOf sp:arg .
8134 +
7925 arg:uid 8135 arg:uid
7926 rdf:type rdf:Property ; 8136 rdf:type rdf:Property ;
7927 rdfs:label "uid"^^xsd:string ; 8137 rdfs:label "uid"^^xsd:string ;
......
...@@ -110,10 +110,6 @@ body { ...@@ -110,10 +110,6 @@ body {
110 margin-bottom: 16px; 110 margin-bottom: 16px;
111 } 111 }
112 112
113 -.appShiftedLabel {
114 - padding-top: 5px;
115 -}
116 -
117 .appEditorHiddenField { 113 .appEditorHiddenField {
118 } 114 }
119 115
...@@ -137,7 +133,7 @@ body { ...@@ -137,7 +133,7 @@ body {
137 border-top-style: solid; 133 border-top-style: solid;
138 border-top-color: #b0b0b0; 134 border-top-color: #b0b0b0;
139 background-color: #f0f0f0; 135 background-color: #f0f0f0;
140 - padding-top: 2px; 136 + padding-top: 4px;
141 padding-left: 4px; 137 padding-left: 4px;
142 padding-right: 4px; 138 padding-right: 4px;
143 padding-bottom: 4px; 139 padding-bottom: 4px;
...@@ -241,6 +237,21 @@ td.appPropertyWidgetObjectTD { ...@@ -241,6 +237,21 @@ td.appPropertyWidgetObjectTD {
241 vertical-align: middle; 237 vertical-align: middle;
242 } 238 }
243 239
240 +.appSearchFormTypeSwitch {
241 + border-bottom-width: 1px;
242 + border-bottom-style: solid;
243 + border-bottom-color: #b0b0b0;
244 + background-color: #f0f0f0;
245 + padding-bottom: 4px;
246 + padding-left: 4px;
247 + padding-top: 5px;
248 + width: 100%;
249 +}
250 +
251 +.appShiftedLabel {
252 + padding-top: 5px;
253 +}
254 +
244 .appSubTitle { 255 .appSubTitle {
245 color: gray; 256 color: gray;
246 font-size: 15px; 257 font-size: 15px;
......