ホーム > フォーラム > 開発 > モジュール開発 > gnaviのトップページにXOOPSGTicketとログインユーザーの名前をHTML上に表示させたい

gnaviのトップページにXOOPSGTicketとログインユーザーの名前をHTML上に表示させたい
投稿者: enagii | 投稿日時: 2014/1/10 15:11 | 閲覧: 9225回
enagii

お世話になります。m(_ _)m

javascriptを使って地図上に記事投稿できるようにしたのですが、

そこで必要なXOOPS_G_Ticketとログインユーザーの名前(uname)をHTML上に表示させる必要がありました。

そこでmap.phpにsubmit.phpの中身をコピペして

要らない部分(submit.phpの660行目付近からの)を削除して

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// Show the form
OpenTable();
$form = new XoopsThemeForm( ($mode == G_INSERT ? _MD_GNAV_SMT_UPLOAD : _MD_GNAV_SMT_EDIT ) , "uploadphoto", "index.php?page=submit" ) ;$form->setExtra("enctype='multipart/form-data'");
$xoops_module_header2 = $xoopsTpl->get_template_vars( "xoops_module_header2" ) ."\n" ."<link rel='stylesheet' type='text/css' href='css/gnavi.css'/>";
 
//each setting of insert or update;
 
if($mode == G_INSERT){
	$canuse_editor = $global_perms & GNAV_GPERM_WYSIWYG ;
}else{
	$canuse_editor = $global_perms & GNAV_GPERM_WYSIWYG && ( $my_uid == $photo['submitter'] || $photo['arrowhtml'] ) ? 1 : 0 ;
	if(!$photo['arrowhtml']){
		if( $gnavi_body_editor == 'common_fckeditor' && $canuse_editor ||
		$gnavi_body_editor == 'common_spaw' && file_exists( XOOPS_ROOT_PATH.'/common/spaw/spaw_control.class.php' ) && $canuse_editor  ||
		$gnavi_body_editor == 'pure_html' && $canuse_editor ){
 
			//if use editor with already inputed dhtml,change data for html
 
			$photo['description'] = $myts->displayTarea( $photo['description'] , 0 , 1 , 1 , 1 , 1 , 1) ;
 
		}
	}
 
	$status_hidden = new XoopsFormHidden( "old_status" , $photo['status'] ) ;
	$valid_or_not = $photo['valid'] ? 1 : 0 ;
	$valid_box = new XoopsFormCheckBox( _MD_GNAV_SMT_VALIDPHOTO , "valid" , array( $valid_or_not ) ) ;
	$valid_box->addOption( '1' , '&nbsp;' ) ;
	$storets_box = new XoopsFormCheckBox(_MD_GNAV_SMT_UPDATEDATE, "store_timestamp" , array( 0 ) ) ;
	$storets_box->addOption( '1' , '&nbsp;' ) ;
 
	if( $global_perms & GNAV_GPERM_DELETABLE ) {
		$del_tray = new XoopsFormElementTray(_MD_GNAV_SMT_DELETE) ;
		$delete_button = new XoopsFormButton( "" , "conf_delete" , _DELETE , "submit" ) ;
		$del_tray->addElement( $delete_button ) ;
	}
}
 
//labels
$pixels_text = "$gnavi_width x $gnavi_height" ;
if( $gnavi_canresize ) $pixels_text .=_MD_GNAV_ITM_AUTORESIZE ;
 
$title_text = new XoopsFormText( _MD_GNAV_ITM_TITLE, "title" , 50 , 255 , $myts->makeTboxData4Edit( $photo['title'] ) ) ;
$caption_text  = new XoopsFormText(_MD_GNAV_ITM_CAPTION1, "caption" , 50 , 255 , $myts->makeTboxData4Edit( $photo['caption'] ) ) ;
$caption1_text = new XoopsFormHidden("caption1" , '' ) ;
$caption2_text = new XoopsFormHidden("caption2" , '' ) ;
 
//----------------------------editor-------------------------------------------
$desc_tarea = $hidden_body_html = new stdClass;
// lazy registering & call pre build delegate
if (defined('XOOPS_CUBE_LEGACY')) {
	$delegate = new XCube_Delegate();
	$delegate->register(ucfirst($mydirname).'.Submit.BuildEditorForm');
	$delegate->call(new XCube_Ref($desc_tarea), new XCube_Ref($hidden_body_html), $photo['description'], $canuse_editor);
}
 
