ID |
Date |
Author |
Author Email |
Category |
Subject |
Status |
Last Revision |
33
|
Thu Feb 3 23:51:16 2011 |
T. Ribbrock | emgaron+elog@ribbrock.org | Other | Building elog on OpenBSD | Stable | | Two things are required to get elog (tested with 2.8.1) to compile on OpenBSD (tested on OpenBSD 4.8):
Step 1 - Patch Makefile:
--- Makefile~ Mon Jan 24 21:38:09 2011
+++ Makefile Mon Jan 24 21:42:57 2011
@@ -50,6 +50,10 @@
RM = /usr/bin/rm -f
endif
+ifeq ($(OSTYPE),OpenBSD)
+LIBS += -lcrypto
+endif
+
ifeq ($(OSTYPE),Darwin)
OSTYPE=darwin
endif
Step 2 - Use "gmake" instead of the standard "make" to build.
|
34
|
Fri Feb 4 10:26:38 2011 |
Stefan Ritt | stefan.ritt@psi.ch | Other | Re: Building elog on OpenBSD | Stable | |
T. Ribbrock wrote: |
Two things are required to get elog (tested with 2.8.1) to compile on OpenBSD (tested on OpenBSD 4.8):
Step 1 - Patch Makefile:
--- Makefile~ Mon Jan 24 21:38:09 2011
+++ Makefile Mon Jan 24 21:42:57 2011
@@ -50,6 +50,10 @@
RM = /usr/bin/rm -f
endif
+ifeq ($(OSTYPE),OpenBSD)
+LIBS += -lcrypto
+endif
+
ifeq ($(OSTYPE),Darwin)
OSTYPE=darwin
endif
Step 2 - Use "gmake" instead of the standard "make" to build.
|
Thanks, I added your patch to the distribution. |
35
|
Tue May 24 22:43:38 2011 |
JacekK | doctor99@poczta.onet.pl | Script | Javascript verification of simple attributes with regexp | Beta | Tue May 24 22:46:38 2011 by JacekK | Hi,
I added possibility for a new verification of required fields in generated Javascript "function chkform() ". To do this I added new logbook option "ValidPattern", in which you can set regular expression for an attribute, for example
ValidPattern HexDigits=[0-9a-fA-F]+
If there is a pattern set for required field, then in chkform() function is generated additional verification, if value of the field matches validation regexp.
Changes I made should not decrease performance of elogd. Let me know please if you can add it to regular version.
Jacek |
Attachment 1: JScriptREVerify.patch
|
Index: elogd.c
===================================================================
--- elogd.c (revision 2414)
+++ elogd.c (working copy)
@@ -74,6 +74,8 @@
char attr_list[MAX_N_ATTR][NAME_LENGTH];
char attr_options[MAX_N_ATTR][MAX_N_LIST][NAME_LENGTH];
int attr_flags[MAX_N_ATTR];
+/** Validation pattern for attribute, to test if it contains expected value */
+char attr_valid_pattern[MAX_N_ATTR][NAME_LENGTH];
char attr_list_default[][NAME_LENGTH] = { "Author", "Type", "Category", "Subject", "" };
@@ -7033,7 +7035,7 @@
int scan_attributes(char *logbook)
/* scan configuration file for attributes and fill attr_list, attr_options
- and attr_flags arrays */
+ and attr_flags and attr_valid_pattern arrays */
{
char list[10000], str[NAME_LENGTH], str2[NAME_LENGTH], type[NAME_LENGTH],
tmp_list[MAX_N_ATTR][NAME_LENGTH];
@@ -7062,11 +7064,20 @@
}
}
- /* get options lists for attributes */
+ /* get options lists and validation patterns for attributes */
memset(attr_options, 0, sizeof(attr_options));
+ memset(attr_valid_pattern, 0, sizeof(attr_valid_pattern));
for (i = 0; i < n; i++) {
n_options = 0;
+ sprintf(str, "ValidPattern %s", attr_list[i]);
+ if (getcfg(logbook, str, list, sizeof(list)))
+ {
+ strncpy(attr_valid_pattern[i], list, sizeof(attr_valid_pattern[i])-1);
+ attr_valid_pattern[i][sizeof(attr_valid_pattern[i])-1] = 0;
+ attr_flags[i] |= AF_HAS_VALID_PATT;
+ }
+
sprintf(str, "Options %s", attr_list[i]);
if (getcfg(logbook, str, list, sizeof(list)))
n_options = strbreak(list, attr_options[i], MAX_N_LIST, ",", FALSE);
@@ -9650,6 +9661,17 @@
rsprintf(" document.form1.%s.focus();\n", ua);
rsprintf(" return false;\n");
rsprintf(" }\n");
+ if (attr_flags[i] & AF_HAS_VALID_PATT)
+ {
+ sprintf(str, loc("var validPatt=new RegExp(\"%s\");"), attr_valid_pattern[i]);
+ rsprintf(" %s\n", str);
+ rsprintf(" if (!validPatt.test(document.form1.%s.value)) {\n", ua);
+ sprintf(str, loc("Invalid value for attribute '%s'"), attr_list[i]);
+ rsprintf(" alert(\"%s\");\n", str);
+ rsprintf(" document.form1.%s.focus();\n", ua);
+ rsprintf(" return false;\n");
+ rsprintf(" }\n");
+ }
}
}
Index: elogd.h
===================================================================
--- elogd.h (revision 2414)
+++ elogd.h (working copy)
@@ -192,6 +192,7 @@
#define AF_MUSERLIST (1<<13)
#define AF_USEREMAIL (1<<14)
#define AF_MUSEREMAIL (1<<15)
+#define AF_HAS_VALID_PATT (1<<16)
/* attribute format flags */
#define AFF_SAME_LINE 1
|
36
|
Tue Aug 23 12:07:51 2011 |
Stefan Ritt | stefan.ritt@psi.ch | Script | Re: JavaScript list auto-refresh | Stable | Tue Jul 12 12:36:16 2005 by Emiliano Gabrielli |
Emiliano Gabrielli wrote: | Here is a simple piece of JS code to accomplish a smart page reload.
We don't reload if in some kind of editing mode.
You can put the code everywhere you like in the elog html page, my suggestion is to put it in Bottom Text (or Top Text):
;auto-refresh
Bottom text = [I]<script language="JavaScript">if (null==window.location.href.match('/[0-9]+$|.*(cmd|select)=.*') ) { window.setTimeout("location.reload();", 2*60*1000); now=new Date(); document.write('<br/>Last reload at '+now.getFullYear()+'/'+(now.getMonth()+1)+'/'+now.getDate()+', '+( ((h=now.getHours())<10) ? '0'+h :h)+':'+( ((m=now.getMinutes())<10) ? '0'+m :m)+':'+( ((s=now.getSeconds())<10) ? '0'+s :s)) }</script>[/I]
the timer is a product of # of minutes, #of seconds and milliseconds... 2 minutes in the above example
Revision Tue Jul 12 12:36:16 2005 wrote: |
modified regular expression in order to not activate the auto-refresh in the signle entry view
|
|
Starting with SVN revision 2422, there is a new config option
refresh = <seconds>
which lets you do the same thing. |
37
|
Tue Aug 23 19:45:16 2011 |
Stuart Wilkins | swilkins@bnl.gov | Script | ELOG Mail Parser | Alpha | | Hi!
I have attached a small script which can process an e-mail and submit this e-mail as a log entry. This is alpha at the moment but if you have suggestions or find bugs please let me know.
The easiest way to process this is to use the ".forward" file in unix. If this file contains the line:
| "/usr/bin/python /home/tardis/elogmail/process.py --log /home/tardis/elogmail/mail.log -r -u http://localhost:8080/TARDIS -a Category=email -a Type=Log"
This will pipe the incoming mail to the e-log running on the localhost with the experiment TARDIS. Attributes can be set using the "-a" switch like in the elog command line utility. To get help with all the options please run the script with the command:
python process.py -h
which will give help.
Any questions, please don't hesitate to contact me, and I will do my best to help.
Thanks again to Stefan for a great application.
Best wishes,
Stuart
|
Attachment 1: process.py.gz
|
Attachment 2: forward.gz
|
38
|
Fri Sep 9 12:08:26 2011 |
Andreas Luedeke | andreas.luedeke@psi.ch | Script | create incremental daily backups of logbooks for Unix/Linux | Beta | | A very simple backup utility for elog logbooks.
If you want to recover your logbook from corrupted entries, an incremental backup comes in handy:
you can just replace the corrupted files with the previous versions.
Below is a very simple wrapper to create backups of the logbook into some local directory (/logbooks_backup in
the example script). The second wrapper lists the files in a given ".tar" archive.
You would run the backup from a cron job with the line:
1 0 * * * /usr/local/elog/elog_backup_daily
This will create daily backups of modified logbook and config files and a weekly backup of the password file
/usr/local/elog/passwd.txt (if you wonder why: our passwd.txt file has more than 1 MByte and of course it
changes with every login).
elog_backup_daily (copy to /usr/local/elog) script to create tar file and remove tar files older than 90 days
exclude-logbooks (copy to /usr/local/elog) list of files to be excluded in backup (thumbnails, etc.)
elog_backup_listfiles (copy to /usr/local/bin) shows content of a given tar file (omits directories in list) |
Attachment 1: elog_backup_daily
|
#!/bin/sh
# source file directory
srcd=/usr/local/elog/
# backup all files newer than 25 hours
date=$(date -d "-25hours" "+%Y%m%d %H:%M")
# backup file directory
tard=/logbooks_backup
# backup tar file name
tarf=$tard/$(date +%Y%m%d_%a.tar)
# do not backup files that match patterns in this file
excf=/usr/local/elog/exclude-logbooks
# create backup
cd $srcd
tar --ignore-case -X $excf --newer "$date" -cf $tarf . logbooks/*
# copy passwd.txt
if [ "$(date +%u)" -eq 1 ]
then
passwd=$tard/passwd_$(date +%Y%m%d_%a.txt)
cp $srcd/passwd.txt $passwd
gzip -9 $passwd
fi
# delete all backups older than 90 days
find $tard -mtime +90 -name "*_???.tar" -exec rm -f {} +
find $tard -mtime +90 -name "passwd_*_???.txt.gz" -exec rm -f {} +
|
Attachment 2: exclude-logbooks
|
*.png.png
*.gif.png
*.jpg.png
*.pdf.png
oldLogbooks/*
logbooks/elog.log
passwd.txt
ssl/*
logbooks/Backup/*
logbooks/old/*
|
Attachment 3: elog_backup_listfiles
|
tar -tf $1|grep -v "^.*/$"
|
39
|
Fri Sep 17 06:19:39 2010 |
Stefan Ritt | stefan.ritt@psi.ch | Script | Custom input forms implementation | Stable | Thu Jul 2 20:55:55 2015 by Stefan Ritt | Dear ELOG users,
starting with SVN revision 2328, custom input forms are implemented. This allows application specific formats for check lists etc. In our specific case we had to implement a shift check list, which was quite long. Furthermore the check list should be optimized for an iPad, which we take in the field and record various checks and readings (in our case some gas pressure gauges at the PSI particle accelerator). Since the standard ELOG interface was too inflexible, a completely hand-written form was needed. The form can be activated by the new configuration options Custom New Form, Custom Edit Form and Custom Display Form, one for a new entry, an entry to edit and and entry to display. In our case we used the same form for all three cases. This is how the shift check list looks under the Safari Browser on a PC:
And here is how it looks on the iPad:
Each section can be collapsed and expanded (blue arrows at the left), and various internal checks are made before the check list can be submitted.
Implementing such forms is however more something for the advanced user, since you have to hand-write HTML with CSS and JavaScript code. It can then however be a powerful method for check lists. Please find in the attachments the elogd.cfg configuration for that logbook and the shiftcheck.html source code file. It is a bit complicated since the page is a static page, elogd just serves it from the file. This requires all the dynamic functions to be implemented inside the HTML file with JavaScript. To display an entry for example, the JavaScript loads the raw data with the "?cmd=Download" command and the populates the form fields. The collapsing and expanding is done by using CSS properties. The integrated style sheet was optimized for the rendering on an iPad. Rather large fonts were chosen so that the items can be checked easily with your finger tips. Various parameters are sent between the browser and the elogd program via hidden fields and cookies. So only something for experts! But if you go through the effort and hand-write the form, it can be very handy. Note that you have to upgrade to SVN revision 2328 for the three new options.
|
Attachment 2: elogd.cfg
|
[global]
Port = 8080
Password file = passwd
[ShiftCheck]
Comment = Shift Check List
Attributes = Author, D, M, Y, Shift, a1, a2, a3, a4, a5, h1, h2, h3, h4, h5, c1, c2, c3, c4, c5, c6, c7, bb1, cr1, cr2, cr3, cr4, cr5, cr6, cr7, cr8, cr9, cr10, cr11, cr12, cr13, cr14, cr15, cr16, cr17, cr18, cr19, cr20, cr21, cr22, cr23, cr24, cr25, cr26, sw1, sw2, sw3, sw4, sw5
Quick filter = Shift, Author
Options Shift = Morning, Evening, Night
Enable attachments = 0
Show text = 0
Custom new form = /home/meg/meg/online/elog/shiftcheck.html
Custom edit form = /home/meg/meg/online/elog/shiftcheck.html
Custom display form = /home/meg/meg/online/elog/shiftcheck.html
List after submit = 1
|
Attachment 4: shiftcheck.html
|
Attachment 5: sc_up.png
|
|
Attachment 6: sc_down.png
|
|
40
|
Mon Jan 7 08:45:10 2013 |
Bruce Weber | bruce.weber@inmarsat.com | Script | Server time offset | Stable | | Our server runs on local time, however, we require log entries to be in UTC (-0800hrs) - is there a command to achieve this?
Your assistance will be much appreciated
Thanks |
41
|
Mon Jan 7 16:37:21 2013 |
Stefan Ritt | stefan.ritt@psi.ch | Script | Re: Server time offset | Stable | |
Bruce Weber wrote: |
Our server runs on local time, however, we require log entries to be in UTC (-0800hrs) - is there a command to achieve this?
Your assistance will be much appreciated
Thanks
|
Have you tried
Subst <attribute> = $utcdate
Probably you need a dedicated attribute of type "datetime" and have to play with the "Date format" options. |
42
|
Mon Apr 29 04:29:33 2013 |
Ryan Blakeslee | rb@blakesys.net | Theme/Skin | Clean plain-text CSS - modified from default.css | Stable | Mon Apr 29 23:34:40 2013 by Ryan Blakeslee | Hello,
I am using ELOG 2.5.2. I had a real need for a simplified almost text-only version of the application. For me
personally, I like simple, minimalist and text-only as much as possible for the tools I use. I personally found
the layout with all the colors to be distracting from the content of each log entry. Again this is ONLY my
personal preference, NO offense meant. :-)
I took the default.css and modified it to achieve what I needed. I am uploading here, the .css file. It uses
"blue" for some of the things such as attribute fields on single page view, etc. but overall it's all clean,
plain-text.
I don't know if this css will work on newer versions of ELOG (since I know i'm using an old one.) But it's my
hope that others like me, will find this modification very useful.
Thank you Stefan, and community -- this is an awesome tool, that I use in my business. It's amazing how simple
tools are always the most powerful and scale-able! Fantastic, excellent job on this app. |
Attachment 1: plaintxt-blue.css
|
\/* default formatting */
body {
margin:3px;
color:black;
background-color:white;
font-family:sans-serif;
}
/* standard link colors and decorations */
a:link { color:#0000FF; text-decoration:none }
a:visited { color:#0000FF; text-decoration:none }
a:hover { color:#0000FF; text-decoration:underline }
a:active { color:#0000FF; text-decoration:underline }
a:focus { color:#0000FF; text-decoration:underline }
td {
color:black;
font-family:sans-serif;
}
/* frame table */
.frame {
width:100%;
}
/* printable frame table */
.pframe {
width:600;
}
/* standard formatting for logbook tabs */
.tabs {
font-family:sans-serif;
font-size:10pt;
background-color:white;
}
/* logbook selection page */
.selframe {
width:60%;
background-color:#486090;
border:1px solid #486090;
font-size:12pt;
}
.seltitle {
border:1px solid #0000FF;
border-top:1px solid white;
border-left:1px solid white;
background-color:#CCCCFF;
color:#486090;
text-align:center;
}
.selexp {
border:1px solid #0000FF;
border-top:1px solid white;
border-left:1px solid white;
background-color:#CCCCFF;
color:#486090;
text-align:left;
font-size:10pt;
}
.selspace {
width:2%;
border:1px solid #308000;
border-top:1px solid white;
border-left:1px solid white;
background-color:#EEEEEE;
}
.selgroup {
border:1px solid #308000;
border-top:1px solid white;
border-left:1px solid white;
background-color:#FFCCFF;
padding:3px;
text-align:left;
font-weight:bold;
font-size:14pt;
}
.sellogbook {
border:1px solid #308000;
border-top:1px solid white;
border-left:1px solid white;
background-color:#DDEEBB;
padding:3px;
text-align:left;
font-weight:bold;
}
.selcomment {
font-size:8pt;
}
.selentries {
background-color:#E0E0A0;
border:1px solid #0000FF;
border-top:1px solid white;
border-left:1px solid white;
text-align:center;
font-size:10pt;
}
/* unselected and selected group tabs */
.gtab a {
background-color:#B0E0B0;
padding-left:5px;
padding-right:5px;
}
.gtab {
background-color:#B0E0B0;
border-right:1px solid #409040;
}
.sgtab a {
color:white;
padding-left:5px;
padding-right:5px;
}
.sgtab {
background-color:#486090;
color:white;
border-right:1px solid #084070;
}
.sgtab a:visited { color:white; } /* bug for IE */
/* unselected and selected logbook tabs */
.ltab a {
background-color:#E0E0E0;
padding-left:5px;
padding-right:5px;
}
.ltab {
background-color:#E0E0E0;
border-right:1px solid gray;
}
.sltab a {
background-color:#486090;
color:white;
padding-left:5px;
padding-right:5px;
}
.sltab {
background-color:#486090;
color:white;
border-right:1px solid #084070;
}
.sltab a:visited { color:white; } /* bug for IE */
/* logbook title, left, middle and right cell */
.title1 {
background-color:#486090;
border-bottom:1px solid gray;
border-top:1px solid #E0E0E0;
border-left:1px solid #E0E0E0;
color:white;
font-size:medium;
font-family:sans-serif;
text-align:left;
}
.title1 a:visited { color:#A0FFA0; }
.title1 a:link { color:#A0FFA0; }
.title2 {
background-color:#486090;
border-bottom:1px solid black;
border-top:1px solid #E0E0E0;
color:white;
font-size:medium;
font-family:sans-serif;
text-align:center;
}
.title3 {
border-bottom:1px solid black;
border-top:1px solid #E0E0E0;
border-right:0px solid gray;
background-color:#486090;
text-align:left;
}
/* main menu row */
.menuframe {
border:0px solid black;
border-top:1px solid gray;
border-right:0px solid gray;
border-left:0px solid gray;
padding:3px;
background-color:white;
}
.menu1 {
text-align:left;
font-size:10pt;
}
.menu2a {
text-align:left;
font-size:10pt;
}
.menu2b {
text-align:right;
font-size:10pt;
}
.menu3 {
text-align:left;
font-size:8pt;
font-weight:bold;
}
.menu4 {
text-align:right;
font-size:10pt;
vertical-align:middle;
}
/* frame table in listings */
.listframe {
border:0px solid gray;
border-top:0px solid gray;
border-left:0pc solid gray;
background-color:white;
border:0px;
}
/* title row in listing */
.listtitle {
border:0px solid black;
border-top:1px solid gray;
border-left:0px solid gray;
background-color:white;
text-align:left;
}
/* attachment line */
.attachment {
border-left:1px solid gray;
border-right:1px solid gray;
border-bottom:1px solid gray;
background-color:#FFFFB0;
text-align:left;
}
/* threaded listing */
.thread {
border:0px solid gray;
border-top:0px solid gray;
border-left:0px solid gray;
background-color:white;
}
.threadreply {
border:0px solid #808040;
border-top:0px solid white;
border-left:0px solid white;
background-color:white;
text-align:left;
}
/* attribute names and values on single message page */
.attribhead {
background-color:white;
border:0px solid gray;
border-top:1px solid gray;
border-bottom:1px solid gray;
border-left:0px solid gray;
padding:0px;
font-size:12pt;
font-family:sans-serif;
}
.attribname {
width:150px;
background-color:#486090;
color:white;
padding-left:5px;
padding-right:5px;
padding:3px;
border:1px solid white;
}
.attribvalue {
... 225 more lines ...
|
Attachment 2: summary.png
|
|
Attachment 3: full.png
|
|
Attachment 4: single-view.png
|
|
Attachment 5: find.png
|
|
|