@@ -877,6 +877,54 @@ var hudsonRules = {
877
877
e . setAttribute ( "ref" , checkbox . id = "cb" + ( iota ++ ) ) ;
878
878
} ,
879
879
880
+ // radioBlock.jelly
881
+ "INPUT.radio-block-control" : function ( r ) {
882
+ r . id = "radio-block-" + ( iota ++ ) ;
883
+
884
+ // when one radio button is clicked, we need to update foldable block for
885
+ // other radio buttons with the same name. To do this, group all the
886
+ // radio buttons with the same name together and hang it under the form object
887
+ var f = r . form ;
888
+ var radios = f . radios ;
889
+ if ( radios == null )
890
+ f . radios = radios = { } ;
891
+
892
+ var g = radios [ r . name ] ;
893
+ if ( g == null ) {
894
+ radios [ r . name ] = g = object ( radioBlockSupport ) ;
895
+ g . buttons = [ ] ;
896
+ }
897
+
898
+ var s = findAncestorClass ( r , "radio-block-start" ) ;
899
+ s . setAttribute ( "ref" , r . id ) ;
900
+
901
+ // find the end node
902
+ var e = ( function ( ) {
903
+ var e = s ;
904
+ var cnt = 1 ;
905
+ while ( cnt > 0 ) {
906
+ e = e . nextSibling ;
907
+ if ( Element . hasClassName ( e , "radio-block-start" ) )
908
+ cnt ++ ;
909
+ if ( Element . hasClassName ( e , "radio-block-end" ) )
910
+ cnt -- ;
911
+ }
912
+ return e ;
913
+ } ) ( ) ;
914
+
915
+ var u = function ( ) {
916
+ g . updateSingleButton ( r , s , e ) ;
917
+ } ;
918
+ g . buttons . push ( u ) ;
919
+
920
+ // apply the initial visibility
921
+ u ( ) ;
922
+
923
+ // install event handlers to update visibility.
924
+ // needs to use onclick and onchange for Safari compatibility
925
+ r . onclick = r . onchange = function ( ) { g . updateButtons ( ) ; } ;
926
+ } ,
927
+
880
928
// see RowVisibilityGroupTest
881
929
"TR.rowvg-start" : function ( e ) {
882
930
// figure out the corresponding end marker
@@ -964,6 +1012,9 @@ var hudsonRules = {
964
1012
}
965
1013
var start = e ;
966
1014
1015
+ // @ref on start refers to the ID of the element that controls the JSON object created from these rows
1016
+ // if we don't find it, turn the start node into the governing node (thus the end result is that you
1017
+ // created an intermediate JSON object that's always on.)
967
1018
var ref = start . getAttribute ( "ref" ) ;
968
1019
if ( ref == null )
969
1020
start . id = ref = "rowSetStart" + ( iota ++ ) ;
@@ -1028,54 +1079,6 @@ var hudsonRules = {
1028
1079
}
1029
1080
} ,
1030
1081
1031
- // radioBlock.jelly
1032
- "INPUT.radio-block-control" : function ( r ) {
1033
- r . id = "radio-block-" + ( iota ++ ) ;
1034
-
1035
- // when one radio button is clicked, we need to update foldable block for
1036
- // other radio buttons with the same name. To do this, group all the
1037
- // radio buttons with the same name together and hang it under the form object
1038
- var f = r . form ;
1039
- var radios = f . radios ;
1040
- if ( radios == null )
1041
- f . radios = radios = { } ;
1042
-
1043
- var g = radios [ r . name ] ;
1044
- if ( g == null ) {
1045
- radios [ r . name ] = g = object ( radioBlockSupport ) ;
1046
- g . buttons = [ ] ;
1047
- }
1048
-
1049
- var s = findAncestorClass ( r , "radio-block-start" ) ;
1050
-
1051
- // find the end node
1052
- var e = ( function ( ) {
1053
- var e = s ;
1054
- var cnt = 1 ;
1055
- while ( cnt > 0 ) {
1056
- e = e . nextSibling ;
1057
- if ( Element . hasClassName ( e , "radio-block-start" ) )
1058
- cnt ++ ;
1059
- if ( Element . hasClassName ( e , "radio-block-end" ) )
1060
- cnt -- ;
1061
- }
1062
- return e ;
1063
- } ) ( ) ;
1064
-
1065
- var u = function ( ) {
1066
- g . updateSingleButton ( r , s , e ) ;
1067
- } ;
1068
- applyNameRef ( s , e , r . id ) ;
1069
- g . buttons . push ( u ) ;
1070
-
1071
- // apply the initial visibility
1072
- u ( ) ;
1073
-
1074
- // install event handlers to update visibility.
1075
- // needs to use onclick and onchange for Safari compatibility
1076
- r . onclick = r . onchange = function ( ) { g . updateButtons ( ) ; } ;
1077
- } ,
1078
-
1079
1082
// editableComboBox.jelly
1080
1083
"INPUT.combobox" : function ( c ) {
1081
1084
// Next element after <input class="combobox"/> should be <div class="combobox-values">
@@ -1348,6 +1351,10 @@ function replaceDescription() {
1348
1351
return false ;
1349
1352
}
1350
1353
1354
+ /**
1355
+ * Indicates that form fields from rows [s,e) should be grouped into a JSON object,
1356
+ * and attached under the element identified by the specified id.
1357
+ */
1351
1358
function applyNameRef ( s , e , id ) {
1352
1359
$ ( id ) . groupingNode = true ;
1353
1360
// s contains the node itself
@@ -1684,7 +1691,7 @@ var repeatableSupport = {
1684
1691
1685
1692
// prototype object to be duplicated for each radio button group
1686
1693
var radioBlockSupport = {
1687
- buttons : null ,
1694
+ buttons : null , // set of functions, one for updating one radio block each
1688
1695
1689
1696
updateButtons : function ( ) {
1690
1697
for ( var i = 0 ; i < this . buttons . length ; i ++ )
0 commit comments