Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37883142
en ru br
ALT Linux repositórios
S:0.9.2-alt1
5.0: 0.6-alt1
4.1: 0.4-alt2.M41.3
4.0: 0.1-alt2.M40.1

Group :: Sistema/Configurações/Rede
RPM: alterator-logs

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

alterator-logs-0.4/000075500000000000000000000000001111621627000143075ustar00rootroot00000000000000alterator-logs-0.4/Makefile000064400000000000000000000003701111621627000157470ustar00rootroot00000000000000NAME=logs
DESCRIPTION="System logs"

INSTALL=/usr/bin/install

all:
clean:
install: install-module install-data

include /usr/share/alterator/build/module.mak

install-data:
install -d $(sysconfdir)/alterator
cp -a logs $(sysconfdir)/alterator
alterator-logs-0.4/applications/000075500000000000000000000000001111621627000167755ustar00rootroot00000000000000alterator-logs-0.4/applications/logs.desktop000064400000000000000000000002251111621627000213330ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-System
Icon=logs
Terminal=false
Name=System logs
X-Alterator-URI=/logs
X-Alterator-Help=logs
alterator-logs-0.4/backend3/000075500000000000000000000000001111621627000157615ustar00rootroot00000000000000alterator-logs-0.4/backend3/logs000075500000000000000000000061361111621627000166610ustar00rootroot00000000000000#!/bin/sh

datadir=/etc/alterator/logs
cachefile=/var/cache/alterator/alterator-logs.txt
po_domain="alterator-logs"

. alterator-sh-functions

log_basename()
{
local n=${1##*/}
echo "${n%%.desktop}"
}

desktop_awk()
{
[ ! -f "$1" ] ||
alterator-dump-desktop \
-v lang="$in_language" \
-v out="X-Alterator-URI;Name" \
-v def="/notfound;" \
$1
}

cat_log()
{
find "$(dirname $1)" -type f -name "$(basename $1)*"|
while read f; do
t="$(file -b "$f")"
if [ -z "${t##bzip2 compressed data*}" ]; then
bzcat "$f"
elif [ -z "${t##gzip compressed data*}" ]; then
zcat "$f"
else
cat "$f"
fi
done
}

on_message()
{
case "$in_action" in
write)
write_nop
;;
read)
echo '('
local name="$in_name"
local desktopfile="$datadir/$name.desktop"

if [ ! -n "$name" ] ;then
desktopfile="$(find "$datadir" -name '*.desktop'|head -n1)"
name="$(log_basename "$desktopfile")"
fi

#dump + total size
local path="$(desktop_awk "$desktopfile"|cut -f1)"
local total="$(cat_log "$path"|tee "$cachefile"|wc -l)"

#main data: page size and start shift
local start="$in_start"
local size="$in_size"
local stop=

[ -n "$size" ] || size=20
[ -n "$start" ] || start=1

#change size: back to first page
if [ -n "$in_new_size" -a "$in_new_size" != "$in_size" ];then
size="$in_new_size"
start=1
fi

#next/back/first/last
if [ -n "$in_next" ]; then
start="$(($start + $size))"
fi

if [ -n "$in_back" ]; then
start="$(($start - $size))"
[ "$start" -gt 0 ] || start=1
fi

if [ -n "$in_first" ]; then
start=1
fi

if [ -n "$in_last" ]; then
start="$(( ( $total / $size ) * $size ))"
[ "$start" -gt 0 ] || start=1
stop="$total"
else
stop="$(($start + $size))"
fi

printf 'text "%s"' "$(sed -n -e "$start,$stop p" -e "$stop q" "$cachefile"|string_quote)"
[ "$stop" -lt "$total" ] || stop="$total"

local format="`_ "Lines %s-%s of %s"`"
printf "range \"$format\"\n" "$start" "$stop" "$total"

#save information for next page switch
if [ "$stop" -eq "$total" ] ;then
start="$(($start - $size))"
[ "$start" -gt 0 ] || start=1
fi
printf 'name "%s"\n' "$name"
printf 'start "%s"\n' "$start"
printf 'size "%s"\n' "$size"
printf 'new_size "%s"\n' "$size"

echo ')'
;;
list)
echo '('
case "$in__objects" in
avail_size)
write_enum_item "10" "`_ "10 lines"`"
write_enum_item "20" "`_ "20 lines"`"
write_enum_item "50" "`_ "50 lines"`"
write_enum_item "100" "`_ "100 lines"`"
;;
avail_log)
find "$datadir" -name '*.desktop'|
while read n;do
printf '%s\t' "$(log_basename "$n")"
desktop_awk "$n"
done|
while read desktopfile path description;do
[ -f "$path" ] || continue
write_enum_item "$desktopfile" "$description"
done
;;
esac
echo ')'
;;
*)
echo '#f'
;;
esac
}

message_loop
alterator-logs-0.4/design/000075500000000000000000000000001111621627000155605ustar00rootroot00000000000000alterator-logs-0.4/design/scripts/000075500000000000000000000000001111621627000172475ustar00rootroot00000000000000alterator-logs-0.4/design/scripts/logs/000075500000000000000000000000001111621627000202135ustar00rootroot00000000000000alterator-logs-0.4/design/scripts/logs/select.js000064400000000000000000000006071111621627000220330ustar00rootroot00000000000000function LogsAutoSubmit(name)
{
var view = document.getElementById(name);
var select = document.getElementById("select-"+name);
if (!view || !select) return;

view.style.display="none";
addEvent(select,'change',function() { select.form.submit(); });
}

