As new thing, they can automatically deleted or rename, as far they respective pages have these actions.
# Other global variables: use vars qw( ... + %UserInterest? ... sub LoadUserData { ... %UserData = split(/$FS1/, $data, -1); + %UserInterest? = split(/$FS2/, $UserData{'interest'}, -1); ... }
+ sub GetUserBar? { + my ($fname, $data, $status); + my @pages; + my $result; + + $fname = &UserDataFilename($UserID); + ($status, $data) = &ReadFile($fname); + %UserData = split(/$FS1/, $data, -1); + @pages = sort (keys (%UserInterest? )); + foreach (@pages) { + $result .= ' . ' if ($_ =~ m|/|); + $result .= &GetPageOrEditLink($_)."
"; + } + return $result; + }
+ sub DoInterest? { + my $id; + my $mode; + + $id = &GetParam('id', ''); + $mode = &GetParam('mode', ''); + + return if (!&ValidIdOrDie($id)); + if (&GetParam('username') eq "") { + print &GetHeader(, T('Error'), ); + print T('You must login to do this action'); + print &GetFooterText(); + return; + } + if ($mode eq 'add') { + $title = Ts('%s(Add)', $id); + } elsif ($mode eq 'remove') { + $title = Ts('%s(Remove)', $id); + } else { + print &GetHeader(, T('Error'), ); + print Ts('Invalid action parameter %s', $mode); + print &GetFooterText(); + return; + } + print &GetHeader(, $title, ); + print &AdminUploadLink?("right::vrbs.png"); + if ($mode eq 'add') { + $UserInterest?{$id} = "1"; + print Ts('Page %s is added to your Interest Page List', $id); + } else { + delete $UserInterest?{$id}; + print Ts('Page %s is removed from your Interest Page List', $id); + } + $UserData{'interest'} = join($FS2, %UserInterest?); + &SaveUserData(); + $OpenPageName = $id; + print &GetFooterText(); + return; + }
+ Sub GetFooterText { my ($id, $rev) = @_; + $userName; my $result; ... if ($AdminBar? && &UserIsAdmin()) { $result .= '
' . &GetAdminBar?($id); } + $result .= &GetUserBar?(); + $userName = &GetParam("username", ""); + if ($userName) { + if (defined($UserInterest?{$id})) { + $result .= &ScriptLink("action=interest&mode=remove&id=$id", T('Remove from interest list')); + } else { + $result .= &ScriptLink("action=interest&mode=add&id=$id", T('Add to my interest list')); + } + $result .= " | "; + }
} elsif ($action eq "upload") { $UseShortcut? = 0; &DoUpload?(); ... sub DoOtherRequest { ... + } elsif ($action eq "interest") { + &DoInterest?(); ... sub DeletePage { ... + for ($i= 1001; ; ++$i) { + $fname = &UserDataFilename($i); + ($status, $data) = &ReadFile($fname); + %UserData = split(/$FS1/, $data, -1); + last unless scalar %UserData; + if ($UserData{'interest'}) { + %UserInterest? = split(/$FS2/, $UserData{'interest'}, -1); + foreach (sort (keys (%UserInterest?))) { + if ($page eq $_) { + delete $UserInterest?{$page}; + print $UserData{username} . '(' . T('hold') . ')' . '--JuanmaMP
'; + $UserData{'interest'} = join($FS2, %UserInterest?); + $data = join($FS1, %UserData); + &WriteStringToFile?($fname, $data); + } + } + } + } + &LoadUserData($UserID); ... } sub RenamePage? { ... + for ($i= 1001; ; ++$i) { + $fname = &UserDataFilename($i); # + ($status, $data) = &ReadFile($fname); # 1 + %UserData = split(/$FS1/, $data, -1); # 2 + # 1 + 2 equivale a cargar datos de usuario + last unless scalar %UserData; + if ($UserData{'interest'}) { + %UserInterest? = split(/$FS2/, $UserData{'interest'}, -1); + foreach (sort (keys (%UserInterest?))) { + if ($old eq $_) { + delete $UserInterest?{$old}; + $UserInterest?{$new} = "1"; + print $UserData{username} . '(' . T('hold') . ')' . '
'; + $UserData{'interest'} = join($FS2, %UserInterest?); + $data = join($FS1, %UserData); + &WriteStringToFile?($fname, $data); + } + } + } + } + &LoadUserData($UserID); ... }