1 #pragma TextEncoding = "UTF-8"
2 #pragma rtGlobals=3 // Use modern global access method and strict wave access.
4 #pragma IgorVersion = 6.36
5 #pragma ModuleName = PearlElog
104 if (ItemsInList(templates) < 1)
109 if (strlen(logbook) == 0)
113 string win_name = logbook + "ElogPanel"
114 if (strlen(logbook) > 0)
115 if (strlen(WinList(win_name, ";", "")) > 0)
116 DoWindow /F $win_name
119 STRUCT WMWinHookStruct s
129 string igorApplicationNameStr
137 string igorApplicationNameStr
146 String file,pathName,type,creator
147 if( (kind >= 1) && (kind <= 2))
175 dfref df_package = $package_path
176 dfref df_persistent = df_package:persistent
177 dfref df_volatile = df_package:volatile
181 dfref df_parent = df_package
184 dfref df_parent = df_persistent
187 dfref df_parent = df_persistent:templates
190 dfref df_parent = df_volatile
193 Abort "
get_elog_df: undefined data folder category."
196 if ((strlen(name) > 0) && (category >= 1))
198 dfref df_logbooks = df_parent
200 dfref df_logbooks = df_parent:logbooks
202 dfref df_logbook = df_logbooks:$name
221 if (ParamIsDefault(clean))
225 dfref savedf = getdatafolderdfr()
227 if ((clean == 0) && (DataFolderRefStatus(df_root) == 1))
232 newdatafolder /o/s packages
233 newdatafolder /o/s $package_name
234 dfref df_package_root = getdatafolderdfr()
235 newdatafolder /o/s volatile
236 dfref df_volatile = getdatafolderdfr()
237 newdatafolder /o logbooks
238 setdatafolder df_package_root
239 newdatafolder /o/s persistent
240 dfref df_persistent = getdatafolderdfr()
241 newdatafolder /o logbooks
242 newdatafolder /o templates
245 setdatafolder df_persistent
246 string /g elog_path = "c:\\program files (x86)\\ELOG\\elog.exe"
247 string /g hostname = "localhost"
250 string /g subdir = ""
251 variable /g loglevel = 4
264 dfref savedf = getdatafolderdfr()
271 setdatafolder df_templates
272 newdatafolder /o/s Experiments
276 string /g attributes = "author;project;p-group;sample;source;task;technique;file;valid;"
279 string /g controls = "sv_author;sv_project;sv_pgroup;sv_sample;pm_source;pm_task;pm_technique;sv_file;cb_valid;"
281 string /g options = "source=sources;task=tasks;technique=techniques"
283 string /g required_attributes = "author;project;sample;source;task;technique;valid"
286 string /g sources = "Manual Entry;PShell;Scienta Data;SScan Data;Prosilica Data;OTF Data;Beamline Status;LEED Data;QMS Data;Matrix Data;Igor Pro;Other"
287 string /g tasks = "Measurement;Optimization;Analysis;Sample Preparation;Sample Storage;Comment;Development;Maintenance;Test;Other"
288 string /g techniques = "XPS;UPS;XPD;XAS;XMCD;PhD;ARUPS;STM;STS;LEED;AES;QMS;MBE;Sputter/Anneal;Test;Other"
291 setdatafolder df_templates
292 newdatafolder /o/s Calculations
296 string /g attributes = "author;project;p-group;sample;program;revision;machine;job;experiment;source path;result path;valid"
299 string /g controls = "sv_author;sv_project;sv_pgroup;sv_sample;pm_program;sv_revision;pm_machine;sv_job;sv_experiment;sv_sourcepath;sv_resultpath;cb_valid"
301 string /g options = "program=programs;machine=machines"
303 string /g required_attributes = "author;project;sample"
306 string /g programs = "PMSCO;EDAC;MSC;SSC;MUFPOT;DMSUP;Other"
307 string /g machines = "PC;VM;Ra;Merlin;llcx;Other"
310 setdatafolder df_templates
311 newdatafolder /o/s System
315 string /g attributes = "author;type;system;source;file"
318 string /g controls = "sv_author;pm_type;pm_system;pm_source;sv_file"
320 string /g options = "type=types;system=systems;source=sources"
322 string /g required_attributes = "author;type;system"
325 string /g types = "Installation;Repair;Maintenance;Test;Commissioning;Bakeout;Incident;Cool-down;Warm-up;Storage;Other"
326 string /g systems = "Vacuum;Control System;BL;XA;XP;SA;SP;T;LL;Monochromator;Carving;Scienta;STM;PC-Scienta;PC-Matrix;PC-Console;PC-Console-Win;PC-XP;EPS;LAC;Desiccator;Other"
327 string /g sources = "Manual Entry;PShell;Scienta Data;SScan Data;Prosilica Data;OTF Data;Beamline Status;LEED Data;QMS Data;Matrix Data;Igor Pro;Other"
342 dfref savedf = GetDataFolderDFR()
345 dfref df_volatile_parent = df_volatile_root:logbooks
349 variable nlb = ItemsInList(logbooks)
352 SetDataFolder df_volatile_root
353 if (exists("temp_graph_files") != 2)
354 string /g temp_graph_files = ""
357 for (ilb = 0; ilb < nlb; ilb += 1)
358 logbook = StringFromList(ilb, logbooks)
360 SetDataFolder df_volatile_parent
361 if (DataFolderExists(logbook))
362 SetDataFolder $logbook
364 NewDataFolder /o/s $logbook
367 if (exists("username") != 2)
368 string /g username = ""
370 if (exists("password") != 2)
371 string /g password = ""
373 if (exists("msg_id") != 2)
374 variable /g msg_id = 0
376 if (exists("att_list") != 1)
377 make /n=(0,3) /t /o attach_list
378 make /n=(0,3) /i /o attach_sel
380 if (exists("url") != 2)
419 if (ParamIsDefault(template))
423 dfref savedf = getdatafolderdfr()
426 dfref df_persistent_parent = df_persistent_root:logbooks
428 dfref df_volatile_parent = df_volatile_root:logbooks
430 setdatafolder df_persistent_parent
431 if (CheckName(name, 11) != 0)
433 Abort "invalid logbook name"
437 if (strlen(template) > 0)
440 if (DataFolderRefStatus(df_existing))
441 KillDataFolder /Z df_existing
443 DuplicateDataFolder df_template, df_persistent_parent:$name
445 NewDataFolder /o/s df_persistent_parent:$name
448 string /g logbook = name
451 string /g attributes = ""
454 string /g controls = ""
456 string /g options = ""
458 string /g required_attributes = ""
463 string /g recent = ""
464 string /g recent_message = ""
482 if (!ParamIsDefault(elog_path))
483 svar /sdfr=df g_elog_path = elog_path
484 g_elog_path = elog_path
486 if (!ParamIsDefault(hostname))
487 svar /sdfr=df g_hostname = hostname
488 g_hostname = hostname
490 if (!ParamIsDefault(port))
491 nvar /sdfr=df g_port = port
494 if (!ParamIsDefault(subdir))
495 svar /sdfr=df g_subdir = subdir
520 svar /sdfr=df g_username=username
521 svar /sdfr=df g_password=password
522 g_username = username
523 g_password = password
538 if (strlen(logbook) > 0)
539 svar /z /sdfr=df g_username=username
540 svar /z /sdfr=df g_password=password
541 if (svar_exists(g_username))
544 if (svar_exists(g_password))
548 dfref df2 = df:logbooks
549 variable nlb = CountObjectsDFR(df2, 4)
552 for (ilb = 0; ilb < nlb; ilb += 1)
553 slb = GetIndexedObjNameDFR(df2, 4, ilb)
566 dfref saveDF = GetDataFolderDFR()
569 if (DataFolderRefStatus(df) == 1)
570 string fullPath = SpecialDirPath("Packages", 0, 0, 0)
572 NewPath/O/C/Q tempPackagePrefsPath, fullPath
573 fullPath += ":preferences.pxp"
575 SaveData /O /Q /R fullPath
576 KillPath/Z tempPackagePrefsPath
586 dfref saveDF = GetDataFolderDFR()
592 string fullPath = SpecialDirPath("Packages", 0, 0, 0)
595 GetFileFolderInfo /Q /Z fullPath
597 fullPath += ":preferences.pxp"
598 GetFileFolderInfo /Q /Z fullPath
600 LoadData /O /R /Q fullPath
622 if (ParamIsDefault(templates))
628 dfref df_logbooks = df_persistent:templates
630 dfref df_logbooks = df_persistent:logbooks
634 variable nlb = CountObjectsDFR(df_logbooks, 4)
637 for (ilb = 0; ilb < nlb; ilb += 1)
638 slb = GetIndexedObjNameDFR(df_logbooks, 4, ilb)
640 logbooks = AddListItem(slb, logbooks)
644 return SortList(logbooks, ";", 16)
694 if (ParamIsDefault(encoding))
697 if (ParamIsDefault(graphs))
700 if (ParamIsDefault(replyto))
704 dfref savedf = getdatafolderdfr()
709 nvar /sdfr=df_volatile msg_id
710 nvar /sdfr=df_general loglevel
714 print "ELOG: failed to validate attributes."
720 if (strlen(cmd) == 0)
722 print "ELOG: failed to prepare command line."
728 cmd += " -r " + num2str(replyto)
730 cmd += " -n " + num2str(encoding)
732 variable nattr = ItemsInList(attributes, ";")
735 for (iattr = 0; (iattr < nattr) && (result == 0); iattr += 1)
736 sattr = StringFromList(iattr, attributes, ";")
737 if (strlen(StringFromList(1, sattr, "=")) > 0)
738 sattr = ReplaceString("%", sattr, "")
739 cmd += " -a \"" + sattr + "\""
745 cmd += " " + cmd_graphs
748 if ((result == 0) && (strlen(message) > 0))
750 if (strlen(messagefile) > 0)
751 cmd += " -m \"" + messagefile + "\""
757 if (strlen(cmd_file_path) > 0)
758 ExecuteScriptText cmd_file_path
763 print "ELOG: sent message " + num2str(
id)
767 print "ELOG: sending message failed."
776 print "ELOG: failed to create temporary message file."
798 dfref savedf = getdatafolderdfr()
803 nvar /sdfr=df_volatile msg_id
804 nvar /sdfr=df_general loglevel
807 if (strlen(cmd) == 0)
811 cmd += " -e " + num2str(
id)
815 if (strlen(cmd_graphs) == 0)
821 cmd += " " + cmd_graphs
824 if (strlen(cmd_file_path) > 0)
825 ExecuteScriptText cmd_file_path
830 print "ELOG: attached graphs to message " + num2str(
id)
834 print "ELOG: failed to attach graphs."
861 svar /sdfr=df_general elog_path
862 svar /sdfr=df_general hostname
863 nvar /sdfr=df_general port
864 nvar /sdfr=df_general ssl
865 svar /sdfr=df_general subdir
866 nvar /sdfr=df_general loglevel
867 svar /sdfr=df_volatile username
868 svar /sdfr=df_volatile password
871 cmd = "\"" + elog_path + "\""
875 cmd += " -h " + hostname
876 if ((nvar_exists(port)) && (port > 0))
877 cmd += " -p " + num2str(port)
879 if ((svar_exists(subdir)) && (strlen(subdir) > 0))
880 cmd += " -d " + subdir
882 cmd += " -l \"" + logbook + "\""
883 if ((nvar_exists(ssl)) && (ssl != 0))
887 if (svar_exists(username) && svar_exists(password) && (strlen(username) > 0) && (strlen(password) > 0))
888 cmd += " -u " + username + " " + password
908 svar /sdfr=df_general hostname
909 nvar /sdfr=df_general port
910 nvar /sdfr=df_general ssl
911 svar /sdfr=df_general subdir
914 if ((nvar_exists(ssl)) && (ssl != 0))
920 if ((nvar_exists(port)) && (port > 0))
921 cmd += ":" + num2str(port)
923 if ((svar_exists(subdir)) && (strlen(subdir) > 0))
944 variable ngraphs = ItemsInList(graphs, ";")
948 for (igraph = 0; igraph < ngraphs; igraph += 1)
949 sgraph = StringFromList(igraph, graphs, ";")
951 if (strlen(graph_path) > 0)
952 cmd += " -f \"" + graph_path + "\""
961 Variable now = DateTime
962 string dat = ReplaceString("-", Secs2Date(DateTime, -2), "")
963 string tim = ReplaceString(":", Secs2Time(DateTime, 3), "")
964 return dat + sep + tim
986 message = ReplaceString("%", message, "")
987 string path = SpecialDirPath("Temporary", 0, 1, 0)
988 variable len = strlen(path)
991 if (numtype(len) == 0)
992 filename = "elog_temp_message.txt"
1029 svar /sdfr=df_volatile_root temp_graph_files
1031 string path = SpecialDirPath("Temporary", 0, 1, 0)
1033 variable len = strlen(path)
1036 if (numtype(len) == 0)
1037 filename = "elog_" + ts + "_" + num2str(fileindex) + ".png"
1039 SavePICT /B=72 /E=-5 /M /O /W=(0,0,8,6) /WIN=$graphname /Z as path
1041 temp_graph_files = AddListItem(path, temp_graph_files, ";", inf)
1064 nvar /sdfr=df_general loglevel
1066 if (strlen(cmd) >= 1024)
1068 print "ELOG: command line too
long (add fewer attachments)."
1073 string work_path = SpecialDirPath("Temporary", 0, 1, 0)
1074 variable len = strlen(work_path)
1075 if (numtype(len) == 0)
1077 string cmd_path = work_path + "elog_temp_cmd.bat"
1083 cmdx = "cd \"" + work_path + "\"\r\n"
1085 cmdx = "del elog.log"
1086 fprintf f1, cmdx + "\r\n"
1097 string path = SpecialDirPath("Temporary", 0, 1, 0)
1098 variable len = strlen(path)
1099 if (numtype(len) == 0)
1118 if (DataFolderRefStatus(df_volatile_root))
1119 svar /sdfr=df_volatile_root /z temp_graph_files
1120 if (SVAR_Exists(temp_graph_files))
1121 variable nfi = ItemsInList(temp_graph_files)
1124 for (ifi = 0; ifi < nfi; ifi += 1)
1125 sfi = StringFromList(ifi, temp_graph_files)
1128 temp_graph_files = ""
1144 nvar /sdfr=df_general loglevel
1149 variable success = 0
1154 variable len = strlen(path)
1155 if (numtype(len) == 0)
1157 Open /R/Z f1 as path
1161 if (strlen(line) > 0)
1162 part1 = StringFromList(0, line, ",")
1163 part2 = ReplaceString(" ", StringFromList(1, line, ","), "")
1187 logbooks = AddListItem("(new)", logbooks)
1189 templates = AddListItem("(none)", templates)
1191 string logbook = StringFromList(0, logbooks)
1192 string template = StringFromList(0, logbooks)
1194 string username = ""
1195 string password = ""
1197 prompt logbook, "logbook", popup logbooks
1198 prompt template, "template", popup templates
1199 prompt name, "new logbook name"
1201 doprompt "select logbook", logbook, template, name
1203 if (cmpstr(logbook, "(new)") == 0)
1220 string username = ""
1221 string password = ""
1223 prompt logbook, "logbook", popup logbooks
1224 prompt username, "user name"
1225 prompt password, "password (blank to log out)"
1227 doprompt "log in to logbook", logbook, username, password
1245 dfref savedf = getdatafolderdfr()
1250 string win_name = logbook + "ElogPanel"
1251 string win_title = "ELOG " + logbook
1253 NewPanel /K=1 /N=$win_name /W=(600,200,1200,700) as win_title
1255 ModifyPanel /w=$win_name cbRGB=(52224,52224,65280)
1257 svar /sdfr=df_persistent attributes
1258 svar /sdfr=df_persistent controls
1259 svar /sdfr=df_persistent options
1260 wave /t /sdfr=df_volatile attach_list
1261 wave /sdfr=df_volatile attach_sel
1262 svar /sdfr=df_volatile url
1265 variable nattr = ItemsInList(attributes, ";")
1269 string persistent_path = GetDataFolder(1, df_persistent)
1270 string volatile_path = GetDataFolder(1, df_volatile)
1272 string variable_path
1276 for (iattr = 0; iattr < nattr; iattr += 1)
1277 s_attr = StringFromList(iattr, attributes, ";")
1278 s_control = StringFromList(iattr, controls, ";")
1279 strswitch(s_control[0,1])
1281 SetVariable $s_control, win=$win_name, pos={0,ypos}, size={300,16}, bodyWidth=230
1282 SetVariable $s_control, win=$win_name, title=s_attr, value= _STR:
""
1283 SetVariable $s_control, win=$win_name, userdata(attribute)=s_attr
1287 options_path = persistent_path + StringByKey(s_attr, options,
"=",
";")
1288 PopupMenu $s_control, win=$win_name, pos={0,ypos}, size={300,21}, bodyWidth=230
1289 PopupMenu $s_control, win=$win_name, title=s_attr
1290 PopupMenu $s_control, win=$win_name, mode=1, popvalue=
"Test", value= #options_path
1291 PopupMenu $s_control, win=$win_name, userdata(attribute)=s_attr
1295 CheckBox $s_control, win=$win_name, pos={70,ypos}, size={300,14}
1296 CheckBox $s_control, win=$win_name, title=s_attr, value= 1
1297 CheckBox $s_control, win=$win_name, userdata(attribute)=s_attr
1302 ypos = max(ypos, 80)
1304 TitleBox t_attach, win=$win_name, pos={308,5}, size={70,14}, title=
"Attachments", frame=0
1305 height = ypos - 21 - 4
1306 ListBox lb_attach, win=$win_name, pos={308,21}, size={264,height}
1307 ListBox lb_attach, win=$win_name, listWave=attach_list
1308 ListBox lb_attach, win=$win_name, mode=1, selWave=attach_sel, selRow=-1
1309 ListBox lb_attach, win=$win_name, widths={20,160,80}
1310 ListBox lb_attach, win=$win_name, help={
"Choose graphs to attach to the message."}
1312 Button b_attach_top, win=$win_name, pos={420,2}, size={40,18}, title=
"top"
1313 Button b_attach_top, win=$win_name, fcolor=(56576,60928,47872)
1315 Button b_attach_top, win=$win_name, help={
"Select top graph for attachment."}
1316 Button b_attach_all, win=$win_name, pos={460,2}, size={40,18}, title=
"all"
1317 Button b_attach_all, win=$win_name, fcolor=(56576,60928,47872)
1319 Button b_attach_all, win=$win_name, help={
"Select all graphs for attachment."}
1320 Button b_attach_none, win=$win_name, pos={500,2}, size={40,18}, title=
"none"
1321 Button b_attach_none, win=$win_name, fcolor=(56576,60928,47872)
1323 Button b_attach_none, win=$win_name, help={
"Deselect all attachments."}
1324 Button b_save_graphs, win=$win_name, pos={540,2}, size={40,18}, title=
"save"
1325 Button b_save_graphs, win=$win_name, fcolor=(56576,60928,47872)
1327 Button b_save_graphs, win=$win_name, help={
"Save selected graphs as PNG bitmap files."}
1328 Button b_attach_up, win=$win_name, pos={576,20}, size={20,20}, title=
"\\W517"
1329 Button b_attach_up, win=$win_name, fcolor=(56576,60928,47872)
1331 Button b_attach_up, win=$win_name, help={
"Move selected graph up."}
1332 Button b_attach_dw, win=$win_name, pos={576,40}, size={20,20}, title=
"\\W523"
1333 Button b_attach_dw, win=$win_name, fcolor=(56576,60928,47872)
1335 Button b_attach_dw, win=$win_name, help={
"Move selected graph down."}
1338 Button b_submit,win=$win_name, pos={70,ypos},size={46,20},proc=
PearlElog#
bp_submit,title=
"Submit"
1339 Button b_submit,win=$win_name, help={
"Submit form data to ELOG (new entry)."}
1340 Button b_submit,win=$win_name, fcolor=(56576,60928,47872)
1341 Button b_clear,win=$win_name, pos={120,ypos},size={46,20},proc=
PearlElog#
bp_clear,title=
"Clear"
1342 Button b_clear,win=$win_name, help={
"Clear the form fields"}
1343 Button b_clear,win=$win_name, fcolor=(56576,60928,47872)
1346 variable_path = volatile_path +
"msg_id"
1347 SetVariable sv_id,win=$win_name, pos={51,ypos},size={119,16},bodyWidth=77
1348 SetVariable sv_id,win=$win_name, title=
"ID",value=$variable_path
1349 SetVariable sv_id,win=$win_name, help={
"ID of last submitted message, or message to attach or reply to."}
1351 TitleBox t_host, win=$win_name, pos={170,ypos+4}, size={112.00,14.00}, frame=0
1352 TitleBox t_host, win=$win_name, variable=url
1355 Button b_attach,win=$win_name, pos={170,ypos},size={48,20},proc=
PearlElog#
bp_attach,title=
"Attach"
1356 Button b_attach,win=$win_name, help={
"Attach the selected graph to an existing ELOG entry (correct ID required)."}
1357 Button b_attach,win=$win_name, fcolor=(56576,60928,47872)
1358 Button b_reply,win=$win_name, pos={220,ypos},size={48,20},proc=
PearlElog#
bp_submit,title=
"Reply"
1359 Button b_reply,win=$win_name, help={
"Submit form data to ELOG as a reply to an existing message (correct ID required)."}
1360 Button b_reply,win=$win_name, fcolor=(56576,60928,47872)
1361 Button b_login,win=$win_name, pos={550,ypos},size={46,20},proc=
PearlElog#
bp_login,title=
"Login"
1362 Button b_login,win=$win_name, help={
"Enter user name and password."}
1363 Button b_login,win=$win_name, fcolor=(56576,60928,47872)
1364 Button b_logout,win=$win_name, pos={550,ypos},size={46,20},proc=
PearlElog#
bp_logout,title=
"Logout"
1365 Button b_logout,win=$win_name, help={
"Clear user name and password."}
1366 Button b_logout,win=$win_name, fcolor=(56576,60928,47872), disable=3
1369 SetWindow $win_name, userdata(logbook)=logbook
1372 TitleBox t_message,win=$win_name, pos={10,ypos},size={58,16},fixedSize=1,frame=0,anchor=RT,title=
"Message"
1373 DefineGuide UGH0={FT,ypos},UGV0={FL,70},UGH1={FB,-52},UGV1={FR,-2}
1374 NewNotebook /F=0 /N=Message /OPTS=3 /W=(115,404,345,341)/FG=(UGV0,UGH0,UGV1,UGH1) /HOST=#
1375 Notebook kwTopWin, defaultTab=20, statusWidth=0, autoSave=0
1376 Notebook kwTopWin fSize=10, fStyle=0, textRGB=(0,0,0)
1377 RenameWindow #,Message
1378 string nb_name = win_name +
"#Message"
1379 SetActiveSubwindow ##
1382 svar /z /sdfr=df_persistent recent
1383 if (svar_exists(recent) && (strlen(recent) > 0))
1386 svar /z /sdfr=df_persistent recent_message
1387 if (svar_exists(recent_message) && (strlen(recent_message) > 0))
1390 Notebook $nb_name selection={startOfFile,startOfFile}, findText={
"",1}
1392 setdatafolder savedf
1397 STRUCT WMWinHookStruct &s
1399 Variable hookResult = 0
1403 string logbook = GetUserData(s.winName,
"",
"logbook")
1404 if (strlen(logbook) > 0)
1406 svar /sdfr=df_volatile url
1413 variable b_top = s.winRect.bottom + 4
1414 Button b_submit,pos={70,b_top}
1415 Button b_clear,pos={120,b_top}
1416 TitleBox t_host, pos={170,b_top+4}
1418 Button b_attach,pos={170,b_top}
1419 Button b_reply,pos={220,b_top}
1420 Button b_login, pos={550,b_top}
1421 Button b_logout, pos={550,b_top}
1423 SetVariable sv_id,pos={51,b_top}
1438 dfref savedf = getdatafolderdfr()
1440 wave /t /sdfr=df_volatile attach_list
1441 wave /sdfr=df_volatile attach_sel
1443 if (!waveexists(attach_list))
1446 string names = WinList("*", ";", "WIN:1;VISIBLE:1")
1447 names = SortList(names, ";", 16)
1452 variable n = DimSize(attach_list, 0)
1454 for (i = n-1; i >= 0; i -= 1)
1456 if (WhichListItem(s, names) < 0)
1457 DeletePoints /M=0 i, 1, attach_list, attach_sel
1462 n = ItemsInList(names)
1463 for (i = 0; i < n; i += 1)
1464 s = StringFromList(i, names)
1465 FindValue /text=s /txop=4 /z attach_list
1467 k = DimSize(attach_list, 0)
1468 Redimension /n=(k+1,3) attach_list, attach_sel
1480 n = DimSize(attach_list, 0)
1481 for (i = n-1; i >= 0; i -= 1)
1483 getwindow /z $s, wtitle
1491 setdatafolder savedf
1501 dfref savedf = getdatafolderdfr()
1503 wave /t /sdfr=df_volatile attach_list
1504 wave /sdfr=df_volatile attach_sel
1505 variable n = DimSize(attach_list, 0)
1506 variable dest = item + distance
1508 if ((item >= 0) && (item < n) && (dest >= 0) && (dest < n))
1511 DeletePoints /M=0 item, 1, attach_list, attach_sel
1512 InsertPoints /M=0 dest, 1, attach_list, attach_sel
1521 STRUCT WMButtonAction &ba
1523 switch( ba.eventCode )
1525 string logbook = GetUserData(ba.win, "", "logbook")
1526 ControlInfo /w=$ba.win lb_attach
1527 variable row = v_value
1528 dfref df = $s_datafolder
1529 wave /t /sdfr=df attach_list = $s_value
1530 if (cmpstr(ba.ctrlName, "b_attach_up") == 0)
1534 ListBox lb_attach, win=$ba.win, selRow=(row-1)
1538 if (row < DimSize(attach_list, 0) - 1)
1540 ListBox lb_attach, win=$ba.win, selRow=(row+1)
1553 STRUCT WMButtonAction &ba
1555 switch( ba.eventCode )
1557 string logbook = GetUserData(ba.win, "", "logbook")
1566 if (cmpstr(ba.ctrlName, "b_reply") == 0)
1568 ControlInfo /w=$ba.win sv_id
1577 result =
elog_create_entry(logbook, attributes, message, graphs=graphs, replyto=
id)
1580 svar /sdfr=df recent
1582 svar /sdfr=df recent_message
1583 recent_message = message
1585 abort "Submission failed. Error code " + num2str(result) + "."
1588 abort "Submission failed due to missing/invalid attribute."
1600 STRUCT WMButtonAction &ba
1602 switch( ba.eventCode )
1604 string graphs = WinName(0, 1, 1)
1616 STRUCT WMButtonAction &ba
1618 switch( ba.eventCode )
1620 string logbook = GetUserData(ba.win, "", "logbook")
1622 wave /sdfr=df_volatile attach_sel
1623 if (cmpstr(ba.ctrlName, "b_attach_all") == 0)
1637 STRUCT WMButtonAction &ba
1639 switch( ba.eventCode )
1641 string logbook = GetUserData(ba.win, "", "logbook")
1646 ControlInfo /w=$ba.win sv_id
1650 DoAlert /T="ELOG" 1, "This operation will replace all existing attachments. Do you want to continue?"
1652 if ((
id > 0) && (v_flag == 1))
1656 abort "Submission failed. Error code " + num2str(result) + "."
1659 abort "Submission failed due to missing/invalid attribute."
1670 STRUCT WMButtonAction &ba
1672 switch( ba.eventCode )
1674 string logbook = GetUserData(ba.win, "", "logbook")
1676 variable ngraphs = ItemsInList(graphs, ";")
1681 for (igraph = 0; igraph < ngraphs; igraph += 1)
1682 sgraph = StringFromList(igraph, graphs, ";")
1684 if (strlen(graph_path) > 0)
1698 STRUCT WMButtonAction &ba
1700 switch( ba.eventCode )
1714 STRUCT WMButtonAction &ba
1716 switch( ba.eventCode )
1718 string logbook = GetUserData(ba.win, "", "logbook")
1720 Button b_login, win=$ba.win, disable=3
1721 Button b_logout, win=$ba.win, disable=0
1732 STRUCT WMButtonAction &ba
1734 switch( ba.eventCode )
1736 string logbook = GetUserData(ba.win, "", "logbook")
1738 Button b_login, win=$ba.win, disable=0
1739 Button b_logout, win=$ba.win, disable=3
1750 windowname = StringFromList(0, WinList("*ElogPanel*", ";", "WIN:64"), ";")
1764 if (strlen(windowname) == 0)
1767 if (strlen(windowname) == 0)
1771 string controls = ControlNameList(windowname, ";")
1772 string attributes = ""
1776 variable nco = ItemsInList(controls, ";")
1777 for (ico = 0; ico < nco; ico += 1)
1778 control = StringFromList(ico, controls, ";")
1779 attribute = GetUserData(windowname, control, "attribute")
1780 if (strlen(attribute) > 0)
1781 ControlInfo /w=$windowname $control
1784 attributes = ReplaceNumberByKey(attribute, attributes, v_value, "=", ";")
1788 attributes = ReplaceStringByKey(attribute, attributes, s_value, "=", ";")
1813 if (strlen(windowname) == 0)
1816 if (strlen(windowname) == 0)
1819 if (ParamIsDefault(clear))
1825 string logbook = GetUserData(windowname, "", "logbook")
1827 string persistent_path = GetDataFolder(1, df_persistent)
1828 svar /sdfr=df_persistent options
1831 string controls = ControlNameList(windowname, ";")
1837 variable nco = ItemsInList(controls, ";")
1838 for (ico = 0; ico < nco; ico += 1)
1839 control = StringFromList(ico, controls, ";")
1840 attribute = GetUserData(windowname, control, "attribute")
1841 if (strlen(attribute))
1842 value = StringByKey(attribute, attributes, "=", ";")
1843 if (strlen(value) || clear)
1844 ControlInfo /w=$windowname $control
1847 numval = NumberByKey(attribute, attributes, "=", ";")
1848 if ((numtype(numval) != 0) && clear)
1851 if (numtype(numval) == 0)
1852 CheckBox $control, value=numval, win=$windowname
1856 options_path = persistent_path + StringByKey(attribute, options, "=", ";")
1857 svar values = $options_path
1858 numval = WhichListItem(value, values, ";") + 1
1860 PopupMenu $control, mode=numval, win=$windowname
1864 SetVariable /z $control, value= _STR:value, win=$windowname
1884 if (strlen(windowname) == 0)
1887 if (strlen(windowname) == 0)
1891 string nb = windowname + "
#Message"
1892 notebook $nb selection={startOfFile, endOfFile}
1893 getselection notebook, $nb, 2
1911 if (strlen(windowname) == 0)
1915 string nb = windowname + "
#Message"
1916 notebook $nb selection={startOfFile, endOfFile},text=message
1930 dfref savedf = getdatafolderdfr()
1931 if (strlen(windowname) == 0)
1934 if (strlen(windowname) == 0)
1938 string logbook = GetUserData(windowname, "", "logbook")
1940 wave /t /sdfr=df_volatile attach_list
1941 wave /sdfr=df_volatile attach_sel
1946 variable n = DimSize(attach_sel, 0)
1948 for (i = 0; i < n; i += 1)
1951 windows = WinList(graphname, ";", "WIN:1")
1952 if (ItemsInList(windows) == 1)
1953 graphs = AddListItem(graphname, graphs, ";", inf)
1971 if (strlen(windowname) == 0)
1974 if (strlen(windowname) == 0)
1978 string logbook = GetUserData(windowname, "", "logbook")
1981 wave /t /sdfr=df_volatile attach_list
1982 wave /sdfr=df_volatile attach_sel
1984 variable n = DimSize(attach_sel, 0)
1987 for (i = 0; i < n; i += 1)
1989 if (WhichListItem(graphname, graphs)>= 0)