XPressME Integration Kit

Trac

Changeset 484


Ignore:
Timestamp:
Dec 11, 2009, 2:48:55 PM (14 years ago)
Author:
toemon
Message:

ブロックテンプレートの名前入力フォーム変更 Fixes#267

Location:
trunk/xpressme_integration_kit/blocks
Files:
15 edited

Legend:

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

    r463 r484  
    2828 
    2929                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    30             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     30                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3131                $form .= "<br />"; 
    3232                $a_month = _MB_XP2_ARC_MONTH ; 
  • trunk/xpressme_integration_kit/blocks/authors_block.php

    r463 r484  
    2828                         
    2929                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    30             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     30                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3131                $form .= "<br />"; 
    3232                $form .= yes_no_radio_option('options[2]', _MB_XP2_SHOW_NUM_OF_POST , $optioncount); 
  • trunk/xpressme_integration_kit/blocks/block_common.php

    r447 r484  
    103103 
    104104    $option = "<option value=\"0\" "; 
    105     if ($isAll) $form .= " selected=\"selected\""; 
     105    if ($isAll) $option .= " selected=\"selected\""; 
    106106    $option .= ">"._MB_XP2_ALL ."</option>"; 
    107107 
     
    146146endif; 
    147147 
     148if(!function_exists("block_template_setting")): 
     149function block_template_setting($mydirname,$option_name = '',$value='') 
     150{ 
     151        $temp_parm = explode(':' , $value); 
     152        if (empty($temp_parm[1])) { 
     153                $filename=$temp_parm[0]; 
     154                $temp_type = 'db'; 
     155        } else  { 
     156                $filename=$temp_parm[1]; 
     157                $temp_type = $temp_parm[0]; 
     158        } 
     159 
     160        $none_prefix_filename = ''; 
     161        $pattern = '^' . $mydirname . '_(.*).html'; 
     162        if (preg_match('/' . $pattern . '/' , $filename, $match)){ // file prefix check 
     163                $none_prefix_filename = $match[1]; 
     164        } 
     165         
     166        $output = _MB_XP2_THISTEMPLATE . "\n"; 
     167        $output .=      '<input type="hidden" size="50" name="' . $option_name . '" value="' . $value .'"/>' . "\n"; 
     168    $output .= '&nbsp;<select name="template_type" onclick="Template_Make()">' ."\n"; 
     169        switch ($temp_type){ 
     170                case 'db': 
     171                case 'DB': 
     172                        $output .=  '<option value="0" selected="selected">db</option>'; 
     173                        $output .=  '<option value="1">file</option>'; 
     174                        break; 
     175                default: 
     176                        $output .=  '<option value="0">db</option>'; 
     177                        $output .=  '<option value="1" selected="selected">file</option>'; 
     178        } 
     179        $output .= '</select>'; 
     180        $output .= '<b>:'.$mydirname . '_</b>'; 
     181        $output .= '<input type="text" size="30" name="none_prefix_file" value="'. $none_prefix_filename. '"  onChange="Template_Make()"/><b>.html</b><br />'; 
     182    $output .= ' 
     183<script type="text/javascript"> 
     184        function Template_Make(){ 
     185                var type_element = document.getElementsByName("template_type").item(0); 
     186                var name_element = document.getElementsByName("none_prefix_file").item(0); 
     187                var real_element = document.getElementsByName("' .$option_name . '").item(0); 
     188 
     189                var file_name = "' . $mydirname . '_" + name_element.value + ".html"; 
     190                if (type_element.value ==0) var tmp_type = "db:"; else var tmp_type = "file:"; 
     191                real_element.value = tmp_type + file_name; 
     192        } 
     193</script> 
     194'; 
     195     
     196    return $output; 
     197 
     198} 
     199endif; 
    148200 
    149201?> 
  • trunk/xpressme_integration_kit/blocks/calender_block.php

    r463 r484  
    2626 
    2727                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 
    28             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     28                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    2929                $form .= "<br />"; 
    3030                $form .= _MB_XP2_SUN_COLOR .": <input type='text' name='options[2]' value='" . $sun_color . "' /><br />\n"; 
  • trunk/xpressme_integration_kit/blocks/category_block.php

    r466 r484  
    3535 
    3636                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    37             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     37                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3838                $form .= "<br />"; 
    3939                $form .= _MB_XP2_CAT_ALL_STR . "  <input type='text' name='options[2]' value='" . $show_option_all . "' /><br />"; 
  • trunk/xpressme_integration_kit/blocks/enhanced_block.php

    r467 r484  
    2222                $include_file = empty( $options[2] ) ? '' : $options[2] ; 
    2323                 
     24                require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php'); 
    2425 
    2526                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    26             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     27                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    2728                $form .= "<br />"; 
    2829                $form .= _MB_XP2_ENHACED_FILE .":<br />\n"; 
    29                 $form .= '&emsp;' . _MB_XP2_FILE_NAME . ": my_<input type='text' name='options[2]' value='" . $include_file . "' />_block.php<br>\n"; 
     30                $form .= '&emsp;' . _MB_XP2_FILE_NAME . ": <b>my_</b><input type='text' name='options[2]' value='" . $include_file . "' /><b>_block.php</b><br>\n"; 
    3031                $form .= '&emsp;' . _MB_XP2_MAKE_ENHACED_FILE . "<br>\n"; 
    3132                return $form; 
  • trunk/xpressme_integration_kit/blocks/meta_block.php

    r463 r484  
    3131 
    3232                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    33             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     33                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3434                $form .= "<br />"; 
    3535                $form .= yes_no_radio_option('options[2]', _MB_XP2_META_WP_LINK , $wp_link) . "<br />\n"; 
  • trunk/xpressme_integration_kit/blocks/page_block.php

    r463 r484  
    3535 
    3636                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    37             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     37                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3838                $form .= "<br />"; 
    3939                $form .= _MB_XP2_PAGE_ORDERBY .": "; 
  • trunk/xpressme_integration_kit/blocks/popular_posts_block.php

    r463 r484  
    2828                 
    2929                require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php'); 
    30  
    3130                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 
    32             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     31                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3332                $form .= "<br />\n"; 
    3433                $form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n"; 
  • trunk/xpressme_integration_kit/blocks/recent_comments_block.php

    r463 r484  
    3030                 
    3131                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 
    32             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     32                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3333                $form .= "<br />"; 
    3434                $form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n"; 
  • trunk/xpressme_integration_kit/blocks/recent_posts_content_block.php

    r463 r484  
    3434                 
    3535                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 
    36             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     36                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
     37                $form .= "<br />"; 
    3738                $form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n"; 
    3839                $form .= yes_no_radio_option('options[3]', _MB_XP2_P_EXCERPT , $excerpt) . "<br />\n"; 
  • trunk/xpressme_integration_kit/blocks/recent_posts_list_block.php

    r463 r484  
    3131 
    3232                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 
    33             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     33                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3434                $form .= "<br />\n";     
    3535                $form .= _MB_XP2_COUNT .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />\n"; 
  • trunk/xpressme_integration_kit/blocks/search_block.php

    r463 r484  
    2525                 
    2626                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    27             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     27                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    2828                $form .= "<br />";               
    2929                $form .= _MB_XP2_SEARCH_LENGTH .": <input type='text' size='3' name='options[2]' value='" . $disp_count . "' /><br />"; 
  • trunk/xpressme_integration_kit/blocks/tag_cloud_block.php

    r463 r484  
    3232 
    3333                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    34             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     34                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    3535                $form .= "<br />"; 
    3636                $form .= _MB_XP2_CLOUD_SMALLEST .": <input type='text' size='4' name='options[2]' value='" . $smallest . "' /><br />"; 
  • trunk/xpressme_integration_kit/blocks/widget_block.php

    r463 r484  
    4646 
    4747                $form  = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />"; 
    48             $form .= _MB_XP2_THISTEMPLATE . "<input type='text' size='50' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 
     48                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES)); 
    4949                $form .= "<br />" . yes_no_radio_option('options[2]', _MB_XP2_WIDGET_TITLE_SHOW , $title_show); 
    5050                $form .= "<br />"; 
Note: See TracChangeset for help on using the changeset viewer.