⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 templet

📁 WAPmo手机网站管理平台是一款创建与管理维护WAP网站的的软件产品
💻
📖 第 1 页 / 共 2 页
字号:
        GetAdsCategory = "未知"
    End If
End Function

Private Sub ShowPage()
    MyIO.Echo "<tr class=""winT4"">"
    MyIO.Echo "<td colspan=""6"" align=""right"">"
    MyIO.Echo "共 " & objPage.Count & " 条信息 "
    MyIO.Echo objPage.Size & " 条/页 "
    MyIO.Echo objPage.ID & "/" & objPage.Total & " 页"
    If objPage.ID > 1 Then
        MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Ads.doPage(1)"" class=""a1"" />首  页</a>"
        MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Ads.doPage(" & (objPage.ID - 1) & ")"" class=""a1"" />上一页</a>"
    Else
        MyIO.Echo " <a class=""a1"">首  页</a>"
        MyIO.Echo " <a class=""a1"">上一页</a>"
    End If
    If objPage.ID < objPage.Total Then
        MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Ads.doPage(" & (objPage.ID + 1) & ")"" class=""a1"" />下一页</a>"
        MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Ads.doPage(" & objPage.Total & ")"" class=""a1"" />尾  页</a>"
    Else
        MyIO.Echo " <a class=""a1"">下一页</a>"
        MyIO.Echo " <a class=""a1"">尾  页</a>"
    End If
    MyIO.Echo " 跳到 <input type=""text"" id=""_page"" class=""txt"" style=""width:30px"" /> 页"
    MyIO.Echo " <input type=""button"" value=""GO"" class=""btn"" onclick=""jspp.Ads.doPage(document.getElementById('_page').value)"" />"
    MyIO.Echo "</td>"
    MyIO.Echo "</tr>"
End Sub

Private Function GetTempletType(varIn)
    Select Case atoi(varIn)
    Case 1: GetTempletType = "默认首页模版"
    Case 2: GetTempletType = "默认主题模版"
    Case 3: GetTempletType = "默认栏目模版"
    Case 4: GetTempletType = "默认内容模版"
    Case Else: GetTempletType = "普通模版"
    End Select
End Function

Private Sub doPostSave()
    If MyPower("AddTemplet") = 0 Or MyPower("ModifyTemplet") = 0 Then
        MyIO.Echo "您没有添加/修改模版的权限"
    Else
        Dim strName, strValue
        Dim intType
        Dim blnRewrite
        strName = Trim(MyIO.Form("Name"))
        strValue = MyIO.Form("Value")
        intType = atoi(MyIO.Form("Type"))
        blnRewrite = CBool(MyIO.Form("Rewrite") = "1")
        If strName = "" Then
            MyIO.Echo "请先输入模版名称"
        ElseIf strValue = "" Then
            MyIO.Echo "不能保存空模版"
        Else
            Dim xmlDoc
            Dim xmlNode
            Dim strFile, strPath
            Set xmlDoc = WM_GetCache("templet")
            Set xmlNode = XMLQuery(xmlDoc.documentElement, "templet[@name='" & XPathString(strName) & "']")
            If Not xmlNode Is Nothing Then
                If Not blnRewrite Then
                    MyIO.Echo "同名模版已存在"
                Else
                    strPath = GetMapPath("templet/" & XMLAttr(xmlNode, "file") & ".tpl")
                    SetFileString strPath, LOCAL_CHARSET, strValue, True
                    xmlNode.setAttribute "type", intType
                    xmlDoc.Save GetMapPath("config/templet.xml")
                    MyIO.Echo "OK"
                End If
            Else
                strFile = MD5(strName & "@" & GetTime(Now()))
                strPath = GetMapPath("templet/" & strFile & ".tpl")
                SetFileString strPath, LOCAL_CHARSET, strValue, True
                Set xmlNode = xmlDoc.createElement("templet")
                xmlNode.setAttribute "name", strName
                xmlNode.setAttribute "type", intType
                xmlNode.setAttribute "file", strFile
                xmlDoc.documentElement.appendChild xmlNode
                XMLSaveToFile xmlDoc, GetMapPath("config/templet.xml")
                SetCache WM_CacheName("templet"), xmlDoc
                MyIO.Echo "OK"
            End If
            Set xmlNode = Nothing
            Set xmlDoc = Nothing
            Select Case intType
            Case 1
                RemoveCache "index", 0, 0, 0
            Case 2, 3
                RemoveCache "staple", 0, 0, 0
            Case 4
                RemoveCache "content", 0, 0, 0
            End Select
        End If
    End If
End Sub

