Web Application Opener - WebSnap (13)

zhaozj2021-02-08  257

Web Application Opener - WebSnap!

Chapter 10, Adapter and Wrapper

We all referred to the relationship between Adapter and Wrapper in the previous sections, we all know that WebSnap uses Adapters to add Wrapper to Code and Script, but we have not really detailed inspecting how they work together, specific Adapter provides that Wrapper, here we discuss them in detail!

13-1 Wrapper Object & Adapter Component

(Figure: 9)

In the above picture, we can understand when we will reach the application.today.value this script command, in fact, we are operating an Adapter Wrapper Object, with this Adapter Wrapper Object, we can operate to Adapter Component in the Delphi program. When Application This Adapter Wrapper Object receives. Today, she turned the action to Adapter Component in the Delphi program, find the Today this Adapter Field Component, and then create an Adapter Field Wrapper Object is sent back to Active Script, We can also use this Adapter Field Wrapper Object in Active Script to operate the value value in the Delphi program. In fact, the so-called Wrapper Object is our familiar COM object, so we can operate them in Active Script, So when you have completed a WebSnap program, you have to install these COM objects on the web-server computer, so you can perform the WebSnap program, Delphi 6 attached to Windows Install: InstallShield Express 3.5, you can be in Delphi6 The relevant installation file is found in / mergemodules.

13-2 Modules (Global)

This is a world-wide Wrapper, basically she is webmodules in bridge WebContext, allowing us to list all created Module, or take advantage of her to get a specific module, of course! This Module must be established, The following is a list of all established Modules Script:

<% Mdlist = new enumerator (modules) s = 'FOR (; mdlist.atend (); mdlist.movenext ()) {s ='

' mdlist.item (). Name _ ' '} Response.write (s)%> Response is another national Wrapper, we will talk about it, and her feature is the same as the response within the ASP, and the output string is used to the destination HTML file. We can also use modules to get a specific Module:

<% var m = modules.home%>

And take the Wrapper item included in her face by this module wrapper:

<% = M.Adapter1.testfield.value%>

13-3 Application (Global)

She is ApplicationAdapter's Wrapper item, you can get Application.Title by she:

<% = Application.Title%>

Or your full path diameter in on-line help:

<% Function PathinfotoreLativePath (s) {var r = ''; var l = s.Length I = 0 while (i

This program is used to get absolute paths of the program or the URL of the virtual platform. Since we need a absolute path in the preview feature of Visual Page Designer, but in the actual website is URL, she provides the Designing feature value. Let us discriminate is currently in Visual Page Designer or in the actual platform. In this program, QualifyFileName is a function of obtaining an absolute path, of which. The result is C: / TEMP / IMAGES / S. Since ApplicationAdapter is also a member of Adapter, so we can also operate like ADAPTER:

<% = Application.today.Value%>

You can also take the adapter Fields to remove all ADAPTERFIELD

<% AdList = new enumerator (Application.fields) s = 'FOR (; adList.atend (); adList.movenext ()) {s ='

' adList.Item (). Name '} response.write (s)%>

Or ActionS item

<% AdList = new enumerator (Application.Actions) s = 'FOR (; adList.atend (); adList.moveNext ()) {s ='

' adList.Item (). Name '} response.write (s)%>

Its part you can refer to Adapter Wrapper.

13-4 Request (Global)

With the meaning of Request item in the ASP, you can use some of the information on HTTP Request, you can add the Script code to the following Script code:

<% = Request.pathinfo%>

<% = request.scriptname%>

<% = request.host%>

13-5 Response (Global)

I want you to be very clear!

13-6 Enduser (Global)

