css 및 js 호출순서 조정기능 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5785 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2009-03-06 05:33:56 +00:00
parent 4f380d9c48
commit 61851f1dfe
2149 changed files with 109090 additions and 18689 deletions

View file

@ -0,0 +1,108 @@
<?php
if(!defined("__ZBXE__")) exit();
/**
* @file captcha.addon.php
* @author zero (zero@nzeo.com)
* @brief 특정 action을 실행할때 captcah를 띄우도록
**/
// before_module_proc 일 경우 && act_type != everytime 이면 세션 초기화
if($called_position == "before_module_proc" && $addon_info->act_type == 'everytime' && $_SESSION['captcha_authed']) {
unset($_SESSION['captcha_authed']);
// before_module_init 일때에 captcha 동작
} else if($called_position == 'before_module_init') {
$logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) return;
if($addon_info->target != 'all' && Context::get('is_logged')) return;
// 캡챠 인증이 되지 않은 세션이면 실행 시작
if(!$_SESSION['captcha_authed']) {
// 언어파일 로드
Context::loadLang(_XE_PATH_.'addons/captcha/lang');
// 캡챠 세션 세팅
if(Context::get('act')=='setCaptchaSession') {
$f = FileHandler::readDir('./addons/captcha/icon');
shuffle($f);
$key = rand(0,count($f)-1);
$keyword = str_replace('.gif','',$f[$key]);
$_SESSION['captcha_keyword'] = $keyword;
$target = Context::getLang('target_captcha');
header("Content-Type: text/xml; charset=UTF-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
printf("<response>\r\n<error>0</error>\r\n<message>success</message>\r\n<about><![CDATA[%s]]></about>\r\n<keyword><![CDATA[%s]]></keyword>\r\n</response>",Context::getLang('about_captcha'),$target[$keyword]);
Context::close();
exit();
// 캡챠 이미지 출력
} else if(Context::get('act')=='captchaImage') {
$f = FileHandler::readDir('./addons/captcha/icon');
shuffle($f);
$keyword = $_SESSION['captcha_keyword'];
for($key=0,$c=count($f);$key<$c;$key++) {
if($keyword.".gif" == $f[$key]) break;
}
// 이미지 만들기
$thumb = imagecreatetruecolor(250,100);
for($i=0,$c=count($f);$i<$c;$i++) {
$x = ($i%5)*50;
$y = $i>4?0:50;
imagedestroy($dummy);
$dummy = imagecreatefromgif('./addons/captcha/icon/'.$f[$i]);
imagecopyresampled($thumb, $dummy, $x, $y, 0, 0, 50, 50, 50, 50);
if($i==$key) {
$_SESSION['captcha_x'] = $x;
$_SESSION['captcha_y'] = $y;
}
}
imagedestroy($dummy);
header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: image/png");
imagepng($thumb, null,9);
imagedestroy($thumb);
Context::close();
exit();
// 캡챠 이미지 점검
} else if(Context::get('act')=='captchaCompare') {
$x = Context::get('mx');
$y = Context::get('my');
$sx = $_SESSION['captcha_x'];
$sy = $_SESSION['captcha_y'];
if($x>=$sx && $x<=$sx+50 && $y>=$sy && $y<=$sy+50) $_SESSION['captcha_authed'] = true;
else $_SESSION['captcha_authed'] = false;
header("Content-Type: text/xml; charset=UTF-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
print("<response>\r\n<error>0</error>\r\n<message>success</message>\r\n</response>");
Context::close();
exit();
}
Context::addJsFile('./addons/captcha/captcha.js',false);
// 게시판/ 이슈트래커의 글쓰기/댓글쓰기 액션 호출시 세션 비교
if(in_array(Context::get('act'), array('procBoardInsertDocument','procBoardInsertComment','procIssuetrackerInsertIssue','procIssuetrackerInsertHistory'))) {
$this->error = "msg_not_permitted";
}
}
}
?>

109
addons/captcha/captcha.js Normal file
View file

@ -0,0 +1,109 @@
/**
* procFilter 함수를 가로채서 captcha 이미지 폼을 출력
**/
var oldExecXml = null;
var calledArgs = null;
(function($){
$(function() {
var captchaXE = null;
function xeCaptcha() {
var body = $(document.body);
var captchaIma;
if (!captchaXE) {
captchaXE = $("<div>")
.attr("id","captcha_screen")
.css({
position:"absolute",
display:"none",
backgroundColor:"#111",
backgroundRepeat:"repeat",
backgroundPosition:"0 0",
zIndex:500
});
$('<div id="captchaBox" style="display:none;*zoom:1;overflow:hidden;height:200px;">'+
'<img src="" id="captcha_image" />'+
'<p style="color:#666;width:250px;padding:0;margin:10px 0 20px 0; " id="captchaAbout">&nbsp;</p>'+
'<p style="color:#DDD;width:250px;font-size:15px;padding:0; margin:0 0 10px; font-weight:bold; text-align:center;" id="captchaText">&nbsp;</p>'+
'</div>').appendTo(captchaXE);
body.append(captchaXE);
captchaXE.exec= function(act, args) {
if(act == 'procBoardInsertDocument' || act == 'procBoardInsertComment' || act == 'procIssuetrackerInsertIssue' || act == 'procIssuetrackerInsertHistory') {
oldExecXml('captcha','setCaptchaSession',new Array(),this.show,new Array('error','message','about','keyword'));
calledArgs = args;
} else {
oldExecXml(args.module, args.act,args.params,args.callback_func,args.response_tags,args.callback_func_arg,args.fo_obj);
}
};
captchaXE.show = function(ret_obj) {
var clientWidth = $(window).width();
var clientHeight = $(window).height();
$(document).scrollTop(0);
$(document).scrollLeft(0);
$("#captcha_screen").css({
display:"block",
width : clientWidth+"px",
height : clientHeight+"px",
left : 0,
top : 0
});
$("#captchaAbout").html(ret_obj['about']);
$("#captchaText").html(ret_obj['keyword']);
$("#captcha_image")
.css( {
width:"250px",
height:"100px",
margin:"0 0 10px 0",
cursor:"pointer"
})
.attr("src", request_uri.setQuery('act','captchaImage').setQuery('rnd',Math.round(Math.random() * 6)))
.click (captchaXE.compare)
.focus( function() { this.blur(); } );
$("#captchaBox")
.css({
display:"block",
border:"10px solid #222222",
padding:"10px",
position:"absolute",
backgroundColor:"#2B2523",
left : (clientWidth/2-125)+"px",
top : (clientHeight/2-100)+"px"
})
};
captchaXE.compare = function(e) {
var posX = parseInt($("#captchaBox").css("left").replace(/px$/,''),10);
var posY = parseInt($("#captchaBox").css("top").replace(/px$/,''),10);
var x = e.pageX - posX - 20;
var y = e.pageY - posY - 20;
var params = new Array();
params["mx"] = x;
params["my"] = y;
oldExecXml('captcha','captchaCompare',params, function() {
$("#captcha_screen").css({ display:"none" });
oldExecXml(calledArgs.module, calledArgs.act, calledArgs.params, calledArgs.callback_func, calledArgs.response_tags, calledArgs.callback_func_arg, calledArgs.fo_obj);
} );
};
}
return captchaXE;
}
$(window).ready(function(){
oldExecXml = exec_xml;
exec_xml = null;
var newFunc = function(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj) {xeCaptcha().exec(act, {module:module, act:act,params:params,callback_func:callback_func,response_tags:response_tags,callback_func_arg:callback_func_arg,fo_obj:fo_obj})};
exec_xml = newFunc;
});
});
})(jQuery);

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon version="0.2">
<title xml:lang="ko">Captcha 애드온</title>
<title xml:lang="jp">Captchaアドオン</title>
<description xml:lang="ko">
프로그램 글 등록기를 막기 위해 게시판/ issueTracker에서 글/ 댓글을 입력하려 할 때 이미지를 보여주고 글에 해당하는 이미지를 선택하게 하는 애드온입니다.
로그인하지 않은 경우에만 해당됩니다.
</description>
<description xml:lang="jp">
ボット(bot)がプログラムによるスパム行為を防ぐために、掲示板issueTrackerで書き込み・コメントを入力する際、ランダムな文字や数字の列を画面に表示し、表示されたものと同じ情報を入力して、データを登録させるアドオンです。
ログインしてない時だけ、動作します。
</description>
<version>0.1</version>
<date>2009-02-20</date>
<author email_address="zero@zeroboard.com" link="http://blog.nzeo.com">
<name xml:lang="ko">zero</name>
<name xml:lang="jp">zero</name>
</author>
<extra_vars>
<var name="target" type="select">
<title xml:lang="ko">Captcha 표시 대상</title>
<title xml:lang="jp">Captchaを表示する対象</title>
<description xml:lang="ko">글/댓글 등록시 captcha가 동작할 대상을 정할 수 있습니다. 관리자는 무조건 제외됩니다</description>
<description xml:lang="jp">管理者以外、書き込み・コメントを入力する際captchaを見せる対象を設定します。</description>
<options value="">
<title xml:lang="ko">로그인하지 않은 사용자</title>
<title xml:lang="jp">ログインしてないユーザー</title>
</options>
<options value="all">
<title xml:lang="ko">모든 사용자</title>
<title xml:lang="jp">すべてのユーザー</title>
</options>
</var>
<var name="act_type" type="select">
<title xml:lang="ko">동작 방식</title>
<title xml:lang="jp">動作方式</title>
<description xml:lang="ko">"1번만 동작"을 선택하시면 1번만 동작후 상태를 저장해서 다음부터 물어보지 않고 그렇지 않으면 매번 물어보게 됩니다</description>
<description xml:lang="jp">"1回だけ表示"を選択すると、1回だけ動作した後、その情報を保存して次回からはCaptchaを見せないようにし、もう一つのオプションは毎回Captchaを表示します。</description>
<options value="onetime">
<title xml:lang="ko">1번만 동작</title>
<title xml:lang="jp">1回だけ表示</title>
</options>
<options value="everytime">
<title xml:lang="ko">매번 동작</title>
<title xml:lang="jp">毎回表示</title>
</options>
</var>
</extra_vars>
</addon>

BIN
addons/captcha/icon/airplane.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
addons/captcha/icon/apple.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
addons/captcha/icon/book.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
addons/captcha/icon/camera.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
addons/captcha/icon/dog.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
addons/captcha/icon/earth.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
addons/captcha/icon/flag.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
addons/captcha/icon/mobile.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
addons/captcha/icon/note.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
addons/captcha/icon/skeleton.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,21 @@
<?php
/**
* @file addons/captcha/lang/jp.lang.php
* @author zero (zero@nzeo.com) 翻訳:ミニミ
* @brief 日本語言語パッケージ
**/
$lang->about_captcha = "ボットbotのスパム登録を防ぐため、下の単語と一致するイメージを選択して下さい。";
$lang->target_captcha = array(
"airplane" => "飛行機",
"apple" => "りんご",
"book" => "",
"camera" => "カメラ",
"dog" => "",
"earth" => "地球",
"flag" => "",
"mobile" => "携帯",
"note" => "音符",
"skeleton" => "がいこつ",
);
?>

View file

@ -0,0 +1,21 @@
<?php
/**
* @file ko.lang.php
* @author zero (zero@nzeo.com)
* @brief 한국어 언어팩
**/
$lang->about_captcha = "프로그램 등록을 방지하기 위하여 아래 알려주는 이름과 일치하는 이미지를 선택해주세요";
$lang->target_captcha = array(
"airplane" => "비행기",
"apple" => "사과",
"book" => "",
"camera" => "카메라",
"dog" => "강아지",
"earth" => "지구",
"flag" => "깃발",
"mobile" => "핸드폰",
"note" => "음표",
"skeleton" => "해골",
);
?>

View file

@ -5,16 +5,10 @@
* @file counter.addon.php
* @author zero (zero@nzeo.com)
* @brief 카운터 애드온
*
* 카운터 애드온은 XE의 기본 카운터(counter)모듈을 이용하여 로그를 남깁니다.
* 검색 로봇이나 기타 툴의 접속을 방지하고 부하를 줄이기 위해서 페이지가 로드된 후에 javascript로 다시 로그를 남기도록 합니다.
* 따라서 카운터 애드온은 카운터를 수집하게 하는 javascript 파일을 추가하는 동작만 하며 기본 카운터 모듈의 호출은 해당 javascript
* 파일내에서 이루어집니다.
**/
// called_position가 before_module_init 이고 module이 admin이 아닐 경우
if($called_position == 'before_module_init' && !$GLOBALS['__counter_addon_called__'] && !in_array(Context::get('act'), array('procCounterExecute','procFileDelete'))) {
if($this->module != 'admin') Context::addJsFile('./modules/counter/tpl/js/counter.js');
$GLOBALS['__counter_addon_called__'] = true;
// called_position가 before_display_content 일 경우 실행
if(Context::isInstalled() && $called_position == 'before_module_init' && Context::get('module')!='admin') {
$oCounterController = &getController('counter');
$oCounterController->procCounterExecute();
}
?>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon version="0.2">
<title xml:lang="ko">키워드 링크 애드온</title>
<title xml:lang="zh-CN">关键字链接</title>
<title xml:lang="zh-TW">關鍵字連結</title>
<title xml:lang="jp">キーワードリンクアドオン</title>
<description xml:lang="ko">
@ -8,10 +9,15 @@
키워드는 콤마(,)로 구분하여 여러개 등록할 수 있습니다.
먼저 등록된 키워드가 우선순위를 갖습니다.
</description>
<description xml:lang="zh-CN">
此插件将自动给主题正文及评论中的关键字添加相应的预设链接。
多个关键字可以用逗号(,)来区分输入。
多个关键字的优先级以输入顺序准。
</description>
<description xml:lang="zh-TW">
게시글과 댓글의 내용중 등록된 키워드에 링크를 걸어주는 애드온입니다.
將文章與評論中和關鍵字相對應的文字自動作連結。
可用逗號(,)區隔多個關鍵字。
以第一關鍵字為主。
關鍵字的優先順序以第一關鍵字為主。
</description>
<description xml:lang="jp">
本文とコメントの内容中、登録されたキーワードにリンクを貼りつける機能を行います。
@ -33,32 +39,41 @@
<extra_vars>
<var name="cssquery">
<title xml:lang="ko">cssquery</title>
<title xml:lang="zh-CN">cssquery</title>
<title xml:lang="zh-TW">cssquery</title>
<title xml:lang="jp">cssquery</title>
<description xml:lang="ko">치환할 부분의 jQuery cssquery입니다.
xe_board 게시판 스킨이면 공백으로 두면 됩니다.</description>
<description xml:lang="zh-TW">치환할 부분의 jQuery cssquery입니다.
xe_board 게시판 스킨이면 공백으로 두면 됩니다.</description>
<description xml:lang="zh-TW">jQuery cssquery的部份可以置換。
如果是使用xe_board討論板面板請留白。</description>
<description xml:lang="zh-CN">替换部分的jQuery cssquery。
如果正使用的是官方默认皮肤(xe_board此处留空即可。</description>
<description xml:lang="jp">置き換える部分のjQuery cssqueryです。
xe_board掲示板スキンの場合、空白にして下さい。</description>
</var>
<var name="reg_type" type="select">
<title xml:lang="ko">링크 방법</title>
<title xml:lang="zh-CN">链接方式</title>
<title xml:lang="zh-TW">連結方式</title>
<title xml:lang="jp">リンクの貼りつけ方</title>
<description xml:lang="ko"> 키워드가 여러개 있을때 "첫번째 키워드"에만 링크를 걸 것인지 "모든 키워드"에 걸 것인지 선택합니다.
</description>
<description xml:lang="zh-CN">有多个预设关键字时,在此可以指定链接方式。
</description>
<description xml:lang="zh-TW"> 키워드가 여러개 있을때 "첫번째 키워드"에만 링크를 걸 것인지 "모든 키워드"에 걸 것인지 선택합니다.
</description>
<description xml:lang="jp"> 複数のキーワードの場合、"最初のキーワード"のみ、もしくは "全てのキーワード"にリンクを貼りつけるかを選択します。
</description> <options value="">
</description>
<options value="">
<title xml:lang="ko">첫번째 키워드</title>
<title xml:lang="zh-CN">首个关键字</title>
<title xml:lang="zh-TW">第一關鍵字</title>
<title xml:lang="jp">最初のキーワード</title>
</options>
<options value="g">
<title xml:lang="ko">모든 키워드</title>
<title xml:lang="zh-CN">所有关键字</title>
<title xml:lang="zh-TW">所有關鍵字</title>
<title xml:lang="jp">全てのキーワード</title>
</options>
@ -66,51 +81,61 @@
<var name="keyword01">
<title xml:lang="ko">키워드</title>
<title xml:lang="zh-CN">关键字</title>
<title xml:lang="zh-TW">關鍵字</title>
<title xml:lang="jp">キーワード</title>
</var>
<var name="url01">
<title xml:lang="ko">링크</title>
<title xml:lang="zh-CN">链接</title>
<title xml:lang="zh-TW">連結</title>
<title xml:lang="jp">リンク</title>
</var>
<var name="keyword02">
<title xml:lang="ko">키워드</title>
<title xml:lang="zh-CN">关键字</title>
<title xml:lang="zh-TW">關鍵字</title>
<title xml:lang="jp">キーワード</title>
</var>
<var name="url02">
<title xml:lang="ko">링크</title>
<title xml:lang="zh-CN">链接</title>
<title xml:lang="zh-TW">連結</title>
<title xml:lang="jp">リンク</title>
</var>
<var name="keyword03">
<title xml:lang="ko">키워드</title>
<title xml:lang="zh-CN">关键字</title>
<title xml:lang="zh-TW">關鍵字</title>
<title xml:lang="jp">キーワード</title>
</var>
<var name="url03">
<title xml:lang="ko">링크</title>
<title xml:lang="zh-CN">链接</title>
<title xml:lang="zh-TW">連結</title>
<title xml:lang="jp">リンク</title>
</var>
<var name="keyword04">
<title xml:lang="ko">키워드</title>
<title xml:lang="zh-CN">关键字</title>
<title xml:lang="zh-TW">關鍵字</title>
<title xml:lang="jp">キーワード</title>
</var>
<var name="url04">
<title xml:lang="ko">링크</title>
<title xml:lang="zh-CN">链接</title>
<title xml:lang="zh-TW">連結</title>
<title xml:lang="jp">リンク</title>
</var>
<var name="keyword05">
<title xml:lang="ko">키워드</title>
<title xml:lang="zh-CN">关键字</title>
<title xml:lang="zh-TW">關鍵字</title>
<title xml:lang="jp">キーワード</title>
</var>
<var name="url05">
<title xml:lang="ko">링크</title>
<title xml:lang="zh-CN">链接</title>
<title xml:lang="zh-TW">連結</title>
<title xml:lang="jp">リンク</title>
</var>

View file

@ -81,4 +81,4 @@
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationAddFriend','target_srl',$member_srl), 'cmd_add_friend', './modules/communication/tpl/images/icon_add_friend.gif', 'popup');
}
}
?>
?>

View file

@ -1,11 +1,11 @@
<?php
/**
* @file addons/mobile/lang/zh-CN.lang.php
* @author zero (zero@nzeo.com)
* @brief 中文语言包
* @author zero (zero@nzeo.com) 翻译guny
* @brief 手机XE插件简体中文语言包
**/
$lang->cmd_go_upper = '上一级';
$lang->cmd_go_home = '首页';
$lang->cmd_view_sitemap = 'View site map';
$lang->cmd_view_sitemap = '网站地图';
?>

View file

@ -1,11 +1,11 @@
<?php
/**
* @file addons/mobile/lang/zh-TW.lang.php
* @author zero (zero@nzeo.com)
* @author zero (zero@nzeo.com) 翻譯royallin
* @brief 正體中文語言包 (只有基本內容)
**/
$lang->cmd_go_upper = '回上頁';
$lang->cmd_go_home = '回首頁';
$lang->cmd_view_sitemap = 'View site map';
$lang->cmd_view_sitemap = '網站地圖';
?>

View file

@ -1,11 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon version="0.2">
<title xml:lang="ko">플래닛 Bookmark 애드온</title>
<title xml:lang="en">Planet Bookmark Add-Ons</title>
<title xml:lang="es">Guardar planeta Add-Ons</title>
<title xml:lang="zh-CN">微博收藏插件</title>
<title xml:lang="zh-TW">微型部落格書籤</title>
<title xml:lang="jp">Planet Bookmark アドオン</title>
<description xml:lang="ko">
플래닛 Bookmark 애드온
</description>
<description xml:lang="en">
Planet Bookmark Add-Ons
</description>
<description xml:lang="es">
Guardar planeta Add-Ons
</description>
<description xml:lang="zh-CN">
XE微博收藏插件。
@ -21,6 +29,8 @@
<author email_address="zero@zeroboard.com" link="http://blog.nzeo.com">
<name xml:lang="ko">zero</name>
<name xml:lang="es">zero</name>
<name xml:lang="en">zero</name>
<name xml:lang="jp">zero</name>
<name xml:lang="zh-CN">zero</name>
<name xml:lang="zh-TW">zero</name>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon version="0.2">
<title xml:lang="ko">위키 링크 애드온</title>
<title xml:lang="zh-CN">维基链接插件</title>
<title xml:lang="zh-TW">維基百科</title>
<title xml:lang="jp">wikiリンクアドオン</title>
<description xml:lang="ko">
위키 링크를 추가해주는 애드온.
</description>
<description xml:lang="zh-CN">
给维基模块添加链接的插件。
</description>
<description xml:lang="zh-TW">
維基百科控件。
</description>
<description xml:lang="jp">
wikiリンクを追加するアドオン
</description>
<version>0.1</version>
<date>2009-02-03</date>
<author email_address="haneul0318@gmail.com" link="http://blog.nzeo.com">
<name xml:lang="ko">haneul</name>
<name xml:lang="zh-CN">haneul</name>
<name xml:lang="zh-TW">haneul</name>
<name xml:lang="jp">haneul</name>
</author>
</addon>

View file

@ -0,0 +1,14 @@
<?php
if(!defined("__ZBXE__")) exit();
if($called_position == 'after_module_proc' && Context::getResponseMethod()!="XMLRPC" && Context::get('act')=='dispWikiEditPage' ) {
$module_info = Context::get('module_info');
if(!$module_info->module) return;
if($module_info->module != 'wiki') return;
Context::loadJavascriptPlugin('hotkeys');
Context::addJsFile('./addons/wiki_link/wikilink.js');
Context::addCssFile('./addons/wiki_link/wikilink.css');
$footer = "<div id='link'> <div class='linkForm'>Link Target: <input type='text' id='linktarget' class='inputTypeText w100' /><a href='#' onclick='setText(); return false;'>AddLink</a></div></div>";
Context::addHtmlFooter($footer);
}
?>

View file

@ -0,0 +1,4 @@
#link { display: none; }
#link .linkForm { margin-left: 10px; margin-top: 10px; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 5px; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }

View file

@ -0,0 +1,45 @@
function openWikiLinkDialog()
{
var link = jQuery("#link");
link.css('display', 'block');
var target = xGetElementById('linktarget');
target.value = "";
try{
link.dialog({height:100});
}
catch(e)
{
link.dialog("open");
}
}
function setText() {
var target = xGetElementById('linktarget');
if(!target.value || target.value.trim() == '') return;
var text = target.value;
text.replace(/&/ig,'&amp;').replace(/</ig,'&lt;').replace(/>/ig,'&gt;');
var url = request_uri.setQuery('mid',current_mid).setQuery('entry',text);
var link = "<a href=\""+url+"\" ";
link += ">"+text+"</a>";
var iframe_obj = editorGetIFrame(1)
editorReplaceHTML(iframe_obj, link);
jQuery("#link").dialog("close");
}
function addShortCutForWiki()
{
var iframe_obj = editorGetIFrame(1);
if(jQuery.os.Mac)
{
jQuery(iframe_obj.contentWindow.document).bind('keydown', "ALT+SPACE", function(evt) { openWikiLinkDialog(); });
}
else
{
jQuery(iframe_obj.contentWindow.document).bind('keydown', "CTRL+SPACE", function(evt) { openWikiLinkDialog(); });
}
jQuery(document).bind('keydown',"CTRL+ALT+SPACE", function(evt) {} );
}
xAddEventListener(window, 'load', addShortCutForWiki);