Help:Extension/HTMLForm

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
 
(20 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{Extension
 
{{Extension
 
|author=K, Suwa
 
|author=K, Suwa
|version=0.1
+
|version=0.3
|mediawiki=1.11.1
+
|type=Parser function, XML markup
 
}}
 
}}
  
Line 9: Line 9:
 
Extension to use form-related HTML tags (input, textarea, select, option, optgroup, fieldset, legend, label, form).<br>
 
Extension to use form-related HTML tags (input, textarea, select, option, optgroup, fieldset, legend, label, form).<br>
 
The action URL in the form must be the wiki root directory (e.g. action="/wiki/...").
 
The action URL in the form must be the wiki root directory (e.g. action="/wiki/...").
 +
 +
== Example ==
 +
=== <nowiki>{{#formtag:タグ名|属性}}</nowiki> ===
 +
==== 簡単なサンプル====
 +
一つのテキストフィールドと送信ボタンのフォームを作成します。<br />
 +
一つ目の引数にはタグ名、二つ目には属性を記述します。formタグの場合だけ、3つめの引数に、全ての他の項目(inputやlabel, textarea)などを渡します。<br />
 +
 +
* ソース
 +
<nowiki>{{#formtag:form|action="/wiki/Help:Extension/HTMLForm" method="post"|</nowiki>
 +
<nowiki> {{#formtag:input|type="text" name="data" value="input any string"}}</nowiki>
 +
<nowiki> {{#formtag:input|type="submit" value="送信"}}</nowiki>
 +
<nowiki>}}</nowiki>
 +
 +
* 実行例
 +
{{#formtag:form|action="/wiki/Help:CheckOriginalExtension" method="post"|
 +
{{#formtag:input|type="text" name="data" value="input any string"}}
 +
{{#formtag:input|type="submit" value="送信"}}
 +
}}
 +
 +
==== 複雑なサンプル====
 +
formtagで使用可能な全てのフィールドを使用します。内容は第三引数に指定できます。<br />
 +
 +
* ソース
 +
<nowiki>{{#formtag:form|action="/wiki/Help:CheckOriginalExtension" method="post"|</nowiki>
 +
<nowiki> {{#formtag:fieldset||</nowiki>
 +
<nowiki>  {{#formtag:legend||テスト}}</nowiki>
 +
<nowiki>  {{#formtag:label|for="textbox"|label}}</nowiki>
 +
<nowiki>  {{#formtag:input|type="text" name="data" value="input any string" id="textbox"}}</nowiki>
 +
<nowiki>  {{#formtag:textarea|name="area"|textarea sample}}</nowiki>
 +
<nowiki>  {{#formtag:select|name="list"|</nowiki>
 +
<nowiki>  {{#formtag:optgroup|label="numeric"|</nowiki>
 +
<nowiki>    {{#formtag:option|value="1"|1}}</nowiki>
 +
<nowiki>    {{#formtag:option|value="2"|2}}</nowiki>
 +
<nowiki>    {{#formtag:option|value="3"|3}}</nowiki>
 +
<nowiki>  }}</nowiki>
 +
<nowiki>  }}</nowiki>
 +
<nowiki>  {{#formtag:input|type="submit" value="送信"}}</nowiki>
 +
<nowiki> }}</nowiki>
 +
<nowiki>}}</nowiki>
 +
 +
* 実行例
 +
{{#formtag:form|action="/wiki/Help:CheckOriginalExtension" method="post"|
 +
{{#formtag:fieldset||
 +
{{#formtag:legend||テスト}}
 +
{{#formtag:label|for="textbox"|label}}
 +
{{#formtag:input|type="text" name="data" value="input any string" id="textbox"}}
 +
{{#formtag:textarea|name="area"|textarea sample}}
 +
{{#formtag:select|name="list"|
 +
{{#formtag:optgroup|label="numeric"|
 +
{{#formtag:option|value="1"|1}}
 +
{{#formtag:option|value="2"|2}}
 +
{{#formtag:option|value="3"|3}}
 +
}}
 +
}}
 +
{{#formtag:input|type="submit" value="送信"}}
 +
}}
 +
}}
  
 
== Requirements ==
 
== Requirements ==
Line 15: Line 72:
 
== Download ==
 
== Download ==
 
<table border="1" cellpadding="3" cellspacing="1">
 
<table border="1" cellpadding="3" cellspacing="1">
  <tr><td>version</td><td>source</td><td>size</td></tr>
+
  <tr><td>version</td><td>source</td><td>md5</td><td>OperationCheck version</td></tr>
  <tr><td>0.1(September 11,2008)</td><td>HTMLForm.phps</td><td></td></tr>
+
  <tr><td>0.3(October 8,2009)</td><td>{{#ifexistfile:/data/src/HTMLForm/HTMLForm.phps}}</td><td>1fc23f68fed045993e10233280a36122</td><td>1.11.1, 1.16.2</td></tr>
 +
<tr><td>0.2(November 18,2008)</td><td>{{#ifexistfile:/data/src/HTMLForm/previous/HTMLForm-0.2.phps}}</td><td>d74705c84362efe1ccfbebe3bec640b8</td><td>1.11.1</td></tr>
 
</table>
 
</table>
  
 
== Installtion ==
 
== Installtion ==
 
<ol>
 
<ol>
  <li>Download source and rename to HTMLForm.php.</li>
+
  <li>Download the source code and rename it to HTMLForm.php.</li>
  <li>Put in extensions/ directory.</li>
+
  <li>Place it in the extensions/ directory.</li>
  <li>Insert follow line to LocalSettings.php
+
  <li>Insert the follow lines to LocalSettings.php
 
  <pre>require_once( "$IP/extensions/HTMLForm.php" );</pre></li>
 
  <pre>require_once( "$IP/extensions/HTMLForm.php" );</pre></li>
  <li>Optionally, Insert follow line to LocalSettings.php
+
  <li>Optionally, insert the follow lines to LocalSettings.php
 
  <pre>$egParamPrefix = "any string"; (default: "my_")</pre></li>
 
  <pre>$egParamPrefix = "any string"; (default: "my_")</pre></li>
 
$egParamPrefix is used to distinguish parameters from original MediaWiki parameters.
 
$egParamPrefix is used to distinguish parameters from original MediaWiki parameters.
Line 31: Line 89:
  
 
== Function ==
 
== Function ==
# [[Doc:Extensions#.7B.7B.23get:name.7D.7D|get]]
+
# [[Help:Extensions#.7B.7B.23get:name.7D.7D|get]]
# [[Doc:Extensions#.7B.7B.23tag:str.7Carg.7Cbetween.7D.7D|tag]]
+
# [[Help:Extensions#.7B.7B.23formtag:str.7Carg.7Cbetween.7D.7D|formtag]]
 +
# [[Help:Extensions#.7B.7B.23encode:str.7D.7D|encode]]
 +
# [[Help:Extensions#.7B.7B.23decode:str.7D.7D|decode]]
 +
 
 +
== ChangeLog ==
 +
0.3
 +
* encodeが変換先の文字コードを受け取れるよう変更しました。ただし現在サポートしているのはEUC-JPのみです。
 +
0.2
 +
* <nowiki>{{#tag:}}エクステンションを{{#formtag:}}という表記に変えました。(mediawiki 1.12から{{#tag:}}が実装されたため)</nowiki>
 +
* <nowiki>{{#encode:}}, {{#decode:}}を追加</nowiki>
 +
 
 +
== Bug ==
 +
* inputタグにおいて内容を渡すことが出来ません。(2011/3/1 未対応)

Latest revision as of 15:45, 1 March 2011

Extension Information
Implementation
Description
Author(s)K, Suwa
Version0.3
MediaWiki
License
Hooks used
Token typeParser function, XML markup

Contents


Extension to use form-related HTML tags (input, textarea, select, option, optgroup, fieldset, legend, label, form).
The action URL in the form must be the wiki root directory (e.g. action="/wiki/...").

[edit] Example

[edit] {{#formtag:タグ名|属性}}

[edit] 簡単なサンプル

一つのテキストフィールドと送信ボタンのフォームを作成します。
一つ目の引数にはタグ名、二つ目には属性を記述します。formタグの場合だけ、3つめの引数に、全ての他の項目(inputやlabel, textarea)などを渡します。

  • ソース
{{#formtag:form|action="/wiki/Help:Extension/HTMLForm" method="post"|
 {{#formtag:input|type="text" name="data" value="input any string"}}
 {{#formtag:input|type="submit" value="送信"}}
}}
  • 実行例

[edit] 複雑なサンプル

formtagで使用可能な全てのフィールドを使用します。内容は第三引数に指定できます。

  • ソース
{{#formtag:form|action="/wiki/Help:CheckOriginalExtension" method="post"|
 {{#formtag:fieldset||
  {{#formtag:legend||テスト}}
  {{#formtag:label|for="textbox"|label}}
  {{#formtag:input|type="text" name="data" value="input any string" id="textbox"}}
  {{#formtag:textarea|name="area"|textarea sample}}
  {{#formtag:select|name="list"|
   {{#formtag:optgroup|label="numeric"|
    {{#formtag:option|value="1"|1}}
    {{#formtag:option|value="2"|2}}
    {{#formtag:option|value="3"|3}}
   }}
  }}
  {{#formtag:input|type="submit" value="送信"}}
 }}
}}
  • 実行例

テスト

[edit] Requirements

None

[edit] Download

versionsourcemd5OperationCheck version
0.3(October 8,2009)HTMLForm.phps1fc23f68fed045993e10233280a361221.11.1, 1.16.2
0.2(November 18,2008)HTMLForm-0.2.phpsd74705c84362efe1ccfbebe3bec640b81.11.1

[edit] Installtion

  1. Download the source code and rename it to HTMLForm.php.
  2. Place it in the extensions/ directory.
  3. Insert the follow lines to LocalSettings.php
    require_once( "$IP/extensions/HTMLForm.php" );
  4. Optionally, insert the follow lines to LocalSettings.php
    $egParamPrefix = "any string"; (default: "my_")
  5. $egParamPrefix is used to distinguish parameters from original MediaWiki parameters.

[edit] Function

  1. get
  2. formtag
  3. encode
  4. decode

[edit] ChangeLog

0.3

  • encodeが変換先の文字コードを受け取れるよう変更しました。ただし現在サポートしているのはEUC-JPのみです。

0.2

  • {{#tag:}}エクステンションを{{#formtag:}}という表記に変えました。(mediawiki 1.12から{{#tag:}}が実装されたため)
  • {{#encode:}}, {{#decode:}}を追加

[edit] Bug

  • inputタグにおいて内容を渡すことが出来ません。(2011/3/1 未対応)
Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox