XPressME Integration Kit

Trac


Ignore:
Timestamp:
Nov 20, 2009, 2:52:16 PM (14 years ago)
Author:
toemon
Message:

MUブランチにVer2.2.0RC1の変更内容をマージ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/XPressMU/xpressme_integration_kit/blocks/block_common.php

    r63 r451  
    1818endif; 
    1919 
    20 if(!function_exists("dropdown_cats_options")): 
    21 function dropdown_cats_options($sort_column = 'ID', $sort_order = 'asc', $selected=array())  
     20if(!function_exists("categorie_select")): 
     21function categorie_select($option_name = '',$value='',$row_num=0 ,$sort_column = 'ID', $sort_order = 'asc') 
    2222{ 
    2323    $mydirpath = dirname(dirname(__FILE__)); 
     
    3030        $xoopsDB =& Database::getInstance(); 
    3131        $myts =& MyTextSanitizer::getInstance(); 
    32     $selected = is_array($selected)?$selected:array($selected); 
     32    $selected = explode(',' , $value); 
     33        $isAll = (count($selected)==0||empty($selected[0]))?true:false; 
    3334    $sort_column = 'cat_'.$sort_column; 
     35    if (empty($row_num)) $size = ''; else $size = 'size="' . $row_num . '"'; 
    3436        include $mydirpath.'/wp-includes/version.php'; 
    3537        if ($wp_db_version < 6124) { 
     
    5355    } 
    5456        $res =  $xoopsDB->query($query, 0, 0); 
     57        $option = "\t<option value=\"0\" "; 
     58        if ($isAll) $option .= " selected=\"selected\""; 
     59        $option .= ">"._MB_XP2_ALL ."</option>\n"; 
     60 
    5561    if ($res !== false){ 
    5662                while($row = $xoopsDB->fetchArray($res)){ 
    5763            $cat_name = $row['cat_name']; 
    5864            $cat_ID = $row['cat_ID']; 
    59             echo "\t<option value=\"".$cat_ID."\""; 
     65            $option .= "\t<option value=\"".$cat_ID."\""; 
    6066            if (in_array($cat_ID, $selected)) 
    61                 echo ' selected="selected"'; 
    62             echo '>'; 
    63             echo $myts->htmlspecialchars($cat_name); 
    64             echo "</option>\n"; 
     67                $option .= ' selected="selected"'; 
     68            $option .= '>'; 
     69            $option .= $myts->htmlspecialchars($cat_name); 
     70            $option .= "</option>\n"; 
    6571        } 
    6672    } 
    67     return; 
     73    $output = _MB_XP2_CATS_SELECT ."<br />\n"; 
     74    $output .=  "<input type='hidden' name='$option_name' value='$value' />\n"; 
     75    $output .= '&nbsp;&nbsp;<select name="categorie" '.$size.' multiple="multiple" onclick="CatSelect()">' ."\n"; 
     76    $output .= $option; 
     77    $output .= '</select><br />'; 
     78    $output .= ' 
     79<script type="text/javascript"> 
     80    function CatSelect(){ 
     81        var idx=new Array(); 
     82        var sel=document.forms["blockform"].elements["categorie"].options; 
     83        for(var i=0, n=0; i<sel.length; i++){ 
     84            if(sel[i].selected){ idx[n++]=sel[i].value; } 
     85        } 
     86        if(idx.length>0){ 
     87                document.forms["blockform"].elements["' .$option_name . '"].value = idx; 
     88                } 
     89    } 
     90</script> 
     91'; 
     92     
     93    return $output; 
     94 
     95} 
     96endif; 
     97 
     98if(!function_exists("comment_type_select")): 
     99function comment_type_select($option_name = '',$value='') 
     100{ 
     101    $selected = explode(',' , $value); 
     102        $isAll = (count($selected)==0||empty($selected[0]))?true:false; 
     103 
     104    $option = "<option value=\"0\" "; 
     105    if ($isAll) $form .= " selected=\"selected\""; 
     106    $option .= ">"._MB_XP2_ALL ."</option>"; 
     107 
     108    $option .= "<option value=\"1\" "; 
     109    if (in_array(1, $selected)) 
     110                $option .= " selected=\"selected\""; 
     111    $option .= ">"._MB_XP2_COMMENT ."</option>"; 
     112 
     113    $option .= "<option value=\"2\" "; 
     114    if (in_array(2, $selected)) 
     115                $option .= " selected=\"selected\""; 
     116    $option .= ">"._MB_XP2_TRUCKBACK ."</option>"; 
     117 
     118    $option .= "<option value=\"3\" "; 
     119    if (in_array(3, $selected)) 
     120                $option .= " selected=\"selected\""; 
     121    $option .= ">"._MB_XP2_PINGBACK ."</option>"; 
     122 
     123    $output = _MB_XP2_COM_TYPE . "<br />\n"; 
     124    $output .=  "<input type='hidden' name='$option_name' value='$value' />\n"; 
     125    $output .= '&nbsp;&nbsp;<select name="com_type" multiple="multiple" onclick="ComTypeSelect()">' ."\n"; 
     126    $output .= $option; 
     127    $output .= '</select><br />'; 
     128    $output .= ' 
     129<script type="text/javascript"> 
     130    function ComTypeSelect(){ 
     131        var idx=new Array(); 
     132        var sel=document.forms["blockform"].elements["com_type"].options; 
     133        for(var i=0, n=0; i<sel.length; i++){ 
     134            if(sel[i].selected){ idx[n++]=sel[i].value; } 
     135        } 
     136        if(idx.length>0){ 
     137                document.forms["blockform"].elements["' .$option_name . '"].value = idx; 
     138                } 
     139    } 
     140</script> 
     141'; 
     142     
     143    return $output; 
     144 
    68145} 
    69146endif; 
    70147 
    71148 
    72  
    73149?> 
Note: See TracChangeset for help on using the changeset viewer.