สร้าง Popup progress bar - เขียน Extension phpbb3.1
โพสต์แล้ว: 07/03/2015 12:13 am
โค้ด: เลือกทั้งหมด
<script type="text/javascript">
// <![CDATA[
/**
* Popup search progress bar
*/
function popup_progress_bar(progress_type)
{
close_waitscreen = 0;
// no scrollbars
popup('{UA_PROGRESS_BAR}&type=' + progress_type, 400, 240, '_index');
}
// ]]>
</script>
โค้ด: เลือกทั้งหมด
<input type="submit" name="submit" value="{L_AUTOGROPS}" onclick="popup_progress_bar('create');" class="button1" />
โค้ด: เลือกทั้งหมด
$action = request_var('action', '');
if ($action)
{
switch ($action)
{
case 'progress_bar':
$type = request_var('type', '');
$this->display_progress_bar($type);
break;
}
}
โค้ด: เลือกทั้งหมด
$template->assign_vars(array(
'U_ACTION' => $this->u_action,
// 'U_PROGRESS_BAR' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar"),
'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar")),
));
โค้ด: เลือกทั้งหมด
function display_progress_bar($type)
{
global $template, $user;
//$l_type = ($type == 'create') ? 'INDEXING_IN_PROGRESS' : 'DELETING_INDEX_IN_PROGRESS';
$l_type = 'INDEXING_IN_PROGRESS';
adm_page_header($user->lang[$l_type]);
$template->set_filenames(array(
'body' => 'progress_bar.html')
);
$template->assign_vars(array(
'L_PROGRESS' => $user->lang[$l_type],
'L_PROGRESS_EXPLAIN' => $user->lang[$l_type . '_EXPLAIN'])
);
adm_page_footer();
}
โค้ด: เลือกทั้งหมด
trigger_error($user->lang['AUTOGROP_PROGRESS'] . adm_back_link($this->u_action) . $this->close_popup_js());
โค้ด: เลือกทั้งหมด
function close_popup_js()
{
return "<script type=\"text/javascript\">\n" .
"// <![CDATA[\n" .
" close_waitscreen = 1;\n" .
"// ]]>\n" .
"</script>\n";
}
ไฟล์ภาษาที่ใช้เเสดงใน popup
โค้ด: เลือกทั้งหมด
'INDEXING_IN_PROGRESS' => 'อยู่ระหว่างการจัดกลุ่มอัตโนมัติ',
'INDEXING_IN_PROGRESS_EXPLAIN' => 'กำลังจัดกลุ่มอัตโนมัติสำหรับกลุ่มที่เลือก กระบวนการนี้อาจกินเวลานาน ขึ้นอยู่กับขนาดเว็บบอร์ด',
'AUTOGROP_PROGRESS' => 'ทำการจัดกลุ่มอัตโนมัติเรียบร้อยเเล้ว',