She is the Wrapper of Enduseradapter, in technology, no matter if you put on the enduSeradapter to AppModule, she will be established, but the physical object has been established, so you can safely use her in Script, without careful Enduseradapter There is no existence: <% IF (Enduser.logout! = NULL) {%> <% IF (Enduser.displayName! = ') {%>

Welcome <% = Enduser.displayName%> You are <% this year = Enduser.adaptage.value%> Years <%}%> <% IF (enduser.logout.enable) {%> When using Adapter with multiple materials, such as TDataSetAdapter, the Myadapter we wrote before, we can use the Records enumerated device to move record locations:

<% var e = new enumerator (;) for (;!! "{%>

<% obj = checkboxgroup (vdsadaptcust_filter, vdsadaptcust_filter.inputname, 1, '')%> <% = Obj.Text%> <%}%>

You can see the same way of use in AdapterGrid, when you set Adaptergrid's AdapterMode to Edit, you can also see Hiddenfields and HiddenRecordfields, these two Wrapper can use Writefields in the Hidden field in Adapter Write to HTML, use on DataSetAdapter, you can find related information in the Adateraction section, the information in Hiddenfields and HiddenRecordfields is affected by the FieldFlags feature value in DataSetAdapterfield, just like the UpdateFlag we are familiar with. CANMODIFY and Canview are part of the permission control. The characteristic value of Mode is used to discriminate the status of the current web page, such as the status provided by DataSetAdapter, such as Edit, INSERT, Query. Your own Adaptermode and Adapter have a sample in Inside WebSnap.

13-11 Adaptection

AdapterAction's Wrapper Object, we can see Script below in the Grid Page:

οnclick = "adapterform2 .__ act.value = '<% = VADAPTER1_QUERY.LINKTOPAGE (" Edit "," Error "). AsfieldValue%>

This will prepare the HTML below

__sp.4.edit__fp.5.rror__id.19.grid.adapter1.Query Detailed Use of each parameter Please refer to the Adapteraction section. The Style feature value emphasizes iGethTMLStyLle.getDisplayType in Adaptection, can be used to get an action display method, such as Button, Image, Link, etc., Array allows us to list the commands supported by the Action, more obvious examples of Pagedapter Gotopage Script:

<% // gotopage has a list of commoughs. Loop through the list. Only Use an Anchor tag if the command // is enabled if (vgar e = new enumerator (vgari) for (Vgar E = new enumerator) for ;! E. Dend (); E.MOVENEXT ()) {%> <% IF (vgotopage.enabled) {%> <% = vgotopage.displayLabel%> <%} else {%> <% = vgotopage.displayLabel%> <%}%> <%}} %>

13-12 Adapterfield

I think you should be quite familiar with her. It is important to have a technology in this characteristic value. You can understand that it is much more implicated with Records with the HTML that TDataSetadapter and Tadapter. The number behind the InputName represents the data record position. After the Adaptergrid Post, these values ​​will be sent to the Action, then we can take advantage of the ActionRequest and ActionFieldVALUES, InputStyle is HTML Control type, DisplayType and Adaptertion.Style The same effect is the same, but the object is text, image, list, viewmode is display mode: Input and Display, Displaytext and EditText are the value of Adapterfield, usually we use Displaytext, INPUT, use editText, ValuesList is back Adapterfield Wrapper object in Valuelist.

13-13 Adapterrrors

It is an error-incorrect information of Adapter, which is the column that is wrong in Adapter Wrapper Object. <% Var e = new enumerator (modules.countrytable.adapter.errors) for (;!! " ) {Response.write ("

13-14 AdapterfieldValues

This is TADAPTERMULTIVALUEFIELD, which is TADAPTERMULTIVALUEFIELD, as multi-election, such as HTML List Control, etc. You can take these values ​​with the following programs.

Var e = new enumerator (f.values.Records) for (;!!); E.MOVENEXT ()) {s = '

  • ' s = f.values.Valuefield.displaytext; s = '' c } E.MOVEFIRST ()

    13-15 AdapterfieldValuesList

    This is the Wrapper Object I came back by Adapterfield.valuelist, which is the same as the upper surface, and does not add the ability to pass back AdapterImage and the direct Name to take a value.

    13-16 AdapTerhiddenfields

    It is the Wrapper item that I have ever passed by Adapter.hiddenfields.

    13-17 AdapterImage

    Use the Wrapper Object sent back from Adapterfield.Image to provide a pattern of the URL.

    This chapter will post

    Wrapper object in WebSNAP is probably these, I didn't want to list these, because these things have detailed instructions and sample files in the updated HELP file, but there are some blurred, so I decided to cause some will result Some of the questions, please refer to On-line Help, there will be a complete understanding.

  • 转载请注明原文地址:https://www.9cbs.com/read-3112.html

    New Post(0)
    CopyRight © 2020 All Rights Reserved
    Processed: 0.038, SQL: 9