function initLogs()
{
LogsAutoSubmit("view");
LogsAutoSubmit("change");
}

addEvent(window,'load',initLogs);
alterator-logs-0.4/logs/000075500000000000000000000000001111621627000152535ustar00rootroot00000000000000alterator-logs-0.4/logs/ahttpd.desktop000064400000000000000000000003271111621627000201340ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Xorg
Icon=configd
Terminal=false
Name=Web interface HTTP server
Name[ru]=HTTP-сервер web-интерфейса
X-Alterator-URI=/var/log/ahttpd/access.log
alterator-logs-0.4/logs/configd.desktop000064400000000000000000000003141111621627000202550ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Xorg
Icon=configd
Terminal=false
Name=System configurator
Name[ru]=Системный конфигуратор
X-Alterator-URI=/var/log/configd.log
alterator-logs-0.4/logs/kernel.desktop000064400000000000000000000002331111621627000201240ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Xorg
Icon=secure
Terminal=false
Name=Kernel
Name[ru]=Ядро
X-Alterator-URI=/var/log/kernel/info
alterator-logs-0.4/logs/messages.desktop000064400000000000000000000003061111621627000204540ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Xorg
Icon=configd
Terminal=false
Name=System messages
Name[ru]=Системные сообщения
X-Alterator-URI=/var/log/syslog/messages
alterator-logs-0.4/logs/secure.desktop000064400000000000000000000002551111621627000201360ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Xorg
Icon=secure
Terminal=false
Name=Security
Name[ru]=Безопасность
X-Alterator-URI=/var/log/auth/secure
alterator-logs-0.4/templates/000075500000000000000000000000001111621627000163055ustar00rootroot00000000000000alterator-logs-0.4/templates/logs/000075500000000000000000000000001111621627000172515ustar00rootroot00000000000000alterator-logs-0.4/templates/logs/index.html000064400000000000000000000024301111621627000212450ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!-- log viewer module -->
<html wf="form">
<head>
<script src="/design/scripts/logs/select.js"/>
</head>
<body>
<form method="GET">
<span translate="_">Logs:</span>
<select name="name" enumref="/logs/avail_log" id="select-view"/>
<input type="submit" class="btn" value="View" id="view"/>
<br/>
</form>
<form>
<textarea name="text" style="width:100%;height:350px" readonly="yes"></textarea>
</form>
<form method="GET">
<input type="hidden" name="name"/>
<input type="hidden" name="start"/>
<input type="hidden" name="size"/>

<span class="alterator-label" name="range"/>
&nbsp;
<input type="submit" class="btn" name="back" value="Previous"/>
<input type="submit" class="btn" name="next" value="Next"/>
&nbsp;
&nbsp;
<input type="submit" class="btn" name="first" value="First page"/>
<input type="submit" class="btn" name="last" value="Last page"/>
&nbsp;|&nbsp;
<span translate="_">Show:</span>
<select name="new_size" enumref="/logs/avail_size" id="select-change"/>
<input type="submit" class="btn" value="Change" id="change"/>
</form>
</body>
</html>
alterator-logs-0.4/ui/000075500000000000000000000000001111621627000147245ustar00rootroot00000000000000alterator-logs-0.4/ui/logs/000075500000000000000000000000001111621627000156705ustar00rootroot00000000000000alterator-logs-0.4/ui/logs/index.scm000064400000000000000000000027661111621627000175160ustar00rootroot00000000000000(document:surround "/std/frame")
(document:insert "/std/functions")

(define *start* (make-cell 1))
(define *size* (make-cell 1))

;;; Functions
(define (do-apply data)
(cell-set! *start* (woo-get-option data 'start))
(cell-set! *size* (woo-get-option data 'size))
(txt text (woo-get-option data 'text))
(range text (woo-get-option data 'range)))

(define (do-update . args)
(woo-catch/message
(thunk
(do-apply (apply woo-read-first "/logs"
'start (cell-ref *start*)
'size (cell-ref *size*)
'name (log value)
args)))))

;;; UI
(hbox align "left"
(label text (_ "Logs:"))
(document:id log (combobox (when selected (do-update)))))
(document:id txt (textbox))
(hbox align "left"
(document:id range (label))
(button text (_ "Previous") (when clicked (do-update 'back #t)))
(button text (_ "Next") (when clicked (do-update 'next #t)))
(label)
(button text (_ "First page") (when clicked (do-update 'first #t)))
(button text (_ "Last page") (when clicked (do-update 'last #t)))
(label text "|")
(label text (_ "Show:"))
(document:id new_size (combobox (when selected (do-update 'new_size (new_size value))))))

;;; Logic
(document:root
(when loaded
(woo-catch/message
(thunk
(let ((data (woo-read-first "/logs")))
(log enumref "/logs/avail_log"
value (woo-get-option data 'name))
(new_size enumref "/logs/avail_size"
value (woo-get-option data 'new_size))

(do-apply data))))))
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009