[첫화면으로]UseModWiki소스수정/goto매크로버그

마지막으로 [b]

1. goto 매크로 문제 해결
1.1. wiki.pl 수정
1.2. macros/goto.pl 수정
1.3. 추가 업데이트 내역
1.4. 의견란

1. goto 매크로 문제 해결

1.1. wiki.pl 수정

sub DoBrowseRequest {
    ...
    if ($action eq 'browse') {
        if ($FreeLinks && (!-f &GetPageFile($id))) {
            $id = &FreeToNormal($id);
        }
        if (($NotFoundPg ne '') && (!-f &GetPageFile($id))) {
            $id = $NotFoundPg;
        }
### 추가
        if ($id eq '') {
            $id = $HomePage;
        }
###
        &BrowsePage($id)  if &ValidIdOrDie($id);
        return 1;
    ...
}

MacroGoto함수는 ext2.3에서 고쳐져서, 더 이상 유효하지 않음

1.2. macros/goto.pl 수정

sub goto {
    my ($txt) = @_;

    $txt =~ s/\&__LT__;goto\((.*?)\)\&__GT__;/&MacroGoto($1)/gei;

    return $txt;
}

sub MacroGoto {
    my ($string) = @_;
    $string = &RemoveLink($string);
    return &GetGotoForm($string);
}

1;

1.3. 추가 업데이트 내역

goto 매크로를 쓸 때 인자로 들어가는 스트링이 위키네임일 경우 문제가 됩니다. 위의 sub MacroGoto 안에
    $string = &RemoveLink($string);
을 추가해 주면 됩니다.
-- Raymundo 2003-2-27 9:28 pm

ext1.90

-- Raymundo 2005-11-19 6:06 pm

ext2.3

1.4. 의견란

i tried a link (a la CWIK) as:

sub GetPrinterFriendlyLink {
my ($id) = @_;
my $action;

$action = lc(&GetParam('action', ''));

if ($action) {
return &ScriptLink("action=$action&id=$id&embed=1", T('Printer'));
} else {
return &ScriptLink("action=browse&id=$id&embed=1", T('Printer'));
}
}

but GetGotoForm of UsemodKr seems "to capture" the action. I have commented in sub GetGotoForm

#. &GetHiddenValue("action", "browse")

and, for the time being, I don't see drawbacks.

Regards.

-- JustSameJuanmaMP 2009-8-25 6:18 am
이름:  
Homepage:
내용:
 


위키위키분류

마지막 편집일: 2009-8-25 6:18 am (변경사항 [d])
877 hits | Permalink | 변경내역 보기 [h] | 페이지 소스 보기