@@ -4,6 +4,34 @@ library(BH)
44WebForms <- function () {
55 WebFormsData <- NameValueCollection()
66
7+ GetFormsActionData = function () {
8+ ReturnValue <- " "
9+ for (nv in WebFormsData $ GetList()) {
10+ ReturnValue <- paste0(ReturnValue , ' \n ' , nv $ Name )
11+ if (nchar(nv $ Value ) > 0 ) {
12+ ReturnValue <- paste0(ReturnValue , " =" , nv $ Value )
13+ }
14+ }
15+ ReturnValue
16+ }
17+
18+ GetFormsActionDataLineBreak = function () {
19+ ReturnValue <- " "
20+ WebFormsDataList <- WebFormsData $ GetList()
21+ i <- length(WebFormsDataList )
22+ for (nv in WebFormsDataList ) {
23+ ReturnValue <- paste0(ReturnValue , nv $ Name )
24+ if (nchar(nv $ Value ) > 0 ) {
25+ ReturnValue <- paste0(ReturnValue , " =" , gsub(" \" " , " $[dq];" , nv $ Value ))
26+ }
27+ if (i > 1 ) {
28+ ReturnValue <- paste0(ReturnValue , " $[sln];" )
29+ }
30+ i <- i - 1
31+ }
32+ ReturnValue
33+ }
34+
735 list (
836 AddLine = function (Name , Value ) {
937 WebFormsData $ Add(Name , Value )
@@ -23,7 +51,7 @@ WebForms <- function() {
2351 AddStyle = function (InputPlace , Style ) {
2452 WebFormsData $ Add(paste0(" as" , InputPlace ), Style )
2553 },
26- AddStyleWithValue = function (InputPlace , Name , Value ) {
54+ AddStyleWithNameValue = function (InputPlace , Name , Value ) {
2755 WebFormsData $ Add(paste0(" as" , InputPlace ), paste0(Name , " :" , Value ))
2856 },
2957 AddOptionTag = function (InputPlace , Text , Value , Selected = FALSE ) {
@@ -71,7 +99,7 @@ WebForms <- function() {
7199 SetStyle = function (InputPlace , Style ) {
72100 WebFormsData $ Add(paste0(" ss" , InputPlace ), Style )
73101 },
74- SetStyleWithValue = function (InputPlace , Name , Value ) {
102+ SetStyleWithNameValue = function (InputPlace , Name , Value ) {
75103 WebFormsData $ Add(paste0(" ss" , InputPlace ), paste0(Name , " :" , Value ))
76104 },
77105 SetOptionTag = function (InputPlace , Text , Value , Selected = FALSE ) {
@@ -92,13 +120,13 @@ WebForms <- function() {
92120 SetAttribute = function (InputPlace , Attribute , Value = " " ) {
93121 WebFormsData $ Add(paste0(" sa" , InputPlace ), paste0(Attribute , ifelse(nchar(Value ) > 0 , paste0(" |" , Value ), " " )))
94122 },
95- SetWidth = function (InputPlace , Width ) {
123+ SetWidthString = function (InputPlace , Width ) {
96124 WebFormsData $ Add(paste0(" sw" , InputPlace ), Width )
97125 },
98126 SetWidth = function (InputPlace , Width ) {
99127 SetWidth(InputPlace , paste0(Width , " px" ))
100128 },
101- SetHeight = function (InputPlace , Height ) {
129+ SetHeightString = function (InputPlace , Height ) {
102130 WebFormsData $ Add(paste0(" sh" , InputPlace ), Height )
103131 },
104132 SetHeight = function (InputPlace , Height ) {
@@ -119,7 +147,7 @@ WebForms <- function() {
119147 InsertStyle = function (InputPlace , Style ) {
120148 WebFormsData $ Add(paste0(" is" , InputPlace ), Style )
121149 },
122- InsertStyle = function (InputPlace , Name , Value ) {
150+ InsertStyleWithNameValue = function (InputPlace , Name , Value ) {
123151 WebFormsData $ Add(paste0(" is" , InputPlace ), paste0(Name , " :" , Value ))
124152 },
125153 InsertOptionTag = function (InputPlace , Text , Value , Selected = FALSE ) {
@@ -188,10 +216,10 @@ WebForms <- function() {
188216 SetFontName = function (InputPlace , Name ) {
189217 WebFormsData $ Add(paste0(" fn" , InputPlace ), Name )
190218 },
191- SetFontSize = function (InputPlace , Size ) {
219+ SetFontSizeString = function (InputPlace , Size ) {
192220 WebFormsData $ Add(paste0(" fs" , InputPlace ), Size )
193221 },
194- SetFontSizeString = function (InputPlace , Size ) {
222+ SetFontSize = function (InputPlace , Size ) {
195223 WebFormsData $ Add(paste0(" fs" , InputPlace ), paste0(Size , " px" ))
196224 },
197225 SetFontBold = function (InputPlace , Bold ) {
@@ -257,7 +285,7 @@ WebForms <- function() {
257285 SetCache = function (Second ) {
258286 WebFormsData $ Add(" cd" , as.character(Second ))
259287 },
260- SetCache = function () {
288+ SetCacheNoTime = function () {
261289 WebFormsData $ Add(" cd" , " *" )
262290 },
263291 IncreaseMinLength = function (InputPlace , Value ) {
@@ -317,25 +345,25 @@ WebForms <- function() {
317345 SetGetEvent = function (InputPlace , HtmlEvent , Path = NULL ) {
318346 WebFormsData $ Add(paste0(" Eg" , InputPlace ), paste0(HtmlEvent , " |" , ifelse(is.null(Path ), " #" , Path )))
319347 },
320- SetGetEvent = function (InputPlace , HtmlEvent , OutputPlace , Path = NULL ) {
348+ SetGetEventWithOutput = function (InputPlace , HtmlEvent , OutputPlace , Path = NULL ) {
321349 WebFormsData $ Add(paste0(" Eg" , InputPlace ), paste0(HtmlEvent , " |" , ifelse(is.null(Path ), " #" , Path ), " |" , OutputPlace ))
322350 },
323351 SetGetEventInForm = function (InputPlace , HtmlEvent ) {
324352 WebFormsData $ Add(paste0(" Eg" , InputPlace ), HtmlEvent )
325353 },
326- SetGetEventInForm = function (InputPlace , HtmlEvent , OutputPlace ) {
354+ SetGetEventInFormWithOutput = function (InputPlace , HtmlEvent , OutputPlace ) {
327355 WebFormsData $ Add(paste0(" Eg" , InputPlace ), paste0(HtmlEvent , " |" , OutputPlace ))
328356 },
329357 SetGetEventListener = function (InputPlace , HtmlEventListener , Path = NULL ) {
330358 WebFormsData $ Add(paste0(" EG" , InputPlace ), paste0(HtmlEventListener , " |" , ifelse(is.null(Path ), " #" , Path )))
331359 },
332- SetGetEventListener = function (InputPlace , HtmlEventListener , OutputPlace , Path = NULL ) {
360+ SetGetEventListenerWithOutput = function (InputPlace , HtmlEventListener , OutputPlace , Path = NULL ) {
333361 WebFormsData $ Add(paste0(" EG" , InputPlace ), paste0(HtmlEventListener , " |" , ifelse(is.null(Path ), " #" , Path ), " |" , OutputPlace ))
334362 },
335363 SetGetEventInFormListener = function (InputPlace , HtmlEventListener ) {
336364 WebFormsData $ Add(paste0(" EG" , InputPlace ), HtmlEventListener )
337365 },
338- SetGetEventInFormListener = function (InputPlace , HtmlEventListener , OutputPlace ) {
366+ SetGetEventInFormListenerWithOutput = function (InputPlace , HtmlEventListener , OutputPlace ) {
339367 WebFormsData $ Add(paste0(" EG" , InputPlace ), paste0(HtmlEventListener , " |" , OutputPlace ))
340368 },
341369 SetTagEvent = function (InputPlace , HtmlEvent , OutputPlace ) {
@@ -446,46 +474,19 @@ WebForms <- function() {
446474 StartIndex = function (Name = " " ) {
447475 WebFormsData $ Add(" #" , Name )
448476 },
449- GetFormsActionData = function () {
450- ReturnValue <- " "
451- for (nv in WebFormsData $ GetList()) {
452- ReturnValue <- paste0(ReturnValue , " \n " , nv $ Name )
453- if (nchar(nv $ Value ) > 0 ) {
454- ReturnValue <- paste0(ReturnValue , " =" , nv $ Value )
455- }
477+ Response = function (res = NULL ) {
478+ if (! is.null(res )) {
479+ SetHeaders(res )
456480 }
457- ReturnValue
458- },
459- Response = function () {
460481 paste0(" [web-forms]" , GetFormsActionData())
461482 },
462- Response = function (context ) {
463- SetHeaders(context )
464- Response()
465- },
466- GetFormsActionDataLineBreak = function () {
467- ReturnValue <- " "
468- WebFormsDataList <- WebFormsData $ GetList()
469- i <- length(WebFormsDataList )
470- for (nv in WebFormsDataList ) {
471- ReturnValue <- paste0(ReturnValue , nv $ Name )
472- if (nchar(nv $ Value ) > 0 ) {
473- ReturnValue <- paste0(ReturnValue , " =" , gsub(" \" " , " $[dq];" , nv $ Value ))
474- }
475- if (i > 1 ) {
476- ReturnValue <- paste0(ReturnValue , " $[sln];" )
477- }
478- i <- i - 1
479- }
480- ReturnValue
481- },
482483 ExportToWebFormsTag = function (src = NULL ) {
483484 paste0(" <web-forms ac=\" " , GetFormsActionDataLineBreak(), " \" " , ifelse(! is.null(src ), paste0(" src=\" " , src , " \" " ), " " ), " ></web-forms>" )
484485 },
485- ExportToWebFormsTag = function (Width , Height , src = NULL ) {
486+ ExportToWebFormsTagWithDimensions = function (Width , Height , src = NULL ) {
486487 paste0(" <web-forms ac=\" " , GetFormsActionDataLineBreak(), " \" width=\" " , Width , " \" height=\" " , Height , " \" " , ifelse(! is.null(src ), paste0(" src=\" " , src , " \" " ), " " ), " ></web-forms>" )
487488 },
488- ExportToWebFormsTag = function (Width , Height , src = NULL ) {
489+ ExportToWebFormsTagWithDimensionsInt = function (Width , Height , src = NULL ) {
489490 ExportToWebFormsTag(paste0(Width , " px" ), paste0(Height , " px" ), src )
490491 },
491492 DoneToWebFormsTag = function (Id = NULL ) {
@@ -497,8 +498,8 @@ WebForms <- function() {
497498 AppendForm = function (form ) {
498499 WebFormsData $ AddList(form $ ExportToNameValue()$ GetList())
499500 },
500- SetHeaders = function (context ) {
501- context $ Response $ Headers $ Add (" Content-Type" , " text/plain" )
501+ SetHeaders = function (res ) {
502+ res $ setHeader (" Content-Type" , " text/plain" )
502503 },
503504 Clean = function () {
504505 WebFormsData <- NameValueCollection()
0 commit comments