Changeset 451 for branches/XPressMU/xpressme_integration_kit/blocks
- Timestamp:
- Nov 20, 2009, 2:52:16 PM (15 years ago)
- Location:
- branches/XPressMU/xpressme_integration_kit/blocks
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/XPressMU/xpressme_integration_kit/blocks/block_common.php
r63 r451 18 18 endif; 19 19 20 if(!function_exists(" dropdown_cats_options")):21 function dropdown_cats_options($sort_column = 'ID', $sort_order = 'asc', $selected=array())20 if(!function_exists("categorie_select")): 21 function categorie_select($option_name = '',$value='',$row_num=0 ,$sort_column = 'ID', $sort_order = 'asc') 22 22 { 23 23 $mydirpath = dirname(dirname(__FILE__)); … … 30 30 $xoopsDB =& Database::getInstance(); 31 31 $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; 33 34 $sort_column = 'cat_'.$sort_column; 35 if (empty($row_num)) $size = ''; else $size = 'size="' . $row_num . '"'; 34 36 include $mydirpath.'/wp-includes/version.php'; 35 37 if ($wp_db_version < 6124) { … … 53 55 } 54 56 $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 55 61 if ($res !== false){ 56 62 while($row = $xoopsDB->fetchArray($res)){ 57 63 $cat_name = $row['cat_name']; 58 64 $cat_ID = $row['cat_ID']; 59 echo"\t<option value=\"".$cat_ID."\"";65 $option .= "\t<option value=\"".$cat_ID."\""; 60 66 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"; 65 71 } 66 72 } 67 return; 73 $output = _MB_XP2_CATS_SELECT ."<br />\n"; 74 $output .= "<input type='hidden' name='$option_name' value='$value' />\n"; 75 $output .= ' <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 } 96 endif; 97 98 if(!function_exists("comment_type_select")): 99 function 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 .= ' <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 68 145 } 69 146 endif; 70 147 71 148 72 73 149 ?> -
branches/XPressMU/xpressme_integration_kit/blocks/popular_posts_block.php
r365 r451 23 23 $time_format = empty( $options[5] ) ? '' : $options[5] ; 24 24 $tag_select = $options[6] ; 25 $ selected = array_slice($options, 7); // get allowed cats25 $cat_select = empty( $options[7] ) ? '0' : $options[7] ; 26 26 27 27 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; … … 44 44 } 45 45 46 $form .= _MB_XP2_CATS_SELECT ."<br />\n"; 47 $isAll = (count($selected)==0||empty($selected[0]))?true:false; 48 $form .= " <select name=\"options[]\" multiple=\"multiple\">"; 49 $form .= "<option value=\"0\" "; 50 if ($isAll) $form .= " selected=\"selected\""; 51 $form .= ">"._MB_XP2_ALL ."</option>"; 52 ob_start(); 53 dropdown_cats_options('ID','asc',$selected); 54 $list_str = ob_get_contents(); 55 ob_end_clean(); 56 $form .= $list_str. "</select><br />"; 57 // $form .="<br /><input type='text' size='60' name='options[5]' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />"; 58 46 $form .= categorie_select('options[7]' , $cat_select); 59 47 return $form; 60 48 } -
branches/XPressMU/xpressme_integration_kit/blocks/recent_comments_block.php
r232 r451 23 23 $date_format = empty( $options[4] ) ? '' : $options[4] ; 24 24 $time_format = empty( $options[5] ) ? '' : $options[5] ; 25 $selected = array_slice($options,6); // get allowed cats25 $com_select = empty( $options[6] ) ? '0' : $options[6] ; 26 26 27 27 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; … … 37 37 $form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[5]' value='" . $time_format . "' /><br />\n"; 38 38 $form .= "<br />\n"; 39 $form .= _MB_XP2_COM_TYPE . "<br />\n"; 40 $isAll = (count($selected)==0||empty($selected[0]))?true:false; 41 $form .= " <select name=\"options[]\" multiple=\"multiple\">"; 42 $form .= "<option value=\"0\" "; 43 if ($isAll) $form .= " selected=\"selected\""; 44 $form .= ">"._MB_XP2_ALL ."</option>"; 45 46 $form .= "<option value=\"1\" "; 47 if (in_array(1, $selected)) 48 $form .= " selected=\"selected\""; 49 $form .= ">"._MB_XP2_COMMENT ."</option>"; 50 51 $form .= "<option value=\"2\" "; 52 if (in_array(2, $selected)) 53 $form .= " selected=\"selected\""; 54 $form .= ">"._MB_XP2_TRUCKBACK ."</option>"; 55 56 $form .= "<option value=\"3\" "; 57 if (in_array(3, $selected)) 58 $form .= " selected=\"selected\""; 59 $form .= ">"._MB_XP2_PINGBACK ."</option>"; 60 $form .= "</select><br />"; 61 // $form .="<br /><input type='text' size='60' name='options[5]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />"; 39 $form .= comment_type_select('options[6]' , $com_select); 62 40 63 41 -
branches/XPressMU/xpressme_integration_kit/blocks/recent_posts_content_block.php
r425 r451 19 19 $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ; 20 20 $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_posts_content_block.html' : trim( $options[1] ); 21 $d ay_select = ($options[2])?intval($options[2]):0;22 $ day_size = ($options[3])?intval($options[3]):0;23 $ disp_count = ($options[4])?intval($options[4]):10;24 $ excerpt = empty( $options[5] ) ? false : true;25 $ excerpt_size = ($options[6])?intval($options[6]):100;26 $ date_format = empty( $options[7] ) ? '' :$options[7] ;27 $ time_format = empty( $options[8] ) ? '' : $options[8] ;28 $ tag_select = $options[9];29 $selected = array_slice($options,10); // get allowed cats21 $disp_count = ($options[2])?intval($options[2]):10; 22 $excerpt = empty( $options[3] ) ? false : true ; 23 $excerpt_size = ($options[4])?intval($options[4]):100; 24 $date_format = empty( $options[5] ) ? '' : $options[5] ; 25 $time_format = empty( $options[6] ) ? '' : $options[6] ; 26 $tag_select = $options[7] ; 27 $cat_select = empty( $options[8] ) ? '0' : $options[8] ; 28 $day_select = ($options[9])?intval($options[9]):0; 29 $day_size = ($options[10])?intval($options[10]):0; 30 30 31 31 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; … … 35 35 $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n"; 36 36 $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />"; 37 $form .= "<br />"; 38 $form .= _MB_XP2_DAY_SELECT . ':' . _MB_XP2_DAY_BETWEEN . '<select name="options[2]">'; 37 $form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n"; 38 $form .= yes_no_radio_option('options[3]', _MB_XP2_P_EXCERPT , $excerpt) . "<br />\n"; 39 $form .= _MB_XP2_P_EXCERPT_SIZE .": <input type='text' name='options[4]' value='" . $excerpt_size . "' /><br />\n"; 40 $form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[5]' value='" . $date_format . "' /><br />\n"; 41 $form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[6]' value='" . $time_format . "' /><br />\n"; 42 43 include $mydirpath .'/wp-includes/version.php' ; 44 if (wp_version_compare($wp_version, '>=','2.3')){ 45 $form .= "<br />\n"; 46 $form .= _MB_XP2_TAGS_SELECT .": <input type='text' name='options[7]' value='" . $tag_select . "' /><br />\n"; 47 } else { 48 $form .= "<input type='hidden' name='options[7]' value='' /><br />\n"; 49 } 50 51 $form .= categorie_select('options[8]' , $cat_select); 52 53 $form .= "<br />"; 54 $form .= _MB_XP2_DAY_SELECT . ':' . _MB_XP2_DAY_BETWEEN . '<select name="options[9]">'; 39 55 switch ($day_select){ 40 56 case 1: 41 57 $form .= '<option value="0">' . _MB_XP2_NONE . '</option>'; 42 58 $form .= '<option value="1" selected>'. _MB_XP2_TODAY . '</option>'; 43 $form .= '<option value="2">' . _MB_XP2_LA STES. '</option>';59 $form .= '<option value="2">' . _MB_XP2_LATEST . '</option>'; 44 60 break; 45 61 case 2: 46 62 $form .= '<option value="0">' . _MB_XP2_NONE . '</option>'; 47 63 $form .= '<option value="1">'. _MB_XP2_TODAY . '</option>'; 48 $form .= '<option value="2" selected>' . _MB_XP2_LA STES. '</option>';64 $form .= '<option value="2" selected>' . _MB_XP2_LATEST . '</option>'; 49 65 break; 50 66 default : 51 67 $form .= '<option value="0" selected>' . _MB_XP2_NONE . '</option>'; 52 68 $form .= '<option value="1">'. _MB_XP2_TODAY . '</option>'; 53 $form .= '<option value="2">' . _MB_XP2_LA STES. '</option>';69 $form .= '<option value="2">' . _MB_XP2_LATEST . '</option>'; 54 70 } 55 71 $form .= '</select>'; 56 72 57 $form .= ' ' . _MB_XP2_DAYS_AND . " <input type='text' size='2' name='options[3]' value='" . $day_size . "' />" . _MB_XP2_DAYS_AGO . "<br />\n"; 58 59 $form .= _MB_XP2_COUNT .": <input type='text' name='options[4]' value='" . $disp_count . "' /><br />\n"; 60 $form .= yes_no_radio_option('options[5]', _MB_XP2_P_EXCERPT , $excerpt) . "<br />\n"; 61 $form .= _MB_XP2_P_EXCERPT_SIZE .": <input type='text' name='options[6]' value='" . $excerpt_size . "' /><br />\n"; 62 $form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[7]' value='" . $date_format . "' /><br />\n"; 63 $form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[8]' value='" . $time_format . "' /><br />\n"; 64 65 include $mydirpath .'/wp-includes/version.php' ; 66 if (wp_version_compare($wp_version, '>=','2.3')){ 67 $form .= "<br />\n"; 68 $form .= _MB_XP2_TAGS_SELECT .": <input type='text' name='options[9]' value='" . $tag_select . "' /><br />\n"; 69 } else { 70 $form .= "<input type='hidden' name='options[9]' value='' /><br />\n"; 71 } 72 73 $form .= _MB_XP2_CATS_SELECT ."<br />\n"; 74 $isAll = (count($selected)==0||empty($selected[0]))?true:false; 75 $form .= " <select name=\"options[]\" multiple=\"multiple\">\n"; 76 $form .= "\t<option value=\"0\" "; 77 if ($isAll) $form .= " selected=\"selected\""; 78 $form .= ">"._MB_XP2_ALL ."</option>\n"; 79 ob_start(); 80 dropdown_cats_options('ID','asc',$selected); 81 $list_str = ob_get_contents(); 82 ob_end_clean(); 83 $form .= $list_str. "</select><br />\n"; 84 85 // $form .="<br /><input type='text' size='60' name='options[11]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />"; 73 $form .= ' ' . _MB_XP2_DAYS_AND . " <input type='text' size='2' name='options[10]' value='" . $day_size . "' />" . _MB_XP2_DAYS_AGO . "<br />\n"; 86 74 87 75 return $form; -
branches/XPressMU/xpressme_integration_kit/blocks/recent_posts_list_block.php
r365 r451 24 24 $time_format = empty( $options[6] ) ? '' : $options[6] ; 25 25 $tag_select = $options[7] ; 26 $ selected = array_slice($options,8); // get allowed cats26 $cat_select = empty( $options[8] ) ? '0' : $options[8] ; 27 27 28 28 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; … … 47 47 } 48 48 49 $form .= _MB_XP2_CATS_SELECT ."<br />\n"; 50 $isAll = (count($selected)==0||empty($selected[0]))?true:false; 51 $form .= " <select name=\"options[]\" multiple=\"multiple\">\n"; 52 $form .= "\t<option value=\"0\" "; 53 if ($isAll) $form .= " selected=\"selected\""; 54 $form .= ">"._MB_XP2_ALL ."</option>\n"; 55 ob_start(); 56 dropdown_cats_options('ID','asc',$selected); 57 $list_str = ob_get_contents(); 58 ob_end_clean(); 59 $form .= $list_str. "</select><br />\n"; 60 61 // $form .="<br /><input type='text' size='60' name='options[5]' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />"; 49 $form .= categorie_select('options[8]' , $cat_select); 62 50 63 51 return $form; -
branches/XPressMU/xpressme_integration_kit/blocks/widget_block.php
r339 r451 20 20 $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_widget_block.html' : trim( $options[1] ); 21 21 $title_show = empty( $options[2] ) ? false : true ; 22 $selected = array_slice($options,3); // get allowed cats 22 $widget_select = empty( $options[3] ) ? '' : $options[3] ; 23 24 $selected = explode(',' , $widget_select); 23 25 24 26 if ($mydirname == 'wordpress'){ … … 48 50 $form .= "<br />"; 49 51 $form .= _MB_XP2_SELECT_WIDGET .":<br />\n"; 50 $select = " <select name='options[]' multiple=\"multiple\">\n"; 52 $form .= "<input type='hidden' name='options[3]' value='$widget_select' />\n"; 53 54 $select = " <select name='widget_sel' multiple=\"multiple\" onclick=\"WidgetSelect()\">\n"; 51 55 $found = false; 52 56 foreach ( (array) $sidebars_widgets as $index => $sidebar ){ … … 67 71 68 72 $select .= "</select><br/>\n"; 73 $select .= ' 74 <script type="text/javascript"> 75 function WidgetSelect(){ 76 var idx=new Array(); 77 var sel=document.forms["blockform"].elements["widget_sel"].options; 78 for(var i=0, n=0; i<sel.length; i++){ 79 if(sel[i].selected){ idx[n++]=sel[i].value; } 80 } 81 if(idx.length>0){ 82 document.forms["blockform"].elements["options[3]"].value = idx; 83 } 84 } 85 </script> 86 '; 87 69 88 if ($found){ 70 89 $form = $form . $select;
Note: See TracChangeset
for help on using the changeset viewer.