当前位置: 首页 > 网络学院 > 客户端脚本教程 > APPML > 案例研究:托运人

APPML
AppML 简介
AppML 案例
AppML 案例说明
AppML 网络服务
案例研究简介
案例研究:数据库
案例研究:AppML
案例研究:HTML 报告
案例研究:HTML 表单
案例研究:目录
案例研究:产品
案例研究:托运人
案例研究:供应商
案例研究:客户
案例研究:雇员
案例研究:应用程序
案例研究:下载
AppML FAQ
AppML 文档
AppML 数据库元素

APPML 中的 案例研究:托运人


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 716 ::
收藏到网摘: n/a

This chapter demonstrates AppML on the Shippers table in the Northwind database.
这章讲述了AppML基于Northwind数据库中托运人表格的应用。


The Shippers XML File
托运人XML文件

The "Shippers" AppML description: northwind/shippers.xml
“托运人”AppML描述:northwind/shippers.xml


AppML HTML Report
AppML HTML 报告

HTML Report: appml.asp?appname=northwind/shippers&displaytype=report
HTML 报告:appml.asp?appname=northwind/shippers&displaytype=report

The link above runs the AppML HTML report service. To be able to run an AppML HTML report, the AppML description must contain an <htmlreport> tag.
上述链接运行了AppML HTML 报告服务。为了能够运行一个AppML HTML 报告,AppML描述必须包含一个<htmlreport>标签。

We see that the report contains a header ("Shippers"), a table listing the different companies along with their phone numbers. The report also lists the number of records at the bottom. The title and sql selection shown in the report, is taken from the <title> tag (under the <appml> tag) and the <sql> tag inside <htmlreport>. The number of records are automatically added by AppML.
我们都看到,这份报告包含了一个页眉(“托运人”),一个根据目录、供应商和单位数量列举不同产品的表格。报告还在底部列举了记录的数量。报告中展示的标题 和SQL选集是从<htmlreport>内部的<title>标签(在<appml>之下)和< sql>标签提取出来的。记录数量通过AppML自动被添加的。

This report also have a Filter button. If you click on the Filter button, you can filter the report.
这份报告还包含了一个过滤按钮。如果你点击了过滤按钮,你就可以报告进行过滤和分类。

The <filters> tag in "shippers.xml" looks like this:
“shippers.xml” 中的<filters>标签显示如下:

<filters>
<orderby>Companyname</orderby>
<query>
<field>Companyname</field>
</query>
</filters>

We see that the <filters> tag contains an <orderby> tag and a <query> tag.
我们看到,<filters>标签包含了一个<orderby>标签、部分<query>标签和一个<orderselect>标签。

The <orderby> tag specifies which field the report should be ordered by. In this case, the report will be ordered by the companyname field in the Shippers table.
<orderby>标签指定了报告该以什么字段为基准进行排序。在这个案例中,该报告将托运人表格中的公司名称字段进行排序。

The <query> tag define which field the user can search on. The <field> tag defines the name of the field in the table, and the <label> tag defines the label that will be visible for the user. In this case, the user can search on "Companyname".
<query>标签定义了用户可以根据什么字段进行搜索。<field>标签定义了表格中的字段名称,<label>标签定义了标签对于用户来说是否可视。在这个案例中,用户可以根据“公司名称” 进行搜索。

The <filters> tag is used by both <htmlreport> and <htmllist>.
<filters>标签可用于<htmlreport>标签和<htmllist>标签。


AppML HTML Form
AppML HTML 表单

HTML Form: appml.asp?appname=northwind/shippers&displaytype=form
HTML表单:appml.asp?appname=northwind/shippers&displaytype=form

The link above runs the AppML form service. To be able to run AppML form, the AppML description must contain an <htmlform> tag. The AppML description must also contain a <maintable> tag and a <keyfield> tag (inside the <database> tag).
上述链接运行了AppML表单服务。为了能够运行AppML HTML 报告,AppML描述必须包含一个<htmlreport>标签。AppML描述必须还要包含一个<maintable>标签和一个<keyword>标签(位于<database>标签内部)。

The link above takes you to a page with a blank form. Here you can add a new record. AppML automatically adds New, Submit, and Delete buttons.
上述链接可以使你重新打开一个全新的空白页面。你可以在里面添加全新的记录。AppML会自动添加新记录按钮、提交按钮和删除按钮。

This time we have specified the look of the form with standard HTML code. The <htmlform> tag in "shippers.xml" looks like this:
我们已经依据HTML代码的标准指定了表单的外观。“shippers.xml”中的<htmlform>标签如下:

<htmlform>
<sql>SELECT companyname,phone FROM shippers</sql>
<form>
<br/>
<table width="50%">
<tr>
<td>
<fieldset>
<legend style="color:darkblue">Shipper information</legend>
<br/>
<table border="0">
<tr>
<td>Company Name:</td>
<td><input size="40" maxlength="40" id="companyname"/></td>
</tr>
<tr>
<td>Phone:</td>
<td><input size="24" maxlength="24" id="phone"/></td>
</tr>
</table>
<br/>
</fieldset>
</td>
</tr>
</table>
</form>
</htmlform>