if (! ($desc_tarea instanceof XoopsFormElement) || ! ($hidden_body_html instanceof XoopsFormElement) ) {
	if( $gnavi_body_editor == 'common_fckeditor' && $canuse_editor ) {
 
		// FCKeditor in common/fckeditor/
		$xoops_module_header2 .= '
			<script type="text/javascript" src="'.XOOPS_URL.'/common/fckeditor/fckeditor.js"></script>
			<script type="text/javascript"><!--
				function fckeditor_exec() {
					var oFCKeditor = new FCKeditor( "desc_text" , "100%" , "500" , "Default" );
			
					oFCKeditor.BasePath = "'.XOOPS_URL.'/common/fckeditor/";
			
					oFCKeditor.ReplaceTextarea();
				}
			// --></script>
		' ;
		$wysiwyg_body = '<textarea id="desc_text" name="desc_text">'.htmlspecialchars( $photo['description'] ,ENT_QUOTES).'</textarea><script>fckeditor_exec();</script>' ;
		$desc_tarea =  new XoopsFormLabel( _MD_GNAV_ITM_DESC , $wysiwyg_body ) ;
		$hidden_body_html = new XoopsFormHidden("body_html","1") ;
 
	} else if( $gnavi_body_editor == 'common_spaw' && file_exists( XOOPS_ROOT_PATH.'/common/spaw/spaw_control.class.php' ) && $canuse_editor ) {
 
		// older spaw in common/spaw/
		include XOOPS_ROOT_PATH.'/common/spaw/spaw_control.class.php' ;
		ob_start() ;
		$sw = new SPAW_Wysiwyg( "desc_text" ,  $photo['description']  ) ;
		$sw->show() ;
		$wysiwyg_body = ob_get_contents() ;
		ob_end_clean() ;
		$desc_tarea =  new XoopsFormLabel( _MD_GNAV_ITM_DESC , $wysiwyg_body ) ;
		$hidden_body_html = new XoopsFormHidden("body_html","1") ;
 
	}else if ($gnavi_body_editor == 'pure_html' && $canuse_editor ){
		$desc_tarea = new XoopsFormTextArea(_MD_GNAV_ITM_DESC, "desc_text" , $myts->makeTareaData4Edit( $photo['description'] ) , 20 , 60 ) ;
		$hidden_body_html = new XoopsFormHidden("body_html","1") ;
	} else {
		$desc_tarea = new XoopsFormDhtmlTextArea(_MD_GNAV_ITM_DESC, "desc_text" , $myts->makeTareaData4Edit( $photo['description'] ) , 20 , 60 ) ;
		if (method_exists($desc_tarea, 'setEditor')) {
			// XoopsFormDhtmlTextArea::setEditor
			// https://github.com/xoopscube/legacy/pull/68 (xoopscube)
			// https://github.com/XoopsX/legacy/pull/44 (XoopsX)
			$desc_tarea->setEditor($canuse_editor? 'html' : 'bbcode');
			$hidden_body_html = new XoopsFormHidden("body_html", $canuse_editor? '1' : '0') ;
		} else {
			$hidden_body_html = new XoopsFormHidden("body_html","0") ;
		}
	}
}
 
//---------------------------------------------------------------------------------
$add_info_text = new XoopsFormTextArea(_MD_GNAV_ITM_ADDINFO, "addinfo" , $myts->makeTareaData4Edit( $photo['addinfo'] ) , 6 , 50 ) ;
$add_info_desc = new XoopsFormLabel( "" , _MD_GNAV_ITM_ADDINFODESC ) ;
 
if( gnavi_get_anony_perms() & GNAV_GPERM_INSERTABLE) {
	$poster_name_text = new XoopsFormText(_MD_GNAV_ITM_POSTERNAME, "poster_name" , 30 , 60 , $myts->makeTboxData4Edit( $photo['poster_name'] ) ) ;
}else{
	$poster_name_text = new XoopsFormHidden("poster_name",$myts->makeTboxData4Edit( $photo['poster_name'] )) ;
}
 
 
//fileform
if($photo['ext']){
	$photoview = new XoopsFormLabel(_MD_GNAV_ITM_FILE1, "<img src='".$photo['imgsrc_photo']."' width='150' />" ) ;
	$file_form = new XoopsFormFile(_MD_GNAV_ITM_EDIT_FILE1, "photofile" , $gnavi_fsize ) ;
	$del_box = new XoopsFormCheckBox( "&nbsp;" , "del_photo" , array( 0 ) ) ;
	$del_box->addOption( '1' ,_MD_GNAV_ITM_DEL_FILE1) ;
	$del_hidden = new XoopsFormHidden( "del_photo",$del_photo) ;
}else{
	$file_form = new XoopsFormFile(_MD_GNAV_ITM_FILE1, "photofile" , $gnavi_fsize ) ;
	if(!$gnavi_allownoimage){
		$form->setRequired( $file_form ) ;
	}
}
$file_form->setExtra( "size='70'" ) ;
 
