
alias blog { dialog -m logsys logsys }
dialog LogSys {
  title "Log Gösterici"
  size -1 -1 272 300
  option pxl
  tab "Kanal Logları" 12, 1 1 268 300
  tab "Özel Logları" 13,
  box "", 1, 10 26 150 260
  list 2, 15 41 140 240, size vsbar sort tab12
  list 14, 15 41 140 240, size vsbar sort tab13
  box "", 3, 162 26 100 260
  text "" 15, 165 45 90 22, read autohs
  button "&Aç", 4, 165 70 90 21,tab12
  button "&Sil", 5, 165 95 90 21,tab12
  button "&Düzenle" , 6, 165 120 90 21,tab12
  button "&Yeniden Adlandir", 7, 165 145 90 21,tab12
  button "&Yenile", 8, 165 170 90 21,tab12
  button "&Dcc Gönder", 21, 165 195 90 21,tab12
  button "&Aç", 16, 165 70 90 21,tab13
  button "&Sil", 17, 165 95 90 21,tab13
  button "&Düzenle" , 18, 165 120 90 21,tab13
  button "&Yeniden Adlandir", 19, 165 145 90 21,tab13
  button "&Yenile", 20, 165 170 90 21,tab13
  button "&Dcc Gönder", 22, 165 195 90 21,tab13
  button "&Kapat", 10, 165 258 90 21, ok
}
alias verlog {
  %log = $1
  if (%log == $null) %log = $gettok($active,1,32)
  if ($findfile($logdir, [ $replace(%log,$chr(124),_,$chr(94),_,\,_) $+ .log ] ,0) == 0) { .erro Log Listeniz Bos. | halt }
  var %log.name = @ $+ %log $+ -log
  %log.arquivo = logs/ $+ $replace(%log,$chr(124),_,$chr(94),_,\,_) $+ .log | window %log.name
  if (%log.name) clear %log.name
  loadbuf -p %log.name %log.arquivo
  unset %log.arquivo
}

on *:Dialog:LogSys:init:0:{ 
  .Logs.Chan.List 
  did -a logsys 15 Ön Izleme
}
on *:dialog:LogSys:sclick:2: { 
  .set %Log.Num $did($dname,2,1).sel 
  .did -a logsys 15 $did($dname,2,%Log.Num)
}
on *:dialog:LogSys:sclick:4: { verlog $did($dname,2,%Log.Num) }
on *:dialog:LogSys:sclick:21: { .dcc send $$?="Nick?" }

on *:dialog:LogSys:sclick:22: { .dcc send $$?="Nick?" }
on *:dialog:LogSys:sclick:5: { .set %Log.Num $did($dname,2,1).sel 
  .remove logs\ $+ $did($dname,2,%Log.Num) $+ .log 
  .Logs.Chan.List 
}
on *:dialog:LogSys:sclick:6: { .set %Log.Num $did($dname,2,1).sel 
  .run notepad logs\ $+ $did($dname,2,%Log.Num) $+ .log 
}
on *:dialog:LogSys:sclick:7: { .timer 1 0 Logs.Chan.NewName 
  .set %Log.Num $did($dname,2,1).sel 
  .set %Log.Place logs\ $+ $did($dname,2,%Log.Num) $+ .log 
}
on *:dialog:LogSys:sclick:8: { .Logs.Chan.List }
on *:dialog:LogSys:sclick:13: { 
  .Logs.Pvt.List
  did -a logsys 15 Ön Izleme
}
on *:dialog:LogSys:sclick:14: {  
  .set %Log.Num $did($dname,14,1).sel 
  .did -a logsys 15 $did($dname,14,%Log.Num)
}
on *:dialog:LogSys:sclick:16: { verlog $did($dname,14,%Log.Num) }
on *:dialog:LogSys:sclick:17: { 
  set %Log.Num $did($dname,14,1).sel 
  .remove logs\ $+ $did($dname,14,%Log.Num) $+ .log 
  .Logs.Pvt.List 
}
on *:dialog:LogSys:sclick:18: { set %Log.Num $did($dname,14,1).sel 
  run notepad logs\ $+ $did($dname,14,%Log.Num) $+ .log 
}
on *:dialog:LogSys:sclick:19: { .timer 1 0 Logs.Pvt.NewName 
  .set %Log.Num $did($dname,14,1).sel 
  .set %Log.Place logs\ $+ $did($dname,14,%Log.Num) $+ .log 
}
on *:dialog:LogSys:sclick:20: { .Logs.Pvt.List }

alias Logs.Chan.NewName { 
  .set %Logs.Pvt.NewName $$?="Yeniden Adlandir. Bir Isim Giriniz." 
  .rename %Log.Place logs\ $+ %Logs.Pvt.NewName $+ .log 
  unset %Logs.Pvt.NewName 
  Logs.Chan.List 
  halt 
}
alias Logs.Pvt.NewName { 
  set %Logs.Pvt.NewName $$?="Yeniden Adlandir. Bir Isim Giriniz." 
  .rename %Log.Place logs\ $+ %Logs.Pvt.NewName $+ .log 
  unset %Logs.Pvt.NewName 
  Logs.Pvt.List 
  halt 
}

alias Logs.Pvt.List {
  did -r LogSys 14
  set %Logs.Pvt.list 0
  :list
  inc %Logs.Pvt.list 1
  if ($findfile(logs,*.log,%Logs.Pvt.list,1,set %var $1-)) { if ($chr(35) isin %var) { goto list } | else { did -a LogSys 14 $remove($nopath(%var),.log) | goto list } }
  :end
  unset %Logs.Pvt.list %var
}
alias Logs.Chan.List {
  did -r LogSys 2
  set %Logs.Chan.list 0
  :list
  inc %Logs.Chan.list 
  if ($findfile(logs,#*.log,%Logs.Chan.list,1,did -a LogSys 2 $remove($nopath($1-),.log))) goto list
  :end
  unset %Logs.Chan.list
}
menu channel,status,menubar,query {
  .Log Kayıt
  ..-
  ..Bu yazışmayı kaydet:/log on
  ..Kayıt etmeyi sonlandır:/log off
  .-
  . +> Log Okuyucu:/blog
}
