Template:EditButton/CheckList

From Metabolomics.JP
< Template:EditButton(Difference between revisions)
Jump to: navigation, search
 
(5 intermediate revisions by one user not shown)
Line 4: Line 4:
 
{{#get:prevpage}} 飛んできたページ
 
{{#get:prevpage}} 飛んできたページ
 
{{#get:title}}    「species」や「効能」と言ったようなタイトル
 
{{#get:title}}    「species」や「効能」と言ったようなタイトル
 +
{{#get:separator}} Separator symbol for the selected items
 
-->{{#lua:
 
-->{{#lua:
--%% 前処理 %%--
+
--%% Preprocessing %%--
 
local list = {} -- データリスト
 
local list = {} -- データリスト
 
local i = 0;
 
local i = 0;
Line 12: Line 13:
 
   i = i + 1;
 
   i = i + 1;
 
end
 
end
--%% 表示処理 %%--
+
--%% Display Setting %%--
 
print('{{#form' .. 'tag:form|action="/wiki/{{#get:prevpage}}" method="post"|')
 
print('{{#form' .. 'tag:form|action="/wiki/{{#get:prevpage}}" method="post"|')
 
print('{{#form' .. 'tag:input|type="submit" value="update"}}<br>')
 
print('{{#form' .. 'tag:input|type="submit" value="update"}}<br>')
  
--%% できればここに目次を作成したい %%--
 
 
local head, body;
 
local head, body;
 
for i = 0, table.maxn(list) do
 
for i = 0, table.maxn(list) do
 
   head = string.match(list[i], "^([\*\#]+%s*)");
 
   head = string.match(list[i], "^([\*\#]+%s*)");
   --%% *,#で始まる行ならチェックボックスを、そうでないならそのまま表示 %%--
+
   --%% If *,# precedes a line, then place a checkbox, otherwise not. %%--
 
   if (head ~= nil) then
 
   if (head ~= nil) then
 
     body = string.sub(list[i],string.len(head)+1);
 
     body = string.sub(list[i],string.len(head)+1);
     --%% あらかじめセットしてあるデータをチェック - データは"、"区切り %%--
+
     --%% Check whether items are already selected.%%--
     if (string.match("{{#get:initset}}", "[、^]" .. body .. "[、$]", 0) == nil) then
+
     if (string.match("{{#get:initset}}", "{{#get:separator}}" .. body .. "{{#get:separator}}", 0) or
    checked = ''  
+
        string.match("{{#get:initset}}", "^" .. body .. "{{#get:separator}}", 0) or
 +
        string.match("{{#get:initset}}", "{{#get:separator}}" .. body .. "$", 0) ) then
 +
      checked = ' checked="yes"'  
 
     else
 
     else
       checked = ' checked="yes"'
+
       checked = ''
 
     end
 
     end
 
     print(head .. '{{#form' .. 'tag:input|type="checkbox" value="' .. body .. '" name="list[]" id="' .. body .. '"' .. checked .. '}}{{#form' .. 'tag:label|for="' .. body .. '"|' .. body .. '}}<br>')
 
     print(head .. '{{#form' .. 'tag:input|type="checkbox" value="' .. body .. '" name="list[]" id="' .. body .. '"' .. checked .. '}}{{#form' .. 'tag:label|for="' .. body .. '"|' .. body .. '}}<br>')
Line 36: Line 38:
 
print('{{#form' .. 'tag:input|type="hidden" name="listpage" value="{{#get:listpage}}"}}')
 
print('{{#form' .. 'tag:input|type="hidden" name="listpage" value="{{#get:listpage}}"}}')
 
print('{{#form' .. 'tag:input|type="hidden" name="title" value="{{#get:title}}"}}')
 
print('{{#form' .. 'tag:input|type="hidden" name="title" value="{{#get:title}}"}}')
 +
print('{{#form' .. 'tag:input|type="hidden" name="separator" value="{{#get:separator}}"}}')
 
print('{{#form' .. 'tag:input|type="hidden" name="hookinsert" value="__HOOK_AND_INSERT__"}}')
 
print('{{#form' .. 'tag:input|type="hidden" name="hookinsert" value="__HOOK_AND_INSERT__"}}')
 
print('{{#form' .. 'tag:input|type="submit" value="update"}}')
 
print('{{#form' .. 'tag:input|type="submit" value="update"}}')

Latest revision as of 09:51, 10 April 2009


{{ }}

Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox