XPressME Integration Kit

Trac

source: branches/Ver2.4/xpressme_integration_kit/blocks/archives_block.php @ 829

Last change on this file since 829 was 495, checked in by toemon, 14 years ago

ブロックオプションでjavascriptの有効性チェック Fixes #274

File size: 3.1 KB
Line 
1<?php
2if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
3$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
4
5eval( '
6function b_'.$mydirname.'_archives_show($options){
7        return _b_archives_show($options) ;
8}
9function b_'.$mydirname.'_archives_edit($options){
10        return _b_archives_edit($options) ;
11}
12' ) ;           
13       
14
15if( ! defined( 'XPRESS_ARCHIVES_BLOCK_INCLUDED' ) ) {
16        define( 'XPRESS_ARCHIVES_BLOCK_INCLUDED' , 1 ) ;
17       
18        function _b_archives_edit($options)
19        {
20                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
21                $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_archives_block.html' : trim( $options[1] );
22                $type = empty( $options[2] ) ? 'monthly' : $options[2] ;
23                $limit  = !is_numeric( $options[3] ) ? 0 : $options[3] ;
24                $show_post_count = empty( $options[4] ) ? false : true ;               
25                $drop_down = empty( $options[5] ) ? false : true ;
26               
27                require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
28
29                $form  = javascript_check();
30                $form .= "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
31                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
32                $form .= "<br />";
33                $a_month = _MB_XP2_ARC_MONTH ;
34                $a_week = _MB_XP2_ARC_WEEK ;           
35
36                $form .= _MB_XP2_ARC_TYPE .": ";
37                $form .=  "<select name='options[2]'>";
38                if ($type =='yearly')
39                        $form .=  "<option value='yearly' selected='selected'>". _MB_XP2_ARC_YEAR;
40                else
41                        $form .=  "<option value='yearly'>". _MB_XP2_ARC_YEAR;
42               
43                if ($type =='monthly')
44                        $form .=  "<option value='monthly' selected='selected'>". _MB_XP2_ARC_MONTH;
45                else
46                        $form .=  "<option value='monthly'>". _MB_XP2_ARC_MONTH;
47               
48                if ($type =='weekly')
49                        $form .=  "<option value='weekly' selected='selected'>". _MB_XP2_ARC_WEEK;
50                else
51                        $form .=  "<option value='weekly'>". _MB_XP2_ARC_WEEK;
52               
53                if ($type =='daily')
54                        $form .=  "<option value='daily' selected='selected'>". _MB_XP2_ARC_DAY;
55                else
56                        $form .=  "<option value='daily'>". _MB_XP2_ARC_DAY;
57
58                if ($type =='postbypost')
59                        $form .=  "<option value='postbypost' selected='selected'>". _MB_XP2_ARC_POST;
60                else
61                        $form .=  "<option value='postbypost'>". _MB_XP2_ARC_POST;
62
63                $form .=  "</select><br/>";
64               
65                $form .= "<br />" . _MB_XP2_COUNT_ZERO_ALL . "  <input type='text' size='3' name='options[3]' value='" . $limit . "' />";
66                $form .= "<br />" . yes_no_radio_option('options[4]', _MB_XP2_SHOW_NUM_OF_POST , $show_post_count);
67                $form .= "<br />" . yes_no_radio_option('options[5]', _MB_XP2_SHOW_DROP_DOWN , $drop_down);
68//          $form .="<br /><input type='text' size='60' name='options[5]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
69           
70                return $form;
71        }
72
73        function _b_archives_show($options)
74        {
75                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
76                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
77                $block_function_name = basename( __FILE__ );
78               
79                require_once $mydirpath.'/include/xpress_block_render.php';
80                return xpress_block_render($mydirname,$block_function_name,$options);
81        }
82
83
84}
85
86?>
Note: See TracBrowser for help on using the repository browser.