Latest web development tutorials

AppMLケース・モデル

このケーススタディでは、データベース、編集、検索機能内のテーブルの数のために記載されている情報で、完全な<AppML>インターネットアプリケーションを構築する方法を示します。


応用モデル

この章では、完全なアプリケーション・モデルを作成するために、データベースのCustomersテーブルになります。


<AppML>フィルタ

フィルタリング<AppML>データを許可するには、単にモデルに<フィルタ>要素を追加します。

例:

<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>

フルの場合は、<AppML>参照リファレンスマニュアルを


<AppML>アップデート

アップデート<AppML>データを許可するには、単にモデルに<更新>要素を追加します。

例:

<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>

そして<データベース>要素に<maintable>と<keyfield>要素を追加します。

例:

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

フルの場合は、<AppML>参照リファレンスマニュアルを


<AppML>セキュリティ

あなたは<AppML> <AppML>追加のセキュリティモデルに簡単に来るまで、セキュリティラベル属性を追加することができます。

例:

<appml security="admin" >

上記の例では、ユーザだけがモデルにアクセスするにはメンバーのユーザー・グループが「admin」としてログインします。

<更新>要素はセキュリティを設定するには、単に<更新>要素にセキュリティ属性を追加します。

例:

<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>


お客様の完全なモデル

この章では、アプリケーションモデルのテーブルごとに、データベースを設定します。

モデルと呼ばれる新しいフォルダを作成します。 Modelsフォルダーでは、各アプリケーションのためのモデルを作成します。

モデル: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>



モデルビュー

モデルビューを作成し、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>

»をお試しください


これで、すべてのマージ

次に、JavaScriptコードの小さな量は、すべてのモデルのテストページを作成します。

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_obj
app_obj=new AppML("appml.php","Models/" + pname);
app_obj.run("Place01");
}
</script>

</body>
</html>

検索結果表示»