//other
$cat_select = new XoopsFormHidden("cid", '1') ;
$op_hidden = new XoopsFormHidden( "op" , "submit" ) ;
$counter_hidden = new XoopsFormHidden( "fieldCounter" , 1 ) ;
$preview_hidden = new XoopsFormHidden( "preview_name" , htmlspecialchars( $preview_name ) , ENT_QUOTES ) ;
$preview1_hidden = new XoopsFormHidden( "preview_name1" , htmlspecialchars( $preview_name1 ) , ENT_QUOTES ) ;
$preview2_hidden = new XoopsFormHidden( "preview_name2" , htmlspecialchars( $preview_name2 ) , ENT_QUOTES ) ;
$submit_button = new XoopsFormButton( "" , "submit" , _SUBMIT , "submit" ) ;
$submit_tray = new XoopsFormElementTray( '' ) ;
$submit_tray->addElement( $submit_button ) ;
if (@ $gnavi_configs['gnavi_use_gps']) {
	$preview_tray = new XoopsFormElementTray( _MD_GNAV_GPS_PREVIEW ) ;
	$preview_tray->addElement( $gps_preview_button ) ;
	$preview_tray->addElement( new XoopsFormLabel( '' , _MD_GNAV_GPS_PREVIEW_DESC ) ) ;
} else {
	$preview_tray = null;
}
$lid_hidden = new XoopsFormHidden( "lid",$photo['lid']) ;
 
 
//moreinfo
$url_text = new XoopsFormHidden("url" , '' ) ;
$tel_text = new XoopsFormHidden("tel" , '' ) ;
$fax_text = new XoopsFormHidden("fax" , '' ) ;
$zip_text = new XoopsFormHidden("zip" , '' ) ;
$rss_text = new XoopsFormHidden("rss" , '' ) ;
 
if($language=='japanese' || $language=='ja_utf8' ){
	if(file_exists(XOOPS_ROOT_PATH.$gnavi_ajaxzip_place."ajaxzip2.js")){
		$xoops_module_header2 .="
<script src='js/prototype.js' charset='UTF-8'></script>
<script src='".XOOPS_URL.$gnavi_ajaxzip_place."ajaxzip2.js' charset='UTF-8'></script>
<script type='text/javascript'>
//<![CDATA[
	AjaxZip2.JSONDATA = '".XOOPS_URL.$gnavi_ajaxzip_place."data';
//]]>
</script>
";
		$zip_text->setExtra("onKeyUp=\"AjaxZip2.zip2addr(this,'address','address');\"");
	}
}
 
$address_tray = new XoopsFormElementTray(_MD_GNAV_ITM_ADDRESS,'' );
$address_text = new XoopsFormText( "" , "address" , 50 , 255 , $myts->makeTboxData4Edit( $photo['address'] ) ) ;
$address_tray->addElement($address_text);
if($gnavi_usegooglemap){
	$geo_button = new XoopsFormButton( "" , "geo" ,_MD_GNAV_MAP_SEARCH, "button" ) ;
	$geo_button->setExtra("onClick=\"showAddress(document.getElementById('address').value);\"");
	$address_tray->addElement($geo_button);
}
 
