<%
Dim objChannelField
Set objChannelField = New Cls_ChannelField

Class Cls_ChannelField


    Public Function LoadFieldType(ByVal Val, ByVal IsDisabled)
        Dim StrTemp, ii, arrTemp, arrTempSp
        arrTemp = "选择类型|单行文本|上传控件[图片]|上传控件[Flash]|上传控件[媒体]|上传控件[文件]|上传控件[广告]|日期控件|单选项|多选项|下拉框|多行文本|编辑器"
        StrTemp = "<select name=""FieldType"" id=""FieldType"" class=""select2"" datatype=""select"" onChange=""ShowType(this.value);"""& Easp.IIf(IsDisabled = 1, " disabled=""disabled""", "") &">" & vbCrLf
        arrTempSp = Split(arrTemp, "|")
        For ii = 0 To UBound(arrTempSp)
            StrTemp = StrTemp & "<option value="""& ii &""""& Easp.IIf(Trim(Val) = Trim(ii), " selected=""selected""", "") &">"& arrTempSp(ii) &"</option>" & vbCrLf
        Next
        StrTemp = StrTemp & "</select>" & vbCrLf
        LoadFieldType = StrTemp
    End Function

    Public Function GetFieldType(ByVal Val)
        Dim StrTemp, ii, arrTemp, arrTempSp
        arrTemp = "选择类型|单行文本|上传控件[图片]|上传控件[Flash]|上传控件[媒体]|上传控件[文件]|上传控件[广告]|日期控件|单选项|多选项|下拉框|多行文本|编辑器"
        arrTempSp = Split(arrTemp, "|")
        For ii = 0 To UBound(arrTempSp)
            If Trim(Val) = Trim(ii) Then
                StrTemp = arrTempSp(ii)
            End If
        Next
        GetFieldType = StrTemp
    End Function

    Public Function CreateField(ByVal ChannelId, ByVal TableName, ByVal FieldName, ByVal FieldType)
        If (CmsFun.ChkNumEric(ChannelId) = 0 Or Easp.IsN(TableName) Or Easp.IsN(FieldName) Or CmsFun.ChkNumEric(FieldType) = 0) Then
            Exit Function
        Else
            Dim StrFieldType
            StrFieldType = CmsFun.ChkNumEric(FieldType)
            Select Case StrFieldType
                Case 1, 2, 3
                    CmsMain.AddColumn TableName, FieldName, " nvarchar(255) Null"
                Case Else
                    CmsMain.AddColumn TableName, FieldName, " text Null"
            End Select
        End If
    End Function

End Class
%>