The sql selection for the form is specified in the <sql> tag inside <htmlform>.
关于表单的sql选集被指定在了<htmlform>中<sql>标签的内部。

The look of the input form is specified inside the <form> and </form> tags. Here we use standard HTML (like <table> tags, <fieldset> and <legend>, and <input>).
输入表单的外观被指定在了<form>标签和</form>标签的内部。在这里,我们使用的是标准的HTML代码(如:< table>标签、<fieldset>标签、<legend>标签和<input>标签)。

Notice that to show the data from a database and to make the data updateable, we set the id attribute of the input tags equal to the fieldnames in our sql selection.
注意:对于显示数据库数据和更新数据来说,设置<input>标签中的id属性和设置sql 选项集中的字段名属性的效果是一样的。


AppML HTML List
AppML HTML 列表

HTML List: appml.asp?appname=northwind/shippers&displaytype=list
HTML 列表:appml.asp?appname=northwind/shippers&displaytype=list

The link above runs the AppML list service. To be able to run AppML list, the AppML description must contain an <htmllist> tag.
上述链接运行了AppML列表服务。为了能够创建AppML列表,AppML描述必须包含一个<htmllist>标签。

We see that the list contains a header ("Shippers"), the number of records in the list, a Filter button, a New button, a Report button, and a table listing the different shippers.
我们都看到,这份报告包含了一个页眉(“托运人”)、列表中的记录数、一个过滤按钮、一个新按钮、一个报告按钮和一个罗列不同产品的表格按钮以及罗列了不同托运人的表格。

The title and sql selection shown in the report, is taken from the <title> tag and the <sql> tag inside <htmllist>. The number of records and the buttons are automatically added by AppML.
报告中展示的标题和SQL选集是从<htmllist>内部的<title>标签和<sql>标签提取出来的。记录的数量和按钮是自动添加到AppML中的。

The Filter button is automatically added because the AppML description contains a <filters> tag.
过滤按钮是自动添加的,因为AppML描述包含了一个<filters>标签。

The New button is automatically added because the AppML description contains an <htmlform> tag.
新 按钮是自动添加的,因为AppML描述包含了一个<htmlreport>标签。

The Report button is automatically added because the AppML description contains an <htmlreport> tag.
报告按钮是自动添加的,因为AppML描述包含了一个<htmlreport>标签。

The Folder image to the left of each records is automatically added because the AppML description contains an <htmlform> tag. If you click on the Folder image, you will be taken to the AppML form.
每条记录左边的文件夹图像是自动添加的,因为AppML描述包含了一个<htmlform>标签。如果你点击了文件夹图像,你将会进入AppML表单。

The <htmllist> tag in "shippers.xml" looks like this:
“shippers.xml” 文件的<htmllist>标签如下:

<htmllist>
<sql>
SELECT Companyname,Phone,ShipperID AS Orders FROM shippers
</sql>
<server>
<field name="Orders">
<display>
<a href="appml.asp?appname=northwind/orders&amp;filter=
shippers.companyname&amp;value=#appml:field(name='companyname')">
Orders</a>
</display>
</field>
</server>
</htmllist>

In the list, notice the column called "Orders". This column is a link that goes to the "Orders" application and shows the orders for each shipping company.
在列表中我们可以发现名为“Orders”的列。这个列链接到“Orders” 应用程序中,并且,它将显示每个托运公司的顺序。


AppML XML Report
AppML XML 报告

XML Report:
appml.asp?appname=northwind/shippers&displaytype=report&type=xml

XML报告:
appml.asp?appname=northwind/shippers&displaytype=report&type=xml

The link above runs the AppML XML service.
上述链接运行了AppML XML 服务。

The AppML XML report service above will generate an XML report based on the sql defined in the <htmlreport> element. The XML report's root element is <table>. The first element after <table> is <sql>, which lists the sql used in the description. Then there will be one <row> element for each record in the sql. The <row> element contains one element for each field in the sql.
上述的AppML XML报告服务将会产生一个基于在<htmlreport>元素中定义的sql来产生一个XML报告。XML报告的根元素是< table>。在<table>之后的第一个元素是<sql>,它罗列了在描述中使用的sql。对于sql中每一条记录而 言,都会包含一个<row>元素。<row>元素为sql中的每条字段包含了一个元素。


All AppML Services in One
所有的AppML服务

To run all the AppML services above (except XML report) in one, use the following link: appml.asp?appname=northwind/shippers
希望运行上面的AppML服务(除了XML报告),可以点击下面的链接:appml.asp?appname=northwind/products


评论 (0) All

登陆 | 还没注册?