ANC Bootstrap controls (Testing < and & # 6 0 ;)

Testing step in site (or in each HTML output function to replace < with <
To make it safe to show html tags in web pages


Public

Tested

My Own Work
ANC Functions, similar to ANBS function set
' Needs RemoveHTML


<script type="text/javascript">
    function DirSwitch_global(cntrl) {
        var dii = document.getElementById(cntrl).style.direction;
        if (dii== "rtl")
            document.getElementById(cntrl).style.direction = "ltr"
        else
            document.getElementById(cntrl).style.direction = "rtl"
        ;
    }
</script>
<script language="JavaScript" type="text/javascript">
    function confirmDelete(anchor) {
        if (confirm('Are you sure?')) {
        anchor.href += '&confirm=1';
        return true;
        }
        return false;
    }
</script>


Function ANC_Button(URL, Caption, Classes, FAIcon)
    ' Creates string with Bootstrap ancher button
    Rett    = ""
    Rett    = Rett & "<a href=""" & URL & """ class=""btn " & Classes & """>"
    Rett    = Rett & "<i class=""fa " & FAIcon & " fa-lg"" ></i> " & Caption & "</a>" & vbcrlf
    ANC_Button    = Rett
End Function

Function ANC_Button_ConfirmDelete(URL, Caption, Classes, FAIcon)
    ' Creates string with bootstrap ancher button to delete something with Confirm question
    Rett    = ""
    Rett    = Rett & "<a href=""" & URL & """ class=""btn " & Classes & """ onClick=""return confirmDelete(this)"">"
    Rett    = Rett & "<i class=""fa " & FAIcon & " fa-lg"" ></i> " & Caption & "</a>" & vbcrlf
    ANC_Button_ConfirmDelete    = Rett
End Function

Function ANC_Button_Disabled(Caption, Classes, FAIcon)
    ' Creates disabled bootstrap button
    Rett    = ""
    Rett    = Rett & "<a href=""javascript:void(0);"" class=""btn " & Classes & """ disabled=""disabed"" >"
    Rett    = Rett & "<i class=""fa " & FAIcon & " fa-lg"" ></i> " & Caption & "</a>" & vbcrlf
    ANC_Button_Disabled    = Rett
End Function

Function ANC_ModalButton(ModalID, Caption, DataParameters, Classes, FAIcon)
    ' Creates bootstrap button to call Modal window passing all available data attributes
    Rett    = ""
    Rett    = Rett & "<a href=""javascript:void(0);"" data-toggle=""modal"" data-target=""#" & ModalID & """ class=""btn " & Classes & """ "
    Rett    = Rett & DataParameters & " ><i class=""fa " & FAIcon & " fa-lg"" ></i> " & Caption & "</a>" & vbcrlf
    ANC_ModalButton    = Rett
End Function

Function ANC_InputBox(BName, BValue, BCaption, ReadOnly1_ReadWrite2)
    Rett    = ""
    Rett    = Rett & "<div class=""form-group"">" & vbcrlf
    Rett    = Rett & "<label for=""" & BName & """ class=""col-lg-3 col-md-3 col-sm-3 control-label""> " & BCaption & "</label>"
    Rett    = Rett & "<div class=""col-lg-9 col-md-9 col-sm-9"">"
    Rett    = Rett & "<input name=""" & BName & """ id=""" & BName & """ placeholder=""" & RemoveHTML(BCaption)
    Rett    = Rett & """ class=""form-control"" value=""" & BValue & """ "
    If ReadOnly1_ReadWrite2    = 1 then Rett    = Rett & " readonly "
    Rett    = Rett & ">"
    Rett    = Rett & "</div></div>" & vbcrlf
    ANC_InputBox    = Rett
End Function

Function ANC_InputBox_NoLabel(BName, BValue, ReadOnly1_ReadWrite2)
    Rett    = ""
    Rett    = Rett & "<input name=""" & BName & """ id=""" & BName & """ class=""form-control"" value=""" & BValue & """ "
    If ReadOnly1_ReadWrite2    = 1 then Rett    = Rett & " readonly "
    Rett    = Rett & ">"
    Rett    = Rett & vbcrlf
    ANC_InputBox_NoLabel    = Rett
End Function

Function ANC_TextArea(BName, BValue, BCaption, ReadOnly1_ReadWrite2, RowsHeight)
    Rett    = ""
    Rett    = Rett & "<div class=""form-group"">" & vbcrlf
    Rett    = Rett & "<label for=""" & BName & """ class=""col-lg-3 col-md-3 col-sm-3 control-label""> " & BCaption & "</label>"
    Rett    = Rett & "<div class=""col-lg-9 col-md-9 col-sm-9"">"
    Rett    = Rett & "<textarea name=""" & BName & """ id=""" & BName & """ placeholder=""" & RemoveHTML(BCaption) & """"
    If ReadOnly1_ReadWrite2    = 1 then Rett    = Rett & " readonly "
    If fix(RowsHeight)    < 1 then RowsHeight    = 5
    Rett    = Rett & " class=""form-control"" rows=""" & RowsHeight & """ >"
    Rett    = Rett & BValue
    Rett    = Rett & "</textarea>"
    Rett    = Rett & "</div></div>" & vbcrlf
    ANC_TextArea    = Rett
End Function

Function ANC_InputBox_DirButton(BName, BValue, BCaption, ReadOnly1_ReadWrite2)
    ' Creates input box with direction button
    Rett    = ""
    Rett    = Rett & "<div class=""form-group"">" & vbcrlf
    Rett    = Rett & "<label for=""" & BName & """ class=""col-lg-3 col-md-3 col-sm-3 control-label""> " & BCaption
    Rett    = Rett & "<button type=""button"" class=""btn btn-default"" style=""margin-top:10px;"" onclick=""DirSwitch_global('" & BName & "')"">"
    Rett    = Rett & "<i class=""fa fa-caret-left""></i> <i class=""fa fa-paragraph""></i> <i class=""fa fa-caret-right""></i></button>"
    Rett    = Rett & "</label>"
    Rett    = Rett & "<div class=""col-lg-9 col-md-9 col-sm-9"">"
    Rett    = Rett & "<input name=""" & BName & """ id=""" & BName & """ placeholder=""" & RemoveHTML(BCaption)
    Rett    = Rett & """ class=""form-control"" value=""" & BValue & """ "
    If ReadOnly1_ReadWrite2    = 1 then Rett    = Rett & " readonly "
    Rett    = Rett & ">"
    Rett    = Rett & "</div></div>" & vbcrlf
    ANC_InputBox_DirButton    = Rett
End Function

Function ANC_TextArea_DirButton(BName, BValue, BCaption, ReadOnly1_ReadWrite2, RowsHeight)
    ' Creates text area with direction button
    Rett    = ""
    Rett    = Rett & "<div class=""form-group"">" & vbcrlf
    Rett    = Rett & "<label for=""" & BName & """ class=""col-lg-3 col-md-3 col-sm-3 control-label""> " & BCaption
    Rett    = Rett & "<button type=""button"" class=""btn btn-default btn-lg"" style=""margin-top:10px;"" onclick=""DirSwitch_global('" & BName & "')"">"
    Rett    = Rett & "<i class=""fa fa-caret-left""></i> <i class=""fa fa-paragraph""></i> <i class=""fa fa-caret-right""></i></button>"
    Rett    = Rett & ""
    Rett    = Rett & "</label>"
    Rett    = Rett & "<div class=""col-lg-9 col-md-9 col-sm-9"">"
    Rett    = Rett & "<textarea name=""" & BName & """ id=""" & BName & """ placeholder=""" & RemoveHTML(BCaption) & """"
    If ReadOnly1_ReadWrite2    = 1 then Rett    = Rett & " readonly "
    If fix(RowsHeight)    < 1 then RowsHeight    = 5
    Rett    = Rett & " class=""form-control"" rows=""" & RowsHeight & """ >"
    Rett    = Rett & BValue
    Rett    = Rett & "</textarea>"
    Rett    = Rett & "</div></div>" & vbcrlf
    ANC_TextArea_DirButton    = Rett
End Function

Function ANC_ListBox(BName, BList, BCaption, InitialSelection)
    Rett    = ""
    Rett    = Rett & "<div class=""form-group"">" & vbcrlf
    Rett    = Rett & "<label for=""" & BName & """ class=""col-lg-3 col-md-3 col-sm-3 control-label""> " & BCaption & "</label>"
    Rett    = Rett & "<div class=""col-lg-9 col-md-9 col-sm-9"">" & vbcrlf
    Rett    = Rett & "<select name=""" & BName & """ id=""" & BName & """ class=""form-control"" >" & vbcrlf
    X1        = 0
    For Each OpItem in Split(BList, Default_Sepa)
        ActiveOne    = ""
        X1            = X1+1
        If IsNumeric(InitialSelection) Then
            If Fix(InitialSelection)    = X1 Then ActiveOne    = " selected "
        Else
            If UCase(InitialSelection)    = UCase(OpItem) Then ActiveOne    = " selected "
        End If
        Rett    = Rett & "<option value=""" & OpItem & """ " & ActiveOne & ">" & OpItem & "</option>" & vbcrlf
    Next
    Rett    = Rett & "</select>"
    ' Rett    = Rett & "<p> </p>" & vbcrlf
    Rett    = Rett & "</div></div>" & vbcrlf
    ANC_ListBox        = Rett
End Function

Function ANC_ListBox_NameValue84(BName, BList, BCaption, InitialSelection)
    Rett    = ""
    Rett    = Rett & "<div class=""form-group"">" & vbcrlf
    Rett    = Rett & "<label for=""" & BName & """ class=""col-lg-5 col-md-5 col-sm-5 control-label""> " & BCaption & "</label>"
    Rett    = Rett & "<div class=""col-lg-7 col-md-7 col-sm-7"">" & vbcrlf
    Rett    = Rett & "<select name=""" & BName & """ id=""" & BName & """ class=""form-control"" >" & vbcrlf
    Rett    = Rett & "<option value=""No"" >[NONE]</option>" & vbcrlf
    X1        = 0
    For Each OpItem in Split(BList, Default_SepaR)
        OpItemID    = CutString(CutString3(OpItem, 1, Default_Sepa), "Settings_Allergen_", "", 1)
        OpItemCap    = CutString3(OpItem, 2, Default_Sepa)
        ActiveOne    = ""
        X1            = X1+1
        If IsNumeric(InitialSelection) Then
            If Fix(InitialSelection)    = X1 Then ActiveOne    = " selected "
        Else
            If UCase(InitialSelection)    = UCase(OpItemID) Then ActiveOne    = " selected "
        End If
        Rett    = Rett & "<option value=""" & OpItemID & """ " & ActiveOne & ">" & OpItemCap & "</option>" & vbcrlf
    Next
    Rett    = Rett & "</select>"
    Rett    = Rett & "</div></div>" & vbcrlf
    ANC_ListBox_NameValue84        = Rett
End Function

Function ANC_ListBox_Options(BName, BOptionList, BCaption, InitialSel1, LReadOnly)
    '
    BOptionList1            = BOptionList
    If Len(InitialSel1)    > 0 Then
        BOptionList1        = Replace(BOptionList1, " selected >", " >")
        BOptionList2        = Replace(BOptionList1, " value=""" & Trim(InitialSel1) & """ >", " value=""" & InitialSel1 & """ selected >",1,-1,1) ' to replace only 1 item, upper or lower
        If BOptionList1 = BOptionList2 Then
            BOptionList2    = Replace(BOptionList1, ">" & Trim(InitialSel1) & "<", " selected>" & Trim(InitialSel1) & "<",1,-1,1)' to replace only 1 item, upper or lower
        End If
        BOptionList1        = BOptionList2
    End If
    Rett                        = ""
    Rett                        = Rett & "<div class=""form-group"">" & vbcrlf
    Rett                        = Rett & "<label for=""" & BName & """ class=""col-lg-3 col-md-3 col-sm-3 control-label""> " & BCaption & "</label>"
    Rett                        = Rett & "<div class=""col-lg-9 col-md-9 col-sm-9"">" & vbcrlf
    Rett                        = Rett & "<select name=""" & BName & """ id=""" & BName & """ class=""form-control"" "
    If LReadOnly > "" Then Rett    = Rett & " disabled "
    Rett                        = Rett & " >" & vbcrlf
    Rett                        = Rett & BOptionList1
    Rett                        = Rett & "</select>"
    Rett                        = Rett & "</div></div>" & vbcrlf
    ANC_ListBox_Options    = Rett
End Function

Views 379 Downloads 86