Last active
April 18, 2016 22:03
-
-
Save hideki-a/46d0158d46b87115660f42fdb1467ede to your computer and use it in GitHub Desktop.
ウェブページの一覧にルートからのパスを表示する。(表示オプションでフルパスを選択する。)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id: DispPageFullPath | |
name: DispPageFullPath | |
version: 1.0 | |
list_properties: | |
page: | |
fullpath: | |
label: 'フルパス' | |
html: > | |
sub { | |
my $prop = shift; | |
my ( $obj, $app, $opts ) = @_; | |
my $folder = $obj->folder; | |
if ($folder) { | |
my @folders = (); | |
while (1) { | |
if ($folder->parent == 0) { | |
push (@folders, $folder); | |
last; | |
} | |
push (@folders, $folder); | |
$folder = MT::Folder->load($folder->parent); | |
} | |
@folders = reverse @folders; | |
my @folder_labels = (); | |
for my $folder (@folders) { | |
push (@folder_labels, $folder->label); | |
} | |
return join('/', @folder_labels); | |
} | |
return '(root)'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
最上位が必ずしもルートとは限らない。