Subversion Repositories wimsdev

Rev

Rev 15117 | Rev 15636 | 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
 
14861 guerimand 16
ltfile=!sh cd $wims_home/log/classes/$wims_class/tchat; if [ -e $user.old1 ]; then ls $user.old*; fi;
14777 guerimand 17
nbfile=!linecnt $ltfile
18
 
14976 guerimand 19
!if $save!=$empty and $desc!=$empty and $cf_preview=$empty
14777 guerimand 20
  desc=!detag $desc
21
  desc=!char 1 to $msg_limit of $desc
22
  dt=!char 1 to 14 of $wims_now
23
  rcnt=!recordcnt wimshome/log/classes/$wims_class/tchat/$user
24
  !if $rcnt>=$msg_recordlimit
25
    !increase nbfile
26
    !sh mv $wims_home/log/classes/$wims_class/tchat/$user $wims_home/log/classes/$wims_class/tchat/$(user).old$nbfile;
27
  !endif
14861 guerimand 28
  !appendfile wimshome/log/classes/$wims_class/tchat/$user :$wims_user $dt\
14777 guerimand 29
$desc
14976 guerimand 30
  !reset job2 desc save
14777 guerimand 31
!endif
32
 
33
!if $nbfile=0
34
  lastmsg=!recordcnt wimshome/log/classes/$wims_class/tchat/$user
35
  nbmsg=$[min($msg_numberlimit,$lastmsg)]
36
!else
37
  nbmsg=$msg_numberlimit
38
!endif
39
!if $wims_user=supervisor
14861 guerimand 40
  !if . isin $user
41
    n=!text select 0123456789 in $user
42
    name_title=!nosubst $(livingname_$n)
43
  !else
44
    po=!positionof item $user in $ulist
45
    username=$(nlist[$po])
46
    name_title=$name_tchatwith $username
47
  !endif
14777 guerimand 48
!else
49
  username=Participant
14861 guerimand 50
  !if . isin $user
15047 guerimand 51
    n=!text select 0123456789 in $user
14861 guerimand 52
    name_title=!nosubst $(livingname_$n)
53
  !else
54
    name_title=$name_ownliving
55
  !endif
56
  otherliving=!listcomplement $user in $livingfile,$wims_user
14777 guerimand 57
!endif
14905 guerimand 58
ses=!replace internal _ by , in $wims_session
59
ses=!item 1 of $ses
14861 guerimand 60
!setdef wims_opentchat=$user in wimshome/sessions/$ses/var.stat
14777 guerimand 61
 
62
!! ------- build of userpage supervisor can look
14877 guerimand 63
!! userpage can't be view in living (only in individual tchat) : todo ?
64
!if $wims_user=supervisor and $user isitemof $wims_connectedlogin and . notin $user
14777 guerimand 65
   !readproc script/getsession.proc $user
66
!endif
14876 guerimand 67
 
14877 guerimand 68
!! ------ build of list of users
14876 guerimand 69
!if . isin $user
15082 guerimand 70
  living=!text select 0123456789 in $user
14876 guerimand 71
  !if $(livingusers_$living)!=all
72
    listnameusers=$empty
73
    !for u in $(livingusers_$living)
15047 guerimand 74
      po=!positionof item $u in $ulist
14876 guerimand 75
      !if $u!=supervisor and $u!=$wims_user and $po!=$empty
76
        listnameusers=!append item $(nlist[$po]) to $listnameusers
77
      !endif
78
    !next u
79
    !if $listnameusers!=$empty
80
      listnameusers=, $name_yourself $name_and $listnameusers
81
    !else
82
      listnameusers=$name_and $name_yourself
83
    !endif
84
  !endif
85
!else
14877 guerimand 86
  !if $wims_user=supervisor
87
    po=!positionof item $user in $ulist
88
    listnameusers=$name_and $(nlist[$po])
89
  !else
90
    listnameusers=$name_and $name_yourself
91
  !endif
14876 guerimand 92
!endif
93
 
15082 guerimand 94
!! ------- manage of autorefresh
95
!if $job2!=newmsg
96
  !if $wims_user=supervisor
97
    autorefresh=yes
98
  !else
15144 guerimand 99
    !! variable autorefresh is the status of autorefresh yes on ; no : off
100
    !! variable mautorefresh is the type of autorefresh user want.
101
    !! if mautorefresh is empty then autorefresh is automatically fixed. Two case
102
    !!           in personnal living : to yes if last message is user and no if last message is supervisor
103
    !!                                 in case of mautorefresh give same status as autorefresh, mautorefresh 
104
    !!                                 is reset to come back to automatically manage
105
    !!           other : always yes
106
    !! if mautorefresh=0 then autorefresh is fixed to no
107
    !! if mautorefresh=1 then autorefresh is fixed to yes
108
    !bound mautorefresh within yes,no default $empty
15082 guerimand 109
    lastauth=!record -1 of wimshome/log/classes/$wims_class/tchat/$user
110
    lastauth=!line 1 of $lastauth
111
    lastauth=!word 1 of $lastauth
112
    !if $lastauth=$wims_user or $user!=$wims_user
15144 guerimand 113
      wautorefresh=yes
15082 guerimand 114
    !else
15144 guerimand 115
      wautorefresh=no
15082 guerimand 116
    !endif
15144 guerimand 117
    !if $wautorefresh=$mautorefresh
118
      !reset mautorefresh
119
    !endif
120
    !if $mautorefresh=$empty
121
      autorefresh=$wautorefresh
122
    !else
123
      autorefresh=$mautorefresh
124
    !endif
15082 guerimand 125
  !endif
126
  !if $autorefresh=yes
127
    !let rd=!randint 111111,999999
15144 guerimand 128
    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&+mautorefresh=$mautorefresh">
15082 guerimand 129
  !endif
130
!endif
15117 guerimand 131
 
132
 
133
 
134