master merge 충돌 수정
This commit is contained in:
@ -12,11 +12,30 @@ if (!get_session('ss_admin')) {
|
||||
// 스킨디렉토리를 SELECT 형식으로 얻음
|
||||
function get_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
||||
{
|
||||
$skins = get_skin_dir($skin_gubun);
|
||||
global $config;
|
||||
|
||||
$skins = array();
|
||||
|
||||
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
|
||||
$dirs = get_skin_dir($skin_gubun, G5_THEME_PATH.'/'.G5_SKIN_DIR);
|
||||
if(!empty($dirs)) {
|
||||
foreach($dirs as $dir) {
|
||||
$skins[] = 'theme/'.$dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$skins = array_merge($skins, get_skin_dir($skin_gubun));
|
||||
|
||||
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
|
||||
for ($i=0; $i<count($skins); $i++) {
|
||||
if ($i == 0) $str .= "<option value=\"\">선택</option>";
|
||||
$str .= option_selected($skins[$i], $selected);
|
||||
if(preg_match('#^theme/(.+)$#', $skins[$i], $match))
|
||||
$text = '(테마) '.$match[1];
|
||||
else
|
||||
$text = $skins[$i];
|
||||
|
||||
$str .= option_selected($skins[$i], $selected, $text);
|
||||
}
|
||||
$str .= "</select>";
|
||||
return $str;
|
||||
@ -25,11 +44,30 @@ function get_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
||||
// 모바일 스킨디렉토리를 SELECT 형식으로 얻음
|
||||
function get_mobile_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
||||
{
|
||||
$skins = get_skin_dir($skin_gubun, G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
global $config;
|
||||
|
||||
$skins = array();
|
||||
|
||||
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
|
||||
$dirs = get_skin_dir($skin_gubun, G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
if(!empty($dirs)) {
|
||||
foreach($dirs as $dir) {
|
||||
$skins[] = 'theme/'.$dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$skins = array_merge($skins, get_skin_dir($skin_gubun, G5_MOBILE_PATH.'/'.G5_SKIN_DIR));
|
||||
|
||||
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
|
||||
for ($i=0; $i<count($skins); $i++) {
|
||||
if ($i == 0) $str .= "<option value=\"\">선택</option>";
|
||||
$str .= option_selected($skins[$i], $selected);
|
||||
if(preg_match('#^theme/(.+)$#', $skins[$i], $match))
|
||||
$text = '(테마) '.$match[1];
|
||||
else
|
||||
$text = $skins[$i];
|
||||
|
||||
$str .= option_selected($skins[$i], $selected, $text);
|
||||
}
|
||||
$str .= "</select>";
|
||||
return $str;
|
||||
@ -44,6 +82,9 @@ function get_skin_dir($skin, $skin_path=G5_SKIN_PATH)
|
||||
$result_array = array();
|
||||
|
||||
$dirname = $skin_path.'/'.$skin.'/';
|
||||
if(!is_dir($dirname))
|
||||
return;
|
||||
|
||||
$handle = opendir($dirname);
|
||||
while ($file = readdir($handle)) {
|
||||
if($file == '.'||$file == '..') continue;
|
||||
@ -57,6 +98,101 @@ function get_skin_dir($skin, $skin_path=G5_SKIN_PATH)
|
||||
}
|
||||
|
||||
|
||||
// 테마
|
||||
function get_theme_dir()
|
||||
{
|
||||
$result_array = array();
|
||||
|
||||
$dirname = G5_PATH.'/'.G5_THEME_DIR.'/';
|
||||
$handle = opendir($dirname);
|
||||
while ($file = readdir($handle)) {
|
||||
if($file == '.'||$file == '..') continue;
|
||||
|
||||
if (is_dir($dirname.$file)) {
|
||||
$theme_path = $dirname.$file;
|
||||
if(is_file($theme_path.'/index.php') && is_file($theme_path.'/head.php') && is_file($theme_path.'/tail.php'))
|
||||
$result_array[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
natsort($result_array);
|
||||
|
||||
return $result_array;
|
||||
}
|
||||
|
||||
|
||||
// 테마정보
|
||||
function get_theme_info($dir)
|
||||
{
|
||||
$info = array();
|
||||
$path = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir;
|
||||
|
||||
if(is_dir($path)) {
|
||||
$screenshot = $path.'/screenshot.png';
|
||||
if(is_file($screenshot)) {
|
||||
$size = @getimagesize($screenshot);
|
||||
|
||||
if($size[2] == 3)
|
||||
$screenshot_url = str_replace(G5_PATH, G5_URL, $screenshot);
|
||||
}
|
||||
|
||||
$info['screenshot'] = $screenshot_url;
|
||||
|
||||
$text = $path.'/readme.txt';
|
||||
if(is_file($text)) {
|
||||
$content = file($text, false);
|
||||
$content = array_map('trim', $content);
|
||||
|
||||
preg_match('#^Theme Name:(.+)$#i', $content[0], $m0);
|
||||
preg_match('#^Theme URI:(.+)$#i', $content[1], $m1);
|
||||
preg_match('#^Maker:(.+)$#i', $content[2], $m2);
|
||||
preg_match('#^Maker URI:(.+)$#i', $content[3], $m3);
|
||||
preg_match('#^Version:(.+)$#i', $content[4], $m4);
|
||||
preg_match('#^Detail:(.+)$#i', $content[5], $m5);
|
||||
preg_match('#^License:(.+)$#i', $content[6], $m6);
|
||||
preg_match('#^License URI:(.+)$#i', $content[7], $m7);
|
||||
|
||||
$info['theme_name'] = trim($m0[1]);
|
||||
$info['theme_uri'] = trim($m1[1]);
|
||||
$info['maker'] = trim($m2[1]);
|
||||
$info['maker_uri'] = trim($m3[1]);
|
||||
$info['version'] = trim($m4[1]);
|
||||
$info['detail'] = trim($m5[1]);
|
||||
$info['license'] = trim($m6[1]);
|
||||
$info['license_uri'] = trim($m7[1]);
|
||||
}
|
||||
|
||||
if(!$info['theme_name'])
|
||||
$info['theme_name'] = $dir;
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
// 테마설정 정보
|
||||
function get_theme_config_value($dir, $key='*')
|
||||
{
|
||||
$tconfig = array();
|
||||
|
||||
$theme_config_file = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir.'/theme.config.php';
|
||||
if(is_file) {
|
||||
include($theme_config_file);
|
||||
|
||||
if($key == '*') {
|
||||
$tconfig = $theme_config;
|
||||
} else {
|
||||
$keys = array_map('trim', explode(',', $key));
|
||||
foreach($keys as $v) {
|
||||
$tconfig[$v] = trim($theme_config[$v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tconfig;
|
||||
}
|
||||
|
||||
|
||||
// 회원권한을 SELECT 형식으로 얻음
|
||||
function get_member_level_select($name, $start_id=0, $end_id=10, $selected="", $event="")
|
||||
{
|
||||
@ -95,26 +231,48 @@ function get_member_id_select($name, $level, $selected="", $event="")
|
||||
}
|
||||
|
||||
// 권한 검사
|
||||
function auth_check($auth, $attr)
|
||||
function auth_check($auth, $attr, $return=false)
|
||||
{
|
||||
global $is_admin;
|
||||
|
||||
if ($is_admin == 'super') return;
|
||||
|
||||
if (!trim($auth))
|
||||
alert('이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.');
|
||||
if (!trim($auth)) {
|
||||
$msg = '이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.';
|
||||
if($return)
|
||||
return $msg;
|
||||
else
|
||||
alert($msg);
|
||||
}
|
||||
|
||||
$attr = strtolower($attr);
|
||||
|
||||
if (!strstr($auth, $attr)) {
|
||||
if ($attr == 'r')
|
||||
alert('읽을 권한이 없습니다.');
|
||||
else if ($attr == 'w')
|
||||
alert('입력, 추가, 생성, 수정 권한이 없습니다.');
|
||||
else if ($attr == 'd')
|
||||
alert('삭제 권한이 없습니다.');
|
||||
else
|
||||
alert('속성이 잘못 되었습니다.');
|
||||
if ($attr == 'r') {
|
||||
$msg = '읽을 권한이 없습니다.';
|
||||
if($return)
|
||||
return $msg;
|
||||
else
|
||||
alert($msg);
|
||||
} else if ($attr == 'w') {
|
||||
$msg = '입력, 추가, 생성, 수정 권한이 없습니다.';
|
||||
if($return)
|
||||
return $msg;
|
||||
else
|
||||
alert($msg);
|
||||
} else if ($attr == 'd') {
|
||||
$msg = '삭제 권한이 없습니다.';
|
||||
if($return)
|
||||
return $msg;
|
||||
else
|
||||
alert($msg);
|
||||
} else {
|
||||
$msg = '속성이 잘못 되었습니다.';
|
||||
if($return)
|
||||
return $msg;
|
||||
else
|
||||
alert($msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ $menu['menu100'] = array (
|
||||
array('100000', '환경설정', G5_ADMIN_URL.'/config_form.php', 'config'),
|
||||
array('', '기본환경설정', G5_ADMIN_URL.'/config_form.php', 'cf_basic'),
|
||||
array('', '관리권한설정', G5_ADMIN_URL.'/auth_list.php', 'cf_auth'),
|
||||
array('', '테마설정', G5_ADMIN_URL.'/theme.php', 'cf_theme', 1),
|
||||
array('', '메뉴설정', G5_ADMIN_URL.'/menu_list.php', 'cf_menu', 1),
|
||||
array('100300', '메일 테스트', G5_ADMIN_URL.'/sendmail_test.php', 'cf_mailtest'),
|
||||
array('100310', '팝업레이어관리', G5_ADMIN_URL.'/newwinlist.php', 'scf_poplayer'),
|
||||
|
||||
@ -8,5 +8,6 @@ $menu['menu300'] = array (
|
||||
array('300500', '1:1문의설정', ''.G5_ADMIN_URL.'/qa_config.php', 'qa'),
|
||||
array('300600', '내용관리', G5_ADMIN_URL.'/contentlist.php', 'scf_contents', 1),
|
||||
array('300700', 'FAQ관리', G5_ADMIN_URL.'/faqmasterlist.php', 'scf_faq', 1),
|
||||
array('300820', '글,댓글 현황', G5_ADMIN_URL.'/write_count.php', 'scf_write_count'),
|
||||
);
|
||||
?>
|
||||
@ -153,10 +153,9 @@ $pg_anchor = '<ul class="anchor">
|
||||
$frm_submit = '<div class="btn_confirm01 btn_confirm">
|
||||
<input type="submit" value="확인" class="btn_submit" accesskey="s">
|
||||
<a href="./board_list.php?'.$qstr.'">목록</a>'.PHP_EOL;
|
||||
if ($w == 'u') $frm_submit .= ' <a href="./board_copy.php?bo_table='.$bo_table.'" id="board_copy" target="win_board_copy">게시판복사</a>
|
||||
if ($w == 'u') $frm_submit .= '<a href="./board_copy.php?bo_table='.$bo_table.'" id="board_copy" target="win_board_copy">게시판복사</a>
|
||||
<a href="'.G5_BBS_URL.'/board.php?bo_table='.$board['bo_table'].'" class="btn_frmline">게시판 바로가기</a>
|
||||
<a href="./board_thumbnail_delete.php?bo_table='.$board['bo_table'].'&'.$qstr.'" onclick="return delete_confirm2(\'게시판 썸네일 파일을 삭제하시겠습니까?\');">게시판 썸네일 삭제</a>
|
||||
'.PHP_EOL;
|
||||
<a href="./board_thumbnail_delete.php?bo_table='.$board['bo_table'].'&'.$qstr.'" onclick="return delete_confirm2(\'게시판 썸네일 파일을 삭제하시겠습니까?\');">게시판 썸네일 삭제</a>'.PHP_EOL;
|
||||
$frm_submit .= '</div>';
|
||||
?>
|
||||
|
||||
@ -1118,7 +1117,7 @@ $frm_submit .= '</div>';
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php echo $frm_submit; ?>
|
||||
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_galc">테마 이미지설정 가져오기</button></div>', $frm_submit); ?>
|
||||
|
||||
<section id="anc_bo_point">
|
||||
<h2 class="h2_frm">게시판 포인트 설정</h2>
|
||||
@ -1240,6 +1239,37 @@ $(function(){
|
||||
window.open(this.href, "win_board_copy", "left=10,top=10,width=500,height=400");
|
||||
return false;
|
||||
});
|
||||
|
||||
$(".get_theme_galc").on("click", function() {
|
||||
if(!confirm("현재 테마의 게시판 이미지 설정을 적용하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./theme_config_load.php",
|
||||
cache: false,
|
||||
async: false,
|
||||
data: { type: "board" },
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.error) {
|
||||
alert(data.error);
|
||||
return false;
|
||||
}
|
||||
|
||||
var field = Array('bo_gallery_cols', 'bo_gallery_width', 'bo_gallery_height', 'bo_mobile_gallery_width', 'bo_mobile_gallery_height', 'bo_image_width');
|
||||
var count = field.length;
|
||||
var key;
|
||||
|
||||
for(i=0; i<count; i++) {
|
||||
key = field[i];
|
||||
|
||||
if(data[key] != undefined && data[key] != "")
|
||||
$("input[name="+key+"]").val(data[key]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function board_copy(bo_table) {
|
||||
|
||||
@ -9,12 +9,9 @@ $token = get_token();
|
||||
if ($is_admin != 'super')
|
||||
alert('최고관리자만 접근 가능합니다.');
|
||||
|
||||
if (!isset($config['cf_include_index'])) {
|
||||
if (!isset($config['cf_add_script'])) {
|
||||
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
||||
ADD `cf_include_index` VARCHAR(255) NOT NULL AFTER `cf_admin`,
|
||||
ADD `cf_include_head` VARCHAR(255) NOT NULL AFTER `cf_include_index`,
|
||||
ADD `cf_include_tail` VARCHAR(255) NOT NULL AFTER `cf_include_head`,
|
||||
ADD `cf_add_script` TEXT NOT NULL AFTER `cf_include_tail` ", true);
|
||||
ADD `cf_add_script` TEXT NOT NULL AFTER `cf_admin_email_name` ", true);
|
||||
}
|
||||
|
||||
if (!isset($config['cf_mobile_new_skin'])) {
|
||||
@ -212,7 +209,7 @@ $frm_submit = '<div class="btn_confirm01 btn_confirm">
|
||||
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
|
||||
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
||||
|
||||
if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
|
||||
}
|
||||
?>
|
||||
@ -341,105 +338,41 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_new_skin">최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_new_skin" id="cf_new_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('new');
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_new_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_skin_select('new', 'cf_new_skin', 'cf_new_skin', $config['cf_new_skin'], 'required'); ?>
|
||||
</td>
|
||||
<th scope="row"><label for="cf_mobile_new_skin">모바일<br>최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_mobile_new_skin" id="cf_mobile_new_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('new', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_new_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_mobile_skin_select('new', 'cf_mobile_new_skin', 'cf_mobile_new_skin', $config['cf_mobile_new_skin'], 'required'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_search_skin">검색 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_search_skin" id="cf_search_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('search');
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_search_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_skin_select('search', 'cf_search_skin', 'cf_search_skin', $config['cf_search_skin'], 'required'); ?>
|
||||
</td>
|
||||
<th scope="row"><label for="cf_mobile_search_skin">모바일 검색 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_mobile_search_skin" id="cf_mobile_search_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('search', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_search_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_mobile_skin_select('search', 'cf_mobile_search_skin', 'cf_mobile_search_skin', $config['cf_mobile_search_skin'], 'required'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_connect_skin">접속자 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_connect_skin" id="cf_connect_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('connect');
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_connect_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_skin_select('connect', 'cf_connect_skin', 'cf_connect_skin', $config['cf_connect_skin'], 'required'); ?>
|
||||
</td>
|
||||
<th scope="row"><label for="cf_mobile_connect_skin">모바일 접속자 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_mobile_connect_skin" id="cf_mobile_connect_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('connect', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_connect_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_mobile_skin_select('connect', 'cf_mobile_connect_skin', 'cf_mobile_connect_skin', $config['cf_mobile_connect_skin'], 'required'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_faq_skin">FAQ 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_faq_skin" id="cf_faq_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('faq');
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_faq_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_skin_select('faq', 'cf_faq_skin', 'cf_faq_skin', $config['cf_faq_skin'], 'required'); ?>
|
||||
</td>
|
||||
<th scope="row"><label for="cf_mobile_faq_skin">모바일 FAQ 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_mobile_faq_skin" id="cf_mobile_faq_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('faq', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_faq_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_mobile_skin_select('faq', 'cf_mobile_faq_skin', 'cf_mobile_faq_skin', $config['cf_mobile_faq_skin'], 'required'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -532,7 +465,7 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php echo $frm_submit; ?>
|
||||
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_confc" data-type="conf_skin">테마 스킨설정 가져오기</button></div>', $frm_submit); ?>
|
||||
|
||||
<section id="anc_cf_board">
|
||||
<h2 class="h2_frm">게시판 기본 설정</h2>
|
||||
@ -636,27 +569,11 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_member_skin">회원 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_member_skin" id="cf_member_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('member');
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo '<option value="'.$arr[$i].'"'.get_selected($config['cf_member_skin'], $arr[$i]).'>'.$arr[$i].'</option>'."\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_skin_select('member', 'cf_member_skin', 'cf_member_skin', $config['cf_member_skin'], 'required'); ?>
|
||||
</td>
|
||||
<th scope="row"><label for="cf_mobile_member_skin">모바일<br>회원 스킨<strong class="sound_only">필수</strong></label></th>
|
||||
<td>
|
||||
<select name="cf_mobile_member_skin" id="cf_mobile_member_skin" required class="required">
|
||||
<?php
|
||||
$arr = get_skin_dir('member', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||
for ($i=0; $i<count($arr); $i++) {
|
||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
||||
echo '<option value="'.$arr[$i].'"'.get_selected($config['cf_mobile_member_skin'], $arr[$i]).'>'.$arr[$i].'</option>'."\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php echo get_mobile_skin_select('member', 'cf_mobile_member_skin', 'cf_mobile_member_skin', $config['cf_mobile_member_skin'], 'required'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -761,7 +678,7 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php echo $frm_submit; ?>
|
||||
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_confc" data-type="conf_member">테마 회원스킨설정 가져오기</button></div>', $frm_submit); ?>
|
||||
|
||||
<section id="anc_cf_cert">
|
||||
<h2 class="h2_frm">본인확인 설정</h2>
|
||||
@ -1082,27 +999,6 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_include_index">초기화면 파일 경로</label></th>
|
||||
<td>
|
||||
<?php echo help('입력이 없으면 index.php가 초기화면 파일로 설정됩니다.<br>초기화면 파일은 index.php 파일과 동일한 위치에 존재해야 합니다.') ?>
|
||||
<input type="text" name="cf_include_index" value="<?php echo $config['cf_include_index'] ?>" id="cf_include_index" class="frm_input" size="50">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_include_head">상단 파일 경로</label></th>
|
||||
<td>
|
||||
<?php echo help('입력이 없으면 head.php가 상단 파일로 설정됩니다.<br>상단 파일은 head.php 파일과 동일한 위치에 존재해야 합니다.') ?>
|
||||
<input type="text" name="cf_include_head" value="<?php echo $config['cf_include_head'] ?>" id="cf_include_head" class="frm_input" size="50">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_include_tail">하단 파일 경로</label></th>
|
||||
<td>
|
||||
<?php echo help('입력이 없으면 tail.php가 하단 파일로 설정됩니다.<br>초기화면 파일은 tail.php 파일과 동일한 위치에 존재해야 합니다.') ?>
|
||||
<input type="text" name="cf_include_tail" value="<?php echo $config['cf_include_tail'] ?>" id="cf_include_tail" class="frm_input" size="50">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="cf_add_script">추가 script, css</label></th>
|
||||
<td>
|
||||
@ -1250,6 +1146,42 @@ $(function(){
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
$(".get_theme_confc").on("click", function() {
|
||||
var type = $(this).data("type");
|
||||
var msg = "기본환경 스킨 설정";
|
||||
if(type == "conf_member")
|
||||
msg = "기본환경 회원스킨 설정";
|
||||
|
||||
if(!confirm("현재 테마의 "+msg+"을 적용하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./theme_config_load.php",
|
||||
cache: false,
|
||||
async: false,
|
||||
data: { type: type },
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.error) {
|
||||
alert(data.error);
|
||||
return false;
|
||||
}
|
||||
|
||||
var field = Array('cf_member_skin', 'cf_mobile_member_skin', 'cf_new_skin', 'cf_mobile_new_skin', 'cf_search_skin', 'cf_mobile_search_skin', 'cf_connect_skin', 'cf_mobile_connect_skin', 'cf_faq_skin', 'cf_mobile_faq_skin');
|
||||
var count = field.length;
|
||||
var key;
|
||||
|
||||
for(i=0; i<count; i++) {
|
||||
key = field[i];
|
||||
|
||||
if(data[key] != undefined && data[key] != "")
|
||||
$("select[name="+key+"]").val(data[key]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function fconfigform_submit(f)
|
||||
|
||||
@ -29,9 +29,6 @@ $sql = " update {$g5['config_table']}
|
||||
cf_admin = '{$_POST['cf_admin']}',
|
||||
cf_admin_email = '{$_POST['cf_admin_email']}',
|
||||
cf_admin_email_name = '{$_POST['cf_admin_email_name']}',
|
||||
cf_include_index = '{$_POST['cf_include_index']}',
|
||||
cf_include_head = '{$_POST['cf_include_head']}',
|
||||
cf_include_tail = '{$_POST['cf_include_tail']}',
|
||||
cf_add_script = '{$_POST['cf_add_script']}',
|
||||
cf_use_point = '{$_POST['cf_use_point']}',
|
||||
cf_point_term = '{$_POST['cf_point_term']}',
|
||||
|
||||
@ -714,3 +714,48 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
|
||||
.sevice_2 .svc_sms .svc_btn a{display:inline-block; background:#f8f8f8;width:100%;text-align:center;margin:0;padding:10px 0 0 }
|
||||
.sevice_2 .svc_design{overflow:hidden;height:210px;position:relative}
|
||||
.sevice_2 .svc_design .svc_btn a{margin:0 0 20px}
|
||||
|
||||
/*테마*/
|
||||
.theme_p{padding:0 20px}
|
||||
#theme_list{padding:0;margin:0 10px;list-style:none; width: 1000px;position:relative}
|
||||
#theme_list:after{display:block;visibility:hidden;clear:both;content:""}
|
||||
#theme_list li{padding:10px;margin:0;float:left;width:302px}
|
||||
#theme_list li:after{display:block;visibility:hidden;clear:both;content:""}
|
||||
#theme_list li .tmli_if{border: 1px solid #d1dee2;width:300px;}
|
||||
#theme_list li .tmli_if>img{width:300px;height:225px;}
|
||||
#theme_list li .tmli_if:hover>img{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter: alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}
|
||||
#theme_list li .tmli_tit{position:relative; border-top: 1px solid #d1dee2; background: #e5ecef;}
|
||||
#theme_list li .tmli_tit p{height:40px;line-height:40px;padding:0 10px 0;font-weight:bold;text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
|
||||
#theme_list li .tmli_tit button.tmli_dt{position:absolute;top:8px;right:10px;padding:5px;background:#111;color:#fff;display:none;border:none}
|
||||
#theme_list li .tmli_if:hover button.tmli_dt{display:block}
|
||||
#theme_list li .theme_sl{float:left;border:none;margin-top:5px;padding:0 5px;height:26px;background:#999;color:#fff}
|
||||
#theme_list li .theme_sl:hover{background:#ff3061}
|
||||
#theme_list li .theme_deactive{margin-left:4px}
|
||||
#theme_list li .theme_sl_use{background:#ff3061;line-height:26px}
|
||||
#theme_list li .theme_pr{float:right;margin-top:5px;padding:0 5px;height:24px;line-height:24px; border: 1px solid #ccc; background: #fafafa; }
|
||||
#theme_list li .theme_preview{ float: right; margin-top: 5px; padding:0 5px;height:26px; border: 1px solid #ccc; background: #fafafa; margin-right:3px}
|
||||
|
||||
#theme_detail{position:fixed;_position:absolute;top:50%;left:20px;_top:300px;width:950px;height:490px;margin-top:-245px;background:#fff;border:1px solid #000;z-index:99999;}
|
||||
#theme_detail .thdt_img{padding:20px 0 20px 20px;float:left;}
|
||||
#theme_detail .thdt_img img{width:600px;height:450px;}
|
||||
#theme_detail .thdt_if{float:right;width:290px;padding:40px 20px 0 0;position:relative}
|
||||
#theme_detail .thdt_if h2{padding:0 ;margin:0}
|
||||
#theme_detail .thdt_if p{font-weight:normal;padding:10px;background:#f5f5f5;height:250px;overflow-y:auto;}
|
||||
#theme_detail .thdt_if a{vertical-align:middle;}
|
||||
#theme_detail .thdt_if .thdt_home{background:url(../img/link_icon.gif) no-repeat bottom right;padding-right:13px;}
|
||||
#theme_detail .close_btn{position:absolute;top:10px;right:10px;background:url(../img/close.gif) no-repeat 50% 50%;border:none;width:30px;height:30px;overflow:hidden;text-indent:-9999px;}
|
||||
#theme_detail table{border-collapse:collapse;margin:5px 0 10px}
|
||||
#theme_detail table th{padding: 5px 0; border: 1px solid #d1dee2; background: #e5ecef;width:50px;padding:10px;text-align:left}
|
||||
#theme_detail table td{ border: 1px solid #ececec;padding:10px}
|
||||
.no_theme{text-align:center;padding:100px 0;color:#555}
|
||||
|
||||
/*글,댓글현황*/
|
||||
#wr_cont{position:relative;margin:10px 20px}
|
||||
#wr_cont input[type="submit"]{background:#ff3061;border:none;color:#fff;padding: 0 5px;height: 24px;}
|
||||
#wr_cont select{height: 24px;}
|
||||
#grp_color{border:2px solid #ddd;position:absolute;top:0;right:0;list-style:none;padding: 5px 5px; margin:0;}
|
||||
#grp_color li{padding:5px 10px;}
|
||||
#grp_color li span{width:10px;height:10px; display:inline-block;background:rgb(75, 178, 197);margin-right:5px;}
|
||||
#grp_color li.color2 span{background:rgb(234, 162, 40);}
|
||||
#chart_wr h5{text-align:center;border:1px solid #eee;padding:30px 0}
|
||||
#chart_wr{margin:20px }
|
||||
8
adm/css/theme.css
Normal file
8
adm/css/theme.css
Normal file
@ -0,0 +1,8 @@
|
||||
@charset "utf-8";
|
||||
#preview_item{height:50px}
|
||||
#preview_item ul{margin:0;padding:0;top:0;width:100%;border-bottom:1px solid #eee; margin:0 auto;text-align:center;background:#333;position:fixed;top:0;z-index:999999;width:100%;}
|
||||
#preview_item ul li{list-style:none;display:inline-block;height:50px;line-height:50px;padding:0 3px;*display:inline; zoom:1;}
|
||||
#preview_item ul li a{color:#555;padding:0 8px;height:24px;line-height:24px;background:#f2f2f2;border-radius:3px;display:inline-block;vertical-align:middle;border:1px solid #dcdcdc;}
|
||||
#preview_item ul li a:hover{background:#ccc;text-decoration:none;border:1px solid #ccc;}
|
||||
#preview_item ul li button{color:#fff;padding:0 8px;background:#FF5191;border-radius:3px;height:26px;line-height:24px;vertical-align:middle;border:none}
|
||||
#preview_item ul li button:hover{background:#e40d5c;color:#fff;text-decoration:none;}
|
||||
@ -8,7 +8,7 @@ auth_check($auth[$sub_menu], "w");
|
||||
$sql = " select * from {$g5['faq_master_table']} where fm_id = '$fm_id' ";
|
||||
$fm = sql_fetch($sql);
|
||||
|
||||
$html_title = 'FAQ '.$fm['fm_subject'];;
|
||||
$html_title = 'FAQ '.$fm['fm_subject'];
|
||||
|
||||
if ($w == "u")
|
||||
{
|
||||
|
||||
BIN
adm/img/close.gif
Normal file
BIN
adm/img/close.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
BIN
adm/img/link_icon.gif
Normal file
BIN
adm/img/link_icon.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 B |
BIN
adm/img/theme_img.jpg
Normal file
BIN
adm/img/theme_img.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@ -52,14 +52,14 @@ $(function() {
|
||||
);
|
||||
});
|
||||
|
||||
$("#add_manual").live("click", function() {
|
||||
$(document).on("click", "#add_manual", function() {
|
||||
var me_name = $.trim($("#me_name").val());
|
||||
var me_link = $.trim($("#me_link").val());
|
||||
|
||||
add_menu_list(me_name, me_link, "<?php echo $code; ?>");
|
||||
});
|
||||
|
||||
$(".add_select").live("click", function() {
|
||||
$(document).on("click", ".add_select", function() {
|
||||
var me_name = $.trim($(this).siblings("input[name='subject[]']").val());
|
||||
var me_link = $.trim($(this).siblings("input[name='link[]']").val());
|
||||
|
||||
|
||||
@ -136,12 +136,12 @@ $colspan = 7;
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$(".btn_add_submenu").live("click", function() {
|
||||
$(document).on("click", ".btn_add_submenu", function() {
|
||||
var code = $(this).closest("tr").find("input[name='code[]']").val().substr(0, 2);
|
||||
add_submenu(code);
|
||||
});
|
||||
|
||||
$(".btn_del_menu").live("click", function() {
|
||||
$(document).on("click", ".btn_del_menu", function() {
|
||||
if(!confirm("메뉴를 삭제하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ $g5['title'] = "SMS 기본설정";
|
||||
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
|
||||
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
||||
|
||||
if ($config['cf_icode_id'] && $config['cf_icode_pw'])
|
||||
if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw'])
|
||||
{
|
||||
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ if ($result)
|
||||
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
|
||||
|
||||
$log = array_shift($SMS->Log);
|
||||
$log = @iconv('UTF-8', 'UTF-8//IGNORE', $log);
|
||||
$log = @iconv('euc-kr', 'utf-8', $log);
|
||||
|
||||
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum='$new_wr_renum', bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='{$row['hs_name']}', hs_hp='{$row['hs_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='".addslashes($hs_memo)."', hs_log='".addslashes($log)."'", false);
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ if ($result)
|
||||
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
|
||||
|
||||
$log = array_shift($SMS->Log);
|
||||
$log = @iconv('UTF-8', 'UTF-8//IGNORE', $log);
|
||||
$log = @iconv('euc-kr', 'utf-8', $log);
|
||||
|
||||
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum=0, bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='".addslashes($row['bk_name'])."', hs_hp='{$row['bk_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='".addslashes($hs_memo)."', hs_log='".addslashes($log)."'", false);
|
||||
}
|
||||
|
||||
80
adm/theme.js
Normal file
80
adm/theme.js
Normal file
@ -0,0 +1,80 @@
|
||||
$(function() {
|
||||
$(".theme_active").on("click", function() {
|
||||
var theme = $(this).data("theme");
|
||||
var name = $(this).data("name");
|
||||
|
||||
if(!confirm(name+" 테마를 적용하시겠습니까?"))
|
||||
return false;
|
||||
|
||||
var set_default_skin = 0;
|
||||
if($(this).data("set_default_skin") == true) {
|
||||
if(confirm("기본환경설정, 1:1문의 스킨을 테마에서 설정된 스킨으로 변경하시겠습니까?\n\n변경을 선택하시면 테마에서 지정된 스킨으로 회원스킨 등이 변경됩니다."))
|
||||
set_default_skin = 1;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./theme_update.php",
|
||||
data: {
|
||||
"theme": theme,
|
||||
"set_default_skin": set_default_skin
|
||||
},
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if(data) {
|
||||
alert(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".theme_deactive").on("click", function() {
|
||||
var theme = $(this).data("theme");
|
||||
var name = $(this).data("name");
|
||||
|
||||
if(!confirm(name+" 테마 사용설정을 해제하시겠습니까?\n\n테마 설정을 해제하셔도 게시판 등의 스킨은 변경되지 않으므로 개별 변경작업이 필요합니다."))
|
||||
return false;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./theme_update.php",
|
||||
data: {
|
||||
"theme": theme,
|
||||
"type": "reset"
|
||||
},
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if(data) {
|
||||
alert(data);
|
||||
return false;
|
||||
}
|
||||
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".theme_preview").on("click", function() {
|
||||
var theme = $(this).data("theme");
|
||||
|
||||
$("#theme_detail").remove();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "./theme_detail.php",
|
||||
data: {
|
||||
"theme": theme
|
||||
},
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
$("#theme_list").after(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
77
adm/theme.php
Normal file
77
adm/theme.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
$sub_menu = "100280";
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_admin != 'super')
|
||||
alert('최고관리자만 접근 가능합니다.');
|
||||
|
||||
// 테마 필드 추가
|
||||
if(!isset($config['cf_theme'])) {
|
||||
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
||||
ADD `cf_theme` varchar(255) NOT NULL DEFAULT '' AFTER `cf_title` ", true);
|
||||
}
|
||||
|
||||
$theme = get_theme_dir();
|
||||
if($config['cf_theme'] && in_array($config['cf_theme'], $theme))
|
||||
array_unshift($theme, $config['cf_theme']);
|
||||
$theme = array_values(array_unique($theme));
|
||||
$total_count = count($theme);
|
||||
|
||||
// 설정된 테마가 존재하지 않는다면 cf_theme 초기화
|
||||
if($config['cf_theme'] && !in_array($config['cf_theme'], $theme))
|
||||
sql_query(" update {$g5['config_table']} set cf_theme = '' ");
|
||||
|
||||
$g5['title'] = "테마설정";
|
||||
include_once('./admin.head.php');
|
||||
?>
|
||||
|
||||
<script src="<?php echo G5_ADMIN_URL; ?>/theme.js"></script>
|
||||
|
||||
<p class="theme_p">설치된 테마 : <?php echo number_format($total_count); ?></p>
|
||||
|
||||
<?php if($total_count > 0) { ?>
|
||||
<ul id="theme_list">
|
||||
<?php
|
||||
for($i=0; $i<$total_count; $i++) {
|
||||
$info = get_theme_info($theme[$i]);
|
||||
|
||||
$name = get_text($info['theme_name']);
|
||||
if($info['screenshot'])
|
||||
$screenshot = '<img src="'.$info['screenshot'].'" alt="'.$name.'">';
|
||||
else
|
||||
$screenshot = '<img src="'.G5_ADMIN_URL.'/img/theme_img.jpg" alt="">';
|
||||
|
||||
if($config['cf_theme'] == $theme[$i]) {
|
||||
$btn_active = '<span class="theme_sl theme_sl_use">사용중</span><button type="button" class="theme_sl theme_deactive" data-theme="'.$theme[$i].'" '.'data-name="'.$name.'">사용안함</button>';
|
||||
} else {
|
||||
$tconfig = get_theme_config_value($theme[$i], 'set_default_skin');
|
||||
if($tconfig['set_default_skin'])
|
||||
$set_default_skin = 'true';
|
||||
else
|
||||
$set_default_skin = 'false';
|
||||
|
||||
$btn_active = '<button type="button" class="theme_sl theme_active" data-theme="'.$theme[$i].'" '.'data-name="'.$name.'" data-set_default_skin="'.$set_default_skin.'">테마적용</button>';
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<div class="tmli_if">
|
||||
<?php echo $screenshot; ?>
|
||||
<div class="tmli_tit">
|
||||
<p><?php echo get_text($info['theme_name']); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $btn_active; ?>
|
||||
<a href="./theme_preview.php?theme=<?php echo $theme[$i]; ?>" class="theme_pr" target="theme_preview">미리보기</a>
|
||||
<button type="button" class="tmli_dt theme_preview" data-theme="<?php echo $theme[$i]; ?>">상세보기</button>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php } else { ?>
|
||||
<p class="no_theme">설치된 테마가 없습니다.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
include_once ('./admin.tail.php');
|
||||
?>
|
||||
78
adm/theme_config_load.php
Normal file
78
adm/theme_config_load.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
$sub_menu = "100280";
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/json.lib.php');
|
||||
|
||||
$data = array();
|
||||
$data['error'] = '';
|
||||
|
||||
$data['error'] = auth_check($auth[$sub_menu], 'w', true);
|
||||
if($data['error'])
|
||||
die(json_encode($data));
|
||||
|
||||
if(!$config['cf_theme']) {
|
||||
$data['error'] = '사용 중인 테마가 없습니다.';
|
||||
die(json_encode($data));
|
||||
}
|
||||
|
||||
$theme_dir = get_theme_dir();
|
||||
if(!in_array($config['cf_theme'], $theme_dir)) {
|
||||
$data['error'] = $config['cf_theme'].' 테마는 설치된 테마가 아닙니다.';
|
||||
die(json_encode($data));
|
||||
}
|
||||
|
||||
$type = $_POST['type'];
|
||||
$arr_type = array('board', 'conf_skin', 'conf_member');
|
||||
if(!in_array($type, $arr_type)) {
|
||||
$data['error'] = '올바른 방법으로 이용해 주십시오.';
|
||||
die(json_encode($data));
|
||||
}
|
||||
|
||||
if($type == 'board') {
|
||||
$keys = array('bo_gallery_cols', 'bo_gallery_width', 'bo_gallery_height', 'bo_mobile_gallery_width', 'bo_mobile_gallery_height', 'bo_image_width');
|
||||
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
|
||||
|
||||
$i = 0;
|
||||
foreach($keys as $val) {
|
||||
if($tconfig[$val]) {
|
||||
$data[$val] = (int)preg_replace('#[^0-9]#', '', $tconfig[$val]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if($i == 0)
|
||||
$data['error'] = '적용할 게시판 이미지 설정이 없습니다.';
|
||||
} else if($type == 'conf_skin') {
|
||||
$keys = array('cf_new_skin', 'cf_mobile_new_skin', 'cf_search_skin', 'cf_mobile_search_skin', 'cf_connect_skin', 'cf_mobile_connect_skin', 'cf_faq_skin', 'cf_mobile_faq_skin');
|
||||
|
||||
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
|
||||
|
||||
$i = 0;
|
||||
foreach($keys as $val) {
|
||||
if($tconfig[$val]) {
|
||||
$data[$val] = preg_match('#^theme/.+$#', $tconfig[$val]) ? $tconfig[$val] : 'theme/'.$tconfig[$val];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if($i == 0)
|
||||
$data['error'] = '적용할 기본환경 스킨 설정이 없습니다.';
|
||||
} else if($type == 'conf_member') {
|
||||
$keys = array('cf_member_skin', 'cf_mobile_member_skin');
|
||||
|
||||
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
|
||||
|
||||
$i = 0;
|
||||
foreach($keys as $val) {
|
||||
if($tconfig[$val]) {
|
||||
$data[$val] = preg_match('#^theme/.+$#', $tconfig[$val]) ? $tconfig[$val] : 'theme/'.$tconfig[$val];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if($i == 0)
|
||||
$data['error'] = '적용할 기본환경 회원스킨 설정이 없습니다.';
|
||||
}
|
||||
|
||||
die(json_encode($data));
|
||||
?>
|
||||
64
adm/theme_detail.php
Normal file
64
adm/theme_detail.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
$sub_menu = "100280";
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_admin != 'super')
|
||||
die('최고관리자만 접근 가능합니다.');
|
||||
|
||||
$theme = trim($_POST['theme']);
|
||||
$theme_dir = get_theme_dir();
|
||||
|
||||
if(!in_array($theme, $theme_dir))
|
||||
die('선택하신 테마가 설치되어 있지 않습니다.');
|
||||
|
||||
$info = get_theme_info($theme);
|
||||
|
||||
if($info['screenshot'])
|
||||
$screenshot = '<img src="'.$info['screenshot'].'" alt="'.$name.'">';
|
||||
else
|
||||
$screenshot = '<img src="'.G5_ADMIN_URL.'/img/theme_img.jpg" alt="">';
|
||||
|
||||
$name = get_text($info['theme_name']);
|
||||
if($info['theme_uri']) {
|
||||
$name = '<a href="'.set_http($info['theme_uri']).'" target="_blank" class="thdt_home">'.$name.'</a>';
|
||||
}
|
||||
|
||||
$maker = get_text($info['maker']);
|
||||
if($info['maker_uri']) {
|
||||
$maker = '<a href="'.set_http($info['maker_uri']).'" target="_blank" class="thdt_home">'.$maker.'</a>';
|
||||
}
|
||||
|
||||
$license = get_text($info['license']);
|
||||
if($info['license_uri']) {
|
||||
$license = '<a href="'.set_http($info['license_uri']).'" target="_blank" class="thdt_home">'.$license.'</a>';
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="theme_detail">
|
||||
<div class="thdt_img"><?php echo $screenshot; ?></div>
|
||||
<div class="thdt_if">
|
||||
<h2><?php echo $name; ?></h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th scope="row">Version</th>
|
||||
<td><?php echo get_text($info['version']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Maker</th>
|
||||
<td><?php echo $maker; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">License</th>
|
||||
<td><?php echo $license; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><?php echo get_text($info['detail']); ?></p>
|
||||
<button type="button" class="close_btn">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(".close_btn").on("click", function() {
|
||||
$("#theme_detail").remove();
|
||||
});
|
||||
</script>
|
||||
118
adm/theme_preview.php
Normal file
118
adm/theme_preview.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
$sub_menu = "100280";
|
||||
define('_THEME_PREVIEW_', true);
|
||||
include_once('./_common.php');
|
||||
|
||||
$theme_dir = get_theme_dir();
|
||||
|
||||
if(!$theme || !in_array($theme, $theme_dir))
|
||||
alert_close('테마가 존재하지 않거나 올바르지 않습니다.');
|
||||
|
||||
$info = get_theme_info($theme);
|
||||
|
||||
$arr_mode = array('index', 'list', 'view');
|
||||
$mode = substr(strip_tags($_GET['mode']), 0, 20);
|
||||
if(!in_array($mode, $arr_mode))
|
||||
$mode = 'index';
|
||||
|
||||
$qstr_index = '&mode=index';
|
||||
$qstr_list = '&mode=list';
|
||||
$qstr_view = '&mode=view';
|
||||
$qstr_device = '&mode='.$mode.'&device='.(G5_IS_MOBILE ? 'pc' : 'mobile');
|
||||
|
||||
$sql = " select bo_table, wr_parent from {$g5['board_new_table']} order by bn_id desc limit 1 ";
|
||||
$row = sql_fetch($sql);
|
||||
$bo_table = $row['bo_table'];
|
||||
$board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '$bo_table' ");
|
||||
$write_table = $g5['write_prefix'] . $bo_table;
|
||||
|
||||
// theme.config.php 미리보기 게시판 스킨이 설정돼 있다면
|
||||
$tconfig = get_theme_config_value($theme, 'set_default_skin, preview_board_skin, preview_mobile_board_skin');
|
||||
if($mode == 'list' || $mode == 'view') {
|
||||
if($tconfig['preview_board_skin'])
|
||||
$board['bo_skin'] = preg_match('#^theme/.+$#', $tconfig['preview_board_skin']) ? $tconfig['preview_board_skin'] : 'theme/'.$tconfig['preview_board_skin'];
|
||||
|
||||
if($tconfig['preview_mobile_board_skin'])
|
||||
$board['bo_mobile_skin'] = preg_match('#^theme/.+$#', $tconfig['preview_mobile_board_skin']) ? $tconfig['preview_mobile_board_skin'] : 'theme/'.$tconfig['preview_mobile_board_skin'];
|
||||
}
|
||||
|
||||
// 스킨경로
|
||||
if (G5_IS_MOBILE) {
|
||||
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
|
||||
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
|
||||
$member_skin_path = get_skin_path('member', $config['cf_mobile_member_skin']);
|
||||
$member_skin_url = get_skin_url('member', $config['cf_mobile_member_skin']);
|
||||
$new_skin_path = get_skin_path('new', $config['cf_mobile_new_skin']);
|
||||
$new_skin_url = get_skin_url('new', $config['cf_mobile_new_skin']);
|
||||
$search_skin_path = get_skin_path('search', $config['cf_mobile_search_skin']);
|
||||
$search_skin_url = get_skin_url('search', $config['cf_mobile_search_skin']);
|
||||
$connect_skin_path = get_skin_path('connect', $config['cf_mobile_connect_skin']);
|
||||
$connect_skin_url = get_skin_url('connect', $config['cf_mobile_connect_skin']);
|
||||
$faq_skin_path = get_skin_path('faq', $config['cf_mobile_faq_skin']);
|
||||
$faq_skin_url = get_skin_url('faq', $config['cf_mobile_faq_skin']);
|
||||
} else {
|
||||
$board_skin_path = get_skin_path('board', $board['bo_skin']);
|
||||
$board_skin_url = get_skin_url('board', $board['bo_skin']);
|
||||
$member_skin_path = get_skin_path('member', $config['cf_member_skin']);
|
||||
$member_skin_url = get_skin_url('member', $config['cf_member_skin']);
|
||||
$new_skin_path = get_skin_path('new', $config['cf_new_skin']);
|
||||
$new_skin_url = get_skin_url('new', $config['cf_new_skin']);
|
||||
$search_skin_path = get_skin_path('search', $config['cf_search_skin']);
|
||||
$search_skin_url = get_skin_url('search', $config['cf_search_skin']);
|
||||
$connect_skin_path = get_skin_path('connect', $config['cf_connect_skin']);
|
||||
$connect_skin_url = get_skin_url('connect', $config['cf_connect_skin']);
|
||||
$faq_skin_path = get_skin_path('faq', $config['cf_faq_skin']);
|
||||
$faq_skin_url = get_skin_url('faq', $config['cf_faq_skin']);
|
||||
}
|
||||
|
||||
$conf = sql_fetch(" select cf_theme from {$g5['config_table']} ");
|
||||
$name = get_text($info['theme_name']);
|
||||
if($conf['cf_theme'] != $theme) {
|
||||
if($tconfig['set_default_skin'])
|
||||
$set_default_skin = 'true';
|
||||
else
|
||||
$set_default_skin = 'false';
|
||||
|
||||
$btn_active = '<li><button type="button" class="theme_sl theme_active" data-theme="'.$theme.'" '.'data-name="'.$name.'" data-set_default_skin="'.$set_default_skin.'">테마적용</button></li>';
|
||||
} else {
|
||||
$btn_active = '';
|
||||
}
|
||||
|
||||
$g5['title'] = get_text($info['theme_name']).' 테마 미리보기';
|
||||
require_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="<?php echo G5_ADMIN_URL; ?>/css/theme.css">
|
||||
<script src="<?php echo G5_ADMIN_URL; ?>/theme.js"></script>
|
||||
|
||||
<section id="preview_item">
|
||||
<ul>
|
||||
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_index; ?>">인덱스 화면</a></li>
|
||||
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_list; ?>">게시글 리스트</a></li>
|
||||
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_view; ?>">게시글 보기</a></li>
|
||||
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_device; ?>"><?php echo (G5_IS_MOBILE ? 'PC 버전' : '모바일 버전'); ?></a></li>
|
||||
<?php echo $btn_active; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section id="preview_content">
|
||||
<?php
|
||||
switch($mode) {
|
||||
case 'list':
|
||||
include(G5_BBS_PATH.'/board.php');
|
||||
break;
|
||||
case 'view':
|
||||
$wr_id = $row['wr_parent'];
|
||||
$write = sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
|
||||
include(G5_BBS_PATH.'/board.php');
|
||||
break;
|
||||
default:
|
||||
include(G5_PATH.'/index.php');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</section>
|
||||
|
||||
<?php
|
||||
require_once(G5_PATH.'/tail.sub.php');
|
||||
?>
|
||||
70
adm/theme_update.php
Normal file
70
adm/theme_update.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
$sub_menu = "100280";
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($is_admin != 'super')
|
||||
die('최고관리자만 접근 가능합니다.');
|
||||
|
||||
$theme = trim($_POST['theme']);
|
||||
$theme_dir = get_theme_dir();
|
||||
|
||||
if($_POST['type'] == 'reset') {
|
||||
$sql = " update {$g5['config_table']} set cf_theme = '' ";
|
||||
sql_query($sql);
|
||||
die('');
|
||||
}
|
||||
|
||||
if(!in_array($theme, $theme_dir))
|
||||
die('선택하신 테마가 설치되어 있지 않습니다.');
|
||||
|
||||
// 테마적용
|
||||
$sql = " update {$g5['config_table']} set cf_theme = '$theme' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 테마 설정 스킨 적용
|
||||
if($_POST['set_default_skin'] == 1) {
|
||||
$keys = 'set_default_skin, cf_member_skin, cf_mobile_member_skin, cf_new_skin, cf_mobile_new_skin, cf_search_skin, cf_mobile_search_skin, cf_connect_skin, cf_mobile_connect_skin, cf_faq_skin, cf_mobile_faq_skin, qa_skin, qa_mobile_skin';
|
||||
|
||||
$tconfig = get_theme_config_value($theme, $keys);
|
||||
|
||||
if($tconfig['set_default_skin']) {
|
||||
$sql_common = array();
|
||||
$qa_sql_common = array();
|
||||
|
||||
foreach($tconfig as $key => $val) {
|
||||
if(preg_match('#^qa_.+$#', $key)) {
|
||||
if($val) {
|
||||
if(!preg_match('#^theme/.+$#', $val))
|
||||
$val = 'theme/'.$val;
|
||||
|
||||
$qa_sql_common[] = " $key = '$val' ";
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!isset($config[$key]))
|
||||
continue;
|
||||
|
||||
if($val) {
|
||||
if(!preg_match('#^theme/.+$#', $val))
|
||||
$val = 'theme/'.$val;
|
||||
|
||||
$sql_common[] = " $key = '$val' ";
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($sql_common)) {
|
||||
$sql = " update {$g5['config_table']} set " . implode(', ', $sql_common);
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if(!empty($qa_sql_common)) {
|
||||
$sql = " update {$g5['qa_config_table']} set " . implode(', ', $qa_sql_common);
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
die('');
|
||||
?>
|
||||
210
adm/write_count.php
Normal file
210
adm/write_count.php
Normal file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
$sub_menu = '300820';
|
||||
include_once('./_common.php');
|
||||
|
||||
check_demo();
|
||||
|
||||
auth_check($auth[$sub_menu], 'r');
|
||||
|
||||
// http://www.jqplot.com/
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_PLUGIN_URL.'/jqplot/jquery.jqplot.css">', 0);
|
||||
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jquery.jqplot.js"></script>', 0);
|
||||
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>', 0);
|
||||
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>', 0);
|
||||
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.pointLabels.min.js"></script>', 0);
|
||||
add_javascript('<!--[if lt IE 9]><script src="'.G5_PLUGIN_URL.'/jqplot/excanvas.js"></script><![endif]-->', 0);
|
||||
|
||||
if (!($graph == 'line' || $graph == 'bar'))
|
||||
$graph = 'line';
|
||||
|
||||
if ($graph == 'bar') {
|
||||
// 바 타입으로 사용하는 코드입니다.
|
||||
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.barRenderer.min.js"></script>', 0);
|
||||
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.categoryAxisRenderer.min.js"></script>', 0);
|
||||
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.pointLabels.min.js"></script>', 0);
|
||||
}
|
||||
|
||||
$g5['title'] = '글,댓글 현황';
|
||||
include_once ('./admin.head.php');
|
||||
|
||||
$period_array = array(
|
||||
'오늘'=>array('시간', 0),
|
||||
'어제'=>array('시간', 0),
|
||||
'7일전'=>array('일', 7),
|
||||
'14일전'=>array('일', 14),
|
||||
'30일전'=>array('일', 30),
|
||||
'3개월전'=>array('주', 90),
|
||||
'6개월전'=>array('주', 180),
|
||||
'1년전'=>array('월', 365),
|
||||
'2년전'=>array('월', 365*2),
|
||||
'3년전'=>array('월', 365*3),
|
||||
'5년전'=>array('년', 365*5),
|
||||
'10년전'=>array('년', 365*10),
|
||||
);
|
||||
|
||||
$is_period = false;
|
||||
foreach($period_array as $key=>$value) {
|
||||
if ($key == $period) {
|
||||
$is_period = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$is_period)
|
||||
$period = '오늘';
|
||||
|
||||
$day = $period_array[$period][0];
|
||||
|
||||
$today = date('Y-m-d', G5_SERVER_TIME);
|
||||
$yesterday = date('Y-m-d', G5_SERVER_TIME - 86400);
|
||||
|
||||
if ($period == '오늘') {
|
||||
$from = $today;
|
||||
$to = $from;
|
||||
} else if ($period == '어제') {
|
||||
$from = $yesterday;
|
||||
$to = $from;
|
||||
} else if ($period == '내일') {
|
||||
$from = date('Y-m-d', G5_SERVER_TIME + (86400 * 2));
|
||||
$to = $from;
|
||||
} else {
|
||||
$from = date('Y-m-d', G5_SERVER_TIME - (86400 * $period_array[$period][1]));
|
||||
$to = $yesterday;
|
||||
}
|
||||
|
||||
$sql_bo_table = '';
|
||||
if ($bo_table)
|
||||
$sql_bo_table = "and bo_table = '$bo_table'";
|
||||
|
||||
switch ($day) {
|
||||
case '시간' :
|
||||
$sql = " select substr(bn_datetime,6,8) as hours, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by hours order by bn_datetime ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 월-일 시간
|
||||
$line1[] = "['".substr($row['hours'],0,8)."',".$row['wcount'].']';
|
||||
$line2[] = "['".substr($row['hours'],0,8)."',".$row['ccount'].']';
|
||||
}
|
||||
break;
|
||||
case '일' :
|
||||
$sql = " select substr(bn_datetime,1,10) as days, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by days order by bn_datetime ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 월-일
|
||||
$line1[] = "['".substr($row['days'],5,5)."',".$row['wcount'].']';
|
||||
$line2[] = "['".substr($row['days'],5,5)."',".$row['ccount'].']';
|
||||
}
|
||||
break;
|
||||
case '주' :
|
||||
$sql = " select concat(substr(bn_datetime,1,4), '-', weekofyear(bn_datetime)) as weeks, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by weeks order by bn_datetime ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 올해의 몇주로 보여주면 바로 확인이 안되므로 주를 날짜로 바꾼다.
|
||||
// 년-월-일
|
||||
list($lyear, $lweek) = explode('-', $row['weeks']);
|
||||
$date = date('y-m-d', strtotime($lyear.'W'.str_pad($lweek, 2, '0', STR_PAD_LEFT)));
|
||||
$line1[] = "['".$date."',".$row['wcount'].']';
|
||||
$line2[] = "['".$date."',".$row['ccount'].']';
|
||||
}
|
||||
break;
|
||||
case '월' :
|
||||
$sql = " select substr(bn_datetime,1,7) as months, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by months order by bn_datetime ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 년-월
|
||||
$line1[] = "['".substr($row['months'],2,5)."',".$row['wcount'].']';
|
||||
$line2[] = "['".substr($row['months'],2,5)."',".$row['ccount'].']';
|
||||
}
|
||||
break;
|
||||
case '년' :
|
||||
$sql = " select substr(bn_datetime,1,4) as years, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by years order by bn_datetime ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
// 년(4자리)
|
||||
$line1[] = "['".substr($row['years'],0,4)."',".$row['wcount'].']';
|
||||
$line2[] = "['".substr($row['years'],0,4)."',".$row['ccount'].']';
|
||||
}
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<div id="wr_cont">
|
||||
<form>
|
||||
<select name="bo_table">
|
||||
<option value="">전체게시판</a>
|
||||
<?php
|
||||
$sql = " select bo_table, bo_subject from {$g5['board_table']} order by bo_count_write desc ";
|
||||
$result = sql_query($sql);
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
echo "<option value=\"{$row['bo_table']}\"";
|
||||
if ($bo_table == $row['bo_table'])
|
||||
echo ' selected="selected"';
|
||||
echo ">{$row['bo_subject']}</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<select name="period">
|
||||
<?php
|
||||
foreach($period_array as $key=>$value) {
|
||||
echo "<option value=\"{$key}\"";
|
||||
if ($key == $period)
|
||||
echo " selected=\"selected\"";
|
||||
echo ">{$key}</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<select name="graph">
|
||||
<option value="line" <?php echo ($graph == 'line' ? 'selected="selected"' : ''); ?>>선그래프</option>
|
||||
<option value="bar" <?php echo ($graph == 'bar' ? 'selected="selected"' : ''); ?>>막대그래프</option>
|
||||
</select>
|
||||
|
||||
<input type="submit" class="btn_submit" value="확인">
|
||||
</form>
|
||||
<ul id="grp_color">
|
||||
<li><span></span>글 수</li>
|
||||
<li class="color2"><span></span>댓글 수</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
<div id="chart_wr">
|
||||
<?php
|
||||
if (empty($line1) || empty($line2)) {
|
||||
echo "<h5>그래프를 만들 데이터가 없습니다.</h5>\n";
|
||||
} else {
|
||||
?>
|
||||
<div id="chart1" style="height:500px; width:100%;"></div>
|
||||
<div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var line1 = [<?php echo implode($line1, ','); ?>];
|
||||
var line2 = [<?php echo implode($line2, ','); ?>];
|
||||
var plot1 = $.jqplot ('chart1', [line1, line2], {
|
||||
seriesDefaults: {
|
||||
<?php if ($graph == 'bar') { ?>
|
||||
renderer:$.jqplot.BarRenderer,
|
||||
<?php } ?>
|
||||
pointLabels: { show: true }
|
||||
},
|
||||
axes:{
|
||||
xaxis: {
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
label: '<?php echo $day; ?>',
|
||||
pad:0,
|
||||
max:23
|
||||
},
|
||||
yaxis: {
|
||||
label: '글수',
|
||||
min: 0
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?
|
||||
include_once ('./admin.tail.php');
|
||||
?>
|
||||
@ -222,19 +222,19 @@ $admin_href = "";
|
||||
if ($member['mb_id'] && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id']))
|
||||
$admin_href = G5_ADMIN_URL.'/board_form.php?w=u&bo_table='.$bo_table;
|
||||
|
||||
include_once('./board_head.php');
|
||||
include_once(G5_BBS_PATH.'/board_head.php');
|
||||
|
||||
// 게시물 아이디가 있다면 게시물 보기를 INCLUDE
|
||||
if (isset($wr_id) && $wr_id) {
|
||||
include_once('./view.php');
|
||||
include_once(G5_BBS_PATH.'/view.php');
|
||||
}
|
||||
|
||||
// 전체목록보이기 사용이 "예" 또는 wr_id 값이 없다면 목록을 보임
|
||||
//if ($board['bo_use_list_view'] || empty($wr_id))
|
||||
if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view'] || empty($wr_id))
|
||||
include_once ('./list.php');
|
||||
include_once (G5_BBS_PATH.'/list.php');
|
||||
|
||||
include_once('./board_tail.php');
|
||||
include_once(G5_BBS_PATH.'/board_tail.php');
|
||||
|
||||
echo "\n<!-- 사용스킨 : ".(G5_IS_MOBILE ? $board['bo_mobile_skin'] : $board['bo_skin'])." -->\n";
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
// 게시판 관리의 상단 내용
|
||||
if (G5_IS_MOBILE) {
|
||||
// 모바일의 경우 설정을 따르지 않는다.
|
||||
include_once('./_head.php');
|
||||
include_once(G5_BBS_PATH.'/_head.php');
|
||||
echo stripslashes($board['bo_mobile_content_head']);
|
||||
} else {
|
||||
@include ($board['bo_include_head']);
|
||||
|
||||
@ -5,7 +5,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
if (G5_IS_MOBILE) {
|
||||
echo stripslashes($board['bo_mobile_content_tail']);
|
||||
// 모바일의 경우 설정을 따르지 않는다.
|
||||
include_once('./_tail.php');
|
||||
include_once(G5_BBS_PATH.'/_tail.php');
|
||||
} else {
|
||||
echo stripslashes($board['bo_content_tail']);
|
||||
@include ($board['bo_include_tail']);
|
||||
|
||||
@ -62,8 +62,8 @@ $str = preg_replace($src, $dst, $str);
|
||||
if(trim($co['co_skin']) == '')
|
||||
$co['co_skin'] = 'basic';
|
||||
|
||||
$content_skin_path = G5_SKIN_PATH.'/content/'.$co['co_skin'];
|
||||
$content_skin_url = G5_SKIN_URL.'/content/'.$co['co_skin'];
|
||||
$content_skin_path = get_skin_path('content', $co['co_skin']);
|
||||
$content_skin_url = get_skin_url('content', $co['co_skin']);
|
||||
$skin_file = $content_skin_path.'/content.skin.php';
|
||||
|
||||
if ($is_admin)
|
||||
|
||||
@ -1,7 +1,14 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/latest.lib.php');
|
||||
$g5['title'] = $group['gr_subject'];
|
||||
|
||||
if(defined('G5_THEME_PATH')) {
|
||||
$group_file = G5_THEME_PATH.'/group.php';
|
||||
if(is_file($group_file)) {
|
||||
require_once($group_file);
|
||||
return;
|
||||
}
|
||||
unset($group_file);
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MOBILE_PATH.'/group.php');
|
||||
@ -11,7 +18,9 @@ if (G5_IS_MOBILE) {
|
||||
if(!$is_admin && $group['gr_device'] == 'mobile')
|
||||
alert($group['gr_subject'].' 그룹은 모바일에서만 접근할 수 있습니다.');
|
||||
|
||||
$g5['title'] = $group['gr_subject'];
|
||||
include_once('./_head.php');
|
||||
include_once(G5_LIB_PATH.'/latest.lib.php');
|
||||
?>
|
||||
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
include_once('./_common.php');
|
||||
|
||||
// 이호경님 제안 코드
|
||||
session_unset(); // 모든 세션변수를 언레지스터 시켜줌
|
||||
session_destroy(); // 세션해제함
|
||||
session_unset(); // 모든 세션변수를 언레지스터 시켜줌
|
||||
session_destroy(); // 세션해제함
|
||||
|
||||
// 자동로그인 해제 --------------------------------
|
||||
set_cookie('ck_mb_id', '', 0);
|
||||
@ -11,7 +11,7 @@ set_cookie('ck_auto', '', 0);
|
||||
// 자동로그인 해제 end --------------------------------
|
||||
|
||||
if ($url) {
|
||||
$p = parse_url($url);
|
||||
$p = @parse_url($url);
|
||||
if ($p['scheme'] || $p['host']) {
|
||||
alert('url에 도메인을 지정할 수 없습니다.');
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ $sql = " select wr_subject from {$write_table}
|
||||
and wr_is_comment = 0 ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$g5['title'] = $row['wr_subject'];
|
||||
$g5['title'] = get_text($row['wr_subject']);
|
||||
|
||||
include_once($member_skin_path.'/password.skin.php');
|
||||
|
||||
|
||||
@ -85,12 +85,25 @@ for ($i=0; $row2=sql_fetch_array($result); $i++) {
|
||||
$list3[$i]['subject'] = cut_str($row2['po_subject'],60,"…");
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$poll_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||
if(!is_dir($poll_skin_path))
|
||||
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||
} else {
|
||||
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||
}
|
||||
//$skin_dir = $match[1];
|
||||
} else {
|
||||
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
||||
if (G5_IS_MOBILE) {
|
||||
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
} else {
|
||||
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$qa_skin_path = (G5_IS_MOBILE ? G5_MOBILE_PATH : G5_PATH).'/'.G5_SKIN_DIR.'/qa/'.(G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']);
|
||||
$qa_skin_url = (G5_IS_MOBILE ? G5_MOBILE_URL : G5_URL).'/'.G5_SKIN_DIR.'/qa/'.(G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']);
|
||||
$qa_skin_path = get_skin_path('qa', (G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']));
|
||||
$qa_skin_url = get_skin_url('qa', (G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']));
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
// 모바일의 경우 설정을 따르지 않는다.
|
||||
|
||||
@ -2,27 +2,28 @@
|
||||
include_once('./_common.php');
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
$g5['title'] = '메일인증 메일주소 변경';
|
||||
include_once('./_head.php');
|
||||
|
||||
$mb_id = substr(clean_xss_tags($_GET['mb_id']), 0, 20);
|
||||
$sql = " select mb_email, mb_datetime, mb_email_certify from {$g5['member_table']} where mb_id = '{$mb_id}' ";
|
||||
$mb = sql_fetch($sql);
|
||||
if (substr($mb['mb_email_certify'],0,1)!=0) {
|
||||
alert("이미 메일인증 하신 회원입니다.", G5_URL);
|
||||
}
|
||||
|
||||
$g5['title'] = '메일인증 메일주소 변경';
|
||||
include_once('./_head.php');
|
||||
?>
|
||||
|
||||
<p>메일인증을 받지 못한 경우 회원정보의 메일주소를 변경 할 수 있습니다.</p>
|
||||
<p class="rg_em_p">메일인증을 받지 못한 경우 회원정보의 메일주소를 변경 할 수 있습니다.</p>
|
||||
|
||||
<form method="post" name="fregister_email" action="<?php echo G5_HTTPS_BBS_URL.'/register_email_update.php'; ?>" onsubmit="return fregister_email_submit(this);">
|
||||
<input type="hidden" name="mb_id" value="<?php echo $mb_id; ?>">
|
||||
|
||||
<div class="tbl_frm01 tbl_frm">
|
||||
<div class="tbl_frm01 tbl_frm rg_em">
|
||||
<table>
|
||||
<caption>사이트 이용정보 입력</caption>
|
||||
<tr>
|
||||
<th scope="row"><label for="reg_mb_email">E-mail<strong class="sound_only">필수</strong></label></th>
|
||||
<td><input type="text" name="mb_email" id="reg_mb_email" required class="frm_input email required" size="50" maxlength="100" value="<?php echo $mb['mb_email']; ?>"></td>
|
||||
<td><input type="text" name="mb_email" id="reg_mb_email" required class="frm_input email required" size="30" maxlength="100" value="<?php echo $mb['mb_email']; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">자동등록방지</th>
|
||||
|
||||
@ -8,7 +8,7 @@ $mb_email = trim($_POST['mb_email']);
|
||||
|
||||
$sql = " select mb_name, mb_datetime from {$g5['member_table']} where mb_id = '{$mb_id}' and mb_email_certify <> '' ";
|
||||
$mb = sql_fetch($sql);
|
||||
if (!$mb) {
|
||||
if ($mb) {
|
||||
alert("이미 메일인증 하신 회원입니다.", G5_URL);
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ if ($w == '' || $w == 'u') {
|
||||
if($w == '' && $mb_password != $mb_password_re)
|
||||
alert('비밀번호가 일치하지 않습니다.');
|
||||
|
||||
if ($msg = empty_mb_name($mb_id)) alert($msg, "", true, true);
|
||||
if ($msg = empty_mb_name($mb_name)) alert($msg, "", true, true);
|
||||
if ($msg = empty_mb_nick($mb_nick)) alert($msg, "", true, true);
|
||||
if ($msg = empty_mb_email($mb_email)) alert($msg, "", true, true);
|
||||
if ($msg = reserve_mb_id($mb_id)) alert($msg, "", true, true);
|
||||
|
||||
195
common.php
195
common.php
@ -218,58 +218,6 @@ if ($config['cf_editor'])
|
||||
else
|
||||
define('G5_EDITOR_LIB', G5_LIB_PATH."/editor.lib.php");
|
||||
|
||||
//==============================================================================
|
||||
// 사용기기 설정
|
||||
// config.php G5_SET_DEVICE 설정에 따라 사용자 화면 제한됨
|
||||
// pc 설정 시 모바일 기기에서도 PC화면 보여짐
|
||||
// mobile 설정 시 PC에서도 모바일화면 보여짐
|
||||
// both 설정 시 접속 기기에 따른 화면 보여짐
|
||||
//------------------------------------------------------------------------------
|
||||
$is_mobile = false;
|
||||
$set_device = true;
|
||||
if(defined('G5_SET_DEVICE')) {
|
||||
switch(G5_SET_DEVICE) {
|
||||
case 'pc':
|
||||
$is_mobile = false;
|
||||
$set_device = false;
|
||||
break;
|
||||
case 'mobile':
|
||||
$is_mobile = true;
|
||||
$set_device = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//==============================================================================
|
||||
|
||||
//==============================================================================
|
||||
// Mobile 모바일 설정
|
||||
// 쿠키에 저장된 값이 모바일이라면 브라우저 상관없이 모바일로 실행
|
||||
// 그렇지 않다면 브라우저의 HTTP_USER_AGENT 에 따라 모바일 결정
|
||||
// G5_MOBILE_AGENT : config.php 에서 선언
|
||||
//------------------------------------------------------------------------------
|
||||
if (G5_USE_MOBILE && $set_device) {
|
||||
if ($_REQUEST['device']=='pc')
|
||||
$is_mobile = false;
|
||||
else if ($_REQUEST['device']=='mobile')
|
||||
$is_mobile = true;
|
||||
else if (isset($_SESSION['ss_is_mobile']))
|
||||
$is_mobile = $_SESSION['ss_is_mobile'];
|
||||
else if (is_mobile())
|
||||
$is_mobile = true;
|
||||
} else {
|
||||
$set_device = false;
|
||||
}
|
||||
|
||||
$_SESSION['ss_is_mobile'] = $is_mobile;
|
||||
define('G5_IS_MOBILE', $is_mobile);
|
||||
define('G5_DEVICE_BUTTON_DISPLAY', $set_device);
|
||||
if (G5_IS_MOBILE) {
|
||||
$g5['mobile_path'] = G5_PATH.'/'.$g5['mobile_dir'];
|
||||
}
|
||||
//==============================================================================
|
||||
|
||||
// 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다.
|
||||
if (isset($_REQUEST['PHPSESSID']) && $_REQUEST['PHPSESSID'] != session_id())
|
||||
goto_url(G5_BBS_URL.'/logout.php');
|
||||
@ -371,7 +319,7 @@ if (isset($_REQUEST['url'])) {
|
||||
$url = '';
|
||||
$urlencode = urlencode($_SERVER['REQUEST_URI']);
|
||||
if (G5_DOMAIN) {
|
||||
$p = parse_url(G5_DOMAIN);
|
||||
$p = @parse_url(G5_DOMAIN);
|
||||
$urlencode = G5_DOMAIN.urldecode(preg_replace("/^".urlencode($p['path'])."/", "", $urlencode));
|
||||
}
|
||||
}
|
||||
@ -513,35 +461,128 @@ if ($is_admin != 'super') {
|
||||
}
|
||||
|
||||
|
||||
// 테마경로
|
||||
if(defined('_THEME_PREVIEW_') && _THEME_PREVIEW_ === true)
|
||||
$config['cf_theme'] = trim($_GET['theme']);
|
||||
|
||||
if(isset($config['cf_theme']) && trim($config['cf_theme'])) {
|
||||
$theme_path = G5_PATH.'/'.G5_THEME_DIR.'/'.$config['cf_theme'];
|
||||
if(is_dir($theme_path)) {
|
||||
define('G5_THEME_PATH', $theme_path);
|
||||
define('G5_THEME_URL', G5_URL.'/'.G5_THEME_DIR.'/'.$config['cf_theme']);
|
||||
define('G5_THEME_MOBILE_PATH', $theme_path.'/'.G5_MOBILE_DIR);
|
||||
define('G5_THEME_LIB_PATH', $theme_path.'/'.G5_LIB_DIR);
|
||||
define('G5_THEME_CSS_URL', G5_THEME_URL.'/'.G5_CSS_DIR);
|
||||
define('G5_THEME_IMG_URL', G5_THEME_URL.'/'.G5_IMG_DIR);
|
||||
define('G5_THEME_JS_URL', G5_THEME_URL.'/'.G5_JS_DIR);
|
||||
}
|
||||
unset($theme_path);
|
||||
}
|
||||
|
||||
|
||||
// 테마 설정 로드
|
||||
if(is_file(G5_THEME_PATH.'/theme.config.php'))
|
||||
include_once(G5_THEME_PATH.'/theme.config.php');
|
||||
|
||||
//=====================================================================================
|
||||
// 사용기기 설정
|
||||
// 테마의 G5_THEME_DEVICE 설정에 따라 사용자 화면 제한됨
|
||||
// 테마에 별도 설정이 없는 경우 config.php G5_SET_DEVICE 설정에 따라 사용자 화면 제한됨
|
||||
// pc 설정 시 모바일 기기에서도 PC화면 보여짐
|
||||
// mobile 설정 시 PC에서도 모바일화면 보여짐
|
||||
// both 설정 시 접속 기기에 따른 화면 보여짐
|
||||
//-------------------------------------------------------------------------------------
|
||||
$is_mobile = false;
|
||||
$set_device = true;
|
||||
|
||||
if(defined('G5_THEME_DEVICE') && G5_THEME_DEVICE != '') {
|
||||
switch(G5_THEME_DEVICE) {
|
||||
case 'pc':
|
||||
$is_mobile = false;
|
||||
$set_device = false;
|
||||
break;
|
||||
case 'mobile':
|
||||
$is_mobile = true;
|
||||
$set_device = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(defined('G5_SET_DEVICE') && $set_device) {
|
||||
switch(G5_SET_DEVICE) {
|
||||
case 'pc':
|
||||
$is_mobile = false;
|
||||
$set_device = false;
|
||||
break;
|
||||
case 'mobile':
|
||||
$is_mobile = true;
|
||||
$set_device = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//==============================================================================
|
||||
|
||||
//==============================================================================
|
||||
// Mobile 모바일 설정
|
||||
// 쿠키에 저장된 값이 모바일이라면 브라우저 상관없이 모바일로 실행
|
||||
// 그렇지 않다면 브라우저의 HTTP_USER_AGENT 에 따라 모바일 결정
|
||||
// G5_MOBILE_AGENT : config.php 에서 선언
|
||||
//------------------------------------------------------------------------------
|
||||
if (G5_USE_MOBILE && $set_device) {
|
||||
if ($_REQUEST['device']=='pc')
|
||||
$is_mobile = false;
|
||||
else if ($_REQUEST['device']=='mobile')
|
||||
$is_mobile = true;
|
||||
else if (isset($_SESSION['ss_is_mobile']))
|
||||
$is_mobile = $_SESSION['ss_is_mobile'];
|
||||
else if (is_mobile())
|
||||
$is_mobile = true;
|
||||
} else {
|
||||
$set_device = false;
|
||||
}
|
||||
|
||||
$_SESSION['ss_is_mobile'] = $is_mobile;
|
||||
define('G5_IS_MOBILE', $is_mobile);
|
||||
define('G5_DEVICE_BUTTON_DISPLAY', $set_device);
|
||||
if (G5_IS_MOBILE) {
|
||||
$g5['mobile_path'] = G5_PATH.'/'.$g5['mobile_dir'];
|
||||
}
|
||||
//==============================================================================
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// 스킨경로
|
||||
//------------------------------------------------------------------------------
|
||||
if (G5_IS_MOBILE) {
|
||||
$board_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/board/'.$board['bo_mobile_skin'];
|
||||
$board_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/board/'.$board['bo_mobile_skin'];
|
||||
$member_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/member/'.$config['cf_mobile_member_skin'];
|
||||
$member_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/member/'.$config['cf_mobile_member_skin'];
|
||||
$new_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/new/'.$config['cf_mobile_new_skin'];
|
||||
$new_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/new/'.$config['cf_mobile_new_skin'];
|
||||
$search_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/search/'.$config['cf_mobile_search_skin'];
|
||||
$search_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/search/'.$config['cf_mobile_search_skin'];
|
||||
$connect_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$config['cf_mobile_connect_skin'];
|
||||
$connect_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/connect/'.$config['cf_mobile_connect_skin'];
|
||||
$faq_skin_path = G5_MOBILE_PATH .'/'.G5_SKIN_DIR.'/faq/'.$config['cf_mobile_faq_skin'];
|
||||
$faq_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/faq/'.$config['cf_mobile_faq_skin'];
|
||||
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
|
||||
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
|
||||
$member_skin_path = get_skin_path('member', $config['cf_mobile_member_skin']);
|
||||
$member_skin_url = get_skin_url('member', $config['cf_mobile_member_skin']);
|
||||
$new_skin_path = get_skin_path('new', $config['cf_mobile_new_skin']);
|
||||
$new_skin_url = get_skin_url('new', $config['cf_mobile_new_skin']);
|
||||
$search_skin_path = get_skin_path('search', $config['cf_mobile_search_skin']);
|
||||
$search_skin_url = get_skin_url('search', $config['cf_mobile_search_skin']);
|
||||
$connect_skin_path = get_skin_path('connect', $config['cf_mobile_connect_skin']);
|
||||
$connect_skin_url = get_skin_url('connect', $config['cf_mobile_connect_skin']);
|
||||
$faq_skin_path = get_skin_path('faq', $config['cf_mobile_faq_skin']);
|
||||
$faq_skin_url = get_skin_url('faq', $config['cf_mobile_faq_skin']);
|
||||
} else {
|
||||
$board_skin_path = G5_SKIN_PATH.'/board/'.$board['bo_skin'];
|
||||
$board_skin_url = G5_SKIN_URL .'/board/'.$board['bo_skin'];
|
||||
$member_skin_path = G5_SKIN_PATH.'/member/'.$config['cf_member_skin'];
|
||||
$member_skin_url = G5_SKIN_URL .'/member/'.$config['cf_member_skin'];
|
||||
$new_skin_path = G5_SKIN_PATH.'/new/'.$config['cf_new_skin'];
|
||||
$new_skin_url = G5_SKIN_URL .'/new/'.$config['cf_new_skin'];
|
||||
$search_skin_path = G5_SKIN_PATH.'/search/'.$config['cf_search_skin'];
|
||||
$search_skin_url = G5_SKIN_URL .'/search/'.$config['cf_search_skin'];
|
||||
$connect_skin_path = G5_SKIN_PATH.'/connect/'.$config['cf_connect_skin'];
|
||||
$connect_skin_url = G5_SKIN_URL .'/connect/'.$config['cf_connect_skin'];
|
||||
$faq_skin_path = G5_SKIN_PATH.'/faq/'.$config['cf_faq_skin'];
|
||||
$faq_skin_url = G5_SKIN_URL.'/faq/'.$config['cf_faq_skin'];
|
||||
$board_skin_path = get_skin_path('board', $board['bo_skin']);
|
||||
$board_skin_url = get_skin_url('board', $board['bo_skin']);
|
||||
$member_skin_path = get_skin_path('member', $config['cf_member_skin']);
|
||||
$member_skin_url = get_skin_url('member', $config['cf_member_skin']);
|
||||
$new_skin_path = get_skin_path('new', $config['cf_new_skin']);
|
||||
$new_skin_url = get_skin_url('new', $config['cf_new_skin']);
|
||||
$search_skin_path = get_skin_path('search', $config['cf_search_skin']);
|
||||
$search_skin_url = get_skin_url('search', $config['cf_search_skin']);
|
||||
$connect_skin_path = get_skin_path('connect', $config['cf_connect_skin']);
|
||||
$connect_skin_url = get_skin_url('connect', $config['cf_connect_skin']);
|
||||
$faq_skin_path = get_skin_path('faq', $config['cf_faq_skin']);
|
||||
$faq_skin_url = get_skin_url('faq', $config['cf_faq_skin']);
|
||||
}
|
||||
//==============================================================================
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
********************/
|
||||
|
||||
define('G5_VERSION', '그누보드5');
|
||||
define('G5_GNUBOARD_VER', '5.0.40');
|
||||
define('G5_GNUBOARD_VER', '5.1.1');
|
||||
|
||||
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
|
||||
define('_GNUBOARD_', true);
|
||||
@ -59,6 +59,7 @@ define('G5_SNS_DIR', 'sns');
|
||||
define('G5_SYNDI_DIR', 'syndi');
|
||||
define('G5_PHPMAILER_DIR', 'PHPMailer_v2.0.4');
|
||||
define('G5_SESSION_DIR', 'session');
|
||||
define('G5_THEME_DIR', 'theme');
|
||||
|
||||
// URL 은 브라우저상에서의 경로 (도메인으로 부터의)
|
||||
if (G5_DOMAIN) {
|
||||
|
||||
@ -279,4 +279,8 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
|
||||
.pg_current {display:inline-block;margin:0 4px 0 0;background:#333;color:#fff;font-weight:normal}
|
||||
|
||||
/* Mobile화면으로 */
|
||||
#device_change {display:block;margin:0.3em;padding:0.5em 0;border:1px solid #eee;border-radius:2em;background:#fff;color:#000;font-size:2em;text-decoration:none;text-align:center}
|
||||
#device_change {display:block;margin:0.3em;padding:0.5em 0;border:1px solid #eee;border-radius:2em;background:#fff;color:#000;font-size:2em;text-decoration:none;text-align:center}
|
||||
|
||||
/*메일인증*/
|
||||
.rg_em{margin-top:5px}
|
||||
.rg_em caption{padding:0;font-size:0;line-height:0;overflow:hidden}
|
||||
@ -247,4 +247,10 @@ a.btn_admin:focus, a.btn_admin:hover {text-decoration:none}
|
||||
.pg_current {display:inline-block;margin:0 4px 0 0;background:#333;color:#fff;font-weight:normal}
|
||||
|
||||
/* PC화면으로 */
|
||||
#device_change {display:block;margin:5px;padding:5px 0;border:1px solid #eee;border-radius:2em;color:#000;font-size:1em;text-decoration:none;text-align:center}
|
||||
#device_change {display:block;margin:5px;padding:5px 0;border:1px solid #eee;border-radius:2em;color:#000;font-size:1em;text-decoration:none;text-align:center}
|
||||
|
||||
/*메일인증*/
|
||||
.rg_em_p{padding:0 5px}
|
||||
.rg_em{margin:5px 5px 10px;}
|
||||
.rg_em table{width:100%;border-collapse:collapse}
|
||||
.rg_em caption{padding:0;font-size:0;line-height:0;overflow:hidden}
|
||||
@ -1,8 +1,3 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// head.sub.php, tail.sub.php 파일의 이름을 지정할 수 있습니다.
|
||||
// 지정된 파일은 head.sub.php, tail.sub.php 파일과 동일한 위치에 존재해야 합니다.
|
||||
//define('G5_HEAD_SUB_FILE', 'user.head.sub.php');
|
||||
//define('G5_TAIL_SUB_FILE', 'user.tail.sub.php');
|
||||
?>
|
||||
@ -4,7 +4,7 @@ include_once(G5_LIB_PATH.'/connect.lib.php');
|
||||
include_once(G5_LIB_PATH.'/outlogin.lib.php');
|
||||
|
||||
$g5['title'] = '그누보드4 DB 데이터 이전';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/head.sub.php');
|
||||
|
||||
if(get_session('tables_copied') == 'done')
|
||||
alert('DB 데이터 변환을 이미 실행하였습니다. 중복 실행시 오류가 발생할 수 있습니다.', G5_URL);
|
||||
@ -172,5 +172,5 @@ $(function() {
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/tail.sub.php');
|
||||
?>
|
||||
@ -10,7 +10,7 @@ set_time_limit ( 0 );
|
||||
ini_set('memory_limit', '50M');
|
||||
|
||||
$g5['title'] = '그누보드4 DB 데이터 이전';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/head.sub.php');
|
||||
|
||||
echo '<link rel="stylesheet" href="'.G5_URL.'/g4_import.css">';
|
||||
|
||||
@ -536,5 +536,5 @@ $(function() {
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/tail.sub.php');
|
||||
?>
|
||||
25
head.php
25
head.php
@ -1,10 +1,14 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 상단 파일 경로 지정 : 이 코드는 가능한 삭제하지 마십시오.
|
||||
if ($config['cf_include_head'] && is_file(G5_PATH.'/'.$config['cf_include_head'])) {
|
||||
include_once(G5_PATH.'/'.$config['cf_include_head']);
|
||||
return; // 이 코드의 아래는 실행을 하지 않습니다.
|
||||
if(defined('G5_THEME_PATH')) {
|
||||
require_once(G5_THEME_PATH.'/head.php');
|
||||
return;
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MOBILE_PATH.'/head.php');
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
@ -14,11 +18,6 @@ include_once(G5_LIB_PATH.'/poll.lib.php');
|
||||
include_once(G5_LIB_PATH.'/visit.lib.php');
|
||||
include_once(G5_LIB_PATH.'/connect.lib.php');
|
||||
include_once(G5_LIB_PATH.'/popular.lib.php');
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MOBILE_PATH.'/head.php');
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- 상단 시작 { -->
|
||||
@ -98,7 +97,7 @@ if (G5_IS_MOBILE) {
|
||||
<?php } ?>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/faq.php">FAQ</a></li>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/qalist.php">1:1문의</a></li>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/current_connect.php">접속자 <?php echo connect(); // 현재 접속자수 ?></a></li>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/current_connect.php">접속자 <?php echo connect(); // 현재 접속자수, 테마의 스킨을 사용하려면 스킨을 theme/basic 과 같이 지정 ?></a></li>
|
||||
<li><a href="<?php echo G5_BBS_URL ?>/new.php">새글</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -158,8 +157,8 @@ if (G5_IS_MOBILE) {
|
||||
<!-- 콘텐츠 시작 { -->
|
||||
<div id="wrapper">
|
||||
<div id="aside">
|
||||
<?php echo outlogin('basic'); // 외부 로그인 ?>
|
||||
<?php echo poll('basic'); // 설문조사 ?>
|
||||
<?php echo outlogin('basic'); // 외부 로그인, 테마의 스킨을 사용하려면 스킨을 theme/basic 과 같이 지정 ?>
|
||||
<?php echo poll('basic'); // 설문조사, 테마의 스킨을 사용하려면 스킨을 theme/basic 과 같이 지정 ?>
|
||||
</div>
|
||||
<div id="container">
|
||||
<?php if ((!$bo_table || $w == 's' ) && !defined("_INDEX_")) { ?><div id="container_title"><?php echo $g5['title'] ?></div><?php } ?>
|
||||
<?php if ((!$bo_table || $w == 's' ) && !defined("_INDEX_")) { ?><div id="container_title"><?php echo $g5['title'] ?></div><?php } ?>
|
||||
13
head.sub.php
13
head.sub.php
@ -2,14 +2,14 @@
|
||||
// 이 파일은 새로운 파일 생성시 반드시 포함되어야 함
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$begin_time = get_microtime();
|
||||
|
||||
// 사용자가 지정한 head.sub.php 파일이 있다면 include
|
||||
if(defined('G5_HEAD_SUB_FILE') && is_file(G5_PATH.'/'.G5_HEAD_SUB_FILE)) {
|
||||
include_once(G5_PATH.'/'.G5_HEAD_SUB_FILE);
|
||||
// 테마 head.sub.php 파일
|
||||
if(!defined('G5_IS_ADMIN') && defined('G5_THEME_PATH') && is_file(G5_THEME_PATH.'/head.sub.php')) {
|
||||
require_once(G5_THEME_PATH.'/head.sub.php');
|
||||
return;
|
||||
}
|
||||
|
||||
$begin_time = get_microtime();
|
||||
|
||||
if (!isset($g5['title'])) {
|
||||
$g5['title'] = $config['cf_title'];
|
||||
$g5_head_title = $g5['title'];
|
||||
@ -54,7 +54,8 @@ if($config['cf_add_meta'])
|
||||
<title><?php echo $g5_head_title; ?></title>
|
||||
<?php
|
||||
if (defined('G5_IS_ADMIN')) {
|
||||
echo '<link rel="stylesheet" href="'.G5_ADMIN_URL.'/css/admin.css">'.PHP_EOL;
|
||||
if(!defined('_THEME_PREVIEW_'))
|
||||
echo '<link rel="stylesheet" href="'.G5_ADMIN_URL.'/css/admin.css">'.PHP_EOL;
|
||||
} else {
|
||||
echo '<link rel="stylesheet" href="'.G5_CSS_URL.'/'.(G5_IS_MOBILE?'mobile':'default').'.css">'.PHP_EOL;
|
||||
}
|
||||
|
||||
18
index.php
18
index.php
@ -1,11 +1,12 @@
|
||||
<?php
|
||||
define('_INDEX_', true);
|
||||
include_once('./_common.php');
|
||||
|
||||
// 초기화면 파일 경로 지정 : 이 코드는 가능한 삭제하지 마십시오.
|
||||
if ($config['cf_include_index'] && is_file(G5_PATH.'/'.$config['cf_include_index'])) {
|
||||
include_once(G5_PATH.'/'.$config['cf_include_index']);
|
||||
return; // 이 코드의 아래는 실행을 하지 않습니다.
|
||||
define('_INDEX_', true);
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if(defined('G5_THEME_PATH')) {
|
||||
require_once(G5_THEME_PATH.'/index.php');
|
||||
return;
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
@ -13,7 +14,7 @@ if (G5_IS_MOBILE) {
|
||||
return;
|
||||
}
|
||||
|
||||
include_once('./_head.php');
|
||||
include_once(G5_PATH.'/head.php');
|
||||
?>
|
||||
|
||||
<h2 class="sound_only">최신글</h2>
|
||||
@ -35,6 +36,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
<?php
|
||||
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
|
||||
// 사용방법 : latest(스킨, 게시판아이디, 출력라인, 글자수);
|
||||
// 테마의 스킨을 사용하려면 theme/basic 과 같이 지정
|
||||
echo latest("basic", $row['bo_table'], 5, 25);
|
||||
?>
|
||||
</div>
|
||||
@ -44,5 +46,5 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
<!-- } 최신글 끝 -->
|
||||
|
||||
<?php
|
||||
include_once('./_tail.php');
|
||||
?>
|
||||
include_once(G5_PATH.'/tail.php');
|
||||
?>
|
||||
@ -185,12 +185,10 @@ CREATE TABLE IF NOT EXISTS `g5_board_new` (
|
||||
DROP TABLE IF EXISTS `g5_config`;
|
||||
CREATE TABLE IF NOT EXISTS `g5_config` (
|
||||
`cf_title` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_theme` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_admin` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_admin_email` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_admin_email_name` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_include_index` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_include_head` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_include_tail` varchar(255) NOT NULL DEFAULT '',
|
||||
`cf_add_script` text NOT NULL,
|
||||
`cf_use_point` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`cf_point_term` int(11) NOT NULL DEFAULT '0',
|
||||
|
||||
@ -53,10 +53,12 @@ if (!$select_db) {
|
||||
|
||||
$mysql_set_mode = 'false';
|
||||
@mysql_query('set names utf8');
|
||||
if(version_compare(mysql_get_server_info(), '5.6.6', '>=') == 1) {
|
||||
$row = mysql_fetch_assoc(mysql_query(" SELECT @@sql_mode as mode "));
|
||||
if($row['mode']) {
|
||||
@mysql_query("SET SESSION sql_mode = ''");
|
||||
$mysql_set_mode = 'true';
|
||||
}
|
||||
unset($row);
|
||||
?>
|
||||
|
||||
<div class="ins_inner">
|
||||
@ -90,6 +92,7 @@ $download_point = 0;
|
||||
// config 테이블 설정
|
||||
$sql = " insert into `{$table_prefix}config`
|
||||
set cf_title = '".G5_VERSION."',
|
||||
cf_theme = 'basic',
|
||||
cf_admin = '$admin_id',
|
||||
cf_admin_email = '$admin_email',
|
||||
cf_admin_email_name = '".G5_VERSION."',
|
||||
|
||||
@ -69,7 +69,7 @@ $(function(){
|
||||
});
|
||||
|
||||
// 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌
|
||||
$(".autosave_load").live("click", function(){
|
||||
$(document).on( "click", ".autosave_load", function(){
|
||||
var $li = $(this).parents("li");
|
||||
var as_id = $li.data("as_id");
|
||||
var as_uid = $li.data("uid");
|
||||
@ -93,7 +93,7 @@ $(function(){
|
||||
$("#autosave_pop").hide();
|
||||
});
|
||||
|
||||
$(".autosave_del").live("click", function(){
|
||||
$(document).on( "click", ".autosave_del", function(){
|
||||
var $li = $(this).parents("li");
|
||||
var as_id = $li.data("as_id");
|
||||
$.get(g5_bbs_url+"/ajax.autosavedel.php", {"as_id":as_id}, function(data){
|
||||
|
||||
@ -674,7 +674,7 @@ $(function(){
|
||||
}
|
||||
});
|
||||
|
||||
$("textarea#wr_content[maxlength]").live("keyup change", function() {
|
||||
$(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){
|
||||
var str = $(this).val();
|
||||
var mx = parseInt($(this).attr("maxlength"));
|
||||
if (str.length > mx) {
|
||||
|
||||
@ -2066,7 +2066,7 @@ function delete_editor_thumbnail($contents)
|
||||
|
||||
for($i=0; $i<count($matchs[1]); $i++) {
|
||||
// 이미지 path 구함
|
||||
$imgurl = parse_url($matchs[1][$i]);
|
||||
$imgurl = @parse_url($matchs[1][$i]);
|
||||
$srcfile = $_SERVER['DOCUMENT_ROOT'].$imgurl['path'];
|
||||
|
||||
$filename = preg_replace("/\.[^\.]+$/i", "", basename($srcfile));
|
||||
@ -2857,7 +2857,7 @@ function check_url_host($url, $msg='', $return_url=G5_URL)
|
||||
if(!$msg)
|
||||
$msg = 'url에 타 도메인을 지정할 수 없습니다.';
|
||||
|
||||
$p = parse_url($url);
|
||||
$p = @parse_url($url);
|
||||
$host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);
|
||||
|
||||
if ((isset($p['scheme']) && $p['scheme']) || (isset($p['host']) && $p['host'])) {
|
||||
@ -2962,7 +2962,7 @@ function clean_query_string($query, $amp=true)
|
||||
|
||||
function get_device_change_url()
|
||||
{
|
||||
$p = parse_url(G5_URL);
|
||||
$p = @parse_url(G5_URL);
|
||||
$href = $p['scheme'].'://'.$p['host'];
|
||||
if(isset($p['port']) && $p['port'])
|
||||
$href .= ':'.$p['port'];
|
||||
@ -2993,4 +2993,39 @@ function get_device_change_url()
|
||||
|
||||
return $href;
|
||||
}
|
||||
|
||||
// 스킨 path
|
||||
function get_skin_path($dir, $skin)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if(preg_match('#^theme/(.+)$#', $skin, $match)) { // 테마에 포함된 스킨이라면
|
||||
$theme_path = '';
|
||||
$cf_theme = trim($config['cf_theme']);
|
||||
|
||||
$theme_path = G5_PATH.'/'.G5_THEME_DIR.'/'.$cf_theme;
|
||||
if(G5_IS_MOBILE) {
|
||||
$skin_path = $theme_path.'/'.G5_MOBILE_DIR.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$match[1];
|
||||
if(!is_dir($skin_path))
|
||||
$skin_path = $theme_path.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$match[1];
|
||||
} else {
|
||||
$skin_path = $theme_path.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$match[1];
|
||||
}
|
||||
} else {
|
||||
if(G5_IS_MOBILE)
|
||||
$skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$skin;
|
||||
else
|
||||
$skin_path = G5_SKIN_PATH.'/'.$dir.'/'.$skin;
|
||||
}
|
||||
|
||||
return $skin_path;
|
||||
}
|
||||
|
||||
// 스킨 url
|
||||
function get_skin_url($dir, $skin)
|
||||
{
|
||||
$skin_path = get_skin_path($dir, $skin);
|
||||
|
||||
return str_replace(G5_PATH, G5_URL, $skin_path);
|
||||
}
|
||||
?>
|
||||
@ -10,12 +10,25 @@ function connect($skin_dir='basic')
|
||||
$sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from {$g5['login_table']} where mb_id <> '{$config['cf_admin']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(G5_IS_MOBILE) {
|
||||
$connect_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
||||
$connect_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$connect_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$match[1];
|
||||
if(!is_dir($connect_skin_path))
|
||||
$connect_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/connect/'.$match[1];
|
||||
$connect_skin_url = str_replace(G5_PATH, G5_URL, $connect_skin_path);
|
||||
} else {
|
||||
$connect_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/connect/'.$match[1];
|
||||
$connect_skin_url = str_replace(G5_PATH, G5_URL, $connect_skin_path);
|
||||
}
|
||||
$skin_dir = $match[1];
|
||||
} else {
|
||||
$connect_skin_path = G5_SKIN_PATH.'/connect/'.$skin_dir;
|
||||
$connect_skin_url = G5_SKIN_URL.'/connect/'.$skin_dir;
|
||||
if(G5_IS_MOBILE) {
|
||||
$connect_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
||||
$connect_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
||||
} else {
|
||||
$connect_skin_path = G5_SKIN_PATH.'/connect/'.$skin_dir;
|
||||
$connect_skin_url = G5_SKIN_URL.'/connect/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
79
lib/json.lib.php
Normal file
79
lib/json.lib.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
// http://tinsology.net/2011/04/php-json_encode-and-json_decode-alternatives/
|
||||
|
||||
if(!function_exists('json_encode'))
|
||||
{
|
||||
function json_encode($a=false)
|
||||
{
|
||||
// Some basic debugging to ensure we have something returned
|
||||
if (is_null($a)) return 'null';
|
||||
if ($a === false) return 'false';
|
||||
if ($a === true) return 'true';
|
||||
if (is_scalar($a))
|
||||
{
|
||||
if (is_float($a))
|
||||
{
|
||||
// Always use '.' for floats.
|
||||
return floatval(str_replace(',', '.', strval($a)));
|
||||
}
|
||||
if (is_string($a))
|
||||
{
|
||||
static $jsonReplaces = array(array('\\', '/', "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
|
||||
return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
|
||||
}
|
||||
else
|
||||
return $a;
|
||||
}
|
||||
$isList = true;
|
||||
for ($i = 0, reset($a); true; $i++) {
|
||||
if (key($a) !== $i)
|
||||
{
|
||||
$isList = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$result = array();
|
||||
if ($isList)
|
||||
{
|
||||
foreach ($a as $v) $result[] = json_encode($v);
|
||||
return '[' . join(',', $result) . ']';
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
|
||||
return '{' . join(',', $result) . '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('json_decode'))
|
||||
{
|
||||
function json_decode($json)
|
||||
{
|
||||
$comment = false;
|
||||
$out = '$x=';
|
||||
for ($i=0; $i<strlen($json); $i++)
|
||||
{
|
||||
if (!$comment)
|
||||
{
|
||||
if (($json[$i] == '{') || ($json[$i] == '['))
|
||||
$out .= ' array(';
|
||||
else if (($json[$i] == '}') || ($json[$i] == ']'))
|
||||
$out .= ')';
|
||||
else if ($json[$i] == ':')
|
||||
$out .= '=>';
|
||||
else
|
||||
$out .= $json[$i];
|
||||
}
|
||||
else
|
||||
$out .= $json[$i];
|
||||
if ($json[$i] == '"' && $json[($i-1)]!="\\")
|
||||
$comment = !$comment;
|
||||
}
|
||||
eval($out . ';');
|
||||
return $x;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -6,16 +6,28 @@ if (!defined('_GNUBOARD_')) exit;
|
||||
function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='')
|
||||
{
|
||||
global $g5;
|
||||
//static $css = array();
|
||||
|
||||
if (!$skin_dir) $skin_dir = 'basic';
|
||||
|
||||
if(G5_IS_MOBILE) {
|
||||
$latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||
$latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||
if(!is_dir($latest_skin_path))
|
||||
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
|
||||
} else {
|
||||
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
|
||||
}
|
||||
$skin_dir = $match[1];
|
||||
} else {
|
||||
$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
|
||||
$latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
|
||||
if(G5_IS_MOBILE) {
|
||||
$latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||
$latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||
} else {
|
||||
$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
|
||||
$latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
$cache_fwrite = false;
|
||||
@ -60,14 +72,6 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// 같은 스킨은 .css 를 한번만 호출한다.
|
||||
if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) {
|
||||
echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">';
|
||||
$css[] = $skin_dir;
|
||||
}
|
||||
*/
|
||||
|
||||
ob_start();
|
||||
include $latest_skin_path.'/latest.skin.php';
|
||||
$content = ob_get_contents();
|
||||
|
||||
@ -13,12 +13,25 @@ function outlogin($skin_dir='basic')
|
||||
$point = number_format($member['mb_point']);
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
$outlogin_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
||||
$outlogin_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$outlogin_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$match[1];
|
||||
if(!is_dir($outlogin_skin_path))
|
||||
$outlogin_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$match[1];
|
||||
$outlogin_skin_url = str_replace(G5_PATH, G5_URL, $outlogin_skin_path);
|
||||
} else {
|
||||
$outlogin_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$match[1];
|
||||
$outlogin_skin_url = str_replace(G5_PATH, G5_URL, $outlogin_skin_path);
|
||||
}
|
||||
$skin_dir = $match[1];
|
||||
} else {
|
||||
$outlogin_skin_path = G5_SKIN_PATH.'/outlogin/'.$skin_dir;
|
||||
$outlogin_skin_url = G5_SKIN_URL.'/outlogin/'.$skin_dir;
|
||||
if (G5_IS_MOBILE) {
|
||||
$outlogin_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
||||
$outlogin_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
||||
} else {
|
||||
$outlogin_skin_path = G5_SKIN_PATH.'/outlogin/'.$skin_dir;
|
||||
$outlogin_skin_url = G5_SKIN_URL.'/outlogin/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
// 읽지 않은 쪽지가 있다면
|
||||
|
||||
@ -15,16 +15,30 @@ function poll($skin_dir='basic', $po_id=false)
|
||||
if(!$po_id)
|
||||
return;
|
||||
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$poll_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||
if(!is_dir($poll_skin_path))
|
||||
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||
} else {
|
||||
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||
}
|
||||
//$skin_dir = $match[1];
|
||||
} else {
|
||||
if (G5_IS_MOBILE) {
|
||||
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
} else {
|
||||
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '$po_id' ");
|
||||
|
||||
ob_start();
|
||||
if (G5_IS_MOBILE) {
|
||||
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||
} else {
|
||||
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
||||
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
||||
}
|
||||
include_once ($poll_skin_path.'/poll.skin.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
@ -20,14 +20,28 @@ function popular($skin_dir='basic', $pop_cnt=7, $date_cnt=3)
|
||||
$list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
if(G5_IS_MOBILE) {
|
||||
$popular_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
||||
$popular_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$popular_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/popular/'.$match[1];
|
||||
if(!is_dir($popular_skin_path))
|
||||
$popular_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/popular/'.$match[1];
|
||||
$popular_skin_url = str_replace(G5_PATH, G5_URL, $popular_skin_path);
|
||||
} else {
|
||||
$popular_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/popular/'.$match[1];
|
||||
$popular_skin_url = str_replace(G5_PATH, G5_URL,$popular_skin_path);
|
||||
}
|
||||
$skin_dir = $match[1];
|
||||
} else {
|
||||
$popular_skin_path = G5_SKIN_PATH.'/popular/'.$skin_dir;
|
||||
$popular_skin_url = G5_SKIN_URL.'/popular/'.$skin_dir;
|
||||
if(G5_IS_MOBILE) {
|
||||
$popular_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
||||
$popular_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
||||
} else {
|
||||
$popular_skin_path = G5_SKIN_PATH.'/popular/'.$skin_dir;
|
||||
$popular_skin_url = G5_SKIN_URL.'/popular/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include_once ($popular_skin_path.'/popular.skin.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
@ -59,15 +59,19 @@ function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_
|
||||
|
||||
if($tname) {
|
||||
if($edt) {
|
||||
// 오리지날 이미지
|
||||
$ori = G5_URL.$data_path;
|
||||
// 썸네일 이미지
|
||||
$src = G5_URL.str_replace($filename, $tname, $data_path);
|
||||
} else {
|
||||
$ori = G5_DATA_URL.'/file/'.$bo_table.'/'.$filename;
|
||||
$src = G5_DATA_URL.'/file/'.$bo_table.'/'.$tname;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$thumb = array("src"=>$src, "alt"=>$alt);
|
||||
$thumb = array("src"=>$src, "ori"=>$ori, "alt"=>$alt);
|
||||
|
||||
return $thumb;
|
||||
}
|
||||
|
||||
@ -18,14 +18,28 @@ function visit($skin_dir='basic')
|
||||
settype($visit[3], "integer");
|
||||
settype($visit[4], "integer");
|
||||
|
||||
ob_start();
|
||||
if(G5_IS_MOBILE) {
|
||||
$visit_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
||||
$visit_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$visit_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/visit/'.$match[1];
|
||||
if(!is_dir($visit_skin_path))
|
||||
$visit_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/visit/'.$match[1];
|
||||
$visit_skin_url = str_replace(G5_PATH, G5_URL, $visit_skin_path);
|
||||
} else {
|
||||
$visit_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/visit/'.$match[1];
|
||||
$visit_skin_url = str_replace(G5_PATH, G5_URL, $visit_skin_path);
|
||||
}
|
||||
$skin_dir = $match[1];
|
||||
} else {
|
||||
$visit_skin_path = G5_SKIN_PATH.'/visit/'.$skin_dir;
|
||||
$visit_skin_url = G5_SKIN_URL.'/visit/'.$skin_dir;
|
||||
if(G5_IS_MOBILE) {
|
||||
$visit_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
||||
$visit_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
||||
} else {
|
||||
$visit_skin_path = G5_SKIN_PATH.'/visit/'.$skin_dir;
|
||||
$visit_skin_url = G5_SKIN_URL.'/visit/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include_once ($visit_skin_path.'/visit.skin.php');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
@ -49,8 +49,8 @@ $str = preg_replace($src, $dst, $str);
|
||||
if(trim($co['co_mobile_skin']) == '')
|
||||
$co['co_mobile_skin'] = 'basic';
|
||||
|
||||
$content_skin_path = G5_MOBILE_PATH .'/'.G5_SKIN_DIR.'/content/'.$co['co_mobile_skin'];
|
||||
$content_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/content/'.$co['co_mobile_skin'];
|
||||
$content_skin_path = get_skin_path('content', $co['co_mobile_skin']);
|
||||
$content_skin_url = get_skin_url('content', $co['co_mobile_skin']);
|
||||
$skin_file = $content_skin_path.'/content.skin.php';
|
||||
|
||||
if(is_file($skin_file)) {
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if(defined('G5_THEME_PATH')) {
|
||||
require_once(G5_THEME_PATH.'/head.php');
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
include_once(G5_LIB_PATH.'/latest.lib.php');
|
||||
include_once(G5_LIB_PATH.'/outlogin.lib.php');
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
include_once(G5_MOBILE_PATH.'/_head.php');
|
||||
if(defined('G5_THEME_PATH')) {
|
||||
require_once(G5_THEME_PATH.'/index.php');
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_MOBILE_PATH.'/head.php');
|
||||
?>
|
||||
|
||||
<!-- 메인화면 최신글 시작 -->
|
||||
@ -26,5 +31,5 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
<!-- 메인화면 최신글 끝 -->
|
||||
|
||||
<?php
|
||||
include_once(G5_MOBILE_PATH.'/_tail.php');
|
||||
include_once(G5_MOBILE_PATH.'/tail.php');
|
||||
?>
|
||||
@ -65,8 +65,8 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if (implode('', $view['link'])) {
|
||||
?>
|
||||
if ($view['link']) {
|
||||
?>
|
||||
<section id="bo_v_link">
|
||||
<h2>관련링크</h2>
|
||||
<ul>
|
||||
@ -179,7 +179,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
|
||||
|
||||
<?php
|
||||
// 코멘트 입출력
|
||||
include_once('./view_comment.php');
|
||||
include_once(G5_BBS_PATH.'/view_comment.php');
|
||||
?>
|
||||
|
||||
<div id="bo_v_bot">
|
||||
|
||||
@ -65,8 +65,8 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if (implode('', $view['link'])) {
|
||||
?>
|
||||
if ($view['link']) {
|
||||
?>
|
||||
<section id="bo_v_link">
|
||||
<h2>관련링크</h2>
|
||||
<ul>
|
||||
@ -179,7 +179,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
|
||||
|
||||
<?php
|
||||
// 코멘트 입출력
|
||||
include_once('./view_comment.php');
|
||||
include_once(G5_BBS_PATH.'/view_comment.php');
|
||||
?>
|
||||
|
||||
<div id="bo_v_bot">
|
||||
|
||||
@ -21,7 +21,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">',
|
||||
<ul id="memo_list_ul">
|
||||
<?php for ($i=0; $i<count($list); $i++) { ?>
|
||||
<li>
|
||||
<a href="<?php echo $list[$i]['view_href'] ?>" class="memo_link"><?php echo $list[$i]['send_datetime'] ?> 에 받은 쪽지</a>
|
||||
<a href="<?php echo $list[$i]['view_href'] ?>" class="memo_link"><?php echo $list[$i]['send_datetime'] ?> 에 <?php echo ($kind == "recv") ? "받은" : "보낸"; ?> 쪽지</a>
|
||||
<span class="memo_read"><?php echo $list[$i]['read_datetime'] ?></span>
|
||||
<span class="memo_send"><?php echo $list[$i]['name'] ?></span>
|
||||
<a href="<?php echo $list[$i]['del_href'] ?>" onclick="del(this.href); return false;" class="memo_del">삭제</a>
|
||||
|
||||
@ -141,7 +141,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">',
|
||||
<?php if ($config['cf_req_addr']) { ?><strong class="sound_only">필수</strong><?php } ?>
|
||||
</th>
|
||||
<td>
|
||||
<label for="reg_mb_zip1" class="sound_only">우편번호<?php echo $config['cf_req_addr']?'<strong class="sound_only"> 필수</strong>':''; ?></label>
|
||||
<label for="reg_mb_zip" class="sound_only">우편번호<?php echo $config['cf_req_addr']?'<strong class="sound_only"> 필수</strong>':''; ?></label>
|
||||
<input type="text" name="mb_zip" value="<?php echo $member['mb_zip1'].$member['mb_zip2']; ?>" id="reg_mb_zip" <?php echo $config['cf_req_addr']?"required":""; ?> class="frm_input <?php echo $config['cf_req_addr']?"required":""; ?>" size="5" maxlength="6">
|
||||
<button type="button" class="btn_frmline" onclick="win_zip('fregisterform', 'mb_zip', 'mb_addr1', 'mb_addr2', 'mb_addr3', 'mb_addr_jibeon');">주소 검색</button><br>
|
||||
<label for="reg_mb_addr1" class="sound_only">주소<?php echo $config['cf_req_addr']?'<strong class="sound_only"> 필수</strong>':''; ?></label>
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if(defined('G5_THEME_PATH')) {
|
||||
require_once(G5_THEME_PATH.'/tail.php');
|
||||
return;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -29,7 +29,7 @@ function editor_html($id, $content, $is_dhtml_editor=true)
|
||||
$(this).text("단축키 일람 닫기");
|
||||
}
|
||||
});
|
||||
$(".btn_cke_sc_close").live("click",function(){
|
||||
$(document).on("click", ".btn_cke_sc_close", function(){
|
||||
$(this).parent("div.cke_sc_def").remove();
|
||||
});
|
||||
});';
|
||||
|
||||
21
plugin/jqplot/MIT-LICENSE.txt
Normal file
21
plugin/jqplot/MIT-LICENSE.txt
Normal file
@ -0,0 +1,21 @@
|
||||
Title: MIT License
|
||||
|
||||
Copyright (c) 2009-2013 Chris Leonello
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1438
plugin/jqplot/excanvas.js
Normal file
1438
plugin/jqplot/excanvas.js
Normal file
File diff suppressed because it is too large
Load Diff
3
plugin/jqplot/excanvas.min.js
vendored
Normal file
3
plugin/jqplot/excanvas.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
plugin/jqplot/jqplot.barRenderer.min.js
vendored
Normal file
3
plugin/jqplot/jqplot.barRenderer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
plugin/jqplot/jqplot.categoryAxisRenderer.min.js
vendored
Normal file
3
plugin/jqplot/jqplot.categoryAxisRenderer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
plugin/jqplot/jqplot.pointLabels.min.js
vendored
Normal file
3
plugin/jqplot/jqplot.pointLabels.min.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||
jsDate | (c) 2010-2013 Chris Leonello
|
||||
*/(function(c){c.jqplot.PointLabels=function(e){this.show=c.jqplot.config.enablePlugins;this.location="n";this.labelsFromSeries=false;this.seriesLabelIndex=null;this.labels=[];this._labels=[];this.stackedValue=false;this.ypadding=6;this.xpadding=6;this.escapeHTML=true;this.edgeTolerance=-5;this.formatter=c.jqplot.DefaultTickFormatter;this.formatString="";this.hideZeros=false;this._elems=[];c.extend(true,this,e)};var a=["nw","n","ne","e","se","s","sw","w"];var d={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7};var b=["se","s","sw","w","nw","n","ne","e"];c.jqplot.PointLabels.init=function(j,h,f,g,i){var e=c.extend(true,{},f,g);e.pointLabels=e.pointLabels||{};if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"&&!e.pointLabels.location){e.pointLabels.location="e"}this.plugins.pointLabels=new c.jqplot.PointLabels(e.pointLabels);this.plugins.pointLabels.setLabels.call(this)};c.jqplot.PointLabels.prototype.setLabels=function(){var f=this.plugins.pointLabels;var h;if(f.seriesLabelIndex!=null){h=f.seriesLabelIndex}else{if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"){h=(this._plotData[0].length<3)?0:this._plotData[0].length-1}else{h=(this._plotData.length===0)?0:this._plotData[0].length-1}}f._labels=[];if(f.labels.length===0||f.labelsFromSeries){if(f.stackedValue){if(this._plotData.length&&this._plotData[0].length){for(var e=0;e<this._plotData.length;e++){f._labels.push(this._plotData[e][h])}}}else{var g=this.data;if(this.renderer.constructor===c.jqplot.BarRenderer&&this.waterfall){g=this._data}if(g.length&&g[0].length){for(var e=0;e<g.length;e++){f._labels.push(g[e][h])}}g=null}}else{if(f.labels.length){f._labels=f.labels}}};c.jqplot.PointLabels.prototype.xOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerWidth(true)-this.xpadding;break;case"n":h=-f.outerWidth(true)/2;break;case"ne":h=this.xpadding;break;case"e":h=this.xpadding;break;case"se":h=this.xpadding;break;case"s":h=-f.outerWidth(true)/2;break;case"sw":h=-f.outerWidth(true)-this.xpadding;break;case"w":h=-f.outerWidth(true)-this.xpadding;break;default:h=-f.outerWidth(true)-this.xpadding;break}return h};c.jqplot.PointLabels.prototype.yOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerHeight(true)-this.ypadding;break;case"n":h=-f.outerHeight(true)-this.ypadding;break;case"ne":h=-f.outerHeight(true)-this.ypadding;break;case"e":h=-f.outerHeight(true)/2;break;case"se":h=this.ypadding;break;case"s":h=this.ypadding;break;case"sw":h=this.ypadding;break;case"w":h=-f.outerHeight(true)/2;break;default:h=-f.outerHeight(true)-this.ypadding;break}return h};c.jqplot.PointLabels.draw=function(x,j,v){var t=this.plugins.pointLabels;t.setLabels.call(this);for(var w=0;w<t._elems.length;w++){t._elems[w].emptyForce()}t._elems.splice(0,t._elems.length);if(t.show){var r="_"+this._stackAxis+"axis";if(!t.formatString){t.formatString=this[r]._ticks[0].formatString;t.formatter=this[r]._ticks[0].formatter}var E=this._plotData;var D=this._prevPlotData;var A=this._xaxis;var q=this._yaxis;var z,f;for(var w=0,u=t._labels.length;w<u;w++){var o=t._labels[w];if(o==null||(t.hideZeros&&parseInt(o,10)==0)){continue}o=t.formatter(t.formatString,o);f=document.createElement("div");t._elems[w]=c(f);z=t._elems[w];z.addClass("jqplot-point-label jqplot-series-"+this.index+" jqplot-point-"+w);z.css("position","absolute");z.insertAfter(x.canvas);if(t.escapeHTML){z.text(o)}else{z.html(o)}var g=t.location;if((this.fillToZero&&E[w][1]<0)||(this.fillToZero&&this._type==="bar"&&this.barDirection==="horizontal"&&E[w][0]<0)||(this.waterfall&&parseInt(o,10))<0){g=b[d[g]]}var n=A.u2p(E[w][0])+t.xOffset(z,g);var h=q.u2p(E[w][1])+t.yOffset(z,g);if(this._stack&&!t.stackedValue){if(this.barDirection==="vertical"){h=(this._barPoints[w][0][1]+this._barPoints[w][1][1])/2+v._gridPadding.top-0.5*z.outerHeight(true)}else{n=(this._barPoints[w][2][0]+this._barPoints[w][0][0])/2+v._gridPadding.left-0.5*z.outerWidth(true)}}if(this.renderer.constructor==c.jqplot.BarRenderer){if(this.barDirection=="vertical"){n+=this._barNudge}else{h-=this._barNudge}}z.css("left",n);z.css("top",h);var k=n+z.width();var s=h+z.height();var C=t.edgeTolerance;var e=c(x.canvas).position().left;var y=c(x.canvas).position().top;var B=x.canvas.width+e;var m=x.canvas.height+y;if(n-C<e||h-C<y||k+C>B||s+C>m){z.remove()}z=null;f=null}}};c.jqplot.postSeriesInitHooks.push(c.jqplot.PointLabels.init);c.jqplot.postDrawSeriesHooks.push(c.jqplot.PointLabels.draw)})(jQuery);
|
||||
261
plugin/jqplot/jquery.jqplot.css
Normal file
261
plugin/jqplot/jquery.jqplot.css
Normal file
@ -0,0 +1,261 @@
|
||||
/*rules for the plot target div. These will be cascaded down to all plot elements according to css rules*/
|
||||
.jqplot-target {
|
||||
position: relative;
|
||||
color: #666666;
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
font-size: 1em;
|
||||
/* height: 300px;
|
||||
width: 400px;*/
|
||||
}
|
||||
|
||||
/*rules applied to all axes*/
|
||||
.jqplot-axis {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.jqplot-xaxis {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.jqplot-x2axis {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.jqplot-yaxis {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.jqplot-y2axis, .jqplot-y3axis, .jqplot-y4axis, .jqplot-y5axis, .jqplot-y6axis, .jqplot-y7axis, .jqplot-y8axis, .jqplot-y9axis, .jqplot-yMidAxis {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/*rules applied to all axis tick divs*/
|
||||
.jqplot-axis-tick, .jqplot-xaxis-tick, .jqplot-yaxis-tick, .jqplot-x2axis-tick, .jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick, .jqplot-yMidAxis-tick {
|
||||
position: absolute;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
|
||||
.jqplot-xaxis-tick {
|
||||
top: 0px;
|
||||
/* initial position untill tick is drawn in proper place */
|
||||
left: 15px;
|
||||
/* padding-top: 10px;*/
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.jqplot-x2axis-tick {
|
||||
bottom: 0px;
|
||||
/* initial position untill tick is drawn in proper place */
|
||||
left: 15px;
|
||||
/* padding-bottom: 10px;*/
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.jqplot-yaxis-tick {
|
||||
right: 0px;
|
||||
/* initial position untill tick is drawn in proper place */
|
||||
top: 15px;
|
||||
/* padding-right: 10px;*/
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.jqplot-yaxis-tick.jqplot-breakTick {
|
||||
right: -20px;
|
||||
margin-right: 0px;
|
||||
padding:1px 5px 1px 5px;
|
||||
/*background-color: white;*/
|
||||
z-index: 2;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick {
|
||||
left: 0px;
|
||||
/* initial position untill tick is drawn in proper place */
|
||||
top: 15px;
|
||||
/* padding-left: 10px;*/
|
||||
/* padding-right: 15px;*/
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.jqplot-yMidAxis-tick {
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.jqplot-xaxis-label {
|
||||
margin-top: 10px;
|
||||
font-size: 11pt;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jqplot-x2axis-label {
|
||||
margin-bottom: 10px;
|
||||
font-size: 11pt;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jqplot-yaxis-label {
|
||||
margin-right: 10px;
|
||||
/* text-align: center;*/
|
||||
font-size: 11pt;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jqplot-yMidAxis-label {
|
||||
font-size: 11pt;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jqplot-y2axis-label, .jqplot-y3axis-label, .jqplot-y4axis-label, .jqplot-y5axis-label, .jqplot-y6axis-label, .jqplot-y7axis-label, .jqplot-y8axis-label, .jqplot-y9axis-label {
|
||||
/* text-align: center;*/
|
||||
font-size: 11pt;
|
||||
margin-left: 10px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jqplot-meterGauge-tick {
|
||||
font-size: 0.75em;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.jqplot-meterGauge-label {
|
||||
font-size: 1em;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
table.jqplot-table-legend {
|
||||
margin-top: 12px;
|
||||
margin-bottom: 12px;
|
||||
margin-left: 12px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
table.jqplot-table-legend, table.jqplot-cursor-legend {
|
||||
background-color: rgba(255,255,255,0.6);
|
||||
border: 1px solid #cccccc;
|
||||
position: absolute;
|
||||
font-size: 0.75em;
|
||||
}
|
||||
|
||||
td.jqplot-table-legend {
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
/*
|
||||
These rules could be used instead of assigning
|
||||
element styles and relying on js object properties.
|
||||
*/
|
||||
|
||||
/*
|
||||
td.jqplot-table-legend-swatch {
|
||||
padding-top: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
tr.jqplot-table-legend:first td.jqplot-table-legend-swatch {
|
||||
padding-top: 0px;
|
||||
}
|
||||
*/
|
||||
|
||||
td.jqplot-seriesToggle:hover, td.jqplot-seriesToggle:active {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.jqplot-table-legend .jqplot-series-hidden {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
div.jqplot-table-legend-swatch-outline {
|
||||
border: 1px solid #cccccc;
|
||||
padding:1px;
|
||||
}
|
||||
|
||||
div.jqplot-table-legend-swatch {
|
||||
width:0px;
|
||||
height:0px;
|
||||
border-top-width: 5px;
|
||||
border-bottom-width: 5px;
|
||||
border-left-width: 6px;
|
||||
border-right-width: 6px;
|
||||
border-top-style: solid;
|
||||
border-bottom-style: solid;
|
||||
border-left-style: solid;
|
||||
border-right-style: solid;
|
||||
}
|
||||
|
||||
.jqplot-title {
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
padding-bottom: 0.5em;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
table.jqplot-cursor-tooltip {
|
||||
border: 1px solid #cccccc;
|
||||
font-size: 0.75em;
|
||||
}
|
||||
|
||||
|
||||
.jqplot-cursor-tooltip {
|
||||
border: 1px solid #cccccc;
|
||||
font-size: 0.75em;
|
||||
white-space: nowrap;
|
||||
background: rgba(208,208,208,0.5);
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.jqplot-highlighter-tooltip, .jqplot-canvasOverlay-tooltip {
|
||||
border: 1px solid #cccccc;
|
||||
font-size: 0.75em;
|
||||
white-space: nowrap;
|
||||
background: rgba(208,208,208,0.5);
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.jqplot-point-label {
|
||||
font-size: 1em;
|
||||
z-index: 2;
|
||||
font-weight:bold;
|
||||
color:#ff670f;
|
||||
}
|
||||
|
||||
td.jqplot-cursor-legend-swatch {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.jqplot-cursor-legend-swatch {
|
||||
width: 1.2em;
|
||||
height: 0.7em;
|
||||
}
|
||||
|
||||
.jqplot-error {
|
||||
/* Styles added to the plot target container when there is an error go here.*/
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jqplot-error-message {
|
||||
/* Styling of the custom error message div goes here.*/
|
||||
position: relative;
|
||||
top: 46%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
div.jqplot-bubble-label {
|
||||
font-size: 0.8em;
|
||||
/* background: rgba(90%, 90%, 90%, 0.15);*/
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
color: rgb(20%, 20%, 20%);
|
||||
}
|
||||
|
||||
div.jqplot-bubble-label.jqplot-bubble-label-highlight {
|
||||
background: rgba(90%, 90%, 90%, 0.7);
|
||||
}
|
||||
|
||||
div.jqplot-noData-container {
|
||||
text-align: center;
|
||||
background-color: rgba(96%, 96%, 96%, 0.3);
|
||||
}
|
||||
11411
plugin/jqplot/jquery.jqplot.js
Normal file
11411
plugin/jqplot/jquery.jqplot.js
Normal file
File diff suppressed because it is too large
Load Diff
1
plugin/jqplot/jquery.jqplot.min.css
vendored
Normal file
1
plugin/jqplot/jquery.jqplot.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.jqplot-target{position:relative;color:#666;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:1em}.jqplot-axis{font-size:.75em}.jqplot-xaxis{margin-top:10px}.jqplot-x2axis{margin-bottom:10px}.jqplot-yaxis{margin-right:10px}.jqplot-y2axis,.jqplot-y3axis,.jqplot-y4axis,.jqplot-y5axis,.jqplot-y6axis,.jqplot-y7axis,.jqplot-y8axis,.jqplot-y9axis,.jqplot-yMidAxis{margin-left:10px;margin-right:10px}.jqplot-axis-tick,.jqplot-xaxis-tick,.jqplot-yaxis-tick,.jqplot-x2axis-tick,.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick,.jqplot-yMidAxis-tick{position:absolute;white-space:pre}.jqplot-xaxis-tick{top:0;left:15px;vertical-align:top}.jqplot-x2axis-tick{bottom:0;left:15px;vertical-align:bottom}.jqplot-yaxis-tick{right:0;top:15px;text-align:right}.jqplot-yaxis-tick.jqplot-breakTick{right:-20px;margin-right:0;padding:1px 5px 1px 5px;z-index:2;font-size:1.5em}.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick{left:0;top:15px;text-align:left}.jqplot-yMidAxis-tick{text-align:center;white-space:nowrap}.jqplot-xaxis-label{margin-top:10px;font-size:11pt;position:absolute}.jqplot-x2axis-label{margin-bottom:10px;font-size:11pt;position:absolute}.jqplot-yaxis-label{margin-right:10px;font-size:11pt;position:absolute}.jqplot-yMidAxis-label{font-size:11pt;position:absolute}.jqplot-y2axis-label,.jqplot-y3axis-label,.jqplot-y4axis-label,.jqplot-y5axis-label,.jqplot-y6axis-label,.jqplot-y7axis-label,.jqplot-y8axis-label,.jqplot-y9axis-label{font-size:11pt;margin-left:10px;position:absolute}.jqplot-meterGauge-tick{font-size:.75em;color:#999}.jqplot-meterGauge-label{font-size:1em;color:#999}table.jqplot-table-legend{margin-top:12px;margin-bottom:12px;margin-left:12px;margin-right:12px}table.jqplot-table-legend,table.jqplot-cursor-legend{background-color:rgba(255,255,255,0.6);border:1px solid #ccc;position:absolute;font-size:.75em}td.jqplot-table-legend{vertical-align:middle}td.jqplot-seriesToggle:hover,td.jqplot-seriesToggle:active{cursor:pointer}.jqplot-table-legend .jqplot-series-hidden{text-decoration:line-through}div.jqplot-table-legend-swatch-outline{border:1px solid #ccc;padding:1px}div.jqplot-table-legend-swatch{width:0;height:0;border-top-width:5px;border-bottom-width:5px;border-left-width:6px;border-right-width:6px;border-top-style:solid;border-bottom-style:solid;border-left-style:solid;border-right-style:solid}.jqplot-title{top:0;left:0;padding-bottom:.5em;font-size:1.2em}table.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em}.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-highlighter-tooltip,.jqplot-canvasOverlay-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-point-label{font-size:.75em;z-index:2}td.jqplot-cursor-legend-swatch{vertical-align:middle;text-align:center}div.jqplot-cursor-legend-swatch{width:1.2em;height:.7em}.jqplot-error{text-align:center}.jqplot-error-message{position:relative;top:46%;display:inline-block}div.jqplot-bubble-label{font-size:.8em;padding-left:2px;padding-right:2px;color:rgb(20%,20%,20%)}div.jqplot-bubble-label.jqplot-bubble-label-highlight{background:rgba(90%,90%,90%,0.7)}div.jqplot-noData-container{text-align:center;background-color:rgba(96%,96%,96%,0.3)}
|
||||
3
plugin/jqplot/jquery.jqplot.min.js
vendored
Normal file
3
plugin/jqplot/jquery.jqplot.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
314
plugin/jqplot/plugins/jqplot.BezierCurveRenderer.js
Normal file
314
plugin/jqplot/plugins/jqplot.BezierCurveRenderer.js
Normal file
@ -0,0 +1,314 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
// Class: $.jqplot.BezierCurveRenderer.js
|
||||
// Renderer which draws lines as stacked bezier curves.
|
||||
// Data for the line will not be specified as an array of
|
||||
// [x, y] data point values, but as a an array of [start piont, bezier curve]
|
||||
// So, the line is specified as: [[xstart, ystart], [cp1x, cp1y, cp2x, cp2y, xend, yend]].
|
||||
$.jqplot.BezierCurveRenderer = function(){
|
||||
$.jqplot.LineRenderer.call(this);
|
||||
};
|
||||
|
||||
$.jqplot.BezierCurveRenderer.prototype = new $.jqplot.LineRenderer();
|
||||
$.jqplot.BezierCurveRenderer.prototype.constructor = $.jqplot.BezierCurveRenderer;
|
||||
|
||||
|
||||
// Method: setGridData
|
||||
// converts the user data values to grid coordinates and stores them
|
||||
// in the gridData array.
|
||||
// Called with scope of a series.
|
||||
$.jqplot.BezierCurveRenderer.prototype.setGridData = function(plot) {
|
||||
// recalculate the grid data
|
||||
var xp = this._xaxis.series_u2p;
|
||||
var yp = this._yaxis.series_u2p;
|
||||
// this._plotData should be same as this.data
|
||||
var data = this.data;
|
||||
this.gridData = [];
|
||||
this._prevGridData = [];
|
||||
// if seriesIndex = 0, fill to x axis.
|
||||
// if seriesIndex > 0, fill to previous series data.
|
||||
var idx = this.index;
|
||||
if (data.length == 2) {
|
||||
if (idx == 0) {
|
||||
this.gridData = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||
];
|
||||
}
|
||||
else {
|
||||
var psd = plot.series[idx-1].data;
|
||||
this.gridData = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
||||
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
||||
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||
];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (idx == 0) {
|
||||
this.gridData = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||
];
|
||||
}
|
||||
else {
|
||||
var psd = plot.series[idx-1].data;
|
||||
this.gridData = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
||||
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
||||
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||
];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Method: makeGridData
|
||||
// converts any arbitrary data values to grid coordinates and
|
||||
// returns them. This method exists so that plugins can use a series'
|
||||
// linerenderer to generate grid data points without overwriting the
|
||||
// grid data associated with that series.
|
||||
// Called with scope of a series.
|
||||
$.jqplot.BezierCurveRenderer.prototype.makeGridData = function(data, plot) {
|
||||
// recalculate the grid data
|
||||
var xp = this._xaxis.series_u2p;
|
||||
var yp = this._yaxis.series_u2p;
|
||||
var gd = [];
|
||||
var pgd = [];
|
||||
// if seriesIndex = 0, fill to x axis.
|
||||
// if seriesIndex > 0, fill to previous series data.
|
||||
var idx = this.index;
|
||||
if (data.length == 2) {
|
||||
if (idx == 0) {
|
||||
gd = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||
];
|
||||
}
|
||||
else {
|
||||
var psd = plot.series[idx-1].data;
|
||||
gd = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
||||
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
||||
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||
];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (idx == 0) {
|
||||
gd = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||
];
|
||||
}
|
||||
else {
|
||||
var psd = plot.series[idx-1].data;
|
||||
gd = [
|
||||
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
||||
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
||||
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||
];
|
||||
}
|
||||
}
|
||||
return gd;
|
||||
};
|
||||
|
||||
|
||||
// called within scope of series.
|
||||
$.jqplot.BezierCurveRenderer.prototype.draw = function(ctx, gd, options) {
|
||||
var i;
|
||||
ctx.save();
|
||||
if (gd.length) {
|
||||
if (this.showLine) {
|
||||
ctx.save();
|
||||
var opts = (options != null) ? options : {};
|
||||
ctx.fillStyle = opts.fillStyle || this.color;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(gd[0][0], gd[0][1]);
|
||||
ctx.bezierCurveTo(gd[1][0], gd[1][1], gd[1][2], gd[1][3], gd[1][4], gd[1][5]);
|
||||
ctx.lineTo(gd[2][0], gd[2][1]);
|
||||
if (gd[3].length == 2) {
|
||||
ctx.lineTo(gd[3][0], gd[3][1]);
|
||||
}
|
||||
else {
|
||||
ctx.bezierCurveTo(gd[3][0], gd[3][1], gd[3][2], gd[3][3], gd[3][4], gd[3][5]);
|
||||
}
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
$.jqplot.BezierCurveRenderer.prototype.drawShadow = function(ctx, gd, options) {
|
||||
// This is a no-op, shadows drawn with lines.
|
||||
};
|
||||
|
||||
$.jqplot.BezierAxisRenderer = function() {
|
||||
$.jqplot.LinearAxisRenderer.call(this);
|
||||
};
|
||||
|
||||
$.jqplot.BezierAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||
$.jqplot.BezierAxisRenderer.prototype.constructor = $.jqplot.BezierAxisRenderer;
|
||||
|
||||
|
||||
// Axes on a plot with Bezier Curves
|
||||
$.jqplot.BezierAxisRenderer.prototype.init = function(options){
|
||||
$.extend(true, this, options);
|
||||
var db = this._dataBounds;
|
||||
// Go through all the series attached to this axis and find
|
||||
// the min/max bounds for this axis.
|
||||
for (var i=0; i<this._series.length; i++) {
|
||||
var s = this._series[i];
|
||||
var d = s.data;
|
||||
if (d.length == 4) {
|
||||
for (var j=0; j<d.length; j++) {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
if (d[j][0] < db.min || db.min == null) {
|
||||
db.min = d[j][0];
|
||||
}
|
||||
if (d[j][0] > db.max || db.max == null) {
|
||||
db.max = d[j][0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (d[j][1] < db.min || db.min == null) {
|
||||
db.min = d[j][1];
|
||||
}
|
||||
if (d[j][1] > db.max || db.max == null) {
|
||||
db.max = d[j][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
if (d[0][0] < db.min || db.min == null) {
|
||||
db.min = d[0][0];
|
||||
}
|
||||
if (d[0][0] > db.max || db.max == null) {
|
||||
db.max = d[0][0];
|
||||
}
|
||||
for (var j=0; j<5; j+=2) {
|
||||
if (d[1][j] < db.min || db.min == null) {
|
||||
db.min = d[1][j];
|
||||
}
|
||||
if (d[1][j] > db.max || db.max == null) {
|
||||
db.max = d[1][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (d[0][1] < db.min || db.min == null) {
|
||||
db.min = d[0][1];
|
||||
}
|
||||
if (d[0][1] > db.max || db.max == null) {
|
||||
db.max = d[0][1];
|
||||
}
|
||||
for (var j=1; j<6; j+=2) {
|
||||
if (d[1][j] < db.min || db.min == null) {
|
||||
db.min = d[1][j];
|
||||
}
|
||||
if (d[1][j] > db.max || db.max == null) {
|
||||
db.max = d[1][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// setup default renderers for axes and legend so user doesn't have to
|
||||
// called with scope of plot
|
||||
function preInit(target, data, options) {
|
||||
options = options || {};
|
||||
options.axesDefaults = $.extend(true, {pad:0}, options.axesDefaults);
|
||||
options.seriesDefaults = options.seriesDefaults || {};
|
||||
options.legend = $.extend(true, {placement:'outside'}, options.legend);
|
||||
// only set these if there is a pie series
|
||||
var setopts = false;
|
||||
if (options.seriesDefaults.renderer == $.jqplot.BezierCurveRenderer) {
|
||||
setopts = true;
|
||||
}
|
||||
else if (options.series) {
|
||||
for (var i=0; i < options.series.length; i++) {
|
||||
if (options.series[i].renderer == $.jqplot.BezierCurveRenderer) {
|
||||
setopts = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (setopts) {
|
||||
options.axesDefaults.renderer = $.jqplot.BezierAxisRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
$.jqplot.preInitHooks.push(preInit);
|
||||
|
||||
})(jQuery);
|
||||
3
plugin/jqplot/plugins/jqplot.BezierCurveRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.BezierCurveRenderer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
801
plugin/jqplot/plugins/jqplot.barRenderer.js
Normal file
801
plugin/jqplot/plugins/jqplot.barRenderer.js
Normal file
@ -0,0 +1,801 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
// Class: $.jqplot.BarRenderer
|
||||
// A plugin renderer for jqPlot to draw a bar plot.
|
||||
// Draws series as a line.
|
||||
|
||||
$.jqplot.BarRenderer = function(){
|
||||
$.jqplot.LineRenderer.call(this);
|
||||
};
|
||||
|
||||
$.jqplot.BarRenderer.prototype = new $.jqplot.LineRenderer();
|
||||
$.jqplot.BarRenderer.prototype.constructor = $.jqplot.BarRenderer;
|
||||
|
||||
// called with scope of series.
|
||||
$.jqplot.BarRenderer.prototype.init = function(options, plot) {
|
||||
// Group: Properties
|
||||
//
|
||||
// prop: barPadding
|
||||
// Number of pixels between adjacent bars at the same axis value.
|
||||
this.barPadding = 8;
|
||||
// prop: barMargin
|
||||
// Number of pixels between groups of bars at adjacent axis values.
|
||||
this.barMargin = 10;
|
||||
// prop: barDirection
|
||||
// 'vertical' = up and down bars, 'horizontal' = side to side bars
|
||||
this.barDirection = 'vertical';
|
||||
// prop: barWidth
|
||||
// Width of the bar in pixels (auto by devaul). null = calculated automatically.
|
||||
this.barWidth = null;
|
||||
// prop: shadowOffset
|
||||
// offset of the shadow from the slice and offset of
|
||||
// each succesive stroke of the shadow from the last.
|
||||
this.shadowOffset = 2;
|
||||
// prop: shadowDepth
|
||||
// number of strokes to apply to the shadow,
|
||||
// each stroke offset shadowOffset from the last.
|
||||
this.shadowDepth = 5;
|
||||
// prop: shadowAlpha
|
||||
// transparency of the shadow (0 = transparent, 1 = opaque)
|
||||
this.shadowAlpha = 0.08;
|
||||
// prop: waterfall
|
||||
// true to enable waterfall plot.
|
||||
this.waterfall = false;
|
||||
// prop: groups
|
||||
// group bars into this many groups
|
||||
this.groups = 1;
|
||||
// prop: varyBarColor
|
||||
// true to color each bar of a series separately rather than
|
||||
// have every bar of a given series the same color.
|
||||
// If used for non-stacked multiple series bar plots, user should
|
||||
// specify a separate 'seriesColors' array for each series.
|
||||
// Otherwise, each series will set their bars to the same color array.
|
||||
// This option has no Effect for stacked bar charts and is disabled.
|
||||
this.varyBarColor = false;
|
||||
// prop: highlightMouseOver
|
||||
// True to highlight slice when moused over.
|
||||
// This must be false to enable highlightMouseDown to highlight when clicking on a slice.
|
||||
this.highlightMouseOver = true;
|
||||
// prop: highlightMouseDown
|
||||
// True to highlight when a mouse button is pressed over a slice.
|
||||
// This will be disabled if highlightMouseOver is true.
|
||||
this.highlightMouseDown = false;
|
||||
// prop: highlightColors
|
||||
// an array of colors to use when highlighting a bar.
|
||||
this.highlightColors = [];
|
||||
// prop: transposedData
|
||||
// NOT IMPLEMENTED YET. True if this is a horizontal bar plot and
|
||||
// x and y values are "transposed". Tranposed, or "swapped", data is
|
||||
// required prior to rev. 894 builds of jqPlot with horizontal bars.
|
||||
// Allows backward compatability of bar renderer horizontal bars with
|
||||
// old style data sets.
|
||||
this.transposedData = true;
|
||||
this.renderer.animation = {
|
||||
show: false,
|
||||
direction: 'down',
|
||||
speed: 3000,
|
||||
_supported: true
|
||||
};
|
||||
this._type = 'bar';
|
||||
|
||||
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
|
||||
if (options.highlightMouseDown && options.highlightMouseOver == null) {
|
||||
options.highlightMouseOver = false;
|
||||
}
|
||||
|
||||
//////
|
||||
// This is probably wrong here.
|
||||
// After going back and forth on whether renderer should be the thing
|
||||
// or extend the thing, it seems that it it best if it is a property
|
||||
// on the thing. This should be something that is commonized
|
||||
// among series renderers in the future.
|
||||
//////
|
||||
$.extend(true, this, options);
|
||||
|
||||
// really should probably do this
|
||||
$.extend(true, this.renderer, options);
|
||||
// fill is still needed to properly draw the legend.
|
||||
// bars have to be filled.
|
||||
this.fill = true;
|
||||
|
||||
// if horizontal bar and animating, reset the default direction
|
||||
if (this.barDirection === 'horizontal' && this.rendererOptions.animation && this.rendererOptions.animation.direction == null) {
|
||||
this.renderer.animation.direction = 'left';
|
||||
}
|
||||
|
||||
if (this.waterfall) {
|
||||
this.fillToZero = false;
|
||||
this.disableStack = true;
|
||||
}
|
||||
|
||||
if (this.barDirection == 'vertical' ) {
|
||||
this._primaryAxis = '_xaxis';
|
||||
this._stackAxis = 'y';
|
||||
this.fillAxis = 'y';
|
||||
}
|
||||
else {
|
||||
this._primaryAxis = '_yaxis';
|
||||
this._stackAxis = 'x';
|
||||
this.fillAxis = 'x';
|
||||
}
|
||||
// index of the currenty highlighted point, if any
|
||||
this._highlightedPoint = null;
|
||||
// total number of values for all bar series, total number of bar series, and position of this series
|
||||
this._plotSeriesInfo = null;
|
||||
// Array of actual data colors used for each data point.
|
||||
this._dataColors = [];
|
||||
this._barPoints = [];
|
||||
|
||||
// set the shape renderer options
|
||||
var opts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, strokeStyle:this.color, fillStyle:this.color, closePath:this.fill};
|
||||
this.renderer.shapeRenderer.init(opts);
|
||||
// set the shadow renderer options
|
||||
var sopts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, closePath:this.fill};
|
||||
this.renderer.shadowRenderer.init(sopts);
|
||||
|
||||
plot.postInitHooks.addOnce(postInit);
|
||||
plot.postDrawHooks.addOnce(postPlotDraw);
|
||||
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
|
||||
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
|
||||
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
|
||||
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
|
||||
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
|
||||
};
|
||||
|
||||
// called with scope of series
|
||||
function barPreInit(target, data, seriesDefaults, options) {
|
||||
if (this.rendererOptions.barDirection == 'horizontal') {
|
||||
this._stackAxis = 'x';
|
||||
this._primaryAxis = '_yaxis';
|
||||
}
|
||||
if (this.rendererOptions.waterfall == true) {
|
||||
this._data = $.extend(true, [], this.data);
|
||||
var sum = 0;
|
||||
var pos = (!this.rendererOptions.barDirection || this.rendererOptions.barDirection === 'vertical' || this.transposedData === false) ? 1 : 0;
|
||||
for(var i=0; i<this.data.length; i++) {
|
||||
sum += this.data[i][pos];
|
||||
if (i>0) {
|
||||
this.data[i][pos] += this.data[i-1][pos];
|
||||
}
|
||||
}
|
||||
this.data[this.data.length] = (pos == 1) ? [this.data.length+1, sum] : [sum, this.data.length+1];
|
||||
this._data[this._data.length] = (pos == 1) ? [this._data.length+1, sum] : [sum, this._data.length+1];
|
||||
}
|
||||
if (this.rendererOptions.groups > 1) {
|
||||
this.breakOnNull = true;
|
||||
var l = this.data.length;
|
||||
var skip = parseInt(l/this.rendererOptions.groups, 10);
|
||||
var count = 0;
|
||||
for (var i=skip; i<l; i+=skip) {
|
||||
this.data.splice(i+count, 0, [null, null]);
|
||||
this._plotData.splice(i+count, 0, [null, null]);
|
||||
this._stackData.splice(i+count, 0, [null, null]);
|
||||
count++;
|
||||
}
|
||||
for (i=0; i<this.data.length; i++) {
|
||||
if (this._primaryAxis == '_xaxis') {
|
||||
this.data[i][0] = i+1;
|
||||
this._plotData[i][0] = i+1;
|
||||
this._stackData[i][0] = i+1;
|
||||
}
|
||||
else {
|
||||
this.data[i][1] = i+1;
|
||||
this._plotData[i][1] = i+1;
|
||||
this._stackData[i][1] = i+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.jqplot.preSeriesInitHooks.push(barPreInit);
|
||||
|
||||
// needs to be called with scope of series, not renderer.
|
||||
$.jqplot.BarRenderer.prototype.calcSeriesNumbers = function() {
|
||||
var nvals = 0;
|
||||
var nseries = 0;
|
||||
var paxis = this[this._primaryAxis];
|
||||
var s, series, pos;
|
||||
// loop through all series on this axis
|
||||
for (var i=0; i < paxis._series.length; i++) {
|
||||
series = paxis._series[i];
|
||||
if (series === this) {
|
||||
pos = i;
|
||||
}
|
||||
// is the series rendered as a bar?
|
||||
if (series.renderer.constructor == $.jqplot.BarRenderer) {
|
||||
// gridData may not be computed yet, use data length insted
|
||||
nvals += series.data.length;
|
||||
nseries += 1;
|
||||
}
|
||||
}
|
||||
// return total number of values for all bar series, total number of bar series, and position of this series
|
||||
return [nvals, nseries, pos];
|
||||
};
|
||||
|
||||
$.jqplot.BarRenderer.prototype.setBarWidth = function() {
|
||||
// need to know how many data values we have on the approprate axis and figure it out.
|
||||
var i;
|
||||
var nvals = 0;
|
||||
var nseries = 0;
|
||||
var paxis = this[this._primaryAxis];
|
||||
var s, series, pos;
|
||||
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
||||
nvals = temp[0];
|
||||
nseries = temp[1];
|
||||
var nticks = paxis.numberTicks;
|
||||
var nbins = (nticks-1)/2;
|
||||
// so, now we have total number of axis values.
|
||||
if (paxis.name == 'xaxis' || paxis.name == 'x2axis') {
|
||||
if (this._stack) {
|
||||
this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals * nseries - this.barMargin;
|
||||
}
|
||||
else {
|
||||
this.barWidth = ((paxis._offsets.max - paxis._offsets.min)/nbins - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
|
||||
// this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals - this.barPadding - this.barMargin/nseries;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this._stack) {
|
||||
this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals * nseries - this.barMargin;
|
||||
}
|
||||
else {
|
||||
this.barWidth = ((paxis._offsets.min - paxis._offsets.max)/nbins - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
|
||||
// this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals - this.barPadding - this.barMargin/nseries;
|
||||
}
|
||||
}
|
||||
return [nvals, nseries];
|
||||
};
|
||||
|
||||
function computeHighlightColors (colors) {
|
||||
var ret = [];
|
||||
for (var i=0; i<colors.length; i++){
|
||||
var rgba = $.jqplot.getColorComponents(colors[i]);
|
||||
var newrgb = [rgba[0], rgba[1], rgba[2]];
|
||||
var sum = newrgb[0] + newrgb[1] + newrgb[2];
|
||||
for (var j=0; j<3; j++) {
|
||||
// when darkening, lowest color component can be is 60.
|
||||
newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
|
||||
newrgb[j] = parseInt(newrgb[j], 10);
|
||||
}
|
||||
ret.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getStart(sidx, didx, comp, plot, axis) {
|
||||
// check if sign change
|
||||
var seriesIndex = sidx,
|
||||
prevSeriesIndex = sidx - 1,
|
||||
start,
|
||||
prevVal,
|
||||
aidx = (axis === 'x') ? 0 : 1;
|
||||
|
||||
// is this not the first series?
|
||||
if (seriesIndex > 0) {
|
||||
prevVal = plot.series[prevSeriesIndex]._plotData[didx][aidx];
|
||||
|
||||
// is there a sign change
|
||||
if ((comp * prevVal) < 0) {
|
||||
start = getStart(prevSeriesIndex, didx, comp, plot, axis);
|
||||
}
|
||||
|
||||
// no sign change.
|
||||
else {
|
||||
start = plot.series[prevSeriesIndex].gridData[didx][aidx];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if first series, return value at 0
|
||||
else {
|
||||
|
||||
start = (aidx === 0) ? plot.series[seriesIndex]._xaxis.series_u2p(0) : plot.series[seriesIndex]._yaxis.series_u2p(0);
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
$.jqplot.BarRenderer.prototype.draw = function(ctx, gridData, options, plot) {
|
||||
var i;
|
||||
// Ughhh, have to make a copy of options b/c it may be modified later.
|
||||
var opts = $.extend({}, options);
|
||||
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
|
||||
var fill = (opts.fill != undefined) ? opts.fill : this.fill;
|
||||
var xaxis = this.xaxis;
|
||||
var yaxis = this.yaxis;
|
||||
var xp = this._xaxis.series_u2p;
|
||||
var yp = this._yaxis.series_u2p;
|
||||
var pointx, pointy;
|
||||
// clear out data colors.
|
||||
this._dataColors = [];
|
||||
this._barPoints = [];
|
||||
|
||||
if (this.barWidth == null) {
|
||||
this.renderer.setBarWidth.call(this);
|
||||
}
|
||||
|
||||
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
||||
var nvals = temp[0];
|
||||
var nseries = temp[1];
|
||||
var pos = temp[2];
|
||||
var points = [];
|
||||
|
||||
if (this._stack) {
|
||||
this._barNudge = 0;
|
||||
}
|
||||
else {
|
||||
this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
|
||||
}
|
||||
if (showLine) {
|
||||
var negativeColors = new $.jqplot.ColorGenerator(this.negativeSeriesColors);
|
||||
var positiveColors = new $.jqplot.ColorGenerator(this.seriesColors);
|
||||
var negativeColor = negativeColors.get(this.index);
|
||||
if (! this.useNegativeColors) {
|
||||
negativeColor = opts.fillStyle;
|
||||
}
|
||||
var positiveColor = opts.fillStyle;
|
||||
var base;
|
||||
var xstart;
|
||||
var ystart;
|
||||
|
||||
if (this.barDirection == 'vertical') {
|
||||
for (var i=0; i<gridData.length; i++) {
|
||||
if (!this._stack && this.data[i][1] == null) {
|
||||
continue;
|
||||
}
|
||||
points = [];
|
||||
base = gridData[i][0] + this._barNudge;
|
||||
|
||||
// stacked
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
ystart = getStart(this.index, i, this._plotData[i][1], plot, 'y');
|
||||
}
|
||||
|
||||
// not stacked
|
||||
else {
|
||||
if (this.fillToZero) {
|
||||
ystart = this._yaxis.series_u2p(0);
|
||||
}
|
||||
else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
|
||||
ystart = this.gridData[i-1][1];
|
||||
}
|
||||
else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
|
||||
if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
|
||||
ystart = this._yaxis.series_u2p(0);
|
||||
}
|
||||
else if (this._yaxis.min > 0) {
|
||||
ystart = ctx.canvas.height;
|
||||
}
|
||||
else {
|
||||
ystart = 0;
|
||||
}
|
||||
}
|
||||
else if (this.waterfall && i == this.gridData.length - 1) {
|
||||
if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
|
||||
ystart = this._yaxis.series_u2p(0);
|
||||
}
|
||||
else if (this._yaxis.min > 0) {
|
||||
ystart = ctx.canvas.height;
|
||||
}
|
||||
else {
|
||||
ystart = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ystart = ctx.canvas.height;
|
||||
}
|
||||
}
|
||||
if ((this.fillToZero && this._plotData[i][1] < 0) || (this.waterfall && this._data[i][1] < 0)) {
|
||||
if (this.varyBarColor && !this._stack) {
|
||||
if (this.useNegativeColors) {
|
||||
opts.fillStyle = negativeColors.next();
|
||||
}
|
||||
else {
|
||||
opts.fillStyle = positiveColors.next();
|
||||
}
|
||||
}
|
||||
else {
|
||||
opts.fillStyle = negativeColor;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.varyBarColor && !this._stack) {
|
||||
opts.fillStyle = positiveColors.next();
|
||||
}
|
||||
else {
|
||||
opts.fillStyle = positiveColor;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.fillToZero || this._plotData[i][1] >= 0) {
|
||||
points.push([base-this.barWidth/2, ystart]);
|
||||
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, ystart]);
|
||||
}
|
||||
// for negative bars make sure points are always ordered clockwise
|
||||
else {
|
||||
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base-this.barWidth/2, ystart]);
|
||||
points.push([base+this.barWidth/2, ystart]);
|
||||
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||
}
|
||||
this._barPoints.push(points);
|
||||
// now draw the shadows if not stacked.
|
||||
// for stacked plots, they are predrawn by drawShadow
|
||||
if (shadow && !this._stack) {
|
||||
var sopts = $.extend(true, {}, opts);
|
||||
// need to get rid of fillStyle on shadow.
|
||||
delete sopts.fillStyle;
|
||||
this.renderer.shadowRenderer.draw(ctx, points, sopts);
|
||||
}
|
||||
var clr = opts.fillStyle || this.color;
|
||||
this._dataColors.push(clr);
|
||||
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
||||
}
|
||||
}
|
||||
|
||||
else if (this.barDirection == 'horizontal'){
|
||||
for (var i=0; i<gridData.length; i++) {
|
||||
if (!this._stack && this.data[i][0] == null) {
|
||||
continue;
|
||||
}
|
||||
points = [];
|
||||
base = gridData[i][1] - this._barNudge;
|
||||
xstart;
|
||||
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
xstart = getStart(this.index, i, this._plotData[i][0], plot, 'x');
|
||||
}
|
||||
// not stacked
|
||||
else {
|
||||
if (this.fillToZero) {
|
||||
xstart = this._xaxis.series_u2p(0);
|
||||
}
|
||||
else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
|
||||
xstart = this.gridData[i-1][0];
|
||||
}
|
||||
else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
|
||||
if (this._xaxis.min <= 0 && this._xaxis.max >= 0) {
|
||||
xstart = this._xaxis.series_u2p(0);
|
||||
}
|
||||
else if (this._xaxis.min > 0) {
|
||||
xstart = 0;
|
||||
}
|
||||
else {
|
||||
xstart = 0;
|
||||
}
|
||||
}
|
||||
else if (this.waterfall && i == this.gridData.length - 1) {
|
||||
if (this._xaxis.min <= 0 && this._xaxis.max >= 0) {
|
||||
xstart = this._xaxis.series_u2p(0);
|
||||
}
|
||||
else if (this._xaxis.min > 0) {
|
||||
xstart = 0;
|
||||
}
|
||||
else {
|
||||
xstart = ctx.canvas.width;
|
||||
}
|
||||
}
|
||||
else {
|
||||
xstart = 0;
|
||||
}
|
||||
}
|
||||
if ((this.fillToZero && this._plotData[i][0] < 0) || (this.waterfall && this._data[i][0] < 0)) {
|
||||
if (this.varyBarColor && !this._stack) {
|
||||
if (this.useNegativeColors) {
|
||||
opts.fillStyle = negativeColors.next();
|
||||
}
|
||||
else {
|
||||
opts.fillStyle = positiveColors.next();
|
||||
}
|
||||
}
|
||||
else {
|
||||
opts.fillStyle = negativeColor;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.varyBarColor && !this._stack) {
|
||||
opts.fillStyle = positiveColors.next();
|
||||
}
|
||||
else {
|
||||
opts.fillStyle = positiveColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!this.fillToZero || this._plotData[i][0] >= 0) {
|
||||
points.push([xstart, base + this.barWidth / 2]);
|
||||
points.push([xstart, base - this.barWidth / 2]);
|
||||
points.push([gridData[i][0], base - this.barWidth / 2]);
|
||||
points.push([gridData[i][0], base + this.barWidth / 2]);
|
||||
}
|
||||
else {
|
||||
points.push([gridData[i][0], base + this.barWidth / 2]);
|
||||
points.push([gridData[i][0], base - this.barWidth / 2]);
|
||||
points.push([xstart, base - this.barWidth / 2]);
|
||||
points.push([xstart, base + this.barWidth / 2]);
|
||||
}
|
||||
|
||||
this._barPoints.push(points);
|
||||
// now draw the shadows if not stacked.
|
||||
// for stacked plots, they are predrawn by drawShadow
|
||||
if (shadow && !this._stack) {
|
||||
var sopts = $.extend(true, {}, opts);
|
||||
delete sopts.fillStyle;
|
||||
this.renderer.shadowRenderer.draw(ctx, points, sopts);
|
||||
}
|
||||
var clr = opts.fillStyle || this.color;
|
||||
this._dataColors.push(clr);
|
||||
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.highlightColors.length == 0) {
|
||||
this.highlightColors = $.jqplot.computeHighlightColors(this._dataColors);
|
||||
}
|
||||
|
||||
else if (typeof(this.highlightColors) == 'string') {
|
||||
var temp = this.highlightColors;
|
||||
this.highlightColors = [];
|
||||
for (var i=0; i<this._dataColors.length; i++) {
|
||||
this.highlightColors.push(temp);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// for stacked plots, shadows will be pre drawn by drawShadow.
|
||||
$.jqplot.BarRenderer.prototype.drawShadow = function(ctx, gridData, options, plot) {
|
||||
var i;
|
||||
var opts = (options != undefined) ? options : {};
|
||||
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
|
||||
var fill = (opts.fill != undefined) ? opts.fill : this.fill;
|
||||
var xaxis = this.xaxis;
|
||||
var yaxis = this.yaxis;
|
||||
var xp = this._xaxis.series_u2p;
|
||||
var yp = this._yaxis.series_u2p;
|
||||
var pointx, points, pointy, nvals, nseries, pos;
|
||||
|
||||
if (this._stack && this.shadow) {
|
||||
if (this.barWidth == null) {
|
||||
this.renderer.setBarWidth.call(this);
|
||||
}
|
||||
|
||||
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
||||
nvals = temp[0];
|
||||
nseries = temp[1];
|
||||
pos = temp[2];
|
||||
|
||||
if (this._stack) {
|
||||
this._barNudge = 0;
|
||||
}
|
||||
else {
|
||||
this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
|
||||
}
|
||||
if (showLine) {
|
||||
|
||||
if (this.barDirection == 'vertical') {
|
||||
for (var i=0; i<gridData.length; i++) {
|
||||
if (this.data[i][1] == null) {
|
||||
continue;
|
||||
}
|
||||
points = [];
|
||||
var base = gridData[i][0] + this._barNudge;
|
||||
var ystart;
|
||||
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
ystart = getStart(this.index, i, this._plotData[i][1], plot, 'y');
|
||||
}
|
||||
else {
|
||||
if (this.fillToZero) {
|
||||
ystart = this._yaxis.series_u2p(0);
|
||||
}
|
||||
else {
|
||||
ystart = ctx.canvas.height;
|
||||
}
|
||||
}
|
||||
|
||||
points.push([base-this.barWidth/2, ystart]);
|
||||
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, ystart]);
|
||||
this.renderer.shadowRenderer.draw(ctx, points, opts);
|
||||
}
|
||||
}
|
||||
|
||||
else if (this.barDirection == 'horizontal'){
|
||||
for (var i=0; i<gridData.length; i++) {
|
||||
if (this.data[i][0] == null) {
|
||||
continue;
|
||||
}
|
||||
points = [];
|
||||
var base = gridData[i][1] - this._barNudge;
|
||||
var xstart;
|
||||
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
xstart = getStart(this.index, i, this._plotData[i][0], plot, 'x');
|
||||
}
|
||||
else {
|
||||
if (this.fillToZero) {
|
||||
xstart = this._xaxis.series_u2p(0);
|
||||
}
|
||||
else {
|
||||
xstart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
points.push([xstart, base+this.barWidth/2]);
|
||||
points.push([gridData[i][0], base+this.barWidth/2]);
|
||||
points.push([gridData[i][0], base-this.barWidth/2]);
|
||||
points.push([xstart, base-this.barWidth/2]);
|
||||
this.renderer.shadowRenderer.draw(ctx, points, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
function postInit(target, data, options) {
|
||||
for (var i=0; i<this.series.length; i++) {
|
||||
if (this.series[i].renderer.constructor == $.jqplot.BarRenderer) {
|
||||
// don't allow mouseover and mousedown at same time.
|
||||
if (this.series[i].highlightMouseOver) {
|
||||
this.series[i].highlightMouseDown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// called within context of plot
|
||||
// create a canvas which we can draw on.
|
||||
// insert it before the eventCanvas, so eventCanvas will still capture events.
|
||||
function postPlotDraw() {
|
||||
// Memory Leaks patch
|
||||
if (this.plugins.barRenderer && this.plugins.barRenderer.highlightCanvas) {
|
||||
|
||||
this.plugins.barRenderer.highlightCanvas.resetCanvas();
|
||||
this.plugins.barRenderer.highlightCanvas = null;
|
||||
}
|
||||
|
||||
this.plugins.barRenderer = {highlightedSeriesIndex:null};
|
||||
this.plugins.barRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
|
||||
|
||||
this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-barRenderer-highlight-canvas', this._plotDimensions, this));
|
||||
this.plugins.barRenderer.highlightCanvas.setContext();
|
||||
this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
|
||||
}
|
||||
|
||||
function highlight (plot, sidx, pidx, points) {
|
||||
var s = plot.series[sidx];
|
||||
var canvas = plot.plugins.barRenderer.highlightCanvas;
|
||||
canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||
s._highlightedPoint = pidx;
|
||||
plot.plugins.barRenderer.highlightedSeriesIndex = sidx;
|
||||
var opts = {fillStyle: s.highlightColors[pidx]};
|
||||
s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
|
||||
canvas = null;
|
||||
}
|
||||
|
||||
function unhighlight (plot) {
|
||||
var canvas = plot.plugins.barRenderer.highlightCanvas;
|
||||
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||
for (var i=0; i<plot.series.length; i++) {
|
||||
plot.series[i]._highlightedPoint = null;
|
||||
}
|
||||
plot.plugins.barRenderer.highlightedSeriesIndex = null;
|
||||
plot.target.trigger('jqplotDataUnhighlight');
|
||||
canvas = null;
|
||||
}
|
||||
|
||||
|
||||
function handleMove(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||
var evt1 = jQuery.Event('jqplotDataMouseOver');
|
||||
evt1.pageX = ev.pageX;
|
||||
evt1.pageY = ev.pageY;
|
||||
plot.target.trigger(evt1, ins);
|
||||
if (plot.series[ins[0]].show && plot.series[ins[0]].highlightMouseOver &&
|
||||
!(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||
var evt = jQuery.Event('jqplotDataHighlight');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
|
||||
}
|
||||
}
|
||||
else if (neighbor == null) {
|
||||
unhighlight (plot);
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||
var evt = jQuery.Event('jqplotDataHighlight');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
|
||||
}
|
||||
}
|
||||
else if (neighbor == null) {
|
||||
unhighlight (plot);
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
|
||||
var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
|
||||
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||
unhighlight(plot);
|
||||
}
|
||||
}
|
||||
|
||||
function handleClick(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||
var evt = jQuery.Event('jqplotDataClick');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
}
|
||||
}
|
||||
|
||||
function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||
var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
|
||||
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||
unhighlight(plot);
|
||||
}
|
||||
var evt = jQuery.Event('jqplotDataRightClick');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})(jQuery);
|
||||
3
plugin/jqplot/plugins/jqplot.barRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.barRenderer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
235
plugin/jqplot/plugins/jqplot.blockRenderer.js
Normal file
235
plugin/jqplot/plugins/jqplot.blockRenderer.js
Normal file
@ -0,0 +1,235 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* Class: $.jqplot.BlockRenderer
|
||||
* Plugin renderer to draw a x-y block chart. A Block chart has data points displayed as
|
||||
* colored squares with a text label inside. Data must be supplied in the form:
|
||||
*
|
||||
* > [[x1, y1, "label 1", {css}], [x2, y2, "label 2", {css}], ...]
|
||||
*
|
||||
* The label and css object are optional. If the label is ommitted, the
|
||||
* box will collapse unless a css height and/or width is specified.
|
||||
*
|
||||
* The css object is an object specifying css properties
|
||||
* such as:
|
||||
*
|
||||
* > {background:'#4f98a5', border:'3px solid gray', padding:'1px'}
|
||||
*
|
||||
* Note that css properties specified with the data point override defaults
|
||||
* specified with the series.
|
||||
*
|
||||
*/
|
||||
$.jqplot.BlockRenderer = function(){
|
||||
$.jqplot.LineRenderer.call(this);
|
||||
};
|
||||
|
||||
$.jqplot.BlockRenderer.prototype = new $.jqplot.LineRenderer();
|
||||
$.jqplot.BlockRenderer.prototype.constructor = $.jqplot.BlockRenderer;
|
||||
|
||||
// called with scope of a series
|
||||
$.jqplot.BlockRenderer.prototype.init = function(options) {
|
||||
// Group: Properties
|
||||
//
|
||||
// prop: css
|
||||
// default css styles that will be applied to all data blocks.
|
||||
// these values will be overridden by css styles supplied with the
|
||||
// individulal data points.
|
||||
this.css = {padding:'2px', border:'1px solid #999', textAlign:'center'};
|
||||
// prop: escapeHtml
|
||||
// true to escape html in the box label.
|
||||
this.escapeHtml = false;
|
||||
// prop: insertBreaks
|
||||
// true to turn spaces in data block label into html breaks <br />.
|
||||
this.insertBreaks = true;
|
||||
// prop: varyBlockColors
|
||||
// true to vary the color of each block in this series according to
|
||||
// the seriesColors array. False to set each block to the color
|
||||
// specified on this series. This has no effect if a css background color
|
||||
// option is specified in the renderer css options.
|
||||
this.varyBlockColors = false;
|
||||
$.extend(true, this, options);
|
||||
if (this.css.backgroundColor) {
|
||||
this.color = this.css.backgroundColor;
|
||||
}
|
||||
else if (this.css.background) {
|
||||
this.color = this.css.background;
|
||||
}
|
||||
else if (!this.varyBlockColors) {
|
||||
this.css.background = this.color;
|
||||
}
|
||||
this.canvas = new $.jqplot.BlockCanvas();
|
||||
this.shadowCanvas = new $.jqplot.BlockCanvas();
|
||||
this.canvas._plotDimensions = this._plotDimensions;
|
||||
this.shadowCanvas._plotDimensions = this._plotDimensions;
|
||||
this._type = 'block';
|
||||
|
||||
// group: Methods
|
||||
//
|
||||
// Method: moveBlock
|
||||
// Moves an individual block. More efficient than redrawing
|
||||
// the whole series by calling plot.drawSeries().
|
||||
// Properties:
|
||||
// idx - the 0 based index of the block or point in this series.
|
||||
// x - the x coordinate in data units (value on x axis) to move the block to.
|
||||
// y - the y coordinate in data units (value on the y axis) to move the block to.
|
||||
// duration - optional parameter to create an animated movement. Can be a
|
||||
// number (higher is slower animation) or 'fast', 'normal' or 'slow'. If not
|
||||
// provided, the element is moved without any animation.
|
||||
this.moveBlock = function (idx, x, y, duration) {
|
||||
// update plotData, stackData, data and gridData
|
||||
// x and y are in data coordinates.
|
||||
var el = this.canvas._elem.children(':eq('+idx+')');
|
||||
this.data[idx][0] = x;
|
||||
this.data[idx][1] = y;
|
||||
this._plotData[idx][0] = x;
|
||||
this._plotData[idx][1] = y;
|
||||
this._stackData[idx][0] = x;
|
||||
this._stackData[idx][1] = y;
|
||||
this.gridData[idx][0] = this._xaxis.series_u2p(x);
|
||||
this.gridData[idx][1] = this._yaxis.series_u2p(y);
|
||||
var w = el.outerWidth();
|
||||
var h = el.outerHeight();
|
||||
var left = this.gridData[idx][0] - w/2 + 'px';
|
||||
var top = this.gridData[idx][1] - h/2 + 'px';
|
||||
if (duration) {
|
||||
if (parseInt(duration, 10)) {
|
||||
duration = parseInt(duration, 10);
|
||||
}
|
||||
el.animate({left:left, top:top}, duration);
|
||||
}
|
||||
else {
|
||||
el.css({left:left, top:top});
|
||||
}
|
||||
el = null;
|
||||
};
|
||||
};
|
||||
|
||||
// called with scope of series
|
||||
$.jqplot.BlockRenderer.prototype.draw = function (ctx, gd, options) {
|
||||
if (this.plugins.pointLabels) {
|
||||
this.plugins.pointLabels.show = false;
|
||||
}
|
||||
var i, el, d, gd, t, css, w, h, left, top;
|
||||
var opts = (options != undefined) ? options : {};
|
||||
var colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
|
||||
this.canvas._elem.empty();
|
||||
for (i=0; i<this.gridData.length; i++) {
|
||||
d = this.data[i];
|
||||
gd = this.gridData[i];
|
||||
t = '';
|
||||
css = {};
|
||||
if (typeof d[2] == 'string') {
|
||||
t = d[2];
|
||||
}
|
||||
else if (typeof d[2] == 'object') {
|
||||
css = d[2];
|
||||
}
|
||||
if (typeof d[3] == 'object') {
|
||||
css = d[3];
|
||||
}
|
||||
if (this.insertBreaks){
|
||||
t = t.replace(/ /g, '<br />');
|
||||
}
|
||||
css = $.extend(true, {}, this.css, css);
|
||||
// create a div
|
||||
el = $('<div style="position:absolute;margin-left:auto;margin-right:auto;"></div>');
|
||||
this.canvas._elem.append(el);
|
||||
// set text
|
||||
this.escapeHtml ? el.text(t) : el.html(t);
|
||||
// style it
|
||||
// remove styles we don't want overridden.
|
||||
delete css.position;
|
||||
delete css.marginRight;
|
||||
delete css.marginLeft;
|
||||
if (!css.background && !css.backgroundColor && !css.backgroundImage){
|
||||
css.background = colorGenerator.next();
|
||||
}
|
||||
el.css(css);
|
||||
w = el.outerWidth();
|
||||
h = el.outerHeight();
|
||||
left = gd[0] - w/2 + 'px';
|
||||
top = gd[1] - h/2 + 'px';
|
||||
el.css({left:left, top:top});
|
||||
el = null;
|
||||
}
|
||||
};
|
||||
|
||||
$.jqplot.BlockCanvas = function() {
|
||||
$.jqplot.ElemContainer.call(this);
|
||||
this._ctx;
|
||||
};
|
||||
|
||||
$.jqplot.BlockCanvas.prototype = new $.jqplot.ElemContainer();
|
||||
$.jqplot.BlockCanvas.prototype.constructor = $.jqplot.BlockCanvas;
|
||||
|
||||
$.jqplot.BlockCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
|
||||
this._offsets = offsets;
|
||||
var klass = 'jqplot-blockCanvas';
|
||||
if (clss != undefined) {
|
||||
klass = clss;
|
||||
}
|
||||
var elem;
|
||||
// if this canvas already has a dom element, don't make a new one.
|
||||
if (this._elem) {
|
||||
elem = this._elem.get(0);
|
||||
}
|
||||
else {
|
||||
elem = document.createElement('div');
|
||||
}
|
||||
// if new plotDimensions supplied, use them.
|
||||
if (plotDimensions != undefined) {
|
||||
this._plotDimensions = plotDimensions;
|
||||
}
|
||||
|
||||
var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
|
||||
var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
|
||||
this._elem = $(elem);
|
||||
this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
|
||||
|
||||
this._elem.addClass(klass);
|
||||
return this._elem;
|
||||
};
|
||||
|
||||
$.jqplot.BlockCanvas.prototype.setContext = function() {
|
||||
this._ctx = {
|
||||
canvas:{
|
||||
width:0,
|
||||
height:0
|
||||
},
|
||||
clearRect:function(){return null;}
|
||||
};
|
||||
return this._ctx;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
3
plugin/jqplot/plugins/jqplot.blockRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.blockRenderer.min.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||
jsDate | (c) 2010-2013 Chris Leonello
|
||||
*/(function(a){a.jqplot.BlockRenderer=function(){a.jqplot.LineRenderer.call(this)};a.jqplot.BlockRenderer.prototype=new a.jqplot.LineRenderer();a.jqplot.BlockRenderer.prototype.constructor=a.jqplot.BlockRenderer;a.jqplot.BlockRenderer.prototype.init=function(b){this.css={padding:"2px",border:"1px solid #999",textAlign:"center"};this.escapeHtml=false;this.insertBreaks=true;this.varyBlockColors=false;a.extend(true,this,b);if(this.css.backgroundColor){this.color=this.css.backgroundColor}else{if(this.css.background){this.color=this.css.background}else{if(!this.varyBlockColors){this.css.background=this.color}}}this.canvas=new a.jqplot.BlockCanvas();this.shadowCanvas=new a.jqplot.BlockCanvas();this.canvas._plotDimensions=this._plotDimensions;this.shadowCanvas._plotDimensions=this._plotDimensions;this._type="block";this.moveBlock=function(l,j,i,e){var c=this.canvas._elem.children(":eq("+l+")");this.data[l][0]=j;this.data[l][1]=i;this._plotData[l][0]=j;this._plotData[l][1]=i;this._stackData[l][0]=j;this._stackData[l][1]=i;this.gridData[l][0]=this._xaxis.series_u2p(j);this.gridData[l][1]=this._yaxis.series_u2p(i);var k=c.outerWidth();var f=c.outerHeight();var d=this.gridData[l][0]-k/2+"px";var g=this.gridData[l][1]-f/2+"px";if(e){if(parseInt(e,10)){e=parseInt(e,10)}c.animate({left:d,top:g},e)}else{c.css({left:d,top:g})}c=null}};a.jqplot.BlockRenderer.prototype.draw=function(q,o,r){if(this.plugins.pointLabels){this.plugins.pointLabels.show=false}var f,c,l,o,p,k,n,g,e,m;var b=(r!=undefined)?r:{};var j=new a.jqplot.ColorGenerator(this.seriesColors);this.canvas._elem.empty();for(f=0;f<this.gridData.length;f++){l=this.data[f];o=this.gridData[f];p="";k={};if(typeof l[2]=="string"){p=l[2]}else{if(typeof l[2]=="object"){k=l[2]}}if(typeof l[3]=="object"){k=l[3]}if(this.insertBreaks){p=p.replace(/ /g,"<br />")}k=a.extend(true,{},this.css,k);c=a('<div style="position:absolute;margin-left:auto;margin-right:auto;"></div>');this.canvas._elem.append(c);this.escapeHtml?c.text(p):c.html(p);delete k.position;delete k.marginRight;delete k.marginLeft;if(!k.background&&!k.backgroundColor&&!k.backgroundImage){k.background=j.next()}c.css(k);n=c.outerWidth();g=c.outerHeight();e=o[0]-n/2+"px";m=o[1]-g/2+"px";c.css({left:e,top:m});c=null}};a.jqplot.BlockCanvas=function(){a.jqplot.ElemContainer.call(this);this._ctx};a.jqplot.BlockCanvas.prototype=new a.jqplot.ElemContainer();a.jqplot.BlockCanvas.prototype.constructor=a.jqplot.BlockCanvas;a.jqplot.BlockCanvas.prototype.createElement=function(i,e,c){this._offsets=i;var b="jqplot-blockCanvas";if(e!=undefined){b=e}var g;if(this._elem){g=this._elem.get(0)}else{g=document.createElement("div")}if(c!=undefined){this._plotDimensions=c}var d=this._plotDimensions.width-this._offsets.left-this._offsets.right+"px";var f=this._plotDimensions.height-this._offsets.top-this._offsets.bottom+"px";this._elem=a(g);this._elem.css({position:"absolute",width:d,height:f,left:this._offsets.left,top:this._offsets.top});this._elem.addClass(b);return this._elem};a.jqplot.BlockCanvas.prototype.setContext=function(){this._ctx={canvas:{width:0,height:0},clearRect:function(){return null}};return this._ctx}})(jQuery);
|
||||
759
plugin/jqplot/plugins/jqplot.bubbleRenderer.js
Normal file
759
plugin/jqplot/plugins/jqplot.bubbleRenderer.js
Normal file
@ -0,0 +1,759 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
var arrayMax = function( array ){
|
||||
return Math.max.apply( Math, array );
|
||||
};
|
||||
var arrayMin = function( array ){
|
||||
return Math.min.apply( Math, array );
|
||||
};
|
||||
|
||||
/**
|
||||
* Class: $.jqplot.BubbleRenderer
|
||||
* Plugin renderer to draw a bubble chart. A Bubble chart has data points displayed as
|
||||
* colored circles with an optional text label inside. To use
|
||||
* the bubble renderer, you must include the bubble renderer like:
|
||||
*
|
||||
* > <script language="javascript" type="text/javascript" src="../src/plugins/jqplot.bubbleRenderer.js"></script>
|
||||
*
|
||||
* Data must be supplied in
|
||||
* the form:
|
||||
*
|
||||
* > [[x1, y1, r1, <label or {label:'text', color:color}>], ...]
|
||||
*
|
||||
* where the label or options
|
||||
* object is optional.
|
||||
*
|
||||
* Note that all bubble colors will be the same
|
||||
* unless the "varyBubbleColors" option is set to true. Colors can be specified in the data array
|
||||
* or in the seriesColors array option on the series. If no colors are defined, the default jqPlot
|
||||
* series of 16 colors are used. Colors are automatically cycled around again if there are more
|
||||
* bubbles than colors.
|
||||
*
|
||||
* Bubbles are autoscaled by default to fit within the chart area while maintaining
|
||||
* relative sizes. If the "autoscaleBubbles" option is set to false, the r(adius) values
|
||||
* in the data array a treated as literal pixel values for the radii of the bubbles.
|
||||
*
|
||||
* Properties are passed into the bubble renderer in the rendererOptions object of
|
||||
* the series options like:
|
||||
*
|
||||
* > seriesDefaults: {
|
||||
* > renderer: $.jqplot.BubbleRenderer,
|
||||
* > rendererOptions: {
|
||||
* > bubbleAlpha: 0.7,
|
||||
* > varyBubbleColors: false
|
||||
* > }
|
||||
* > }
|
||||
*
|
||||
*/
|
||||
$.jqplot.BubbleRenderer = function(){
|
||||
$.jqplot.LineRenderer.call(this);
|
||||
};
|
||||
|
||||
$.jqplot.BubbleRenderer.prototype = new $.jqplot.LineRenderer();
|
||||
$.jqplot.BubbleRenderer.prototype.constructor = $.jqplot.BubbleRenderer;
|
||||
|
||||
// called with scope of a series
|
||||
$.jqplot.BubbleRenderer.prototype.init = function(options, plot) {
|
||||
// Group: Properties
|
||||
//
|
||||
// prop: varyBubbleColors
|
||||
// True to vary the color of each bubble in this series according to
|
||||
// the seriesColors array. False to set each bubble to the color
|
||||
// specified on this series. This has no effect if a css background color
|
||||
// option is specified in the renderer css options.
|
||||
this.varyBubbleColors = true;
|
||||
// prop: autoscaleBubbles
|
||||
// True to scale the bubble radius based on plot size.
|
||||
// False will use the radius value as provided as a raw pixel value for
|
||||
// bubble radius.
|
||||
this.autoscaleBubbles = true;
|
||||
// prop: autoscaleMultiplier
|
||||
// Multiplier the bubble size if autoscaleBubbles is true.
|
||||
this.autoscaleMultiplier = 1.0;
|
||||
// prop: autoscalePointsFactor
|
||||
// Factor which decreases bubble size based on how many bubbles on on the chart.
|
||||
// 0 means no adjustment for number of bubbles. Negative values will decrease
|
||||
// size of bubbles as more bubbles are added. Values between 0 and -0.2
|
||||
// should work well.
|
||||
this.autoscalePointsFactor = -0.07;
|
||||
// prop: escapeHtml
|
||||
// True to escape html in bubble label text.
|
||||
this.escapeHtml = true;
|
||||
// prop: highlightMouseOver
|
||||
// True to highlight bubbles when moused over.
|
||||
// This must be false to enable highlightMouseDown to highlight when clicking on a slice.
|
||||
this.highlightMouseOver = true;
|
||||
// prop: highlightMouseDown
|
||||
// True to highlight when a mouse button is pressed over a bubble.
|
||||
// This will be disabled if highlightMouseOver is true.
|
||||
this.highlightMouseDown = false;
|
||||
// prop: highlightColors
|
||||
// An array of colors to use when highlighting a slice. Calculated automatically
|
||||
// if not supplied.
|
||||
this.highlightColors = [];
|
||||
// prop: bubbleAlpha
|
||||
// Alpha transparency to apply to all bubbles in this series.
|
||||
this.bubbleAlpha = 1.0;
|
||||
// prop: highlightAlpha
|
||||
// Alpha transparency to apply when highlighting bubble.
|
||||
// Set to value of bubbleAlpha by default.
|
||||
this.highlightAlpha = null;
|
||||
// prop: bubbleGradients
|
||||
// True to color the bubbles with gradient fills instead of flat colors.
|
||||
// NOT AVAILABLE IN IE due to lack of excanvas support for radial gradient fills.
|
||||
// will be ignored in IE.
|
||||
this.bubbleGradients = false;
|
||||
// prop: showLabels
|
||||
// True to show labels on bubbles (if any), false to not show.
|
||||
this.showLabels = true;
|
||||
// array of [point index, radius] which will be sorted in descending order to plot
|
||||
// largest points below smaller points.
|
||||
this.radii = [];
|
||||
this.maxRadius = 0;
|
||||
// index of the currenty highlighted point, if any
|
||||
this._highlightedPoint = null;
|
||||
// array of jQuery labels.
|
||||
this.labels = [];
|
||||
this.bubbleCanvases = [];
|
||||
this._type = 'bubble';
|
||||
|
||||
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
|
||||
if (options.highlightMouseDown && options.highlightMouseOver == null) {
|
||||
options.highlightMouseOver = false;
|
||||
}
|
||||
|
||||
$.extend(true, this, options);
|
||||
|
||||
if (this.highlightAlpha == null) {
|
||||
this.highlightAlpha = this.bubbleAlpha;
|
||||
if (this.bubbleGradients) {
|
||||
this.highlightAlpha = 0.35;
|
||||
}
|
||||
}
|
||||
|
||||
this.autoscaleMultiplier = this.autoscaleMultiplier * Math.pow(this.data.length, this.autoscalePointsFactor);
|
||||
|
||||
// index of the currenty highlighted point, if any
|
||||
this._highlightedPoint = null;
|
||||
|
||||
// adjust the series colors for options colors passed in with data or for alpha.
|
||||
// note, this can leave undefined holes in the seriesColors array.
|
||||
var comps;
|
||||
for (var i=0; i<this.data.length; i++) {
|
||||
var color = null;
|
||||
var d = this.data[i];
|
||||
this.maxRadius = Math.max(this.maxRadius, d[2]);
|
||||
if (d[3]) {
|
||||
if (typeof(d[3]) == 'object') {
|
||||
color = d[3]['color'];
|
||||
}
|
||||
}
|
||||
|
||||
if (color == null) {
|
||||
if (this.seriesColors[i] != null) {
|
||||
color = this.seriesColors[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (color && this.bubbleAlpha < 1.0) {
|
||||
comps = $.jqplot.getColorComponents(color);
|
||||
color = 'rgba('+comps[0]+', '+comps[1]+', '+comps[2]+', '+this.bubbleAlpha+')';
|
||||
}
|
||||
|
||||
if (color) {
|
||||
this.seriesColors[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.varyBubbleColors) {
|
||||
this.seriesColors = [this.color];
|
||||
}
|
||||
|
||||
this.colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
|
||||
|
||||
// set highlight colors if none provided
|
||||
if (this.highlightColors.length == 0) {
|
||||
for (var i=0; i<this.seriesColors.length; i++){
|
||||
var rgba = $.jqplot.getColorComponents(this.seriesColors[i]);
|
||||
var newrgb = [rgba[0], rgba[1], rgba[2]];
|
||||
var sum = newrgb[0] + newrgb[1] + newrgb[2];
|
||||
for (var j=0; j<3; j++) {
|
||||
// when darkening, lowest color component can be is 60.
|
||||
newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
|
||||
newrgb[j] = parseInt(newrgb[j], 10);
|
||||
}
|
||||
this.highlightColors.push('rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+', '+this.highlightAlpha+')');
|
||||
}
|
||||
}
|
||||
|
||||
this.highlightColorGenerator = new $.jqplot.ColorGenerator(this.highlightColors);
|
||||
|
||||
var sopts = {fill:true, isarc:true, angle:this.shadowAngle, alpha:this.shadowAlpha, closePath:true};
|
||||
|
||||
this.renderer.shadowRenderer.init(sopts);
|
||||
|
||||
this.canvas = new $.jqplot.DivCanvas();
|
||||
this.canvas._plotDimensions = this._plotDimensions;
|
||||
|
||||
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
|
||||
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
|
||||
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
|
||||
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
|
||||
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
|
||||
plot.postDrawHooks.addOnce(postPlotDraw);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// converts the user data values to grid coordinates and stores them
|
||||
// in the gridData array.
|
||||
// Called with scope of a series.
|
||||
$.jqplot.BubbleRenderer.prototype.setGridData = function(plot) {
|
||||
// recalculate the grid data
|
||||
var xp = this._xaxis.series_u2p;
|
||||
var yp = this._yaxis.series_u2p;
|
||||
var data = this._plotData;
|
||||
this.gridData = [];
|
||||
var radii = [];
|
||||
this.radii = [];
|
||||
var dim = Math.min(plot._height, plot._width);
|
||||
for (var i=0; i<this.data.length; i++) {
|
||||
if (data[i] != null) {
|
||||
this.gridData.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1]), data[i][2]]);
|
||||
this.radii.push([i, data[i][2]]);
|
||||
radii.push(data[i][2]);
|
||||
}
|
||||
}
|
||||
var r, val, maxr = this.maxRadius = arrayMax(radii);
|
||||
var l = this.gridData.length;
|
||||
if (this.autoscaleBubbles) {
|
||||
for (var i=0; i<l; i++) {
|
||||
val = radii[i]/maxr;
|
||||
r = this.autoscaleMultiplier * dim / 6;
|
||||
this.gridData[i][2] = r * val;
|
||||
}
|
||||
}
|
||||
|
||||
this.radii.sort(function(a, b) { return b[1] - a[1]; });
|
||||
};
|
||||
|
||||
// converts any arbitrary data values to grid coordinates and
|
||||
// returns them. This method exists so that plugins can use a series'
|
||||
// linerenderer to generate grid data points without overwriting the
|
||||
// grid data associated with that series.
|
||||
// Called with scope of a series.
|
||||
$.jqplot.BubbleRenderer.prototype.makeGridData = function(data, plot) {
|
||||
// recalculate the grid data
|
||||
var xp = this._xaxis.series_u2p;
|
||||
var yp = this._yaxis.series_u2p;
|
||||
var gd = [];
|
||||
var radii = [];
|
||||
this.radii = [];
|
||||
var dim = Math.min(plot._height, plot._width);
|
||||
for (var i=0; i<data.length; i++) {
|
||||
if (data[i] != null) {
|
||||
gd.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1]), data[i][2]]);
|
||||
radii.push(data[i][2]);
|
||||
this.radii.push([i, data[i][2]]);
|
||||
}
|
||||
}
|
||||
var r, val, maxr = this.maxRadius = arrayMax(radii);
|
||||
var l = this.gridData.length;
|
||||
if (this.autoscaleBubbles) {
|
||||
for (var i=0; i<l; i++) {
|
||||
val = radii[i]/maxr;
|
||||
r = this.autoscaleMultiplier * dim / 6;
|
||||
gd[i][2] = r * val;
|
||||
}
|
||||
}
|
||||
this.radii.sort(function(a, b) { return b[1] - a[1]; });
|
||||
return gd;
|
||||
};
|
||||
|
||||
// called with scope of series
|
||||
$.jqplot.BubbleRenderer.prototype.draw = function (ctx, gd, options) {
|
||||
if (this.plugins.pointLabels) {
|
||||
this.plugins.pointLabels.show = false;
|
||||
}
|
||||
var opts = (options != undefined) ? options : {};
|
||||
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||
this.canvas._elem.empty();
|
||||
for (var i=0; i<this.radii.length; i++) {
|
||||
var idx = this.radii[i][0];
|
||||
var t=null;
|
||||
var color = null;
|
||||
var el = null;
|
||||
var tel = null;
|
||||
var d = this.data[idx];
|
||||
var gd = this.gridData[idx];
|
||||
if (d[3]) {
|
||||
if (typeof(d[3]) == 'object') {
|
||||
t = d[3]['label'];
|
||||
}
|
||||
else if (typeof(d[3]) == 'string') {
|
||||
t = d[3];
|
||||
}
|
||||
}
|
||||
|
||||
// color = (this.varyBubbleColors) ? this.colorGenerator.get(idx) : this.color;
|
||||
color = this.colorGenerator.get(idx);
|
||||
|
||||
// If we're drawing a shadow, expand the canvas dimensions to accomodate.
|
||||
var canvasRadius = gd[2];
|
||||
var offset, depth;
|
||||
if (this.shadow) {
|
||||
offset = (0.7 + gd[2]/40).toFixed(1);
|
||||
depth = 1 + Math.ceil(gd[2]/15);
|
||||
canvasRadius += offset*depth;
|
||||
}
|
||||
this.bubbleCanvases[idx] = new $.jqplot.BubbleCanvas();
|
||||
this.canvas._elem.append(this.bubbleCanvases[idx].createElement(gd[0], gd[1], canvasRadius));
|
||||
this.bubbleCanvases[idx].setContext();
|
||||
var ctx = this.bubbleCanvases[idx]._ctx;
|
||||
var x = ctx.canvas.width/2;
|
||||
var y = ctx.canvas.height/2;
|
||||
if (this.shadow) {
|
||||
this.renderer.shadowRenderer.draw(ctx, [x, y, gd[2], 0, 2*Math.PI], {offset: offset, depth: depth});
|
||||
}
|
||||
this.bubbleCanvases[idx].draw(gd[2], color, this.bubbleGradients, this.shadowAngle/180*Math.PI);
|
||||
|
||||
// now draw label.
|
||||
if (t && this.showLabels) {
|
||||
tel = $('<div style="position:absolute;" class="jqplot-bubble-label"></div>');
|
||||
if (this.escapeHtml) {
|
||||
tel.text(t);
|
||||
}
|
||||
else {
|
||||
tel.html(t);
|
||||
}
|
||||
this.canvas._elem.append(tel);
|
||||
var h = $(tel).outerHeight();
|
||||
var w = $(tel).outerWidth();
|
||||
var top = gd[1] - 0.5*h;
|
||||
var left = gd[0] - 0.5*w;
|
||||
tel.css({top: top, left: left});
|
||||
this.labels[idx] = $(tel);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$.jqplot.DivCanvas = function() {
|
||||
$.jqplot.ElemContainer.call(this);
|
||||
this._ctx;
|
||||
};
|
||||
|
||||
$.jqplot.DivCanvas.prototype = new $.jqplot.ElemContainer();
|
||||
$.jqplot.DivCanvas.prototype.constructor = $.jqplot.DivCanvas;
|
||||
|
||||
$.jqplot.DivCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
|
||||
this._offsets = offsets;
|
||||
var klass = 'jqplot-DivCanvas';
|
||||
if (clss != undefined) {
|
||||
klass = clss;
|
||||
}
|
||||
var elem;
|
||||
// if this canvas already has a dom element, don't make a new one.
|
||||
if (this._elem) {
|
||||
elem = this._elem.get(0);
|
||||
}
|
||||
else {
|
||||
elem = document.createElement('div');
|
||||
}
|
||||
// if new plotDimensions supplied, use them.
|
||||
if (plotDimensions != undefined) {
|
||||
this._plotDimensions = plotDimensions;
|
||||
}
|
||||
|
||||
var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
|
||||
var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
|
||||
this._elem = $(elem);
|
||||
this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
|
||||
|
||||
this._elem.addClass(klass);
|
||||
return this._elem;
|
||||
};
|
||||
|
||||
$.jqplot.DivCanvas.prototype.setContext = function() {
|
||||
this._ctx = {
|
||||
canvas:{
|
||||
width:0,
|
||||
height:0
|
||||
},
|
||||
clearRect:function(){return null;}
|
||||
};
|
||||
return this._ctx;
|
||||
};
|
||||
|
||||
$.jqplot.BubbleCanvas = function() {
|
||||
$.jqplot.ElemContainer.call(this);
|
||||
this._ctx;
|
||||
};
|
||||
|
||||
$.jqplot.BubbleCanvas.prototype = new $.jqplot.ElemContainer();
|
||||
$.jqplot.BubbleCanvas.prototype.constructor = $.jqplot.BubbleCanvas;
|
||||
|
||||
// initialize with the x,y pont of bubble center and the bubble radius.
|
||||
$.jqplot.BubbleCanvas.prototype.createElement = function(x, y, r) {
|
||||
var klass = 'jqplot-bubble-point';
|
||||
|
||||
var elem;
|
||||
// if this canvas already has a dom element, don't make a new one.
|
||||
if (this._elem) {
|
||||
elem = this._elem.get(0);
|
||||
}
|
||||
else {
|
||||
elem = document.createElement('canvas');
|
||||
}
|
||||
|
||||
elem.width = (r != null) ? 2*r : elem.width;
|
||||
elem.height = (r != null) ? 2*r : elem.height;
|
||||
this._elem = $(elem);
|
||||
var l = (x != null && r != null) ? x - r : this._elem.css('left');
|
||||
var t = (y != null && r != null) ? y - r : this._elem.css('top');
|
||||
this._elem.css({ position: 'absolute', left: l, top: t });
|
||||
|
||||
this._elem.addClass(klass);
|
||||
if ($.jqplot.use_excanvas) {
|
||||
window.G_vmlCanvasManager.init_(document);
|
||||
elem = window.G_vmlCanvasManager.initElement(elem);
|
||||
}
|
||||
|
||||
return this._elem;
|
||||
};
|
||||
|
||||
$.jqplot.BubbleCanvas.prototype.draw = function(r, color, gradients, angle) {
|
||||
var ctx = this._ctx;
|
||||
// r = Math.floor(r*1.04);
|
||||
// var x = Math.round(ctx.canvas.width/2);
|
||||
// var y = Math.round(ctx.canvas.height/2);
|
||||
var x = ctx.canvas.width/2;
|
||||
var y = ctx.canvas.height/2;
|
||||
ctx.save();
|
||||
if (gradients && !$.jqplot.use_excanvas) {
|
||||
r = r*1.04;
|
||||
var comps = $.jqplot.getColorComponents(color);
|
||||
var colorinner = 'rgba('+Math.round(comps[0]+0.8*(255-comps[0]))+', '+Math.round(comps[1]+0.8*(255-comps[1]))+', '+Math.round(comps[2]+0.8*(255-comps[2]))+', '+comps[3]+')';
|
||||
var colorend = 'rgba('+comps[0]+', '+comps[1]+', '+comps[2]+', 0)';
|
||||
// var rinner = Math.round(0.35 * r);
|
||||
// var xinner = Math.round(x - Math.cos(angle) * 0.33 * r);
|
||||
// var yinner = Math.round(y - Math.sin(angle) * 0.33 * r);
|
||||
var rinner = 0.35 * r;
|
||||
var xinner = x - Math.cos(angle) * 0.33 * r;
|
||||
var yinner = y - Math.sin(angle) * 0.33 * r;
|
||||
var radgrad = ctx.createRadialGradient(xinner, yinner, rinner, x, y, r);
|
||||
radgrad.addColorStop(0, colorinner);
|
||||
radgrad.addColorStop(0.93, color);
|
||||
radgrad.addColorStop(0.96, colorend);
|
||||
radgrad.addColorStop(1, colorend);
|
||||
// radgrad.addColorStop(.98, colorend);
|
||||
ctx.fillStyle = radgrad;
|
||||
ctx.fillRect(0,0, ctx.canvas.width, ctx.canvas.height);
|
||||
}
|
||||
else {
|
||||
ctx.fillStyle = color;
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
var ang = 2*Math.PI;
|
||||
ctx.arc(x, y, r, 0, ang, 0);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
}
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
$.jqplot.BubbleCanvas.prototype.setContext = function() {
|
||||
this._ctx = this._elem.get(0).getContext("2d");
|
||||
return this._ctx;
|
||||
};
|
||||
|
||||
$.jqplot.BubbleAxisRenderer = function() {
|
||||
$.jqplot.LinearAxisRenderer.call(this);
|
||||
};
|
||||
|
||||
$.jqplot.BubbleAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||
$.jqplot.BubbleAxisRenderer.prototype.constructor = $.jqplot.BubbleAxisRenderer;
|
||||
|
||||
// called with scope of axis object.
|
||||
$.jqplot.BubbleAxisRenderer.prototype.init = function(options){
|
||||
$.extend(true, this, options);
|
||||
var db = this._dataBounds;
|
||||
var minsidx = 0,
|
||||
minpidx = 0,
|
||||
maxsidx = 0,
|
||||
maxpidx = 0,
|
||||
maxr = 0,
|
||||
minr = 0,
|
||||
minMaxRadius = 0,
|
||||
maxMaxRadius = 0,
|
||||
maxMult = 0,
|
||||
minMult = 0;
|
||||
// Go through all the series attached to this axis and find
|
||||
// the min/max bounds for this axis.
|
||||
for (var i=0; i<this._series.length; i++) {
|
||||
var s = this._series[i];
|
||||
var d = s._plotData;
|
||||
|
||||
for (var j=0; j<d.length; j++) {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
if (d[j][0] < db.min || db.min == null) {
|
||||
db.min = d[j][0];
|
||||
minsidx=i;
|
||||
minpidx=j;
|
||||
minr = d[j][2];
|
||||
minMaxRadius = s.maxRadius;
|
||||
minMult = s.autoscaleMultiplier;
|
||||
}
|
||||
if (d[j][0] > db.max || db.max == null) {
|
||||
db.max = d[j][0];
|
||||
maxsidx=i;
|
||||
maxpidx=j;
|
||||
maxr = d[j][2];
|
||||
maxMaxRadius = s.maxRadius;
|
||||
maxMult = s.autoscaleMultiplier;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (d[j][1] < db.min || db.min == null) {
|
||||
db.min = d[j][1];
|
||||
minsidx=i;
|
||||
minpidx=j;
|
||||
minr = d[j][2];
|
||||
minMaxRadius = s.maxRadius;
|
||||
minMult = s.autoscaleMultiplier;
|
||||
}
|
||||
if (d[j][1] > db.max || db.max == null) {
|
||||
db.max = d[j][1];
|
||||
maxsidx=i;
|
||||
maxpidx=j;
|
||||
maxr = d[j][2];
|
||||
maxMaxRadius = s.maxRadius;
|
||||
maxMult = s.autoscaleMultiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var minRatio = minr/minMaxRadius;
|
||||
var maxRatio = maxr/maxMaxRadius;
|
||||
|
||||
// need to estimate the effect of the radius on total axis span and adjust axis accordingly.
|
||||
var span = db.max - db.min;
|
||||
// var dim = (this.name == 'xaxis' || this.name == 'x2axis') ? this._plotDimensions.width : this._plotDimensions.height;
|
||||
var dim = Math.min(this._plotDimensions.width, this._plotDimensions.height);
|
||||
|
||||
var minfact = minRatio * minMult/3 * span;
|
||||
var maxfact = maxRatio * maxMult/3 * span;
|
||||
db.max += maxfact;
|
||||
db.min -= minfact;
|
||||
};
|
||||
|
||||
function highlight (plot, sidx, pidx) {
|
||||
plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
|
||||
var s = plot.series[sidx];
|
||||
var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
|
||||
var ctx = canvas._ctx;
|
||||
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
|
||||
s._highlightedPoint = pidx;
|
||||
plot.plugins.bubbleRenderer.highlightedSeriesIndex = sidx;
|
||||
|
||||
var color = s.highlightColorGenerator.get(pidx);
|
||||
var x = s.gridData[pidx][0],
|
||||
y = s.gridData[pidx][1],
|
||||
r = s.gridData[pidx][2];
|
||||
ctx.save();
|
||||
ctx.fillStyle = color;
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, r, 0, 2*Math.PI, 0);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.restore();
|
||||
// bring label to front
|
||||
if (s.labels[pidx]) {
|
||||
plot.plugins.bubbleRenderer.highlightLabel = s.labels[pidx].clone();
|
||||
plot.plugins.bubbleRenderer.highlightLabel.appendTo(plot.plugins.bubbleRenderer.highlightLabelCanvas);
|
||||
plot.plugins.bubbleRenderer.highlightLabel.addClass('jqplot-bubble-label-highlight');
|
||||
}
|
||||
}
|
||||
|
||||
function unhighlight (plot) {
|
||||
var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
|
||||
var sidx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
|
||||
plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
|
||||
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||
for (var i=0; i<plot.series.length; i++) {
|
||||
plot.series[i]._highlightedPoint = null;
|
||||
}
|
||||
plot.plugins.bubbleRenderer.highlightedSeriesIndex = null;
|
||||
plot.target.trigger('jqplotDataUnhighlight');
|
||||
}
|
||||
|
||||
|
||||
function handleMove(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var si = neighbor.seriesIndex;
|
||||
var pi = neighbor.pointIndex;
|
||||
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||
var evt1 = jQuery.Event('jqplotDataMouseOver');
|
||||
evt1.pageX = ev.pageX;
|
||||
evt1.pageY = ev.pageY;
|
||||
plot.target.trigger(evt1, ins);
|
||||
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.bubbleRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||
var evt = jQuery.Event('jqplotDataHighlight');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
highlight (plot, ins[0], ins[1]);
|
||||
}
|
||||
}
|
||||
else if (neighbor == null) {
|
||||
unhighlight (plot);
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var si = neighbor.seriesIndex;
|
||||
var pi = neighbor.pointIndex;
|
||||
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.bubbleRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||
var evt = jQuery.Event('jqplotDataHighlight');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
highlight (plot, ins[0], ins[1]);
|
||||
}
|
||||
}
|
||||
else if (neighbor == null) {
|
||||
unhighlight (plot);
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
|
||||
var idx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
|
||||
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||
unhighlight(plot);
|
||||
}
|
||||
}
|
||||
|
||||
function handleClick(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var si = neighbor.seriesIndex;
|
||||
var pi = neighbor.pointIndex;
|
||||
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||
var evt = jQuery.Event('jqplotDataClick');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
}
|
||||
}
|
||||
|
||||
function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
|
||||
if (neighbor) {
|
||||
var si = neighbor.seriesIndex;
|
||||
var pi = neighbor.pointIndex;
|
||||
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||
var idx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
|
||||
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||
unhighlight(plot);
|
||||
}
|
||||
var evt = jQuery.Event('jqplotDataRightClick');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
}
|
||||
}
|
||||
|
||||
// called within context of plot
|
||||
// create a canvas which we can draw on.
|
||||
// insert it before the eventCanvas, so eventCanvas will still capture events.
|
||||
function postPlotDraw() {
|
||||
// Memory Leaks patch
|
||||
if (this.plugins.bubbleRenderer && this.plugins.bubbleRenderer.highlightCanvas) {
|
||||
this.plugins.bubbleRenderer.highlightCanvas.resetCanvas();
|
||||
this.plugins.bubbleRenderer.highlightCanvas = null;
|
||||
}
|
||||
|
||||
this.plugins.bubbleRenderer = {highlightedSeriesIndex:null};
|
||||
this.plugins.bubbleRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
|
||||
this.plugins.bubbleRenderer.highlightLabel = null;
|
||||
this.plugins.bubbleRenderer.highlightLabelCanvas = $('<div style="position:absolute;"></div>');
|
||||
var top = this._gridPadding.top;
|
||||
var left = this._gridPadding.left;
|
||||
var width = this._plotDimensions.width - this._gridPadding.left - this._gridPadding.right;
|
||||
var height = this._plotDimensions.height - this._gridPadding.top - this._gridPadding.bottom;
|
||||
this.plugins.bubbleRenderer.highlightLabelCanvas.css({top:top, left:left, width:width+'px', height:height+'px'});
|
||||
|
||||
this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-bubbleRenderer-highlight-canvas', this._plotDimensions, this));
|
||||
this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightLabelCanvas);
|
||||
|
||||
var hctx = this.plugins.bubbleRenderer.highlightCanvas.setContext();
|
||||
}
|
||||
|
||||
|
||||
// setup default renderers for axes and legend so user doesn't have to
|
||||
// called with scope of plot
|
||||
function preInit(target, data, options) {
|
||||
options = options || {};
|
||||
options.axesDefaults = options.axesDefaults || {};
|
||||
options.seriesDefaults = options.seriesDefaults || {};
|
||||
// only set these if there is a Bubble series
|
||||
var setopts = false;
|
||||
if (options.seriesDefaults.renderer == $.jqplot.BubbleRenderer) {
|
||||
setopts = true;
|
||||
}
|
||||
else if (options.series) {
|
||||
for (var i=0; i < options.series.length; i++) {
|
||||
if (options.series[i].renderer == $.jqplot.BubbleRenderer) {
|
||||
setopts = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (setopts) {
|
||||
options.axesDefaults.renderer = $.jqplot.BubbleAxisRenderer;
|
||||
options.sortData = false;
|
||||
}
|
||||
}
|
||||
|
||||
$.jqplot.preInitHooks.push(preInit);
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
3
plugin/jqplot/plugins/jqplot.bubbleRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.bubbleRenderer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
203
plugin/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js
Normal file
203
plugin/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js
Normal file
@ -0,0 +1,203 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* Class: $.jqplot.CanvasAxisLabelRenderer
|
||||
* Renderer to draw axis labels with a canvas element to support advanced
|
||||
* featrues such as rotated text. This renderer uses a separate rendering engine
|
||||
* to draw the text on the canvas. Two modes of rendering the text are available.
|
||||
* If the browser has native font support for canvas fonts (currently Mozila 3.5
|
||||
* and Safari 4), you can enable text rendering with the canvas fillText method.
|
||||
* You do so by setting the "enableFontSupport" option to true.
|
||||
*
|
||||
* Browsers lacking native font support will have the text drawn on the canvas
|
||||
* using the Hershey font metrics. Even if the "enableFontSupport" option is true
|
||||
* non-supporting browsers will still render with the Hershey font.
|
||||
*
|
||||
*/
|
||||
$.jqplot.CanvasAxisLabelRenderer = function(options) {
|
||||
// Group: Properties
|
||||
|
||||
// prop: angle
|
||||
// angle of text, measured clockwise from x axis.
|
||||
this.angle = 0;
|
||||
// name of the axis associated with this tick
|
||||
this.axis;
|
||||
// prop: show
|
||||
// whether or not to show the tick (mark and label).
|
||||
this.show = true;
|
||||
// prop: showLabel
|
||||
// whether or not to show the label.
|
||||
this.showLabel = true;
|
||||
// prop: label
|
||||
// label for the axis.
|
||||
this.label = '';
|
||||
// prop: fontFamily
|
||||
// CSS spec for the font-family css attribute.
|
||||
// Applies only to browsers supporting native font rendering in the
|
||||
// canvas tag. Currently Mozilla 3.5 and Safari 4.
|
||||
this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
|
||||
// prop: fontSize
|
||||
// CSS spec for font size.
|
||||
this.fontSize = '11pt';
|
||||
// prop: fontWeight
|
||||
// CSS spec for fontWeight: normal, bold, bolder, lighter or a number 100 - 900
|
||||
this.fontWeight = 'normal';
|
||||
// prop: fontStretch
|
||||
// Multiplier to condense or expand font width.
|
||||
// Applies only to browsers which don't support canvas native font rendering.
|
||||
this.fontStretch = 1.0;
|
||||
// prop: textColor
|
||||
// css spec for the color attribute.
|
||||
this.textColor = '#666666';
|
||||
// prop: enableFontSupport
|
||||
// true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
|
||||
// If true, label will be drawn with canvas tag native support for fonts.
|
||||
// If false, label will be drawn with Hershey font metrics.
|
||||
this.enableFontSupport = true;
|
||||
// prop: pt2px
|
||||
// Point to pixel scaling factor, used for computing height of bounding box
|
||||
// around a label. The labels text renderer has a default setting of 1.4, which
|
||||
// should be suitable for most fonts. Leave as null to use default. If tops of
|
||||
// letters appear clipped, increase this. If bounding box seems too big, decrease.
|
||||
// This is an issue only with the native font renderering capabilities of Mozilla
|
||||
// 3.5 and Safari 4 since they do not provide a method to determine the font height.
|
||||
this.pt2px = null;
|
||||
|
||||
this._elem;
|
||||
this._ctx;
|
||||
this._plotWidth;
|
||||
this._plotHeight;
|
||||
this._plotDimensions = {height:null, width:null};
|
||||
|
||||
$.extend(true, this, options);
|
||||
|
||||
if (options.angle == null && this.axis != 'xaxis' && this.axis != 'x2axis') {
|
||||
this.angle = -90;
|
||||
}
|
||||
|
||||
var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
|
||||
if (this.pt2px) {
|
||||
ropts.pt2px = this.pt2px;
|
||||
}
|
||||
|
||||
if (this.enableFontSupport) {
|
||||
if ($.jqplot.support_canvas_text()) {
|
||||
this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
|
||||
}
|
||||
|
||||
else {
|
||||
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||
}
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisLabelRenderer.prototype.init = function(options) {
|
||||
$.extend(true, this, options);
|
||||
this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
|
||||
};
|
||||
|
||||
// return width along the x axis
|
||||
// will check first to see if an element exists.
|
||||
// if not, will return the computed text box width.
|
||||
$.jqplot.CanvasAxisLabelRenderer.prototype.getWidth = function(ctx) {
|
||||
if (this._elem) {
|
||||
return this._elem.outerWidth(true);
|
||||
}
|
||||
else {
|
||||
var tr = this._textRenderer;
|
||||
var l = tr.getWidth(ctx);
|
||||
var h = tr.getHeight(ctx);
|
||||
var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
|
||||
return w;
|
||||
}
|
||||
};
|
||||
|
||||
// return height along the y axis.
|
||||
$.jqplot.CanvasAxisLabelRenderer.prototype.getHeight = function(ctx) {
|
||||
if (this._elem) {
|
||||
return this._elem.outerHeight(true);
|
||||
}
|
||||
else {
|
||||
var tr = this._textRenderer;
|
||||
var l = tr.getWidth(ctx);
|
||||
var h = tr.getHeight(ctx);
|
||||
var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
|
||||
return w;
|
||||
}
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad = function() {
|
||||
var a = this.angle * Math.PI/180;
|
||||
return a;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisLabelRenderer.prototype.draw = function(ctx, plot) {
|
||||
// Memory Leaks patch
|
||||
if (this._elem) {
|
||||
if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
|
||||
window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
|
||||
}
|
||||
|
||||
this._elem.emptyForce();
|
||||
this._elem = null;
|
||||
}
|
||||
|
||||
// create a canvas here, but can't draw on it untill it is appended
|
||||
// to dom for IE compatability.
|
||||
var elem = plot.canvasManager.getCanvas();
|
||||
|
||||
this._textRenderer.setText(this.label, ctx);
|
||||
var w = this.getWidth(ctx);
|
||||
var h = this.getHeight(ctx);
|
||||
elem.width = w;
|
||||
elem.height = h;
|
||||
elem.style.width = w;
|
||||
elem.style.height = h;
|
||||
|
||||
elem = plot.canvasManager.initCanvas(elem);
|
||||
|
||||
this._elem = $(elem);
|
||||
this._elem.css({ position: 'absolute'});
|
||||
this._elem.addClass('jqplot-'+this.axis+'-label');
|
||||
|
||||
elem = null;
|
||||
return this._elem;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisLabelRenderer.prototype.pack = function() {
|
||||
this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
3
plugin/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||
jsDate | (c) 2010-2013 Chris Leonello
|
||||
*/(function(a){a.jqplot.CanvasAxisLabelRenderer=function(b){this.angle=0;this.axis;this.show=true;this.showLabel=true;this.label="";this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';this.fontSize="11pt";this.fontWeight="normal";this.fontStretch=1;this.textColor="#666666";this.enableFontSupport=true;this.pt2px=null;this._elem;this._ctx;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null};a.extend(true,this,b);if(b.angle==null&&this.axis!="xaxis"&&this.axis!="x2axis"){this.angle=-90}var c={fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily};if(this.pt2px){c.pt2px=this.pt2px}if(this.enableFontSupport){if(a.jqplot.support_canvas_text()){this._textRenderer=new a.jqplot.CanvasFontRenderer(c)}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}};a.jqplot.CanvasAxisLabelRenderer.prototype.init=function(b){a.extend(true,this,b);this._textRenderer.init({fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily})};a.jqplot.CanvasAxisLabelRenderer.prototype.getWidth=function(d){if(this._elem){return this._elem.outerWidth(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.sin(f.angle)*e)+Math.abs(Math.cos(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getHeight=function(d){if(this._elem){return this._elem.outerHeight(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.cos(f.angle)*e)+Math.abs(Math.sin(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad=function(){var b=this.angle*Math.PI/180;return b};a.jqplot.CanvasAxisLabelRenderer.prototype.draw=function(c,f){if(this._elem){if(a.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce();this._elem=null}var e=f.canvasManager.getCanvas();this._textRenderer.setText(this.label,c);var b=this.getWidth(c);var d=this.getHeight(c);e.width=b;e.height=d;e.style.width=b;e.style.height=d;e=f.canvasManager.initCanvas(e);this._elem=a(e);this._elem.css({position:"absolute"});this._elem.addClass("jqplot-"+this.axis+"-label");e=null;return this._elem};a.jqplot.CanvasAxisLabelRenderer.prototype.pack=function(){this._textRenderer.draw(this._elem.get(0).getContext("2d"),this.label)}})(jQuery);
|
||||
253
plugin/jqplot/plugins/jqplot.canvasAxisTickRenderer.js
Normal file
253
plugin/jqplot/plugins/jqplot.canvasAxisTickRenderer.js
Normal file
@ -0,0 +1,253 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* Class: $.jqplot.CanvasAxisTickRenderer
|
||||
* Renderer to draw axis ticks with a canvas element to support advanced
|
||||
* featrues such as rotated text. This renderer uses a separate rendering engine
|
||||
* to draw the text on the canvas. Two modes of rendering the text are available.
|
||||
* If the browser has native font support for canvas fonts (currently Mozila 3.5
|
||||
* and Safari 4), you can enable text rendering with the canvas fillText method.
|
||||
* You do so by setting the "enableFontSupport" option to true.
|
||||
*
|
||||
* Browsers lacking native font support will have the text drawn on the canvas
|
||||
* using the Hershey font metrics. Even if the "enableFontSupport" option is true
|
||||
* non-supporting browsers will still render with the Hershey font.
|
||||
*/
|
||||
$.jqplot.CanvasAxisTickRenderer = function(options) {
|
||||
// Group: Properties
|
||||
|
||||
// prop: mark
|
||||
// tick mark on the axis. One of 'inside', 'outside', 'cross', '' or null.
|
||||
this.mark = 'outside';
|
||||
// prop: showMark
|
||||
// whether or not to show the mark on the axis.
|
||||
this.showMark = true;
|
||||
// prop: showGridline
|
||||
// whether or not to draw the gridline on the grid at this tick.
|
||||
this.showGridline = true;
|
||||
// prop: isMinorTick
|
||||
// if this is a minor tick.
|
||||
this.isMinorTick = false;
|
||||
// prop: angle
|
||||
// angle of text, measured clockwise from x axis.
|
||||
this.angle = 0;
|
||||
// prop: markSize
|
||||
// Length of the tick marks in pixels. For 'cross' style, length
|
||||
// will be stoked above and below axis, so total length will be twice this.
|
||||
this.markSize = 4;
|
||||
// prop: show
|
||||
// whether or not to show the tick (mark and label).
|
||||
this.show = true;
|
||||
// prop: showLabel
|
||||
// whether or not to show the label.
|
||||
this.showLabel = true;
|
||||
// prop: labelPosition
|
||||
// 'auto', 'start', 'middle' or 'end'.
|
||||
// Whether tick label should be positioned so the start, middle, or end
|
||||
// of the tick mark.
|
||||
this.labelPosition = 'auto';
|
||||
this.label = '';
|
||||
this.value = null;
|
||||
this._styles = {};
|
||||
// prop: formatter
|
||||
// A class of a formatter for the tick text.
|
||||
// The default $.jqplot.DefaultTickFormatter uses sprintf.
|
||||
this.formatter = $.jqplot.DefaultTickFormatter;
|
||||
// prop: formatString
|
||||
// string passed to the formatter.
|
||||
this.formatString = '';
|
||||
// prop: prefix
|
||||
// String to prepend to the tick label.
|
||||
// Prefix is prepended to the formatted tick label.
|
||||
this.prefix = '';
|
||||
// prop: fontFamily
|
||||
// css spec for the font-family css attribute.
|
||||
this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
|
||||
// prop: fontSize
|
||||
// CSS spec for font size.
|
||||
this.fontSize = '10pt';
|
||||
// prop: fontWeight
|
||||
// CSS spec for fontWeight
|
||||
this.fontWeight = 'normal';
|
||||
// prop: fontStretch
|
||||
// Multiplier to condense or expand font width.
|
||||
// Applies only to browsers which don't support canvas native font rendering.
|
||||
this.fontStretch = 1.0;
|
||||
// prop: textColor
|
||||
// css spec for the color attribute.
|
||||
this.textColor = '#666666';
|
||||
// prop: enableFontSupport
|
||||
// true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
|
||||
// If true, tick label will be drawn with canvas tag native support for fonts.
|
||||
// If false, tick label will be drawn with Hershey font metrics.
|
||||
this.enableFontSupport = true;
|
||||
// prop: pt2px
|
||||
// Point to pixel scaling factor, used for computing height of bounding box
|
||||
// around a label. The labels text renderer has a default setting of 1.4, which
|
||||
// should be suitable for most fonts. Leave as null to use default. If tops of
|
||||
// letters appear clipped, increase this. If bounding box seems too big, decrease.
|
||||
// This is an issue only with the native font renderering capabilities of Mozilla
|
||||
// 3.5 and Safari 4 since they do not provide a method to determine the font height.
|
||||
this.pt2px = null;
|
||||
|
||||
this._elem;
|
||||
this._ctx;
|
||||
this._plotWidth;
|
||||
this._plotHeight;
|
||||
this._plotDimensions = {height:null, width:null};
|
||||
|
||||
$.extend(true, this, options);
|
||||
|
||||
var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
|
||||
if (this.pt2px) {
|
||||
ropts.pt2px = this.pt2px;
|
||||
}
|
||||
|
||||
if (this.enableFontSupport) {
|
||||
if ($.jqplot.support_canvas_text()) {
|
||||
this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
|
||||
}
|
||||
|
||||
else {
|
||||
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||
}
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.init = function(options) {
|
||||
$.extend(true, this, options);
|
||||
this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
|
||||
};
|
||||
|
||||
// return width along the x axis
|
||||
// will check first to see if an element exists.
|
||||
// if not, will return the computed text box width.
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.getWidth = function(ctx) {
|
||||
if (this._elem) {
|
||||
return this._elem.outerWidth(true);
|
||||
}
|
||||
else {
|
||||
var tr = this._textRenderer;
|
||||
var l = tr.getWidth(ctx);
|
||||
var h = tr.getHeight(ctx);
|
||||
var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
|
||||
return w;
|
||||
}
|
||||
};
|
||||
|
||||
// return height along the y axis.
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.getHeight = function(ctx) {
|
||||
if (this._elem) {
|
||||
return this._elem.outerHeight(true);
|
||||
}
|
||||
else {
|
||||
var tr = this._textRenderer;
|
||||
var l = tr.getWidth(ctx);
|
||||
var h = tr.getHeight(ctx);
|
||||
var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
|
||||
return w;
|
||||
}
|
||||
};
|
||||
|
||||
// return top.
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.getTop = function(ctx) {
|
||||
if (this._elem) {
|
||||
return this._elem.position().top;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad = function() {
|
||||
var a = this.angle * Math.PI/180;
|
||||
return a;
|
||||
};
|
||||
|
||||
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
|
||||
this.value = value;
|
||||
if (isMinor) {
|
||||
this.isMinorTick = true;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.draw = function(ctx, plot) {
|
||||
if (!this.label) {
|
||||
this.label = this.prefix + this.formatter(this.formatString, this.value);
|
||||
}
|
||||
|
||||
// Memory Leaks patch
|
||||
if (this._elem) {
|
||||
if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
|
||||
window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
|
||||
}
|
||||
|
||||
this._elem.emptyForce();
|
||||
this._elem = null;
|
||||
}
|
||||
|
||||
// create a canvas here, but can't draw on it untill it is appended
|
||||
// to dom for IE compatability.
|
||||
|
||||
var elem = plot.canvasManager.getCanvas();
|
||||
|
||||
this._textRenderer.setText(this.label, ctx);
|
||||
var w = this.getWidth(ctx);
|
||||
var h = this.getHeight(ctx);
|
||||
// canvases seem to need to have width and heigh attributes directly set.
|
||||
elem.width = w;
|
||||
elem.height = h;
|
||||
elem.style.width = w;
|
||||
elem.style.height = h;
|
||||
elem.style.textAlign = 'left';
|
||||
elem.style.position = 'absolute';
|
||||
|
||||
elem = plot.canvasManager.initCanvas(elem);
|
||||
|
||||
this._elem = $(elem);
|
||||
this._elem.css(this._styles);
|
||||
this._elem.addClass('jqplot-'+this.axis+'-tick');
|
||||
|
||||
elem = null;
|
||||
return this._elem;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasAxisTickRenderer.prototype.pack = function() {
|
||||
this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
3
plugin/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||
jsDate | (c) 2010-2013 Chris Leonello
|
||||
*/(function(a){a.jqplot.CanvasAxisTickRenderer=function(b){this.mark="outside";this.showMark=true;this.showGridline=true;this.isMinorTick=false;this.angle=0;this.markSize=4;this.show=true;this.showLabel=true;this.labelPosition="auto";this.label="";this.value=null;this._styles={};this.formatter=a.jqplot.DefaultTickFormatter;this.formatString="";this.prefix="";this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';this.fontSize="10pt";this.fontWeight="normal";this.fontStretch=1;this.textColor="#666666";this.enableFontSupport=true;this.pt2px=null;this._elem;this._ctx;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null};a.extend(true,this,b);var c={fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily};if(this.pt2px){c.pt2px=this.pt2px}if(this.enableFontSupport){if(a.jqplot.support_canvas_text()){this._textRenderer=new a.jqplot.CanvasFontRenderer(c)}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}};a.jqplot.CanvasAxisTickRenderer.prototype.init=function(b){a.extend(true,this,b);this._textRenderer.init({fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily})};a.jqplot.CanvasAxisTickRenderer.prototype.getWidth=function(d){if(this._elem){return this._elem.outerWidth(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.sin(f.angle)*e)+Math.abs(Math.cos(f.angle)*c);return b}};a.jqplot.CanvasAxisTickRenderer.prototype.getHeight=function(d){if(this._elem){return this._elem.outerHeight(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.cos(f.angle)*e)+Math.abs(Math.sin(f.angle)*c);return b}};a.jqplot.CanvasAxisTickRenderer.prototype.getTop=function(b){if(this._elem){return this._elem.position().top}else{return null}};a.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad=function(){var b=this.angle*Math.PI/180;return b};a.jqplot.CanvasAxisTickRenderer.prototype.setTick=function(b,d,c){this.value=b;if(c){this.isMinorTick=true}return this};a.jqplot.CanvasAxisTickRenderer.prototype.draw=function(c,f){if(!this.label){this.label=this.prefix+this.formatter(this.formatString,this.value)}if(this._elem){if(a.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce();this._elem=null}var e=f.canvasManager.getCanvas();this._textRenderer.setText(this.label,c);var b=this.getWidth(c);var d=this.getHeight(c);e.width=b;e.height=d;e.style.width=b;e.style.height=d;e.style.textAlign="left";e.style.position="absolute";e=f.canvasManager.initCanvas(e);this._elem=a(e);this._elem.css(this._styles);this._elem.addClass("jqplot-"+this.axis+"-tick");e=null;return this._elem};a.jqplot.CanvasAxisTickRenderer.prototype.pack=function(){this._textRenderer.draw(this._elem.get(0).getContext("2d"),this.label)}})(jQuery);
|
||||
1021
plugin/jqplot/plugins/jqplot.canvasOverlay.js
Normal file
1021
plugin/jqplot/plugins/jqplot.canvasOverlay.js
Normal file
File diff suppressed because it is too large
Load Diff
3
plugin/jqplot/plugins/jqplot.canvasOverlay.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.canvasOverlay.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
449
plugin/jqplot/plugins/jqplot.canvasTextRenderer.js
Normal file
449
plugin/jqplot/plugins/jqplot.canvasTextRenderer.js
Normal file
@ -0,0 +1,449 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
* included jsDate library by Chris Leonello:
|
||||
*
|
||||
* Copyright (c) 2010-2013 Chris Leonello
|
||||
*
|
||||
* jsDate is currently available for use in all personal or commercial projects
|
||||
* under both the MIT and GPL version 2.0 licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* jsDate borrows many concepts and ideas from the Date Instance
|
||||
* Methods by Ken Snyder along with some parts of Ken's actual code.
|
||||
*
|
||||
* Ken's original Date Instance Methods and copyright notice:
|
||||
*
|
||||
* Ken Snyder (ken d snyder at gmail dot com)
|
||||
* 2008-09-10
|
||||
* version 2.0.2 (http://kendsnyder.com/sandbox/date/)
|
||||
* Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
|
||||
*
|
||||
* jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
|
||||
* Larry has generously given permission to adapt his code for inclusion
|
||||
* into jqPlot.
|
||||
*
|
||||
* Larry's original code can be found here:
|
||||
*
|
||||
* https://github.com/lsiden/export-jqplot-to-png
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
// This code is a modified version of the canvastext.js code, copyright below:
|
||||
//
|
||||
// This code is released to the public domain by Jim Studt, 2007.
|
||||
// He may keep some sort of up to date copy at http://www.federated.com/~jim/canvastext/
|
||||
//
|
||||
$.jqplot.CanvasTextRenderer = function(options){
|
||||
this.fontStyle = 'normal'; // normal, italic, oblique [not implemented]
|
||||
this.fontVariant = 'normal'; // normal, small caps [not implemented]
|
||||
this.fontWeight = 'normal'; // normal, bold, bolder, lighter, 100 - 900
|
||||
this.fontSize = '10px';
|
||||
this.fontFamily = 'sans-serif';
|
||||
this.fontStretch = 1.0;
|
||||
this.fillStyle = '#666666';
|
||||
this.angle = 0;
|
||||
this.textAlign = 'start';
|
||||
this.textBaseline = 'alphabetic';
|
||||
this.text;
|
||||
this.width;
|
||||
this.height;
|
||||
this.pt2px = 1.28;
|
||||
|
||||
$.extend(true, this, options);
|
||||
this.normalizedFontSize = this.normalizeFontSize(this.fontSize);
|
||||
this.setHeight();
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.init = function(options) {
|
||||
$.extend(true, this, options);
|
||||
this.normalizedFontSize = this.normalizeFontSize(this.fontSize);
|
||||
this.setHeight();
|
||||
};
|
||||
|
||||
// convert css spec into point size
|
||||
// returns float
|
||||
$.jqplot.CanvasTextRenderer.prototype.normalizeFontSize = function(sz) {
|
||||
sz = String(sz);
|
||||
var n = parseFloat(sz);
|
||||
if (sz.indexOf('px') > -1) {
|
||||
return n/this.pt2px;
|
||||
}
|
||||
else if (sz.indexOf('pt') > -1) {
|
||||
return n;
|
||||
}
|
||||
else if (sz.indexOf('em') > -1) {
|
||||
return n*12;
|
||||
}
|
||||
else if (sz.indexOf('%') > -1) {
|
||||
return n*12/100;
|
||||
}
|
||||
// default to pixels;
|
||||
else {
|
||||
return n/this.pt2px;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.fontWeight2Float = function(w) {
|
||||
// w = normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
|
||||
// return values adjusted for Hershey font.
|
||||
if (Number(w)) {
|
||||
return w/400;
|
||||
}
|
||||
else {
|
||||
switch (w) {
|
||||
case 'normal':
|
||||
return 1;
|
||||
break;
|
||||
case 'bold':
|
||||
return 1.75;
|
||||
break;
|
||||
case 'bolder':
|
||||
return 2.25;
|
||||
break;
|
||||
case 'lighter':
|
||||
return 0.75;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.getText = function() {
|
||||
return this.text;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.setText = function(t, ctx) {
|
||||
this.text = t;
|
||||
this.setWidth(ctx);
|
||||
return this;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.getWidth = function(ctx) {
|
||||
return this.width;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.setWidth = function(ctx, w) {
|
||||
if (!w) {
|
||||
this.width = this.measure(ctx, this.text);
|
||||
}
|
||||
else {
|
||||
this.width = w;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
// return height in pixels.
|
||||
$.jqplot.CanvasTextRenderer.prototype.getHeight = function(ctx) {
|
||||
return this.height;
|
||||
};
|
||||
|
||||
// w - height in pt
|
||||
// set heigh in px
|
||||
$.jqplot.CanvasTextRenderer.prototype.setHeight = function(w) {
|
||||
if (!w) {
|
||||
//height = this.fontSize /0.75;
|
||||
this.height = this.normalizedFontSize * this.pt2px;
|
||||
}
|
||||
else {
|
||||
this.height = w;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.letter = function (ch)
|
||||
{
|
||||
return this.letters[ch];
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.ascent = function()
|
||||
{
|
||||
return this.normalizedFontSize;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.descent = function()
|
||||
{
|
||||
return 7.0*this.normalizedFontSize/25.0;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.measure = function(ctx, str)
|
||||
{
|
||||
var total = 0;
|
||||
var len = str.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var c = this.letter(str.charAt(i));
|
||||
if (c) {
|
||||
total += c.width * this.normalizedFontSize / 25.0 * this.fontStretch;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.draw = function(ctx,str)
|
||||
{
|
||||
var x = 0;
|
||||
// leave room at bottom for descenders.
|
||||
var y = this.height*0.72;
|
||||
var total = 0;
|
||||
var len = str.length;
|
||||
var mag = this.normalizedFontSize / 25.0;
|
||||
|
||||
ctx.save();
|
||||
var tx, ty;
|
||||
|
||||
// 1st quadrant
|
||||
if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) {
|
||||
tx = 0;
|
||||
ty = -Math.sin(this.angle) * this.width;
|
||||
}
|
||||
// 4th quadrant
|
||||
else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) {
|
||||
tx = Math.sin(this.angle) * this.height;
|
||||
ty = 0;
|
||||
}
|
||||
// 2nd quadrant
|
||||
else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) {
|
||||
tx = -Math.cos(this.angle) * this.width;
|
||||
ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
|
||||
}
|
||||
// 3rd quadrant
|
||||
else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) {
|
||||
tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
|
||||
ty = -Math.cos(this.angle) * this.height;
|
||||
}
|
||||
|
||||
ctx.strokeStyle = this.fillStyle;
|
||||
ctx.fillStyle = this.fillStyle;
|
||||
ctx.translate(tx, ty);
|
||||
ctx.rotate(this.angle);
|
||||
ctx.lineCap = "round";
|
||||
// multiplier was 2.0
|
||||
var fact = (this.normalizedFontSize > 30) ? 2.0 : 2 + (30 - this.normalizedFontSize)/20;
|
||||
ctx.lineWidth = fact * mag * this.fontWeight2Float(this.fontWeight);
|
||||
|
||||
for ( var i = 0; i < len; i++) {
|
||||
var c = this.letter( str.charAt(i));
|
||||
if ( !c) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
|
||||
var penUp = 1;
|
||||
var needStroke = 0;
|
||||
for ( var j = 0; j < c.points.length; j++) {
|
||||
var a = c.points[j];
|
||||
if ( a[0] == -1 && a[1] == -1) {
|
||||
penUp = 1;
|
||||
continue;
|
||||
}
|
||||
if ( penUp) {
|
||||
ctx.moveTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag);
|
||||
penUp = false;
|
||||
} else {
|
||||
ctx.lineTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag);
|
||||
}
|
||||
}
|
||||
ctx.stroke();
|
||||
x += c.width*mag*this.fontStretch;
|
||||
}
|
||||
ctx.restore();
|
||||
return total;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasTextRenderer.prototype.letters = {
|
||||
' ': { width: 16, points: [] },
|
||||
'!': { width: 10, points: [[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
|
||||
'"': { width: 16, points: [[4,21],[4,14],[-1,-1],[12,21],[12,14]] },
|
||||
'#': { width: 21, points: [[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]] },
|
||||
'$': { width: 20, points: [[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
|
||||
'%': { width: 24, points: [[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] },
|
||||
'&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] },
|
||||
'\'': { width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] },
|
||||
'(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] },
|
||||
')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] },
|
||||
'*': { width: 16, points: [[8,21],[8,9],[-1,-1],[3,18],[13,12],[-1,-1],[13,18],[3,12]] },
|
||||
'+': { width: 26, points: [[13,18],[13,0],[-1,-1],[4,9],[22,9]] },
|
||||
',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
|
||||
'-': { width: 18, points: [[6,9],[12,9]] },
|
||||
'.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] },
|
||||
'/': { width: 22, points: [[20,25],[2,-7]] },
|
||||
'0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] },
|
||||
'1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] },
|
||||
'2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] },
|
||||
'3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
|
||||
'4': { width: 20, points: [[13,21],[3,7],[18,7],[-1,-1],[13,21],[13,0]] },
|
||||
'5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
|
||||
'6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] },
|
||||
'7': { width: 20, points: [[17,21],[7,0],[-1,-1],[3,21],[17,21]] },
|
||||
'8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] },
|
||||
'9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] },
|
||||
':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
|
||||
';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
|
||||
'<': { width: 24, points: [[20,18],[4,9],[20,0]] },
|
||||
'=': { width: 26, points: [[4,12],[22,12],[-1,-1],[4,6],[22,6]] },
|
||||
'>': { width: 24, points: [[4,18],[20,9],[4,0]] },
|
||||
'?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]] },
|
||||
'@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]] },
|
||||
'A': { width: 18, points: [[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]] },
|
||||
'B': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] },
|
||||
'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] },
|
||||
'D': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] },
|
||||
'E': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]] },
|
||||
'F': { width: 18, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]] },
|
||||
'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]] },
|
||||
'H': { width: 22, points: [[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]] },
|
||||
'I': { width: 8, points: [[4,21],[4,0]] },
|
||||
'J': { width: 16, points: [[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]] },
|
||||
'K': { width: 21, points: [[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]] },
|
||||
'L': { width: 17, points: [[4,21],[4,0],[-1,-1],[4,0],[16,0]] },
|
||||
'M': { width: 24, points: [[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]] },
|
||||
'N': { width: 22, points: [[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]] },
|
||||
'O': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]] },
|
||||
'P': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]] },
|
||||
'Q': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]] },
|
||||
'R': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]] },
|
||||
'S': { width: 20, points: [[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
|
||||
'T': { width: 16, points: [[8,21],[8,0],[-1,-1],[1,21],[15,21]] },
|
||||
'U': { width: 22, points: [[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]] },
|
||||
'V': { width: 18, points: [[1,21],[9,0],[-1,-1],[17,21],[9,0]] },
|
||||
'W': { width: 24, points: [[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]] },
|
||||
'X': { width: 20, points: [[3,21],[17,0],[-1,-1],[17,21],[3,0]] },
|
||||
'Y': { width: 18, points: [[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]] },
|
||||
'Z': { width: 20, points: [[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]] },
|
||||
'[': { width: 14, points: [[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]] },
|
||||
'\\': { width: 14, points: [[0,21],[14,-3]] },
|
||||
']': { width: 14, points: [[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]] },
|
||||
'^': { width: 16, points: [[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]] },
|
||||
'_': { width: 16, points: [[0,-2],[16,-2]] },
|
||||
'`': { width: 10, points: [[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]] },
|
||||
'a': { width: 19, points: [[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||
'b': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
|
||||
'c': { width: 18, points: [[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||
'd': { width: 19, points: [[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||
'e': { width: 18, points: [[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||
'f': { width: 12, points: [[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]] },
|
||||
'g': { width: 19, points: [[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||
'h': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
|
||||
'i': { width: 8, points: [[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]] },
|
||||
'j': { width: 10, points: [[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]] },
|
||||
'k': { width: 17, points: [[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]] },
|
||||
'l': { width: 8, points: [[4,21],[4,0]] },
|
||||
'm': { width: 30, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]] },
|
||||
'n': { width: 19, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
|
||||
'o': { width: 19, points: [[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]] },
|
||||
'p': { width: 19, points: [[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
|
||||
'q': { width: 19, points: [[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||
'r': { width: 13, points: [[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]] },
|
||||
's': { width: 17, points: [[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]] },
|
||||
't': { width: 12, points: [[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]] },
|
||||
'u': { width: 19, points: [[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]] },
|
||||
'v': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0]] },
|
||||
'w': { width: 22, points: [[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]] },
|
||||
'x': { width: 17, points: [[3,14],[14,0],[-1,-1],[14,14],[3,0]] },
|
||||
'y': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]] },
|
||||
'z': { width: 17, points: [[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]] },
|
||||
'{': { width: 14, points: [[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]] },
|
||||
'|': { width: 8, points: [[4,25],[4,-7]] },
|
||||
'}': { width: 14, points: [[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]] },
|
||||
'~': { width: 24, points: [[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]] }
|
||||
};
|
||||
|
||||
$.jqplot.CanvasFontRenderer = function(options) {
|
||||
options = options || {};
|
||||
if (!options.pt2px) {
|
||||
options.pt2px = 1.5;
|
||||
}
|
||||
$.jqplot.CanvasTextRenderer.call(this, options);
|
||||
};
|
||||
|
||||
$.jqplot.CanvasFontRenderer.prototype = new $.jqplot.CanvasTextRenderer({});
|
||||
$.jqplot.CanvasFontRenderer.prototype.constructor = $.jqplot.CanvasFontRenderer;
|
||||
|
||||
$.jqplot.CanvasFontRenderer.prototype.measure = function(ctx, str)
|
||||
{
|
||||
// var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily;
|
||||
var fstyle = this.fontSize+' '+this.fontFamily;
|
||||
ctx.save();
|
||||
ctx.font = fstyle;
|
||||
var w = ctx.measureText(str).width;
|
||||
ctx.restore();
|
||||
return w;
|
||||
};
|
||||
|
||||
$.jqplot.CanvasFontRenderer.prototype.draw = function(ctx, str)
|
||||
{
|
||||
var x = 0;
|
||||
// leave room at bottom for descenders.
|
||||
var y = this.height*0.72;
|
||||
//var y = 12;
|
||||
|
||||
ctx.save();
|
||||
var tx, ty;
|
||||
|
||||
// 1st quadrant
|
||||
if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) {
|
||||
tx = 0;
|
||||
ty = -Math.sin(this.angle) * this.width;
|
||||
}
|
||||
// 4th quadrant
|
||||
else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) {
|
||||
tx = Math.sin(this.angle) * this.height;
|
||||
ty = 0;
|
||||
}
|
||||
// 2nd quadrant
|
||||
else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) {
|
||||
tx = -Math.cos(this.angle) * this.width;
|
||||
ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
|
||||
}
|
||||
// 3rd quadrant
|
||||
else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) {
|
||||
tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
|
||||
ty = -Math.cos(this.angle) * this.height;
|
||||
}
|
||||
ctx.strokeStyle = this.fillStyle;
|
||||
ctx.fillStyle = this.fillStyle;
|
||||
// var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily;
|
||||
var fstyle = this.fontSize+' '+this.fontFamily;
|
||||
ctx.font = fstyle;
|
||||
ctx.translate(tx, ty);
|
||||
ctx.rotate(this.angle);
|
||||
ctx.fillText(str, x, y);
|
||||
// ctx.strokeText(str, x, y);
|
||||
|
||||
ctx.restore();
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
3
plugin/jqplot/plugins/jqplot.canvasTextRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.canvasTextRenderer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
679
plugin/jqplot/plugins/jqplot.categoryAxisRenderer.js
Normal file
679
plugin/jqplot/plugins/jqplot.categoryAxisRenderer.js
Normal file
@ -0,0 +1,679 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* class: $.jqplot.CategoryAxisRenderer
|
||||
* A plugin for jqPlot to render a category style axis, with equal pixel spacing between y data values of a series.
|
||||
*
|
||||
* To use this renderer, include the plugin in your source
|
||||
* > <script type="text/javascript" language="javascript" src="plugins/jqplot.categoryAxisRenderer.js"></script>
|
||||
*
|
||||
* and supply the appropriate options to your plot
|
||||
*
|
||||
* > {axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer}}}
|
||||
**/
|
||||
$.jqplot.CategoryAxisRenderer = function(options) {
|
||||
$.jqplot.LinearAxisRenderer.call(this);
|
||||
// prop: sortMergedLabels
|
||||
// True to sort tick labels when labels are created by merging
|
||||
// x axis values from multiple series. That is, say you have
|
||||
// two series like:
|
||||
// > line1 = [[2006, 4], [2008, 9], [2009, 16]];
|
||||
// > line2 = [[2006, 3], [2007, 7], [2008, 6]];
|
||||
// If no label array is specified, tick labels will be collected
|
||||
// from the x values of the series. With sortMergedLabels
|
||||
// set to true, tick labels will be:
|
||||
// > [2006, 2007, 2008, 2009]
|
||||
// With sortMergedLabels set to false, tick labels will be:
|
||||
// > [2006, 2008, 2009, 2007]
|
||||
//
|
||||
// Note, this property is specified on the renderOptions for the
|
||||
// axes when creating a plot:
|
||||
// > axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer, rendererOptions:{sortMergedLabels:true}}}
|
||||
this.sortMergedLabels = false;
|
||||
};
|
||||
|
||||
$.jqplot.CategoryAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||
$.jqplot.CategoryAxisRenderer.prototype.constructor = $.jqplot.CategoryAxisRenderer;
|
||||
|
||||
$.jqplot.CategoryAxisRenderer.prototype.init = function(options){
|
||||
this.groups = 1;
|
||||
this.groupLabels = [];
|
||||
this._groupLabels = [];
|
||||
this._grouped = false;
|
||||
this._barsPerGroup = null;
|
||||
this.reverse = false;
|
||||
// prop: tickRenderer
|
||||
// A class of a rendering engine for creating the ticks labels displayed on the plot,
|
||||
// See <$.jqplot.AxisTickRenderer>.
|
||||
// this.tickRenderer = $.jqplot.AxisTickRenderer;
|
||||
// this.labelRenderer = $.jqplot.AxisLabelRenderer;
|
||||
$.extend(true, this, {tickOptions:{formatString:'%d'}}, options);
|
||||
var db = this._dataBounds;
|
||||
// Go through all the series attached to this axis and find
|
||||
// the min/max bounds for this axis.
|
||||
for (var i=0; i<this._series.length; i++) {
|
||||
var s = this._series[i];
|
||||
if (s.groups) {
|
||||
this.groups = s.groups;
|
||||
}
|
||||
var d = s.data;
|
||||
|
||||
for (var j=0; j<d.length; j++) {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
if (d[j][0] < db.min || db.min == null) {
|
||||
db.min = d[j][0];
|
||||
}
|
||||
if (d[j][0] > db.max || db.max == null) {
|
||||
db.max = d[j][0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (d[j][1] < db.min || db.min == null) {
|
||||
db.min = d[j][1];
|
||||
}
|
||||
if (d[j][1] > db.max || db.max == null) {
|
||||
db.max = d[j][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.groupLabels.length) {
|
||||
this.groups = this.groupLabels.length;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$.jqplot.CategoryAxisRenderer.prototype.createTicks = function() {
|
||||
// we're are operating on an axis here
|
||||
var ticks = this._ticks;
|
||||
var userTicks = this.ticks;
|
||||
var name = this.name;
|
||||
// databounds were set on axis initialization.
|
||||
var db = this._dataBounds;
|
||||
var dim, interval;
|
||||
var min, max;
|
||||
var pos1, pos2;
|
||||
var tt, i;
|
||||
|
||||
// if we already have ticks, use them.
|
||||
if (userTicks.length) {
|
||||
// adjust with blanks if we have groups
|
||||
if (this.groups > 1 && !this._grouped) {
|
||||
var l = userTicks.length;
|
||||
var skip = parseInt(l/this.groups, 10);
|
||||
var count = 0;
|
||||
for (var i=skip; i<l; i+=skip) {
|
||||
userTicks.splice(i+count, 0, ' ');
|
||||
count++;
|
||||
}
|
||||
this._grouped = true;
|
||||
}
|
||||
this.min = 0.5;
|
||||
this.max = userTicks.length + 0.5;
|
||||
var range = this.max - this.min;
|
||||
this.numberTicks = 2*userTicks.length + 1;
|
||||
for (i=0; i<userTicks.length; i++){
|
||||
tt = this.min + 2 * i * range / (this.numberTicks-1);
|
||||
// need a marker before and after the tick
|
||||
var t = new this.tickRenderer(this.tickOptions);
|
||||
t.showLabel = false;
|
||||
// t.showMark = true;
|
||||
t.setTick(tt, this.name);
|
||||
this._ticks.push(t);
|
||||
var t = new this.tickRenderer(this.tickOptions);
|
||||
t.label = userTicks[i];
|
||||
// t.showLabel = true;
|
||||
t.showMark = false;
|
||||
t.showGridline = false;
|
||||
t.setTick(tt+0.5, this.name);
|
||||
this._ticks.push(t);
|
||||
}
|
||||
// now add the last tick at the end
|
||||
var t = new this.tickRenderer(this.tickOptions);
|
||||
t.showLabel = false;
|
||||
// t.showMark = true;
|
||||
t.setTick(tt+1, this.name);
|
||||
this._ticks.push(t);
|
||||
}
|
||||
|
||||
// we don't have any ticks yet, let's make some!
|
||||
else {
|
||||
if (name == 'xaxis' || name == 'x2axis') {
|
||||
dim = this._plotDimensions.width;
|
||||
}
|
||||
else {
|
||||
dim = this._plotDimensions.height;
|
||||
}
|
||||
|
||||
// if min, max and number of ticks specified, user can't specify interval.
|
||||
if (this.min != null && this.max != null && this.numberTicks != null) {
|
||||
this.tickInterval = null;
|
||||
}
|
||||
|
||||
// if max, min, and interval specified and interval won't fit, ignore interval.
|
||||
if (this.min != null && this.max != null && this.tickInterval != null) {
|
||||
if (parseInt((this.max-this.min)/this.tickInterval, 10) != (this.max-this.min)/this.tickInterval) {
|
||||
this.tickInterval = null;
|
||||
}
|
||||
}
|
||||
|
||||
// find out how many categories are in the lines and collect labels
|
||||
var labels = [];
|
||||
var numcats = 0;
|
||||
var min = 0.5;
|
||||
var max, val;
|
||||
var isMerged = false;
|
||||
for (var i=0; i<this._series.length; i++) {
|
||||
var s = this._series[i];
|
||||
for (var j=0; j<s.data.length; j++) {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
val = s.data[j][0];
|
||||
}
|
||||
else {
|
||||
val = s.data[j][1];
|
||||
}
|
||||
if ($.inArray(val, labels) == -1) {
|
||||
isMerged = true;
|
||||
numcats += 1;
|
||||
labels.push(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isMerged && this.sortMergedLabels) {
|
||||
if (typeof labels[0] == "string") {
|
||||
labels.sort();
|
||||
} else {
|
||||
labels.sort(function(a,b) { return a - b; });
|
||||
}
|
||||
}
|
||||
|
||||
// keep a reference to these tick labels to use for redrawing plot (see bug #57)
|
||||
this.ticks = labels;
|
||||
|
||||
// now bin the data values to the right lables.
|
||||
for (var i=0; i<this._series.length; i++) {
|
||||
var s = this._series[i];
|
||||
for (var j=0; j<s.data.length; j++) {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
val = s.data[j][0];
|
||||
}
|
||||
else {
|
||||
val = s.data[j][1];
|
||||
}
|
||||
// for category axis, force the values into category bins.
|
||||
// we should have the value in the label array now.
|
||||
var idx = $.inArray(val, labels)+1;
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
s.data[j][0] = idx;
|
||||
}
|
||||
else {
|
||||
s.data[j][1] = idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// adjust with blanks if we have groups
|
||||
if (this.groups > 1 && !this._grouped) {
|
||||
var l = labels.length;
|
||||
var skip = parseInt(l/this.groups, 10);
|
||||
var count = 0;
|
||||
for (var i=skip; i<l; i+=skip+1) {
|
||||
labels[i] = ' ';
|
||||
}
|
||||
this._grouped = true;
|
||||
}
|
||||
|
||||
max = numcats + 0.5;
|
||||
if (this.numberTicks == null) {
|
||||
this.numberTicks = 2*numcats + 1;
|
||||
}
|
||||
|
||||
var range = max - min;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
var track = 0;
|
||||
|
||||
// todo: adjust this so more ticks displayed.
|
||||
var maxVisibleTicks = parseInt(3+dim/10, 10);
|
||||
var skip = parseInt(numcats/maxVisibleTicks, 10);
|
||||
|
||||
if (this.tickInterval == null) {
|
||||
|
||||
this.tickInterval = range / (this.numberTicks-1);
|
||||
|
||||
}
|
||||
// if tickInterval is specified, we will ignore any computed maximum.
|
||||
for (var i=0; i<this.numberTicks; i++){
|
||||
tt = this.min + i * this.tickInterval;
|
||||
var t = new this.tickRenderer(this.tickOptions);
|
||||
// if even tick, it isn't a category, it's a divider
|
||||
if (i/2 == parseInt(i/2, 10)) {
|
||||
t.showLabel = false;
|
||||
t.showMark = true;
|
||||
}
|
||||
else {
|
||||
if (skip>0 && track<skip) {
|
||||
t.showLabel = false;
|
||||
track += 1;
|
||||
}
|
||||
else {
|
||||
t.showLabel = true;
|
||||
track = 0;
|
||||
}
|
||||
t.label = t.formatter(t.formatString, labels[(i-1)/2]);
|
||||
t.showMark = false;
|
||||
t.showGridline = false;
|
||||
}
|
||||
t.setTick(tt, this.name);
|
||||
this._ticks.push(t);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// called with scope of axis
|
||||
$.jqplot.CategoryAxisRenderer.prototype.draw = function(ctx, plot) {
|
||||
if (this.show) {
|
||||
// populate the axis label and value properties.
|
||||
// createTicks is a method on the renderer, but
|
||||
// call it within the scope of the axis.
|
||||
this.renderer.createTicks.call(this);
|
||||
// fill a div with axes labels in the right direction.
|
||||
// Need to pregenerate each axis to get its bounds and
|
||||
// position it and the labels correctly on the plot.
|
||||
var dim=0;
|
||||
var temp;
|
||||
// Added for theming.
|
||||
if (this._elem) {
|
||||
// this._elem.empty();
|
||||
// Memory Leaks patch
|
||||
this._elem.emptyForce();
|
||||
}
|
||||
|
||||
this._elem = this._elem || $('<div class="jqplot-axis jqplot-'+this.name+'" style="position:absolute;"></div>');
|
||||
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
this._elem.width(this._plotDimensions.width);
|
||||
}
|
||||
else {
|
||||
this._elem.height(this._plotDimensions.height);
|
||||
}
|
||||
|
||||
// create a _label object.
|
||||
this.labelOptions.axis = this.name;
|
||||
this._label = new this.labelRenderer(this.labelOptions);
|
||||
if (this._label.show) {
|
||||
var elem = this._label.draw(ctx, plot);
|
||||
elem.appendTo(this._elem);
|
||||
}
|
||||
|
||||
var t = this._ticks;
|
||||
for (var i=0; i<t.length; i++) {
|
||||
var tick = t[i];
|
||||
if (tick.showLabel && (!tick.isMinorTick || this.showMinorTicks)) {
|
||||
var elem = tick.draw(ctx, plot);
|
||||
elem.appendTo(this._elem);
|
||||
}
|
||||
}
|
||||
|
||||
this._groupLabels = [];
|
||||
// now make group labels
|
||||
for (var i=0; i<this.groupLabels.length; i++)
|
||||
{
|
||||
var elem = $('<div style="position:absolute;" class="jqplot-'+this.name+'-groupLabel"></div>');
|
||||
elem.html(this.groupLabels[i]);
|
||||
this._groupLabels.push(elem);
|
||||
elem.appendTo(this._elem);
|
||||
}
|
||||
}
|
||||
return this._elem;
|
||||
};
|
||||
|
||||
// called with scope of axis
|
||||
$.jqplot.CategoryAxisRenderer.prototype.set = function() {
|
||||
var dim = 0;
|
||||
var temp;
|
||||
var w = 0;
|
||||
var h = 0;
|
||||
var lshow = (this._label == null) ? false : this._label.show;
|
||||
if (this.show) {
|
||||
var t = this._ticks;
|
||||
for (var i=0; i<t.length; i++) {
|
||||
var tick = t[i];
|
||||
if (tick.showLabel && (!tick.isMinorTick || this.showMinorTicks)) {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
temp = tick._elem.outerHeight(true);
|
||||
}
|
||||
else {
|
||||
temp = tick._elem.outerWidth(true);
|
||||
}
|
||||
if (temp > dim) {
|
||||
dim = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var dim2 = 0;
|
||||
for (var i=0; i<this._groupLabels.length; i++) {
|
||||
var l = this._groupLabels[i];
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
temp = l.outerHeight(true);
|
||||
}
|
||||
else {
|
||||
temp = l.outerWidth(true);
|
||||
}
|
||||
if (temp > dim2) {
|
||||
dim2 = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (lshow) {
|
||||
w = this._label._elem.outerWidth(true);
|
||||
h = this._label._elem.outerHeight(true);
|
||||
}
|
||||
if (this.name == 'xaxis') {
|
||||
dim += dim2 + h;
|
||||
this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
|
||||
}
|
||||
else if (this.name == 'x2axis') {
|
||||
dim += dim2 + h;
|
||||
this._elem.css({'height':dim+'px', left:'0px', top:'0px'});
|
||||
}
|
||||
else if (this.name == 'yaxis') {
|
||||
dim += dim2 + w;
|
||||
this._elem.css({'width':dim+'px', left:'0px', top:'0px'});
|
||||
if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
|
||||
this._label._elem.css('width', w+'px');
|
||||
}
|
||||
}
|
||||
else {
|
||||
dim += dim2 + w;
|
||||
this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
|
||||
if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
|
||||
this._label._elem.css('width', w+'px');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// called with scope of axis
|
||||
$.jqplot.CategoryAxisRenderer.prototype.pack = function(pos, offsets) {
|
||||
var ticks = this._ticks;
|
||||
var max = this.max;
|
||||
var min = this.min;
|
||||
var offmax = offsets.max;
|
||||
var offmin = offsets.min;
|
||||
var lshow = (this._label == null) ? false : this._label.show;
|
||||
var i;
|
||||
|
||||
for (var p in pos) {
|
||||
this._elem.css(p, pos[p]);
|
||||
}
|
||||
|
||||
this._offsets = offsets;
|
||||
// pixellength will be + for x axes and - for y axes becasue pixels always measured from top left.
|
||||
var pixellength = offmax - offmin;
|
||||
var unitlength = max - min;
|
||||
|
||||
if (!this.reverse) {
|
||||
// point to unit and unit to point conversions references to Plot DOM element top left corner.
|
||||
|
||||
this.u2p = function(u){
|
||||
return (u - min) * pixellength / unitlength + offmin;
|
||||
};
|
||||
|
||||
this.p2u = function(p){
|
||||
return (p - offmin) * unitlength / pixellength + min;
|
||||
};
|
||||
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis'){
|
||||
this.series_u2p = function(u){
|
||||
return (u - min) * pixellength / unitlength;
|
||||
};
|
||||
this.series_p2u = function(p){
|
||||
return p * unitlength / pixellength + min;
|
||||
};
|
||||
}
|
||||
|
||||
else {
|
||||
this.series_u2p = function(u){
|
||||
return (u - max) * pixellength / unitlength;
|
||||
};
|
||||
this.series_p2u = function(p){
|
||||
return p * unitlength / pixellength + max;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
// point to unit and unit to point conversions references to Plot DOM element top left corner.
|
||||
|
||||
this.u2p = function(u){
|
||||
return offmin + (max - u) * pixellength / unitlength;
|
||||
};
|
||||
|
||||
this.p2u = function(p){
|
||||
return min + (p - offmin) * unitlength / pixellength;
|
||||
};
|
||||
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis'){
|
||||
this.series_u2p = function(u){
|
||||
return (max - u) * pixellength / unitlength;
|
||||
};
|
||||
this.series_p2u = function(p){
|
||||
return p * unitlength / pixellength + max;
|
||||
};
|
||||
}
|
||||
|
||||
else {
|
||||
this.series_u2p = function(u){
|
||||
return (min - u) * pixellength / unitlength;
|
||||
};
|
||||
this.series_p2u = function(p){
|
||||
return p * unitlength / pixellength + min;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (this.show) {
|
||||
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||
for (i=0; i<ticks.length; i++) {
|
||||
var t = ticks[i];
|
||||
if (t.show && t.showLabel) {
|
||||
var shim;
|
||||
|
||||
if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
|
||||
// will need to adjust auto positioning based on which axis this is.
|
||||
var temp = (this.name == 'xaxis') ? 1 : -1;
|
||||
switch (t.labelPosition) {
|
||||
case 'auto':
|
||||
// position at end
|
||||
if (temp * t.angle < 0) {
|
||||
shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||
}
|
||||
// position at start
|
||||
else {
|
||||
shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
||||
}
|
||||
break;
|
||||
case 'end':
|
||||
shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||
break;
|
||||
case 'start':
|
||||
shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
||||
break;
|
||||
case 'middle':
|
||||
shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||
break;
|
||||
default:
|
||||
shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
shim = -t.getWidth()/2;
|
||||
}
|
||||
var val = this.u2p(t.value) + shim + 'px';
|
||||
t._elem.css('left', val);
|
||||
t.pack();
|
||||
}
|
||||
}
|
||||
|
||||
var labeledge=['bottom', 0];
|
||||
if (lshow) {
|
||||
var w = this._label._elem.outerWidth(true);
|
||||
this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
|
||||
if (this.name == 'xaxis') {
|
||||
this._label._elem.css('bottom', '0px');
|
||||
labeledge = ['bottom', this._label._elem.outerHeight(true)];
|
||||
}
|
||||
else {
|
||||
this._label._elem.css('top', '0px');
|
||||
labeledge = ['top', this._label._elem.outerHeight(true)];
|
||||
}
|
||||
this._label.pack();
|
||||
}
|
||||
|
||||
// draw the group labels
|
||||
var step = parseInt(this._ticks.length/this.groups, 10) + 1;
|
||||
for (i=0; i<this._groupLabels.length; i++) {
|
||||
var mid = 0;
|
||||
var count = 0;
|
||||
for (var j=i*step; j<(i+1)*step; j++) {
|
||||
if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
|
||||
if (this._ticks[j]._elem && this._ticks[j].label != " ") {
|
||||
var t = this._ticks[j]._elem;
|
||||
var p = t.position();
|
||||
mid += p.left + t.outerWidth(true)/2;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
mid = mid/count;
|
||||
this._groupLabels[i].css({'left':(mid - this._groupLabels[i].outerWidth(true)/2)});
|
||||
this._groupLabels[i].css(labeledge[0], labeledge[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i=0; i<ticks.length; i++) {
|
||||
var t = ticks[i];
|
||||
if (t.show && t.showLabel) {
|
||||
var shim;
|
||||
if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
|
||||
// will need to adjust auto positioning based on which axis this is.
|
||||
var temp = (this.name == 'yaxis') ? 1 : -1;
|
||||
switch (t.labelPosition) {
|
||||
case 'auto':
|
||||
// position at end
|
||||
case 'end':
|
||||
if (temp * t.angle < 0) {
|
||||
shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
|
||||
}
|
||||
else {
|
||||
shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
|
||||
}
|
||||
break;
|
||||
case 'start':
|
||||
if (t.angle > 0) {
|
||||
shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
|
||||
}
|
||||
else {
|
||||
shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
|
||||
}
|
||||
break;
|
||||
case 'middle':
|
||||
// if (t.angle > 0) {
|
||||
// shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||
// }
|
||||
// else {
|
||||
// shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
||||
// }
|
||||
shim = -t.getHeight()/2;
|
||||
break;
|
||||
default:
|
||||
shim = -t.getHeight()/2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
shim = -t.getHeight()/2;
|
||||
}
|
||||
|
||||
var val = this.u2p(t.value) + shim + 'px';
|
||||
t._elem.css('top', val);
|
||||
t.pack();
|
||||
}
|
||||
}
|
||||
|
||||
var labeledge=['left', 0];
|
||||
if (lshow) {
|
||||
var h = this._label._elem.outerHeight(true);
|
||||
this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
|
||||
if (this.name == 'yaxis') {
|
||||
this._label._elem.css('left', '0px');
|
||||
labeledge = ['left', this._label._elem.outerWidth(true)];
|
||||
}
|
||||
else {
|
||||
this._label._elem.css('right', '0px');
|
||||
labeledge = ['right', this._label._elem.outerWidth(true)];
|
||||
}
|
||||
this._label.pack();
|
||||
}
|
||||
|
||||
// draw the group labels, position top here, do left after label position.
|
||||
var step = parseInt(this._ticks.length/this.groups, 10) + 1; // step is one more than before as we don't want to have overlaps in loops
|
||||
for (i=0; i<this._groupLabels.length; i++) {
|
||||
var mid = 0;
|
||||
var count = 0;
|
||||
for (var j=i*step; j<(i+1)*step; j++) { // j must never reach (i+1)*step as we don't want to have overlap between loops
|
||||
if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
|
||||
if (this._ticks[j]._elem && this._ticks[j].label != " ") {
|
||||
var t = this._ticks[j]._elem;
|
||||
var p = t.position();
|
||||
mid += p.top + t.outerHeight()/2;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
mid = mid/count;
|
||||
this._groupLabels[i].css({'top':mid - this._groupLabels[i].outerHeight()/2});
|
||||
this._groupLabels[i].css(labeledge[0], labeledge[1]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
})(jQuery);
|
||||
3
plugin/jqplot/plugins/jqplot.categoryAxisRenderer.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.categoryAxisRenderer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
116
plugin/jqplot/plugins/jqplot.ciParser.js
Normal file
116
plugin/jqplot/plugins/jqplot.ciParser.js
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
* choose the license that best suits your project and use it accordingly.
|
||||
*
|
||||
* Although not required, the author would appreciate an email letting him
|
||||
* know of any substantial use of jqPlot. You can reach the author at:
|
||||
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||
*
|
||||
* If you are feeling kind and generous, consider supporting the project by
|
||||
* making a donation at: http://www.jqplot.com/donate.php .
|
||||
*
|
||||
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||
*
|
||||
* version 2007.04.27
|
||||
* author Ash Searle
|
||||
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||
* http://hexmen.com/js/sprintf.js
|
||||
* The author (Ash Searle) has placed this code in the public domain:
|
||||
* "This code is unrestricted: you are free to use it however you like."
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* Class: $.jqplot.ciParser
|
||||
* Data Renderer function which converts a custom JSON data object into jqPlot data format.
|
||||
* Set this as a callable on the jqplot dataRenderer plot option:
|
||||
*
|
||||
* > plot = $.jqplot('mychart', [data], { dataRenderer: $.jqplot.ciParser, ... });
|
||||
*
|
||||
* Where data is an object in JSON format or a JSON encoded string conforming to the
|
||||
* City Index API spec.
|
||||
*
|
||||
* Note that calling the renderer function is handled internally by jqPlot. The
|
||||
* user does not have to call the function. The parameters described below will
|
||||
* automatically be passed to the ciParser function.
|
||||
*
|
||||
* Parameters:
|
||||
* data - JSON encoded string or object.
|
||||
* plot - reference to jqPlot Plot object.
|
||||
*
|
||||
* Returns:
|
||||
* data array in jqPlot format.
|
||||
*
|
||||
*/
|
||||
$.jqplot.ciParser = function (data, plot) {
|
||||
var ret = [],
|
||||
line,
|
||||
temp,
|
||||
i, j, k, kk;
|
||||
|
||||
if (typeof(data) == "string") {
|
||||
data = $.jqplot.JSON.parse(data, handleStrings);
|
||||
}
|
||||
|
||||
else if (typeof(data) == "object") {
|
||||
for (k in data) {
|
||||
for (i=0; i<data[k].length; i++) {
|
||||
for (kk in data[k][i]) {
|
||||
data[k][i][kk] = handleStrings(kk, data[k][i][kk]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
||||
// function handleStrings
|
||||
// Checks any JSON encoded strings to see if they are
|
||||
// encoded dates. If so, pull out the timestamp.
|
||||
// Expects dates to be represented by js timestamps.
|
||||
|
||||
function handleStrings(key, value) {
|
||||
var a;
|
||||
if (value != null) {
|
||||
if (value.toString().indexOf('Date') >= 0) {
|
||||
//here we will try to extract the ticks from the Date string in the "value" fields of JSON returned data
|
||||
a = /^\/Date\((-?[0-9]+)\)\/$/.exec(value);
|
||||
if (a) {
|
||||
return parseInt(a[1], 10);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
for (var prop in data) {
|
||||
line = [];
|
||||
temp = data[prop];
|
||||
switch (prop) {
|
||||
case "PriceTicks":
|
||||
for (i=0; i<temp.length; i++) {
|
||||
line.push([temp[i]['TickDate'], temp[i]['Price']]);
|
||||
}
|
||||
break;
|
||||
case "PriceBars":
|
||||
for (i=0; i<temp.length; i++) {
|
||||
line.push([temp[i]['BarDate'], temp[i]['Open'], temp[i]['High'], temp[i]['Low'], temp[i]['Close']]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
ret.push(line);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
})(jQuery);
|
||||
3
plugin/jqplot/plugins/jqplot.ciParser.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.ciParser.min.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||
jsDate | (c) 2010-2013 Chris Leonello
|
||||
*/(function(a){a.jqplot.ciParser=function(g,l){var m=[],o,n,h,f,e,c;if(typeof(g)=="string"){g=a.jqplot.JSON.parse(g,d)}else{if(typeof(g)=="object"){for(e in g){for(h=0;h<g[e].length;h++){for(c in g[e][h]){g[e][h][c]=d(c,g[e][h][c])}}}}else{return null}}function d(j,k){var i;if(k!=null){if(k.toString().indexOf("Date")>=0){i=/^\/Date\((-?[0-9]+)\)\/$/.exec(k);if(i){return parseInt(i[1],10)}}return k}}for(var b in g){o=[];n=g[b];switch(b){case"PriceTicks":for(h=0;h<n.length;h++){o.push([n[h]["TickDate"],n[h]["Price"]])}break;case"PriceBars":for(h=0;h<n.length;h++){o.push([n[h]["BarDate"],n[h]["Open"],n[h]["High"],n[h]["Low"],n[h]["Close"]])}break}m.push(o)}return m}})(jQuery);
|
||||
1108
plugin/jqplot/plugins/jqplot.cursor.js
Normal file
1108
plugin/jqplot/plugins/jqplot.cursor.js
Normal file
File diff suppressed because it is too large
Load Diff
3
plugin/jqplot/plugins/jqplot.cursor.min.js
vendored
Normal file
3
plugin/jqplot/plugins/jqplot.cursor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user