Private Sub doPostRename()
    If MyPower("ModifyTemplet") = 0 Then
        MyIO.Echo "您没有修改模版的权限"
    Else
        Dim oldName
        Dim newName
        oldName = Trim(MyIO.Form("OldName"))
        newName = Trim(MyIO.Form("NewName"))
        If oldName = "" Then
            MyIO.Echo "请选择您要重命名的模版"
        ElseIf newName = "" Then
            MyIO.Echo "请输入新的模版名称"
        ElseIf oldName = newName Then
            MyIO.Echo "新名称不能与旧名称同名"
        Else
            Dim xmlDoc
            Dim xmlNode
            Dim strPath
            Set xmlDoc = WM_GetCache("templet")
            Set xmlNode = XMLQuery(xmlDoc.documentElement, "templet[@name='" & XPathString(newName) & "']")
            If Not xmlNode Is Nothing Then
                MyIO.Echo "新的名称已被占用"
            Else
                Set xmlNode = XMLQuery(xmlDoc.documentElement, "templet[@name='" & XPathString(oldName) & "']")
                If Not xmlNode Is Nothing Then
                    xmlNode.setAttribute "name", newName
                    XMLSaveToFile xmlDoc, GetMapPath("config/templet.xml")
                    SetCache WM_CacheName("templet"), xmlDoc
                    If oldName = MyKernel.Config("Templet") Then
                        MyKernel.Config("Templet") = newName
                    ElseIf atoi(XMLAttr(xmlNode, "type")) = 0 Then
                        strSQL = "UPDATE $(Table) SET Templet='$(New)' WHERE Templet='$(Old)'"
                        strSQL = Replace(strSQL, "$(New)", SafeString(newName))
                        strSQL = Replace(strSQL, "$(Old)", SafeString(oldName))
                        MyKernel.DB.Exec Replace(strSQL, "$(Table)", T_STAPLE)
                        MyKernel.DB.Exec Replace(strSQL, "$(Table)", T_CONTENT)
                        strSQL = "UPDATE $(Table) SET ContentTemplet='$(New)' WHERE ContentTemplet='$(Old)'"
                        strSQL = Replace(strSQL, "$(New)", SafeString(newName))
                        strSQL = Replace(strSQL, "$(Old)", SafeString(oldName))
                        MyKernel.DB.Exec Replace(strSQL, "$(Table)", T_STAPLE)
                    End If
                    MyIO.Echo "OK"
                Else
                    MyIO.Echo "找不到您要重命名的模版[" & oldName & "]"
                End If
            End If
            Set xmlNode = Nothing
            Set xmlDoc = Nothing
        End If
    End If
End Sub

Private Sub doPostDelete()
    If MyPower("DeleteTemplet") = 0 Then
        MyIO.Echo "您没有删除模版的权限"
    Else
        Dim strName
        strName = Trim(MyIO.Form("Name"))
        If strName = "" Then
            MyIO.Echo "请选择您要删除的模版"
        Else
            Dim xmlDoc
            Dim xmlNode
            Dim strFile
            Set xmlDoc = WM_GetCache("templet")
            Set xmlNode = XMLQuery(xmlDoc.documentElement, "templet[@name='" & XPathString(strName) & "']")
            If Not xmlNode Is Nothing Then
                strFile = GetMapPath("templet/" & XMLAttr(xmlNode, "file") & ".tpl")
                If fso.FileExists(strFile) Then
                    fso.DeleteFile strFile
                End If
                xmlNode.parentNode.removeChild xmlNode
                XMLSaveToFile xmlDoc, GetMapPath("config/templet.xml")
                SetCache WM_CacheName("templet"), xmlDoc
                If MyKernel.Config("Templet") = strName Then
                    MyKernel.Config("Templet") = ""
                ElseIf atoi(XMLAttr(xmlNode, "type")) = 0 Then
                    strSQL = "UPDATE $(Table) SET Templet='' WHERE Templet='$(Templet)'"
                    strSQL = Replace(strSQL, "$(Templet)", SafeString(strName))
                    MyKernel.DB.Exec Replace(strSQL, "$(Table)", T_STAPLE)
                    MyKernel.DB.Exec Replace(strSQL, "$(Table)", T_CONTENT)
                    strSQL = "UPDATE $(Table) SET ContentTemplet='' WHERE ContentTemplet='$(Templet)'"
                    strSQL = Replace(strSQL, "$(Templet)", SafeString(strName))
                    MyKernel.DB.Exec Replace(strSQL, "$(Table)", T_STAPLE)
                End If
                MyIO.Echo "OK"
            Else
                MyIO.Echo "找不到您要删除的模版"
            End If
            Set xmlNode = Nothing
            Set xmlDoc = Nothing
        End If
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -