所有浏览器中的 TreeView 在 ActiveX 控件中使用 JQuery 而不是 VBScript

发布于 2024-12-04 04:15:53 字数 4836 浏览 0 评论 0 原文

我们的团队已经使用了一个 TreeView 三四年了,它使我们的 Internet Explorer 用户能够在一个 TreeView 列表中简单地查看来自 MS Access 数据库和 MSSQL 2005 Server 的数据。

事情发展至今,我们陷入了一个困境。用户开始被允许使用 Google Chrome 和 Firefox,它们未包含在原始用例中,并且与该对象在 Internet Explorer 外部编码的 TreeView ActiveX 控件不兼容。我相信最初的想法来自这种类型的 Windows 通用控件< /a>.

使用 JQuery 或其他技术来实现这一点的简单替代方案是什么?服务器端脚本可用

同样,这里的目标是使其与大多数主要浏览器兼容。

注意:我尝试让服务器端脚本可用,但这不是该项目的选项。因此,答案不应该针对使用 JSPPHPASP 等...相反,这里的尝试是找出使用共享网络上的本地文件来实现此目的的方法。

是的,我知道这种类型的设置涉及安全漏洞......无论如何,这一直是方向。

例如,下面是正在使用的对象:

 <body onload="SetupPage()">
      <object classid="CLSID:C74190B6-8589-11D1-B16A-00C0F0283628" id="MainTree" width="100%" height="290" style="font-family: times new roman; font-size: 16px; Visibility: visible">
        <param name="Style" value="7">
        <param name="_ExtentX" value="5292">
        <param name="_ExtentY" value="10583">
        <param name="_Version" value="393217">
        <param name="HideSelection" value="0">
        <param name="Indentation" value="767">
        <param name="LabelEdit" value="0">
        <param name="LineStyle" value="1">
        <param name="PathSeparator" value="\">
        <param name="Sorted" value="0">
        <param name="Checkboxes" value="0">
        <param name="FullRowSelect" value="0">
        <param name="HotTracking" value="1">
        <param name="Scroll" value="1">
        <param name="SingleSel" value="0">
        <param name="ImageList" value="ImgList">
        <param name="BorderStyle" value="1">
        <param name="Appearance" value="1">
        <param name="MousePointer" value="0">
        <param name="Enabled" value="1">
        <param name="OLEDragMode" value="0">
        <param name="OLEDropMode" value="0">
      </object>
      <object classid="CLSID:2C247F23-8591-11D1-B16A-00C0F0283628" id="ImgList" width="0" height="0" style="visibility: hidden"></object>
  <IFrame id="PrtFrame" style="width: 0px; height: 0px">
  </IFRAME>
 </body>

将此对象放置在网页正文中后,对某些 VBScript 的调用允许使用如下内容填充此对象:

 <script language="vbscript">

    Sub SetupPage()

        Call MainTree.Nodes.Clear
        Call PopulateImageList
        Call PopulateTree

    End Sub

    Sub PopulateTree()

        Dim rs       ' RecordSet
        Dim i        ' Index
        Dim ndParent ' Parent Node

        ' Assign the main html form to a variable xfrm
        Set xfrm = document.MainForm

        ' Setup a connection with the Database
        Set AccessConn = CreateObject("ADODB.Connection")
        AccessConn.open AccessConnectionString
        strSQL = "SELECT..."
        Set rs = AccessConn.Execute(strSQL) 

        ' Manually set the parent nodes
        i = 1
        Set ndActive = MainTree.Nodes.Add(, 2, "IDC" & i, "Active", ImageIndex("active"))

        ' Move one forward, since the parent node was set manually
        i = i + 1
        Do While rs.EOF = False

            ' Add the detail to each parent node for each record returned...
            rs.MoveNext
        Loop
        ' etc...
    End Sub

    Sub PopulateImageList()

      Dim lst
      set lst = ImgList.ListImages.Add(1,"header",LoadPicture(DirectoryPath & "TreeImages\header.gif"))
      set lst = ImgList.ListImages.Add(2,"hold",LoadPicture(DirectoryPath & "TreeImages\hold.gif"))
      set lst = ImgList.ListImages.Add(3,"reviewed",LoadPicture(DirectoryPath & "TreeImages\reviewed.gif"))
      set lst = ImgList.ListImages.Add(4,"completed",LoadPicture(DirectoryPath & "TreeImages\completed.gif"))
      set lst = ImgList.ListImages.Add(5,"rejected",LoadPicture(DirectoryPath & "TreeImages\rejected.gif"))
      set lst = ImgList.ListImages.Add(6,"printed",LoadPicture(DirectoryPath & "TreeImages\printer.gif"))
      set lst = ImgList.ListImages.Add(7,"active",LoadPicture(DirectoryPath & "TreeImages\active.gif"))
      set lst = ImgList.ListImages.Add(8,"archived",LoadPicture(DirectoryPath & "TreeImages\archived.gif"))
      set lst = ImgList.ListImages.Add(9,"emailed",LoadPicture(DirectoryPath & "TreeImages\emailed.gif"))
      set lst = ImgList.ListImages.Add(10,"assigned",LoadPicture(DirectoryPath & "TreeImages\assigned.gif"))

    End Sub
 </script>

一旦源数据库中的数据可用,所有用户需要做的是打开共享网络上的本地文件,他们会看到如下内容: TreeView 图片示例

任何实现此目的的想法或方法将不胜感激。

There is a TreeView which our team has been using now for three or four years which provides our Internet Explorer users the ability to simply view data from both an MS Access database and MSSQL 2005 Server in one TreeView list.

Since the development of this, we have a dilemma forming. The users are beginning to be allowed to use Google Chrome and Firefox which was not included in the original use case and are not compatible with the TreeView ActiveX control this object is coded in outside of Internet Explorer. I believe the original idea for this came from this type of Windows Common Control.

What would be a simple alternative to making this possible using JQuery or another technology provided the current constraint of having no server side scripting available?

Again, the aim here is to make it compatible with most of the major browsers.

Note: I have attempted to get server side scripting available and this is not an option for this project. So, answers should not target using JSP, PHP, ASP, etc... Instead the attempt here is to figure out a way to do this using a local file on a shared network.

And yes, I know the security vulnerabilities involved in this type of setup... regardless, this has been the direction.

For example, here is the object in use:

 <body onload="SetupPage()">
      <object classid="CLSID:C74190B6-8589-11D1-B16A-00C0F0283628" id="MainTree" width="100%" height="290" style="font-family: times new roman; font-size: 16px; Visibility: visible">
        <param name="Style" value="7">
        <param name="_ExtentX" value="5292">
        <param name="_ExtentY" value="10583">
        <param name="_Version" value="393217">
        <param name="HideSelection" value="0">
        <param name="Indentation" value="767">
        <param name="LabelEdit" value="0">
        <param name="LineStyle" value="1">
        <param name="PathSeparator" value="\">
        <param name="Sorted" value="0">
        <param name="Checkboxes" value="0">
        <param name="FullRowSelect" value="0">
        <param name="HotTracking" value="1">
        <param name="Scroll" value="1">
        <param name="SingleSel" value="0">
        <param name="ImageList" value="ImgList">
        <param name="BorderStyle" value="1">
        <param name="Appearance" value="1">
        <param name="MousePointer" value="0">
        <param name="Enabled" value="1">
        <param name="OLEDragMode" value="0">
        <param name="OLEDropMode" value="0">
      </object>
      <object classid="CLSID:2C247F23-8591-11D1-B16A-00C0F0283628" id="ImgList" width="0" height="0" style="visibility: hidden"></object>
  <IFrame id="PrtFrame" style="width: 0px; height: 0px">
  </IFRAME>
 </body>

After this object is placed in the body of the web page a call to some VBScript allows for populating this object using something like the following:

 <script language="vbscript">

    Sub SetupPage()

        Call MainTree.Nodes.Clear
        Call PopulateImageList
        Call PopulateTree

    End Sub

    Sub PopulateTree()

        Dim rs       ' RecordSet
        Dim i        ' Index
        Dim ndParent ' Parent Node

        ' Assign the main html form to a variable xfrm
        Set xfrm = document.MainForm

        ' Setup a connection with the Database
        Set AccessConn = CreateObject("ADODB.Connection")
        AccessConn.open AccessConnectionString
        strSQL = "SELECT..."
        Set rs = AccessConn.Execute(strSQL) 

        ' Manually set the parent nodes
        i = 1
        Set ndActive = MainTree.Nodes.Add(, 2, "IDC" & i, "Active", ImageIndex("active"))

        ' Move one forward, since the parent node was set manually
        i = i + 1
        Do While rs.EOF = False

            ' Add the detail to each parent node for each record returned...
            rs.MoveNext
        Loop
        ' etc...
    End Sub

    Sub PopulateImageList()

      Dim lst
      set lst = ImgList.ListImages.Add(1,"header",LoadPicture(DirectoryPath & "TreeImages\header.gif"))
      set lst = ImgList.ListImages.Add(2,"hold",LoadPicture(DirectoryPath & "TreeImages\hold.gif"))
      set lst = ImgList.ListImages.Add(3,"reviewed",LoadPicture(DirectoryPath & "TreeImages\reviewed.gif"))
      set lst = ImgList.ListImages.Add(4,"completed",LoadPicture(DirectoryPath & "TreeImages\completed.gif"))
      set lst = ImgList.ListImages.Add(5,"rejected",LoadPicture(DirectoryPath & "TreeImages\rejected.gif"))
      set lst = ImgList.ListImages.Add(6,"printed",LoadPicture(DirectoryPath & "TreeImages\printer.gif"))
      set lst = ImgList.ListImages.Add(7,"active",LoadPicture(DirectoryPath & "TreeImages\active.gif"))
      set lst = ImgList.ListImages.Add(8,"archived",LoadPicture(DirectoryPath & "TreeImages\archived.gif"))
      set lst = ImgList.ListImages.Add(9,"emailed",LoadPicture(DirectoryPath & "TreeImages\emailed.gif"))
      set lst = ImgList.ListImages.Add(10,"assigned",LoadPicture(DirectoryPath & "TreeImages\assigned.gif"))

    End Sub
 </script>

Once data is available in the source database, all the user needs to do is open the local file on the shared network and they see something like the following:
TreeView Picture Example

Any ideas or methods for accomplishing this would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情话已封尘 2024-12-11 04:15:53

好吧,让我们从不同的角度来看看这个问题......忘记从客户端访问数据库[JavaScript]。比什么?只需使用 SQL Server 作为 Web 服务器来提取数据即可。它称为 HTTP 端点 。通过这种方式,您可以在 SQL Server 端实现数据访问逻辑(包括通过任何可用接口访问 MS Access)。因此,现在 SQL Server 的 Web 服务返回可以使用 jQuery 在客户端 (AJAX) 操作的数据(阅读此内容获取一些信息)。

以下是我找到的端点部分的一些链接:

http://www.simple-talk.com/sql/database-administration/sql-server-endpoints-soup-to-nuts/

http://mscerts.programming4.us/sql_server/sql%20server%202008%20%20sql%20server%20web%20services%20-%20building%20web%20services%20(part%201).aspx

我从未实现过 SQL Server End Point,因此无法判断这是否容易。不过,我在 InterSystems Cache 数据库 中做了类似的事情,效果非常好。

无论如何,这就是我的看法......

PS
我对你的本地文件方法有点困惑

Well, let's look at the problem from different angle... Forget about accessing database from the client-side [JavaScript]. Than what? Just use SQL Server as a web server to pull the data. It is called HTTP End Point. This way you can implement data access logic on the SQL Server side (including to MS Access through any of the available interfaces). So, now SQL Server's web service returns data that can be manipulated on the client-side (AJAX) with jQuery (read this for some info).

Here are some links I found for the End Point part:

http://www.simple-talk.com/sql/database-administration/sql-server-endpoints-soup-to-nuts/

http://mscerts.programming4.us/sql_server/sql%20server%202008%20%20sql%20server%20web%20services%20-%20building%20web%20services%20(part%201).aspx

I have never implemented SQL Server End Point, so cannot tell if this is easy or not. However, I did similar in InterSystems Cache database and that worked very good.

This is how I see it anyway...

P.S.
I am a little confused with your local file approach

拿命拼未来 2024-12-11 04:15:53

您可以使用 Access 处理数据绑定,然后使用动态填充所需内容的 Web 浏览器控件(即 Internet Explorer)。使用 document.write 您可以填充所有内容,而无需在主机上实际创建任何 HTML/JS/CSS。对于图像,您可以只嵌入 DataURI。

您可以根据用户交互的需要绑定事件,它并不漂亮,但可以确保受控环境(您强迫他们使用 IE,而不给他们任何源代码)并且不需要特殊的数据库交互(因为 MS Access 为您完成了所有这些工作) )。

MSDN 有几篇关于该控件的文章: http:// msdn.microsoft.com/en-us/library/aa752041(v=vs.85).aspx

我是一名现役空军,正在为欧洲的一个部队开发“网络应用程序”,该部队具有非常类似的限制。我最终做的是使用 MS Access 启动 IE 并拦截 Navigate2 事件进行处理。在网络方面,我正在构建一种基于 jQuery 的模板语言来处理所有 SQL 的乐趣。这允许我完全用 HTML/JS/CSS 编写应用程序,而 Access 处理实际的 JET 绑定。它仍在开发中,但是当我完成后,我将使用我编写的 C++ 启动器,以便用户将从网络运行我的 EXE,该 EXE 将运行 Access 的不可见实例,并且用户只会看到 IE 实例和应用程序。

https://github.com/jeff-mccoy/EET-Scenario-Builder

You could use Access to handle data binding and then use a web browser control (which is Internet Explorer) that is filled dynamically with the required content. Using document.write you can fill all the content without having to actually create any HTML/JS/CSS on the host machine. For images you could just embed the DataURIs.

You can bind events as required for user interaction, it is not pretty but assures a controlled environment (you force them to use IE without giving them any source code) and doesn't require special database interaction (as MS Access does all that for you).

MSDN has several articles on the control: http://msdn.microsoft.com/en-us/library/aa752041(v=vs.85).aspx.

I'm active duty Air Force working on a "web application" for a unit in Europe with very similar restrictions. What I ended up doing is using MS Access to launch IE and intercept Navigate2 events for processing. On the web side I have a sort of jQuery-based templating language I'm building to handle all the SQL fun. This allows me to write the app entirely in HTML/JS/CSS while Access handles the actually JET binding. It's still in development but when I'm done I'll slap a C++ launcher I've written so the user will run my EXE from the network that will run an invisible instance of Access and the user will only see the IE instance and application.

https://github.com/jeff-mccoy/EET-Scenario-Builder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文