国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

characters

<AppML> 案例研究 - 應(yīng)用程序模型



此案例研究演示了如何構(gòu)建一個(gè)完整的 <AppML> 互聯(lián)網(wǎng)應(yīng)用程序,具有針對(duì)數(shù)據(jù)庫中的若干表進(jìn)行信息列舉、編輯和搜索的功能。


應(yīng)用程序模型

在本章中,我們將為數(shù)據(jù)庫中的 Customers 表建立一個(gè)完整的應(yīng)用程序模型。


<AppML> 過濾器

如需允許過濾 <AppML> 數(shù)據(jù),只需簡(jiǎn)單地向模型添加一個(gè) <filters> 元素:

實(shí)例:

<filters><query> <field label="Customer">CustomerName</field> <field>City</field> <field>Country</field></query> <order> <field label="Customer">CustomerName</field> <field>City</field> <field>Country</field></order> </filters>

如需全面了解,請(qǐng)參閱 <AppML> 參考手冊(cè)。


<AppML> 更新

如需允許更新 <AppML> 數(shù)據(jù),只需簡(jiǎn)單地向模型添加一個(gè) <update> 元素:

實(shí)例:

<update> <item><name>LastName</name></item> <item><name>FirstName</name></item> <item><name>BirthDate</name></item> <item><name>Photo</name></item> <item><name>Notes</name></item> </update>

且向 <database> 元素添加一個(gè) <maintable> 和 <keyfield> 元素:

實(shí)例:

<maintable>Customers</maintable><keyfield>CustomerID</keyfield>

如需全面了解,請(qǐng)參閱 <AppML> 參考手冊(cè)。


<AppML> 安全

您可以通過向 <AppML> 標(biāo)簽添加一個(gè) security 屬性來很容易地為 <AppML> 模型添加安全。

實(shí)例:

<appml security="admin">

在上面的實(shí)例中,只有用戶登錄成為用戶組 "admin" 的會(huì)員才能訪問模型。

如需為 <update> 元素設(shè)置安全,只需簡(jiǎn)單地向 <update> 元素添加一個(gè) security 屬性:

實(shí)例:

<update security="admin"> <item><name>LastName</name></item> <item><name>FirstName</name></item> <item><name>BirthDate</name></item> <item><name>Photo</name></item> <item><name>Notes</name></item> </update>

完整的 Customers 模型

在本章中,我們將為數(shù)據(jù)庫中的每個(gè)表設(shè)立一個(gè)應(yīng)用程序模型。

創(chuàng)建一個(gè)名為 Models 的新文件夾。在 Models 文件夾中,為每個(gè)應(yīng)用程序創(chuàng)建一個(gè)模型。

模型:Customers.xml

<appml security=""><datasource><database> <connection>Demo</connection> <maintable>Customers</maintable> <keyfield>CustomerID</keyfield> <sql>SELECT * FROM Customers</sql> <orderby>CustomerName,City,Country</orderby></database></datasource><filters><query> <field label="Customer">CustomerName</field> <field>City</field> <field>Country</field></query><order> <field label="Customer">CustomerName</field> <field>City</field> <field>Country</field></order></filters><update security="admin"> <item><name>CustomerName</name></item> <item><name>ContactName</name></item> <item><name>Address</name></item> <item><name>PostalCode</name></item> <item><name>City</name></item> <item><name>Country</name></item></update></appml>

模型視圖

創(chuàng)建一個(gè)模型視圖,把它保存為 Demo_Model.html,并嘗試一下:

視圖:Demo_Model.htm

<h1>Customers</h1><div id="List01"></div><script src="appml.js"></script> <script>customers=new AppML("appml.htmlx","Models/Customers");customers.run("List01");</script>
 

現(xiàn)在把所有的合并在一起

然后,通過少量 JavaScript 編碼,為所有模型創(chuàng)建一個(gè)測(cè)試頁面:

Demo_Model_Views.htm

<!DOCTYPE html><html><head><link rel="stylesheet" href="appml.css" /></head><body><h1>Demo Applications</h1><button onclick='myOpen("Customers")'>Customers</button><button onclick='myOpen("Products")'>Products</button><button onclick='myOpen("Suppliers")'>Suppliers</button><button onclick='myOpen("Shippers")'>Shippers</button><button onclick='myOpen("Categories")'>Categories</button><button onclick='myOpen("Employees")'>Employees</button><button onclick='myOpen("Orders")'>Orders</button><button onclick='myOpen("OrderDetails")'>OrderDetails</button><br><br><div id="Place01"></div><script src="appml.js"></script> <script>function myOpen(pname){var app_objapp_obj=new AppML("appml.php","Models/" + pname);app_obj.run("Place01");} </script></body></html>
 
Previous article: Next article: