XPressME Integration Kit

Trac

Changeset 76


Ignore:
Timestamp:
Jan 30, 2009, 9:55:03 PM (15 years ago)
Author:
toemon
Message:

xpressmeプラグイン側で、XOOPSグループに対する権限設定を行うためのデータベースと設定画面を追加
(まだ完全に動いてません)

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/oninstall.php

    r34 r76  
    123123                )$charset_collate;"; 
    124124        dbDelta($views_queries); 
    125                  
     125 
     126        $group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ; 
     127        $views_queries ="CREATE TABLE $group_role ( 
     128                groupid smallint(5) unsigned NOT NULL default '0', 
     129                name varchar(50)  NOT NULL default '' , 
     130                description text  NOT NULL default '', 
     131                group_type varchar(10)  NOT NULL default '' , 
     132                role varchar(20)  NOT NULL default '' , 
     133                KEY groupid (groupid) 
     134                )$charset_collate;"; 
     135        dbDelta($views_queries); 
     136                         
    126137        // make templates 
    127138//      include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates.php' ; 
  • trunk/include/onupdate.php

    r34 r76  
    100100                        )$charset_collate;"; 
    101101                dbDelta($queries); 
     102        } 
     103 
     104        if (! enhanced_table_check($mydirname,'group_role')){ 
     105                $xp_prefix = $mydirname; 
     106                if ($xp_prefix == 'wordpress'){ 
     107                        $xp_prefix = 'wp'; 
     108                } 
     109                 
     110                $charset_collate = ''; 
     111                if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) { 
     112                        if ( ! empty($wpdb->charset) ) 
     113                        $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 
     114                        if ( ! empty($wpdb->collate) ) 
     115                        $charset_collate .= " COLLATE $wpdb->collate"; 
     116                } 
     117         
     118                $group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ; 
     119                $views_queries ="CREATE TABLE $group_role ( 
     120                        groupid smallint(5) unsigned NOT NULL default '0', 
     121                        name varchar(50)  NOT NULL default '' , 
     122                        description text  NOT NULL default '', 
     123                        group_type varchar(10)  NOT NULL default '' , 
     124                        role varchar(20)  NOT NULL default '' , 
     125                        KEY groupid (groupid) 
     126                        )$charset_collate;"; 
     127                dbDelta($views_queries); 
    102128        } 
    103129         
  • trunk/wp-content/plugins/xpressme/xpressme_class.php

    r51 r76  
    1313        var $newer_post_link_text; 
    1414        var $is_author_view_count; 
     15        var $groupe_role_serial; 
     16        var $groupe_role; 
    1517 
    1618        //constructor 
    1719        function XPressME_Class() 
    1820        { 
     21                global $xoops_db; 
     22                 
    1923                $this->setdefault();    //not setting propaty load 
    2024                $this->SettingValueRead(); 
     
    4852        function SettingValueRead() 
    4953        { 
     54                global $xoops_db; 
    5055                $options = get_option('xpressme_option'); 
    5156                if (!$options) { 
     
    7075                        'old_post_link_text' => $this->old_post_link_text , 
    7176                        'newer_post_link_text' => $this->newer_post_link_text, 
    72                         'is_author_view_count' => $this->is_author_view_count 
     77                        'is_author_view_count' => $this->is_author_view_count, 
     78                        'groupe_role_serial' => $this->$groupe_role_serial 
    7379                ); 
    7480                if ($mode == 'add_new') { 
     
    7783                        update_option("xpressme_option", $write_options); 
    7884                } 
     85        } 
     86         
     87        function GroupeRoleRead() { 
     88                global $xoops_db; 
     89                 
     90                // table sync 
     91                $table = get_wp_prefix() . 'group_role'; 
     92                $xoops_group = get_xoops_prefix() . 'groups'; 
     93                $sql=  "SELECT * FROM $table"; 
     94                $before_groupes = $xoops_db->get_results($sql); 
     95                 
     96                $sql = "DELETE FROM $table"; 
     97                $xoops_db->query($sql); 
     98                 
     99                 
     100                $sql=  "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'"; 
     101                $groupes = $xoops_db->get_results($sql); 
     102                $insert_sql = ''; 
     103                foreach ($groupes as $groupe) { 
     104                        $role = ''; 
     105                        foreach ($before_groupes as $before_groupe) { 
     106                                if ($groupe->groupid == $before_groupe->groupid) $role = $before_groupe->role; 
     107                        } 
     108                         
     109                        $insert_sql  = "INSERT INTO  $table "; 
     110                        $insert_sql .= "(groupid , name , description , group_type , role) "; 
     111                        $insert_sql .= "VALUES ("; 
     112                        $insert_sql .= $groupe->groupid . ', '; 
     113                        $insert_sql .= "'" . $groupe->name . "' , "; 
     114                        $insert_sql .= "'" . $groupe->description . "' , "; 
     115                        $insert_sql .= "'" . $groupe->group_type . "' , "; 
     116                        $insert_sql .= "'" . $role . "')"; 
     117                        $xoops_db->query($insert_sql); 
     118                } 
     119                 
     120                $sql=  "SELECT * FROM $table"; 
     121                 
     122                $this->groupe_role =  $xoops_db->get_results($sql); 
     123                        $sql=  "SELECT * FROM $table";   
    79124        } 
    80125         
     
    131176         
    132177        } 
     178         
     179        function groupe_role_option(){ 
     180                global $wp_roles , $xoops_db; 
     181                $this->GroupeRoleRead(); 
     182//              $table = get_xoops_prefix() . 'groups'; 
     183//              $sql=  "SELECT * FROM $table WHERE group_type <> 'Anonymous'"; 
     184//              $groupes = array_diff($this->$groupe_role,array()); 
     185                 
     186                $form = ''; 
     187                $form .= '<tr><th><label for="role">' .__('Role Setting at Login') . '</label></th>'; 
     188                $form .= '<td>'; 
     189                $form .= "<table>\n"; 
     190                $form .= '<tr><td>' . __('XOOPS Groupe') . '</td><td>' . __('WordPress Role') . '</td><td>' . __('Only First Login') . "</td></tr>\n"; 
     191                foreach ($this->groupe_role as $groupe) { 
     192                        $form .= "<tr>"; 
     193                        $form .= "<td> $groupe->name </td>"; 
     194                        $form .= "<td>\n" . '<select name="role_gid_'.$groupe->groupid . '" id="role_gid_' . $groupe->groupid . '">' . "\n"; 
     195                        $role_list = ''; 
     196                        $group_has_role = false; 
     197                 
     198                        $select_value = $groupe->role; 
     199                 
     200                        foreach($wp_roles->role_names as $role => $name) { 
     201                                $name = translate_with_context($name); 
     202                                if ( $role == $select_value) { 
     203                                        $selected = ' selected="selected"'; 
     204                                        $group_has_role = true; 
     205                                } else { 
     206                                        $selected = ''; 
     207                                } 
     208                                $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n"; 
     209                        } 
     210                        if ( $group_has_role ) 
     211                                $role_list .= '<option value="">' . __('&mdash; No role for this blog &mdash;') . "</option>\n"; 
     212                        else 
     213                                $role_list .= '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . "</option>\n"; 
     214                        $form .= $role_list . "</select>\n</td></tr>\n"; 
     215                } 
     216                $form .= "</table></td></tr>\n"; 
     217            return $form; 
     218 
     219        } 
    133220                 
    134221        function option_page() 
    135222        { 
     223/* 
     224$script = <<< _TAB_ 
     225<script type="text/javascript"> 
     226$(function() { 
     227$('#jqtab-example2 > ul').tabs({fxFade:true,fxSpeed:'fast'}); 
     228}); 
     229</script> 
     230   
     231<div id="jqtab-example2"> 
     232<ul> 
     233<li><a href="#tab2-1"><span>JavaScript</span></a></li> 
     234<li><a href="#tab2-2"><span>Document</span></a></li> 
     235<li><a href="#tab2-3"><span>Links</span></a></li> 
     236</ul> 
     237 
     238<div id="tab2-1"> 
     239$('#jqtab-example1 > ul')<br> 
     240.tabs({ fxFade: true, fxSpeed: 'fast' }); 
     241</div> 
     242 
     243<div id="tab2-2"> 
     244�E��E��E�\�E�b�E�htabs�E�̈��E��E�A�E�t�E�F�E�C�E�h�E�G�E�t�E�F�E�N�E�gfxFade�E�ƃG�E�t�E�F�E�N�E�g�E�X�E�s�E�[�E�hfxSpeed 
     245     ("slow", "normal", "fast" ,�E�܂��E�̓~�E��E��E�b) �E��E�w�E�肵�E�Ă��E�܂��E�B 
     246</div> 
     247 
     248<div id="tab2-3"> 
     249     �E�\�E�[�E�X 
     250    </div> 
     251  </div>; 
     252_TAB_; 
     253 
     254                echo $script; 
     255*/       
    136256                if (!empty($_POST['submit_update'])) { 
    137257                        $this->ReadPostData(); 
     
    183303                                                                                                __('YES','xpressme'), 
    184304                                                                                                __('NO','xpressme')              
    185                                                                                                 );                               
     305                                                                                                ); 
     306                echo                            $this->groupe_role_option();                             
    186307//              $this->is_use_xoops_upload_path_html(); 
    187308                echo                    "</table>\n"; 
  • trunk/xoops_version.php

    r61 r76  
    6666        $db_prefix . "_term_taxonomy", 
    6767        $db_prefix . "_views",   
    68         $db_prefix . "_d3forum_link" 
     68        $db_prefix . "_d3forum_link", 
     69        $db_prefix . "_group_role" 
    6970        ); 
    7071 
Note: See TracChangeset for help on using the changeset viewer.