XPressME Integration Kit

Trac


Ignore:
Timestamp:
Nov 13, 2009, 11:03:53 PM (14 years ago)
Author:
toemon
Message:

ブロックオプション、 コメントタイプをカンマ区切りデータとして格納するようにした。 #243

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/blocks/block_common.php

    r435 r436  
    147147endif; 
    148148 
     149if(!function_exists("comment_type_select")): 
     150function comment_type_select($option_name = '',$value='') 
     151{ 
     152    $selected = explode(',' , $value); 
     153        $isAll = (count($selected)==0||empty($selected[0]))?true:false; 
     154 
     155    $option = "<option value=\"0\" "; 
     156    if ($isAll) $form .= " selected=\"selected\""; 
     157    $option .= ">"._MB_XP2_ALL ."</option>"; 
     158 
     159    $option .= "<option value=\"1\" "; 
     160    if (in_array(1, $selected)) 
     161                $option .= " selected=\"selected\""; 
     162    $option .= ">"._MB_XP2_COMMENT ."</option>"; 
     163 
     164    $option .= "<option value=\"2\" "; 
     165    if (in_array(2, $selected)) 
     166                $option .= " selected=\"selected\""; 
     167    $option .= ">"._MB_XP2_TRUCKBACK ."</option>"; 
     168 
     169    $option .= "<option value=\"3\" "; 
     170    if (in_array(3, $selected)) 
     171                $option .= " selected=\"selected\""; 
     172    $option .= ">"._MB_XP2_PINGBACK ."</option>"; 
     173 
     174    $output = _MB_XP2_COM_TYPE . "<br />\n"; 
     175    $output .=  "<input type='hidden' name='$option_name' value='$value' />\n"; 
     176    $output .= '&nbsp;&nbsp;<select name="com_type" multiple="multiple" onclick="ComTypeSelect()">' ."\n"; 
     177    $output .= $option; 
     178    $output .= '</select><br />'; 
     179    $output .= ' 
     180<script type="text/javascript"> 
     181    function ComTypeSelect(){ 
     182        var idx=new Array(); 
     183        var sel=document.forms["blockform"].elements["com_type"].options; 
     184        for(var i=0, n=0; i<sel.length; i++){ 
     185            if(sel[i].selected){ idx[n++]=sel[i].value; } 
     186        } 
     187        if(idx.length>0){ 
     188                document.forms["blockform"].elements["' .$option_name . '"].value = idx; 
     189                } 
     190    } 
     191</script> 
     192'; 
     193     
     194    return $output; 
     195 
     196} 
     197endif; 
     198 
     199 
    149200?> 
Note: See TracChangeset for help on using the changeset viewer.