Subversion Repositories wimsdev

Rev

Rev 5427 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5220 guerimand 1
!! output : whoconnect=list of connected participant
2
!!          numpartconnected=number of participant connected
3
!! in wims_class
5426 guerimand 4
!! output for supervisor :
5
!! wims_whoconnect (tabular one line by participant) login,session,firstname,lastname
6
!! wims_connectedlogin : list of connected login
7
!! wims_numpartconnected : number of connected participant.
8
!! output for other user :
9
!! wims_supervisorconnected
5220 guerimand 10
 
5426 guerimand 11
 
12
!let file_=!replace internal / by ~ in $wims_class
5352 guerimand 13
!if $wims_user=supervisor
6370 guerimand 14
  last_=!sh if [ -e $wims_home/tmp/whoconnect/$file_ ]; then\
15
perl -e '@a = stat($ARGV[0]); print $$a[9]' $wims_home/tmp/whoconnect/$file_;\
5279 guerimand 16
fi;
5352 guerimand 17
 !default $last_=0
18
 !if $wims_nowseconds-$last_>300 or $wims_read_parm=1
19
  ses_=!sh cd $wims_home/sessions;\
20
  grep -r wims_class=$wims_class ./*/var.stat | cut -d/ -f2;
21
  ses_=!words2items $ses_
5426 guerimand 22
  wims_whoconnect=$empty
5352 guerimand 23
  !for s_ in $ses_
24
   t_=!defof wims_user\
5220 guerimand 25
wims_firstname\
26
wims_lastname in wimshome/sessions/$s_/var.stat
5352 guerimand 27
   !distribute line $t_ into t1_,t2_,t3_
28
   !if $t1_!=supervisor
5427 guerimand 29
    !if $t1_ notitemof $wims_connectedlogin
30
     wims_whoconnect=!append line $t1_,$t2_,$t3_,$s_ to $wims_whoconnect
31
     wims_connectedlogin=!append item $t1_ to $wims_connectedlogin
32
    !else
33
     pos_=!positionof item $t1_ in $wims_connectedlogin
34
     tmp_=!append item $s_ to $(wims_whoconnect[$pos_;])
35
     wims_whoconnect=!replace line number $pos_ by $tmp_ in $wims_whoconnect
36
    !endif
5352 guerimand 37
   !endif
38
  !next s_
5426 guerimand 39
  !writefile wimshome/tmp/whoconnect/$file_ $wims_whoconnect
5352 guerimand 40
 !else
5426 guerimand 41
  wims_whoconnect=!record 0 of wimshome/tmp/whoconnect/$file_
5427 guerimand 42
  wims_connectedlogin=!column 1 of $wims_whoconnect
5352 guerimand 43
 !endif
5426 guerimand 44
 wims_numpartconnected=!linecnt $wims_whoconnect
5420 guerimand 45
 !setdef user_connected=$wims_session in wimshome/tmp/whoconnect/sup$file_
5352 guerimand 46
!else
5426 guerimand 47
 wims_supervisorconnected=!defof user_connected in wimshome/tmp/whoconnect/sup$file_
48
 !if $wims_supervisorconnected!=$empty
49
  test_=!defof wims_user in wimshome/sessions/$wims_supervisorconnected/var.stat
5352 guerimand 50
  !if $test_=$empty
5426 guerimand 51
   !reset wims_supervisorconnected
5420 guerimand 52
   !setdef user_connected=$empty in wimshome/tmp/whoconnect/sup$file_
5220 guerimand 53
  !endif
5352 guerimand 54
 !endif
5419 guerimand 55
!endif