XPressME Integration Kit

Trac


Ignore:
Timestamp:
May 1, 2010, 12:27:08 PM (14 years ago)
Author:
toemon
Message:

ブロックチェックのブロックリストにブロックオプション編集へのリンクを追加、異常ブロックのみの除去submitボタン追加 Fixes#252

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/class/check_blocks_class.php

    r505 r598  
    6868        foreach ( $_POST as $k => $v ) 
    6969        { 
     70                if ( preg_match( "/^amid:/", $k ) ) 
     71                { 
     72                        $op  = 'remove_all_block'; 
     73                        $mid = intval( str_replace("amid:", "", $k) ); 
     74                        break; 
     75                } 
    7076                if ( preg_match( "/^mid:/", $k ) ) 
    7177                { 
     
    106112} 
    107113 
    108 function remove_block() 
     114function remove_all_block() 
    109115{ 
    110116        $text = "<h1>Remove xoops block table</h1>\n"; 
     
    141147        return $text; 
    142148} 
     149function remove_block() 
     150{ 
     151        $text = "<h1>Remove xoops block table</h1>\n"; 
     152 
     153        $error = false; 
     154        $block_objs =& $this->_get_block_object_orber_num_bymodule_id( $this->module_id); 
     155        $module_obj =& $this->_get_module_object_bymodule_id( $this->module_id ); 
     156        $infos    =& $module_obj->getInfo('blocks'); 
     157 
     158        foreach ( $infos as $num => $info ) 
     159        { 
     160                $block_err = false; 
     161                if ( !isset( $block_objs[ $num ] ) ){ 
     162                        $block_err = true; 
     163                } else { 
     164                        $block_obj = $block_objs[ $num ]; 
     165                        if ( isset($info['file']) && ( $info['file'] != $block_obj->getVar('func_file', 'n') ) ) $block_err = true; 
     166                        if ( isset($info['show_func']) && ( $info['show_func'] != $block_obj->getVar('show_func', 'n') ) ) $block_err = true; 
     167                        if ( isset($info['edit_func']) && ( $info['edit_func'] != $block_obj->getVar('edit_func', 'n') ) ) $block_err = true; 
     168                        if ( isset($info['template']) && ( $info['template'] != $block_obj->getVar('template', 'n') ) ) $block_err = true; 
     169                        if ( isset($info['options']) ){ 
     170                                $option_arr_1 = explode( '|', $info['options'] ); 
     171                                $option_arr_2 = explode( '|', $block_obj->getVar('options', 'n') ); 
     172                         
     173                                $excludes_block = array(); 
     174                         
     175                                if (in_array($info['file'],$excludes_block)){ 
     176                                        if ( count($option_arr_1) > count($option_arr_2) ) $block_err = true; 
     177                                } else { 
     178                                        if ( count($option_arr_1) != count($option_arr_2) ) $block_err = true; 
     179                                } 
     180                        } 
     181                } 
     182                if ($block_err){ 
     183                        $ret = $this->_delete_block( $block_obj ); 
     184                        if ( !$ret ) $error = true; 
     185                } 
     186        } 
     187 
     188        if ( !$error ) { 
     189                $text .= '<h4 style="color:#0000ff">Success</h4>'."\n"; 
     190        } else { 
     191                $text .= '<h4 style="color:#ff0000">Failed</h4>'."\n"; 
     192        } 
     193 
     194        $url = $this->_build_url_module_update( $module_obj->getVar('dirname', 'n') ); 
     195        $text .= '<a href="'.$url.'">GO to Module Update: '.$module_obj->getVar('name', 's')."</a><br /><br />\n"; 
     196//      $text .= '<a href="check_blocks.php">Check xoops block table</a><br />'."\n"; 
     197 
     198        return $text; 
     199} 
    143200 
    144201//-------------------------------------------------------- 
     
    190247{ 
    191248        $this->_error_flag = false; 
    192  
    193         $name = htmlspecialchars( $info['name'] ); 
     249         
     250        $bid = $block_obj->getVar('bid', 'n'); 
     251        $edit_url = $this->_build_url_block_edit( $bid ); 
     252        $name = '<a href="' . $edit_url . '">'. htmlspecialchars( $info['name'] ). '</a>'; 
     253//      $name = htmlspecialchars( $info['name'] ); 
    194254 
    195255        if ( isset($info['file']) && ( $info['file'] != $block_obj->getVar('func_file', 'n') ) ) 
     
    295355        return $url; 
    296356} 
    297  
     357function _build_url_block_edit( $bid ) 
     358{ 
     359        $dir_name = $this->module_dirname; 
     360        if (file_exists(XOOPS_ROOT_PATH . '/modules/altsys/admin/index.php')){ 
     361//              $url = XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=xp_trunk&op=edit&bid='.$bid; 
     362                $url = XOOPS_URL.'/modules/'.$dir_name.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$dir_name.'xp_trunk&op=edit&bid='.$bid; 
     363        } else if ( $this->_xoops_version == '2.1' ) { 
     364                $url = XOOPS_URL.'/modules/legacy/admin/index.php?action=BlockEdit&bid='.$bid; 
     365        } else { 
     366                $url = XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=mod&bid='.$bid; 
     367        } 
     368        return $url; 
     369} 
    298370//-------------------------------------------------------- 
    299371// user handler 
Note: See TracChangeset for help on using the changeset viewer.