Index: trunk/wp-content/plugins/xpressme/xpressme_class.php
===================================================================
--- trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 75)
+++ trunk/wp-content/plugins/xpressme/xpressme_class.php	(revision 76)
@@ -13,8 +13,12 @@
 	var $newer_post_link_text;
 	var $is_author_view_count;
+	var $groupe_role_serial;
+	var $groupe_role;
 
 	//constructor
 	function XPressME_Class()
 	{
+		global $xoops_db;
+		
 		$this->setdefault();    //not setting propaty load
 		$this->SettingValueRead();
@@ -48,4 +52,5 @@
 	function SettingValueRead()
 	{
+		global $xoops_db;
 		$options = get_option('xpressme_option');
 		if (!$options) {
@@ -70,5 +75,6 @@
 			'old_post_link_text' => $this->old_post_link_text ,
 			'newer_post_link_text' => $this->newer_post_link_text,
-			'is_author_view_count' => $this->is_author_view_count
+			'is_author_view_count' => $this->is_author_view_count,
+			'groupe_role_serial' => $this->$groupe_role_serial
 		);
 		if ($mode == 'add_new') {
@@ -77,4 +83,43 @@
 			update_option("xpressme_option", $write_options);
 		}
+	}
+	
+	function GroupeRoleRead() {
+ 		global $xoops_db;
+		
+		// table sync
+		$table = get_wp_prefix() . 'group_role';
+		$xoops_group = get_xoops_prefix() . 'groups';
+		$sql=  "SELECT * FROM $table";
+		$before_groupes = $xoops_db->get_results($sql);
+		
+		$sql = "DELETE FROM $table";
+		$xoops_db->query($sql);
+		
+		
+		$sql=  "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'";
+		$groupes = $xoops_db->get_results($sql);
+		$insert_sql = '';
+		foreach ($groupes as $groupe) {
+			$role = '';
+			foreach ($before_groupes as $before_groupe) {
+				if ($groupe->groupid == $before_groupe->groupid) $role = $before_groupe->role;
+			}
+			
+			$insert_sql  = "INSERT INTO  $table ";
+			$insert_sql .= "(groupid , name , description , group_type , role) ";
+			$insert_sql .= "VALUES (";
+			$insert_sql .= $groupe->groupid . ', ';
+			$insert_sql .= "'" . $groupe->name . "' , ";
+			$insert_sql .= "'" . $groupe->description . "' , ";
+			$insert_sql .= "'" . $groupe->group_type . "' , ";
+			$insert_sql .= "'" . $role . "')";
+			$xoops_db->query($insert_sql);
+		}
+		
+		$sql=  "SELECT * FROM $table";
+		
+		$this->groupe_role =  $xoops_db->get_results($sql);
+			$sql=  "SELECT * FROM $table";	
 	}
 	
@@ -131,7 +176,82 @@
 	
 	}
+	
+	function groupe_role_option(){
+		global $wp_roles , $xoops_db;
+		$this->GroupeRoleRead();
+//		$table = get_xoops_prefix() . 'groups';
+//		$sql=  "SELECT * FROM $table WHERE group_type <> 'Anonymous'";
+//		$groupes = array_diff($this->$groupe_role,array());
+		
+		$form = '';
+		$form .= '<tr><th><label for="role">' .__('Role Setting at Login') . '</label></th>';
+		$form .= '<td>';
+		$form .= "<table>\n";
+		$form .= '<tr><td>' . __('XOOPS Groupe') . '</td><td>' . __('WordPress Role') . '</td><td>' . __('Only First Login') . "</td></tr>\n";
+		foreach ($this->groupe_role as $groupe) {
+			$form .= "<tr>";
+			$form .= "<td> $groupe->name </td>";
+			$form .= "<td>\n" . '<select name="role_gid_'.$groupe->groupid . '" id="role_gid_' . $groupe->groupid . '">' . "\n";
+			$role_list = '';
+			$group_has_role = false;
+		
+			$select_value = $groupe->role;
+		
+			foreach($wp_roles->role_names as $role => $name) {
+				$name = translate_with_context($name);
+				if ( $role == $select_value) {
+					$selected = ' selected="selected"';
+					$group_has_role = true;
+				} else {
+					$selected = '';
+				}
+				$role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n";
+			}
+			if ( $group_has_role )
+				$role_list .= '<option value="">' . __('&mdash; No role for this blog &mdash;') . "</option>\n";
+			else
+				$role_list .= '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . "</option>\n";
+			$form .= $role_list . "</select>\n</td></tr>\n";
+		}
+		$form .= "</table></td></tr>\n";
+	    return $form;
+
+	}
 		
 	function option_page()
 	{
+/*
+$script = <<< _TAB_
+<script type="text/javascript">
+$(function() {
+$('#jqtab-example2 > ul').tabs({fxFade:true,fxSpeed:'fast'});
+});
+</script>
+  
+<div id="jqtab-example2">
+<ul>
+<li><a href="#tab2-1"><span>JavaScript</span></a></li>
+<li><a href="#tab2-2"><span>Document</span></a></li>
+<li><a href="#tab2-3"><span>Links</span></a></li>
+</ul>
+
+<div id="tab2-1">
+$('#jqtab-example1 > ul')<br>
+.tabs({ fxFade: true, fxSpeed: 'fast' });
+</div>
+
+<div id="tab2-2">
+�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
+     ("slow", "normal", "fast" ,�E�܂��E�̓~�E��E��E�b) �E��E�w�E�肵�E�Ă��E�܂��E�B
+</div>
+
+<div id="tab2-3">
+     �E�\�E�[�E�X
+    </div>
+  </div>;
+_TAB_;
+
+		echo $script;
+*/	
 		if (!empty($_POST['submit_update'])) {
 			$this->ReadPostData();
@@ -183,5 +303,6 @@
 												__('YES','xpressme'),
 												__('NO','xpressme')		
-												);				
+												);
+		echo				$this->groupe_role_option();				
 //		$this->is_use_xoops_upload_path_html();
 		echo			"</table>\n";
