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

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

APPML 中的 案例研究:雇员


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

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


The Employees XML File
客户XML文件

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


AppML HTML Report
AppML HTML 报告

HTML Report: appml.asp?appname=northwind/employees&displaytype=report
HTML 报告:appml.asp?appname=northwind/employees&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 ("Employees"), a table listing the name of the employees along with their title, city, and country. 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 and sort the report. You can also determine in what format you want to show the report (Normal, Word, Excel, or XML).
这份报告还包含了一个过滤按钮。如果你点击了过滤按钮,你就可以报告进行过滤和分类。你同样可以定义报告显示的格式(正常、Word、Excel 或 XML)。

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

<filters>
<orderby>Lastname</orderby>
<query>
<field>Lastname</field>
</query>
<query>
<field>Firstname</field>
</query>
<query>
<field>Title</field>
</query>
<query>
<field>City</field>
</query>
<query>
<field>Country</field>
</query>
<orderselect>
<field>Lastname</field>
<field>Firstname</field>
<field>City</field>
<field>Country</field>
</orderselect>
</filters>

We see that the <filters> tag contains an <orderby> tag, several <query> tags, and an <orderselect> 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 Lastname field in the Employees table.
<orderby>标签指定了报告该以什么字段为基准进行排序。在这个案例中,该报告将雇员表格中的姓字段进行排序。

The <query> tags defines which fields 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 "Lastname", "Firstname", "Title", "City", and "Country".
<query>标签定义了用户可以根据什么字段进行搜索。<field>标签定义了表格中的字段名称,<label>标签定义了标签对于用户来说是否可视。在这个案例中,用户可以根据“姓”、“名”、“标题”、“城市”和“国家”字段 进行搜索。

The <orderselect> tag specifies other order-by options for the user. Here, the user can determine if the report should be ordered by "Lastname", "Firstname", "City", or "Country".
<orderselect>标签为用户指定了其它类型的排序选项。这里,用户可以定义它应该按照“姓”、“名”、“城市”或是“国家”来进行排序。

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


AppML HTML Form
AppML HTML 表单

HTML Form: appml.asp?appname=northwind/employees&displaytype=form
HTML 表单:appml.asp?appname=northwind/employees&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>标签和 一个<keyfield>标签(位于<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 "employees.xml" looks like this:
我们已经依据HTML代码的标准指定了表单的外观。“employees.xml”中的<htmlform>标签如下:

<htmlform>
<sql>
SELECT lastname,firstname,title,titleofcourtesy,birthdate,
hiredate,address,city,region,postalcode,country,homephone,
extension,notes,reportsto
FROM employees
</sql>
<form>
<br/>
<table width="70%">
<tr>
<td>
<fieldset>
<legend style="color:darkblue">Company Information</legend>
<br/>
<table>
<tr>
<td>First Name:</td>
<td><input size="20" maxlength="10" id="firstname"/></td>
<td>Last Name:</td>
<td><input size="20" maxlength="20" id="lastname"/></td>
</tr>
<tr>
<td>Title:</td>
<td><input size="30" maxlength="30" id="title"/></td>
<td>Reports To:</td>
<td>
<field name="reportsto">
<function name="dbselect">
<sql>SELECT employeeid,lastname+' '+firstname as n
FROM employees</sql>
<value>employeeid</value>
<options>n</options>
</function>
</field>
</td>
</tr>
<tr>
<td>Hire Date:</td>
<td><input size="8" maxlength="8" id="hiredate"/></td>
<td>Extension:</td>
<td><input size="8" maxlength="4" id="extension"/></td>
</tr>
</table>
<br/>
</fieldset>
</td>
</tr>
</table>
<br/>
<table width="70%">
<tr>
<td>
<fieldset>
<legend style="color:darkblue">Personal Information</legend>
<br/>
<table>
<tr>
<td>Address:</td>
<td colspan="5"><input size="60" maxlength="60" id="address"/></td>
</tr>
<tr>
<td>City:</td>
<td><input size="15" maxlength="15" id="city"/></td>
<td>Region:</td>
<td colspan="3"><input size="15" maxlength="15" id="region"/></td>
</tr>
<tr>
<td>Postal Code:</td>
<td><input size="10" maxlength="10" id="postalcode"/></td>
<td>Country:</td>
<td colspan="3"><input size="15" maxlength="15" id="country"/></td>
</tr>
<tr>
<td>Home Phone:</td>
<td><input size="24" maxlength="24" id="homephone"/></td>
<td>Birth Date:</td>
<td><input size="8" maxlength="8" id="birthdate"/></td>
<td>Title of Courtesy:</td>
<td><input size="10" maxlength="25" id="titleofcourtesy"/></td>
</tr>
<tr>
<td valign="top">Notes:</td>
<td colspan="5">
<textarea rows="10" cols="80" id="notes"></textarea>
</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/employees&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 ("Employees"), the number of records in the list, a Filter button, a New button, a Report button, and a table listing the different customers.
我们都看到,这份报告包含了一个页眉(“雇员”)、列表中的记录数、一个过滤按钮、一个新按钮、一个报告按钮和一个罗列不同产品的表格按钮以及罗列了不同托运人的表格。

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 "employees.xml" looks like this:
“employees.xml” 文件的<htmllist>标签如下:

<htmllist>
<sql>
SELECT Lastname,Firstname,Title,City,Country,EmployeeID AS Orders
FROM employees
</sql>
<server>
<field name="Orders">
<display>
<a href="appml.asp?appname=northwind/orders&amp;filter=
employees.lastname&amp;value=#appml:field(name='lastname')"
target="_blank">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 employee.
在列表中我们可以发现名为“Orders”的列。这个列链接到“Orders” 应用程序中,并且,它将显示每个雇员的顺序。


AppML XML Report
AppML XML 报告

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

XML报告:
appml.asp?appname=northwind/employees&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 in one, use the following link:
appml.asp?appname=northwind/employees

希望运行上面的AppML服务,可以点击下面的链接:
appml.asp?appname=northwind/employees


评论 (0) All

登陆 | 还没注册?