//Google Maps
if($gnavi_usegooglemap){
	$xoops_module_header2 .="<script src='".$gnavi_googlemap_url."/maps/api/js?sensor=false' type='text/javascript' charset='utf-8'></script>
	<script src='js/module_map.js' type='text/javascript' charset='utf-8'></script>
	<script src='js/map.js' type='text/javascript' charset='utf-8'></script>
	<script type='text/javascript'>
	//<![CDATA[
	$gnavi_lang_java
	google.maps.event.addDomListener(window, 'load', function(){ InputGMap(); });
	//]]>
	</script>";
 
	if($p_set_latlng){
		$set_latlng_state = '' ;
}else{
$set_latlng_state = ' checked ' ;
}
 
$gmap = new XoopsFormLabel(_MD_GNAV_MAP, "
		<div style='margin-bottom:2px;'><input type='checkbox' name='set_latlng' id='set_latlng' value='1' onclick='ChangeMapArea(this)' $set_latlng_state/>&nbsp;"._MD_GNAV_MAP_UNINPUT."</div>
<div id='maparea'>
<div id='map' style='width:100%;height:400px;'></div>
<div id='gn_latlng'>"._MD_GNAV_MAP_LAT.":&nbsp;<span id='slat'>".$myts->makeTboxData4Edit($photo['lat'])."</span>&nbsp;&nbsp;&nbsp;"._MD_GNAV_MAP_LNG.":&nbsp;<span id='slng'>".$myts->makeTboxData4Edit($photo['lng'])."</span>&nbsp;&nbsp;&nbsp;"._MD_GNAV_MAP_ZOOM.":&nbsp;<span id='sz'>".$myts->makeTboxData4Edit($photo['zoom'])."</span></div>
<input type='hidden' name='lat' id='lat' value='".$myts->makeTboxData4Edit($photo['lat'])."' />
<input type='hidden' name='lng' id='lng' value='".$myts->makeTboxData4Edit($photo['lng'])."' />
<input type='hidden' name='z' id='z' value='".$myts->makeTboxData4Edit($photo['zoom'])."' />
<input type='hidden' name='mt' id='mt' value='".$myts->makeTboxData4Edit($photo['mtype'])."' />
<input type='hidden' name='pchange' id='pchange' value='".($pchange?'1':'0')."' />
</div>" ) ;
if($gnavi_icon_by_lid){
$icon_select = new XoopsFormSelect(_MD_GNAV_MAP_ICON, 'icd', $photo['icd'], 1, false);
$sql = "SELECT icd, title FROM $table_icon ";
$result = $xoopsDB->query($sql);
$icons_array = array();
$icons_array[0] = '---';
while ($myrow = $xoopsDB->fetchArray($result)) {
	$icons_array[$myrow['icd']] = $myrow['title'];
}
$icon_select->addOptionArray($icons_array);
}
}
 
 
$form->addElement( $poster_name_text = new XoopsFormHidden("poster_name",$myts->makeTboxData4Edit( $photo['poster_name'] ))) ;
 
$xoopsTpl->assign('xoops_module_header2',$xoops_module_header2);
//----------form-end--------------------------
 
// Ticket
$GLOBALS['xoopsGTicket']->addTicketXoopsFormElement( $form , __LINE__ ) ;
$form->display() ;
CloseTable() ;
gnavi_footer() ;
 
include( XOOPS_ROOT_PATH . "/footer.php" ) ;
 
 
?>

こうして一応表示はできるようにしたのですが、ページ下部に記事を投稿するとだけテーブルが出てしまいます。

<input type="hidden"~~> 使ってページ上では見えないように、ページ下部に表示されないようにしたいのです。

誠に恐縮ですが、どなたかご教示願えませんでしょうか。

コメント(1)

新しいものから | 古いものから | ネスト表示 | RSS feed
Re: gnaviのトップページにXOOPSGTicketとログインユーザーの名前をHTML上に表示させたい 
投稿者: enagii | 投稿日時: 2014/1/13 9:12
enagii

すみません、自己解決いたしました。

$form = new XoopsThemeForm( ($mode == G_INSERT ? _MD_GNAV_SMT_UPLOAD : _MD_GNAV_SMT_EDIT ) , "uploadphoto", "index.php?page=submit" ) ;

XOOPSThemeFormで2番目の要素でidを決めているのでここを

$form = new XoopsThemeForm( ($mode == G_INSERT ? _MD_GNAV_SMT_UPLOAD : _MD_GNAV_SMT_EDIT ) , "mapform", "index.php?page=submit" ) ;$form->setExtra("enctype='multipart/form-data'");

このように変更し

modules/gnavi/css/gnavi.css

このcssに以下を追加して

1
2
3
#mapform {
display:none;
}

こうすれば表示されなくなりました。

単純なことに気がついていなくて恥ずかしいです。

    投票(0)

    新しいものから | 古いものから | RSS feed
     
    To Top