add sysop ability to export own or all logs
This commit is contained in:
parent
6cd3b1e86b
commit
9207306197
@ -281,30 +281,53 @@ def viewLogBook() :
|
|||||||
def exportLogBook() :
|
def exportLogBook() :
|
||||||
global db
|
global db
|
||||||
global handle
|
global handle
|
||||||
|
secLevel = mci2str('SL')
|
||||||
|
filter = handle
|
||||||
|
who = ""
|
||||||
|
if secLevel == "255" :
|
||||||
|
gotoxy(22,19)
|
||||||
|
write("View [A]ll or [S]elf only: ")
|
||||||
|
ch = onekey(chr(13) + 'AS', False)
|
||||||
|
if ch == "S" :
|
||||||
|
pass
|
||||||
|
write("SELF")
|
||||||
|
if ch == "A" :
|
||||||
|
filter = "all"
|
||||||
|
who = "ReportedBy,"
|
||||||
|
write("ALL")
|
||||||
|
|
||||||
|
|
||||||
callsign = db["users"][handle]["callsign"]
|
callsign = db["users"][handle]["callsign"]
|
||||||
tempFile = script_path+"/"+"mL-ham_logbook_"+callsign.lower()+".csv"
|
tempFile = script_path+"/"+"mL-ham_logbook_"+callsign.lower()+".csv"
|
||||||
fHandle = open(tempFile, "w")
|
fHandle = open(tempFile, "w")
|
||||||
fHandle.write("Date,Callsign,Name,RST IN,RST OUT,Notes\n")
|
fHandle.write(who+"Date,Callsign,Name,RST IN,RST OUT,Notes\n")
|
||||||
found = False
|
found = False
|
||||||
|
|
||||||
for LOG in sorted(db["logs"], reverse=False) :
|
for LOG in sorted(db["logs"], reverse=False) :
|
||||||
if db["logs"][LOG]["reportedBy"] == handle :
|
if (filter == "all") or (db["logs"][LOG]["reportedBy"] == handle) :
|
||||||
found = True
|
found = True
|
||||||
|
reportedBy = str(db["logs"][LOG]["reportedBy"])
|
||||||
contactCall = str(db["logs"][LOG]["contactCall"])
|
contactCall = str(db["logs"][LOG]["contactCall"])
|
||||||
observedSig = str(db["logs"][LOG]["observedSig"])
|
observedSig = str(db["logs"][LOG]["observedSig"])
|
||||||
yourSig = str(db["logs"][LOG]["yourSig"])
|
yourSig = str(db["logs"][LOG]["yourSig"])
|
||||||
theirName = str(db["logs"][LOG]["theirName"])
|
theirName = str(db["logs"][LOG]["theirName"])
|
||||||
notes = str(db["logs"][LOG]["notes"])
|
notes = str(db["logs"][LOG]["notes"])
|
||||||
fHandle.write(LOG+","+contactCall+","+theirName+" "+observedSig+","+yourSig+","+notes+"\n")
|
if who != "" :
|
||||||
|
showWho = reportedBy+","
|
||||||
|
else :
|
||||||
|
showWho = ""
|
||||||
|
fHandle.write(showWho+LOG+","+contactCall+","+theirName+" "+observedSig+","+yourSig+","+notes+"\n")
|
||||||
fHandle.close()
|
fHandle.close()
|
||||||
menucmd('F3',tempFile)
|
|
||||||
os.remove(tempFile)
|
if found :
|
||||||
writeln("File exported")
|
menucmd('F3',tempFile)
|
||||||
writeln("|PA")
|
writeln("|15File exported|07")
|
||||||
if not found :
|
|
||||||
writeln("Sorry, no records to export. Aborted.")
|
|
||||||
writeln("|PA")
|
writeln("|PA")
|
||||||
|
else :
|
||||||
|
writeln("|15Sorry, no records to export. Aborted.|07")
|
||||||
|
writeln("|PA")
|
||||||
|
|
||||||
|
os.remove(tempFile)
|
||||||
|
|
||||||
|
|
||||||
def checkConfig(S = None) :
|
def checkConfig(S = None) :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user