Subversion Repositories wimsdev

Rev

Rev 15047 | Rev 15117 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14777 guerimand 1
!if $wims_user!=supervisor
14861 guerimand 2
  !bound user within $wims_user,$livingfile default $wims_user
14777 guerimand 3
!else
14861 guerimand 4
  !bound user within $ulist,$livingfile default $empty
14777 guerimand 5
!endif
6
!if $user=$empty
7
  !reset job
14861 guerimand 8
  !changeto var.proc
14777 guerimand 9
!endif
10
 
11
!bound job2 within newmsg,$empty default $empty
14976 guerimand 12
!if $cf_preview!=$empty
13
  job2=newmsg
14
!endif
14777 guerimand 15
 
14886 guerimand 16
 
15082 guerimand 17
 
14861 guerimand 18
ltfile=!sh cd $wims_home/log/classes/$wims_class/tchat; if [ -e $user.old1 ]; then ls $user.old*; fi;
14777 guerimand 19
nbfile=!linecnt $ltfile
20
 
14976 guerimand 21
!if $save!=$empty and $desc!=$empty and $cf_preview=$empty
14777 guerimand 22
  desc=!detag $desc
23
  desc=!char 1 to $msg_limit of $desc
24
  dt=!char 1 to 14 of $wims_now
25
  rcnt=!recordcnt wimshome/log/classes/$wims_class/tchat/$user
26
  !if $rcnt>=$msg_recordlimit
27
    !increase nbfile
28
    !sh mv $wims_home/log/classes/$wims_class/tchat/$user $wims_home/log/classes/$wims_class/tchat/$(user).old$nbfile;
29
  !endif
14861 guerimand 30
  !appendfile wimshome/log/classes/$wims_class/tchat/$user :$wims_user $dt\
14777 guerimand 31
$desc
14976 guerimand 32
  !reset job2 desc save
14777 guerimand 33
!endif
34
 
35
!if $nbfile=0
36
  lastmsg=!recordcnt wimshome/log/classes/$wims_class/tchat/$user
37
  nbmsg=$[min($msg_numberlimit,$lastmsg)]
38
!else
39
  nbmsg=$msg_numberlimit
40
!endif
41
!if $wims_user=supervisor
14861 guerimand 42
  !if . isin $user
43
    n=!text select 0123456789 in $user
44
    name_title=!nosubst $(livingname_$n)
45
  !else
46
    po=!positionof item $user in $ulist
47
    username=$(nlist[$po])
48
    name_title=$name_tchatwith $username
49
  !endif
14777 guerimand 50
!else
51
  username=Participant
14861 guerimand 52
  !if . isin $user
15047 guerimand 53
    n=!text select 0123456789 in $user
14861 guerimand 54
    name_title=!nosubst $(livingname_$n)
55
  !else
56
    name_title=$name_ownliving
57
  !endif
58
  otherliving=!listcomplement $user in $livingfile,$wims_user
14777 guerimand 59
!endif
14905 guerimand 60
ses=!replace internal _ by , in $wims_session
61
ses=!item 1 of $ses
14861 guerimand 62
!setdef wims_opentchat=$user in wimshome/sessions/$ses/var.stat
14777 guerimand 63
 
64
!! ------- build of userpage supervisor can look
14877 guerimand 65
!! userpage can't be view in living (only in individual tchat) : todo ?
66
!if $wims_user=supervisor and $user isitemof $wims_connectedlogin and . notin $user
14777 guerimand 67
   !readproc script/getsession.proc $user
68
!endif
14876 guerimand 69
 
14877 guerimand 70
!! ------ build of list of users
14876 guerimand 71
!if . isin $user
15082 guerimand 72
  living=!text select 0123456789 in $user
14876 guerimand 73
  !if $(livingusers_$living)!=all
74
    listnameusers=$empty
75
    !for u in $(livingusers_$living)
15047 guerimand 76
      po=!positionof item $u in $ulist
14876 guerimand 77
      !if $u!=supervisor and $u!=$wims_user and $po!=$empty
78
        listnameusers=!append item $(nlist[$po]) to $listnameusers
79
      !endif
80
    !next u
81
    !if $listnameusers!=$empty
82
      listnameusers=, $name_yourself $name_and $listnameusers
83
    !else
84
      listnameusers=$name_and $name_yourself
85
    !endif
86
  !endif
87
!else
14877 guerimand 88
  !if $wims_user=supervisor
89
    po=!positionof item $user in $ulist
90
    listnameusers=$name_and $(nlist[$po])
91
  !else
92
    listnameusers=$name_and $name_yourself
93
  !endif
14876 guerimand 94
!endif
95
 
15082 guerimand 96
 
97
!! ------- manage of autorefresh
98
!if $job2!=newmsg
99
  !if $wims_user=supervisor
100
    autorefresh=yes
101
  !else
102
    lastauth=!record -1 of wimshome/log/classes/$wims_class/tchat/$user
103
    lastauth=!line 1 of $lastauth
104
    lastauth=!word 1 of $lastauth
105
    !if $lastauth=$wims_user or $user!=$wims_user
106
      autorefresh=yes
107
    !else
108
      !if $mautorefresh=1
109
        autorefresh=yes
110
      !else
111
        autorefresh=no
112
      !endif
113
    !endif
114
  !endif
115
  !if $autorefresh=yes
116
    !let rd=!randint 111111,999999
117
    local_html_header=<META HTTP-EQUIV="Refresh" CONTENT="$(tchat_refreshtiming);wims.cgi?session=$wims_session&+module=adm/class/tchat&+serial=$rd&+job=$job&+user=$user">
118
  !endif
119
!endif