# # M C 2 L A B S W E B T E L # version 1.98 rev 0.2b # # # another WIMS-based true interactive Web Application # # (c) Copyright 2004-2007 by MC2LABS.com # # WIMS kernel source file (ws5api.wims) # last update: 28.05.2007 # # codeversion A/2 # # an MC2LABS.com production # # source code follows # WIMS TEMPLATE_KERNEL ws5api noDEBUG 200403270723 # force webpage cache copy check # revision 2.11 # dedicated to friendship interface declare override .InitMaster declare override .Init declare override .Run declare bdbase as root of root declare variable string invite_duration 10 declare variable string service_acl 50 declare variable string service_gal 30 declare variable string service_min 2 declare variable string callservice root.mc2net declare variable string callroot "root.wtcalls." declare variable string mchnroot "root.wtmodules." declare variable string wtdeps "wtadmin|avop|avadmin|tableown|tablepub|tableprint|tableall|" declare variable string weburl "http://ws5api.mc2labs.com" declare variable string adminelm _default declare variable string defcs declare variable string defprof declare variable string mfn declare variable string lang declare variable string sdom declare variable string prntitle declare variable string crl1 declare variable string crl2 declare variable unique string callid 0 declare variable string oncall 0 declare variable string chancall declare variable string oninvite FALSE declare variable string evtinvINstatus declare variable string evtinvOUTstatus declare variable string evtlistener declare variable string evtcall declare variable string invitation declare variable string answer declare variable string status declare variable string skipec declare variable string callstatus declare variable string audio declare variable string trlt declare variable string rlt declare variable string usr declare variable string dev declare variable string tval declare variable string tval1 declare variable string tval2 declare variable string tval3 declare variable string genid declare variable string myuser declare variable string mail declare variable string elm declare variable string pwd declare variable string registered FALSE declare variable string fcrsr 1 declare variable string tcrsr 1 declare variable string cdescr "WS5API" # eliminare uso cdescr e pulire... declare variable string dbpath "dbfile/general/" declare variable string rubrica_search declare variable string rubrica_pos 1 declare variable string domains "root.wtdomains." declare variable string ladmin declare variable string hdcnd declare variable string hdevt declare variable string wmail_pt 1 declare variable string wmail_opt declare variable string grpos 1 declare variable string gupos 1 declare variable string gid declare variable string gusr declare variable string trn declare variable string ntid declare variable string nt_pos 1 declare variable string appd declare variable string tableopt declare variable string tabsr declare variable string tabxtra declare variable string lvl declare variable string xtern NONE declare variable string xternreqer NONE declare variable string mygid NONE declare variable string forumd FALSE declare variable string mid declare variable string forum_pt 0 declare variable string hdx 1 declare variable string et declare variable string sel declare variable string chp declare variable string cb0 "root.mc2mx" declare variable string fpnt 1 declare variable string forumlo declare variable string opt declare variable string sup declare variable string pg_prof declare variable string pid 0 declare variable string ftr declare variable string ok # SmartModule interface (module0) declare variable string exm -1 declare variable string modchan # WebChannel interface declare variable unique string onair FALSE declare variable string runmode NONE declare variable string mc2tv # event handler device (..) declare variable string tvchan root.mc2tv.wch declare variable string tvgroup root.mc2tv.wch.group security global implementation # ---------------------------------------------------------- # DB ADMINISTRATION # ---------------------------------------------------------- procedure !CreateDatabase { call CreateDatabase.permdb call CreateDatabase.LostCall call CreateDatabase.VideoConfig call CreateDatabase.Registers call CreateDatabase.FileDB call CreateDatabase.TableDB call CreateDatabase.TableNotes call CreateDatabase.licensetab call CreateDatabase.ContactTab call CreateDatabase.RubricaDB call CreateDatabase.MessageDB call CreateDatabase.messages call CreateDatabase.groups call CreateDatabase.Approvals call CreateDatabase.prntrace call CreateDatabase.album call CreateDatabase.forumsindex call CreateDatabase.forumadmins call CreateDatabase.appsfmap call CreateDatabase.audiodb call CreateDatabase.hdw call CreateDatabase.fsharetab call CreateDatabase.softwaretab call CreateDatabase.webch.dirette call CreateDatabase.webch.servizi } procedure !CreateDatabase.LostCall { database sql update ("CREATE SEQUENCE lostcall_pkey_id") database sql update ("CREATE TABLE lostcall (idx int4 NOT NULL DEFAULT nextval('lostcall_pkey_id'), reqer text, reqed text, timestamp text, active text, notes text, reqerfn text)") database sql update ("CREATE UNIQUE INDEX lostcall_pkey ON lostcall(idx)") } procedure !CreateDatabase.VideoConfig { database sql update ("CREATE SEQUENCE videoconf_pkey_id") database sql update ("CREATE TABLE videoconf (idx int4 NOT NULL DEFAULT nextval('videoconf_pkey_id'), aname text, aidx text, description text, settings text, lictag text)") database sql update ("CREATE UNIQUE INDEX videoconf_pkey ON videoconf(idx)") } procedure !CreateDatabase.Registers { database sql update ("CREATE SEQUENCE registers_pkey_id") database sql update ("CREATE TABLE registers (idx int4 NOT NULL DEFAULT nextval('registers_pkey_id'), midx text, company text, coreb text, piva text, address text, cap text, city text, province text, state text, weburl text, why text, timestamp text)") database sql update ("CREATE UNIQUE INDEX registers_pkey ON registers(idx)") } procedure !CreateDatabase.FileDB { database sql update ("CREATE SEQUENCE filedb_pkey_id") database sql update ("CREATE TABLE filedb (idx int4 NOT NULL DEFAULT nextval('filedb_pkey_id'), authidx text, timestamp text, filename text, valid text, owneridx text, ftype text, hdwid text, lictag text, filetitle text, shareflag text)") database sql update ("CREATE UNIQUE INDEX filedb_pkey ON filedb(idx)") } procedure !CreateDatabase.TableDB { database sql update ("CREATE SEQUENCE tabledb_pkey_id") database sql update ("CREATE TABLE tabledb (idx int4 NOT NULL DEFAULT nextval('tabledb_pkey_id'), authidx text, owneridx text, timestamp text, fileidx int4, valid text, title text, lictag text, state text, mitt_midx text, mitt_firm text, dest_midx text, dest_firm text, dest_auth text, pub_auth text, appd int4, xtra text)") database sql update ("CREATE UNIQUE INDEX tabledb_pkey ON tabledb(idx)") } procedure !CreateDatabase.licensetab { database sql update ("CREATE SEQUENCE licensetab_pkey_id") database sql update ("CREATE TABLE licensetab (idx int4 NOT NULL DEFAULT nextval('licensetab_pkey_id'), lictag text, camtech text, teltech text, logofile text, adminelm text, weburl text, defcs text, defprof int4, mfn text, sdom text, deflang text, crl1 text, crl2 text, prntitle text, tabxtra text, website text, skin text, sitemod text, intromod, text, runmode text, clname text, clplace text, cldescr text, typ text)") database sql update ("CREATE UNIQUE INDEX licensetab_pkey ON licensetab(idx)") } procedure !CreateDatabase.ContactTab { database sql update ("CREATE SEQUENCE contacttab_pkey_id") database sql update ("CREATE TABLE contacttab (idx int4 NOT NULL DEFAULT nextval('contacttab_pkey_id'), lictag text, _1m text, _1l text, _2m text, _2l text, _3m text, _3l text, _4m text, _4l text, _5m text, _5l text, _6m text, _6l text, _7m text, _7l text, _8m text, _8l text, _9m text, _9l text)") database sql update ("CREATE UNIQUE INDEX contacttab_pkey ON contacttab(idx)") } procedure !CreateDatabase.TableNotes { database sql update ("CREATE SEQUENCE tablenotes_pkey_id") database sql update ("CREATE TABLE tablenotes (idx int4 NOT NULL DEFAULT nextval('tablenotes_pkey_id'), tableidx int4, title text, descr text, creation_ts text, approvation_ts text, creation_midx text, approvation_midx text, creation_firm text, approvation_firm text, posx text, posy text, lenx text, leny text, startx text, starty text, startzm text, approvation_state text, approvation_ip text)") database sql update ("CREATE UNIQUE INDEX tablenotes_pkey ON tablenotes(idx)") } procedure !CreateDatabase.RubricaDB { database sql update ("CREATE SEQUENCE rubricadb_pkey_id") database sql update ("CREATE TABLE rubricadb (idx int4 NOT NULL DEFAULT nextval('rubricadb_pkey_id'), owidx text, cwidx text, cname text)") database sql update ("CREATE UNIQUE INDEX rubricadb_pkey ON rubricadb(idx)") } procedure !CreateDatabase.permdb { database sql update ("CREATE SEQUENCE permdb_pkey_id") database sql update ("CREATE TABLE permdb (idx int4 NOT NULL DEFAULT nextval('permdb_pkey_id'), midx text, op text)") database sql update ("CREATE UNIQUE INDEX permdb_pkey ON permdb(idx)") } procedure !CreateDatabase.MessageDB { database sql update ("CREATE SEQUENCE messagedb_pkey_id") database sql update ("CREATE TABLE messagedb (idx int4 NOT NULL DEFAULT nextval('messagedb_pkey_id'), tstamp text, mfrom text, lfrom text, mto text, lto text, subj text, sent text, received text, read text, approved text, refused text, fwd text, parent text, status text, fatt text, touched text, activefrom text, activeto text)") database sql update ("CREATE UNIQUE INDEX messagedb_pkey ON messagedb(idx)") procedure !CreateDatabase.messages { database sql update ("CREATE SEQUENCE messages_pkey_id") database sql update ("CREATE TABLE messages (idx int4 NOT NULL DEFAULT nextval('messages_pkey_id'), msgid int4, body text, ts text)") database sql update ("CREATE UNIQUE INDEX messages_pkey ON messages(idx)") } procedure !CreateDatabase.groups { database sql update ("CREATE SEQUENCE groupsdb_pkey_id") database sql update ("CREATE TABLE groupsdb (gidx int4 NOT NULL DEFAULT nextval('groupsdb_pkey_id'), lictag text, name text, descr text, lock text)") database sql update ("CREATE UNIQUE INDEX groupsdb_pkey ON groupsdb(gidx)") database sql update ("CREATE SEQUENCE grusersdb_pkey_id") database sql update ("CREATE TABLE grusersdb (idx int4 NOT NULL DEFAULT nextval('grusersdb_pkey_id'), gidx int4, midx text, lictag text)") database sql update ("CREATE UNIQUE INDEX grusersdb_pkey ON grusersdb(idx)") # NT_MC2MX maintaing with $WTDEPS! database sql update ("CREATE SEQUENCE grpermsdb_pkey_id") database sql update ("CREATE TABLE grpermsdb (idx int4 NOT NULL DEFAULT nextval('grpermsdb_pkey_id'), gidx int4, wtadmin text, avop, text, avadmin text, tableown text, tablepub text, tableprint text, tableall text)") #.. database sql update ("CREATE UNIQUE INDEX grpermsdb_pkey ON grpermsdb(idx)") database sql update ("CREATE SEQUENCE grdatadb_pkey_id") database sql update ("CREATE TABLE grdatadb (idx int4 NOT NULL DEFAULT nextval('grdatadb_pkey_id'), gidx int4, tabletag text)") #.. database sql update ("CREATE UNIQUE INDEX grdatadb_pkey ON grdatadb(idx)") } procedure !CreateDatabase.Approvals { database sql update ("CREATE SEQUENCE approvaldb_pkey_id") database sql update ("CREATE TABLE approvaldb (aidx int4 NOT NULL DEFAULT nextval('approvaldb_pkey_id'), tableidx int4, used text, mreqer text, state text, lastown_midx text, lastown_firm text, last_ts text)") database sql update ("CREATE UNIQUE INDEX approvaldb_pkey ON approvaldb(aidx)") } procedure !CreateDatabase.prntrace { database sql update ("CREATE SEQUENCE prntrace_pkey_id") database sql update ("CREATE TABLE prntrace (idx INT4 NOT NULL DEFAULT nextval('prntrace_pkey_id'), lictag text, module text, report text, reqer text, timestamp text, objid text)") database sql update ("CREATE UNIQUE INDEX prntrace_pkey ON prntrace(idx)") } procedure !CreateDatabase.album { database sql update ("CREATE SEQUENCE albumdb_pkey_id") database sql update ("CREATE TABLE albumdb (idx INT4 NOT NULL DEFAULT nextval('albumdb_pkey_id'), mowner text, fowner text, title text, creation text, lastmod text, atag text, aord int4, ownauth text)") database sql update ("CREATE UNIQUE INDEX albumdb_pkey ON albumdb(idx)") database sql update ("CREATE SEQUENCE slidedb_pkey_id") database sql update ("CREATE TABLE slidedb (idx INT4 NOT NULL DEFAULT nextval('slidedb_pkey_id'), albumidx int4, fileidx int4, title text, mowner text, fowner text, timestamp text, sord int4)") database sql update ("CREATE UNIQUE INDEX sildedb_pkey ON slidedb(idx)") } procedure !CreateDatabase.forumsindex { database sql update ("CREATE SEQUENCE forumdb_pkey_id") database sql update ("CREATE TABLE forumdb (fidx INT4 NOT NULL DEFAULT nextval('forumdb_pkey_id'), tagname text, lictag text, descr text, active text, chanpath text, ford int4)") database sql update ("CREATE UNIQUE INDEX forumdb_pkey ON forumdb(fidx)") database sql update ("CREATE SEQUENCE forumsubs_pkey_id") database sql update ("CREATE TABLE forumsubs (idx INT4 NOT NULL DEFAULT nextval('forumsubs_pkey_id'), fidx int4, gidx int4, uidx text)") database sql update ("CREATE UNIQUE INDEX forumsubs_pkey ON forumsubs(idx)") } procedure !CreateDatabase.forumadmins { database sql update ("CREATE SEQUENCE fadmin_pkey_id") database sql update ("CREATE TABLE fadmin (idx INT4 NOT NULL DEFAULT nextval('fadmin_pkey_id'), fidx int4, uidx text)") database sql update ("CREATE UNIQUE INDEX fadmin_pkey ON fadmin(idx)") } procedure !CreateDatabase.appsfmap { database sql update ("CREATE SEQUENCE appsfmap_pkey_id") database sql update ("CREATE TABLE appsfmap (idx INT4 NOT NULL DEFAULT nextval('appsfmap_pkey_id'), fidx int4, apptag text, _module text, _accesslevel int4, _department text)") database sql update ("CREATE UNIQUE INDEX appsfmap_pkey ON appsfmap(idx)") } procedure !CreateDatabase.audiodb { database sql update ("CREATE SEQUENCE audiodb_pkey_id") database sql update ("CREATE TABLE audiodb (aid int4 NOT NULL DEFAULT nextval('audiodb_pkey_id'), xternapp text, lictag text, aui text, wvobjid int4)") database sql update ("CREATE UNIQUE INDEX audiodb_pkey ON audiodb(aid)") } procedure !CreateDatabase.hdw { database sql update ("CREATE SEQUENCE hdw_pkey_id") # idx is not text? database sql update ("CREATE TABLE hdw (idx int4 NOT NULL DEFAULT nextval('hdw_pkey_id'), sord int4, chpath text, _parent text, folder text, exetype text, active text, lic text, owner text, destination text, destype text, lictag text)") database sql update ("CREATE UNIQUE INDEX hdw_pkey ON hdw(idx)") } procedure !CreateDatabase.fsharetab { database sql update ("CREATE SEQUENCE fsharetab_pkey_id") database sql update ("CREATE TABLE fsharetab (idx int4 NOT NULL DEFAULT nextval('fsharetab_pkey_id'), owner text, othu text, fileidx int4, active text, lastupd text, upltms int4)") database sql update ("CREATE UNIQUE INDEX fsharetab_pkey on fsharetab(idx)") } procedure !CreateDatabase.softwaretab { database sql update ("CREATE SEQUENCE swtab_pkey_id") database sql update ("CREATE TABLE swtab (idx int4 NOT NULL DEFAULT nextval('swtab_pkey_id'), wdnid int4, mauthor text, fileidx int4, appname text, applicat text, ver text, posx int4, posy int4, valid text, sword int4)") database sql update ("CREATE UNIQUE INDEX swtab_pkey on swtab(idx)") database sql update ("CREATE SEQUENCE swcab_pkey_id") database sql update ("CREATE TABLE swcab (idx int4 NOT NULL DEFAULT nextval('swcab_pkey_id'), swid int4, lictag text, active text, opt text)") database sql update ("CREATE UNIQUE INDEX swcab_pkey on swcab(idx)") } procedure !CreateDatabase.webch.dirette { database sql update ("CREATE SEQUENCE webch_dirette_pkey_id") database sql update ("CREATE TABLE webch_dirette (idx int4 NOT NULL DEFAULT nextval('webch_dirette_pkey_id'), descr text, rubricaidx int4, etype text, tstamp text, mainstream int4, owner text, evtstart text, evtend text, wmodule text, active text)") database sql update ("CREATE UNIQUE INDEX webch_dirette_pkey on webch_dirette(idx)") } procedure !CreateDatabase.webch.servizi { database sql update ("CREATE SEQUENCE webch_servizi_pkey_id") database sql update ("CREATE TABLE webch_servizi (idx int4 NOT NULL DEFAULT nextval('webch_servizi_pkey_id'), descr text, rubricaidx int4, etype text, tstamp text, mainstream int4, owner text, wmodule text, active text)") database sql update ("CREATE UNIQUE INDEX webch_servizi_pkey on webch_servizi(idx)") } # ---------------------------------------------------------- # APPLET: BUTTONBAR # ---------------------------------------------------------- procedure Applet.ButtonBar.Run { caseCommand [APPLET,BUTTONBAR,CALLER] { capplet area dialog makecall } caseCommand [APPLET,BUTTONBAR,ABORT] { if [$oninvite] { answerInvitation $invitation ABORT $oninvite = FALSE } ifnot [$oninvite] { capplet area dialog abortcall } } caseCommand [APPLET,BUTTONBAR,HANGUP] { ifnot [$oncall == 0] { call hangup } if [$oncall == 0] { capplet area dialog abortcall } } caseCommand [APPLET,BUTTONBAR,SELECT] { capplet area select getCommand(4) if [7 == getCommand(4)] { capplet wch status $onair definechannel $tvchan option=autojoin streamchannel $tvchan devicemap } } caseCommand [APPLET,BUTTONBAR,SETLANG] { send seq language getCommand(4) } caseCommand [APPLET,BUTTONBAR,CBM,ON] { call Applet.ButtonBar.cbmon } caseCommand [APPLET,BUTTONBAR,CBM,OFF] { call Applet.ButtonBar.cbmoff } caseCommand [APPLET,BUTTONBAR,CBMOPEN] { streamchannel $cb0 device=cbj source=myself capplet buttonbar cbmk } caseCommand [APPLET,BUTTONBAR,CBMCLOSE] { streamchannel $cb0 device=cbj source=none } caseCommand [APPLET,BUTTONBAR,REQRESUME] { capplet buttonbar resume } } procedure Applet.ButtonBar.cbmon { setDepartment(cbm) capplet buttonbar cbm on joinchannel $cb0 } procedure Applet.ButtonBar.cbmoff { unsetDepartment(cbm) unjoinchannel $cb0 capplet buttonbar cbm off } # ---------------------------------------------------------- # APPLET: AREA # ---------------------------------------------------------- procedure Applet.Area.Run { caseCommand [APPLET,AREA,ANSWER] { call Applet.Area.AnswerMachine } caseCommand [APPLET,AREA,OPENCALL] { $usr = getCommand(4) if [$usr == getUserWIDX] { capplet area dialog busy } ifnot [$usr == getUserWIDX] { ifnot [$oninvite] { $rlt = ison $callservice [$usr] if [$rlt] { $invitation = placeInvitation $usr $invite_duration $answer = toString("queryInvitation",$invitation) $evtinvOUTstatus = onevent [$answer] do "call InviteManager" $oninvite = TRUE } ifnot [$rlt] { capplet area dialog offline call markLostCall } } } } caseCommand [APPLET,AREA,TAKEUSER] { cappletchanneluser $callservice $usr area join getCommand(4) getCommand(5) getCommand(6) $oninvite = FALSE } caseCommand [APPLET,AREA,JOINCONF] { $oncall = getCommand(4) $dev = getCommand(5) $chancall = toUnspacedString($callroot,$oncall) joinchannel $chancall streamchannel $chancall getCommand(5) source=myself $oninvite = FALSE $skipec = TRUE $callstatus = toString("getusers",$chancall) $evtcall = onevent [$callstatus] do "call callmanager" } caseCommand [APPLET,AREA,UNINVITE] { $oninvite = FALSE capplet area dialog lostcall } } procedure Applet.Area.AnswerMachine { caseCommand [APPLET,AREA,ANSWER,BUSY] { $oninvite = FALSE answerInvitation getCommand(5) BUSY } caseCommand [APPLET,AREA,ANSWER,ACCEPT] { if [queryInvitation getCommand(5) == FALSE] { cappletchanneluser $callservice getUserWIDX dialog lostcall } ifnot [queryInvitation getCommand(5) == FALSE] { cappletchanneluserex $callservice getUserWIDX dialog lostcall # hold answerInvitation getCommand(5) ACCEPTED call joincall } } caseCommand [APPLET,AREA,ANSWER,REFUSE] { $oninvite = FALSE answerInvitation getCommand(5) REFUSED cappletchanneluser $callservice getUserWIDX area dialog abortcall } caseCommand [APPLET,AREA,ANSWER,IGNORE] { $oninvite = FALSE capplet area dialog abortcall } } # ---------------------------------------------------------- # APPLET: UTILITIES # ---------------------------------------------------------- procedure Applet.Utilities.Run { caseCommand [APPLET,UTILITIES,GETCONTACTS] { capplet utilities updatetab database sql getTableQuery(toUnspacedString("select * from contacttab where lictag='",getLicenseTag,"'")) window [1,1] ; select 18 fields _1m,_1l,_2m,_2l,_3m,_3l,_4m,_4l,_5m,_5l,_6m,_6l,_7m,_7l,_8m,_8l,_9m,_9l } caseCommand [APPLET,UTILITIES,SUB] { capplet utilities omodule getCommand(4) } caseCommand [APPLET,UTILITIES,OPENCB] { streamchannel toUnspacedString($domains,getLicenseTag) device=mobj source=myself capplet skin oncb } caseCommand [APPLET,UTILITIES,CLOSECB] { streamchannel toUnspacedString($domains,getLicenseTag) device=mobj source=none } } procedure Applet.Utilities.UpdateHDstatus { caseEvent [TRUE] { capplet utilities hdon } caseEvent [FALSE] { capplet utilities hdoff } } # ---------------------------------------------------------- # APPLET: MISSED # ---------------------------------------------------------- procedure Applet.Missed.Run { caseCommand [APPLET,MISSED,REQLOSTS] { call getLostCalls } caseCommand [APPLET,MISSED,TOUCHLOST] { call touchLostCall } } # ---------------------------------------------------------- # APPLET: VIDEOCONFIG # ---------------------------------------------------------- procedure Applet.VideoConfig.Run { caseCommand [APPLET,VIDEOCONF,SETSTREAM] { ifnot [$oncall == 0] { $tval = getCommand(4) redefinechannel $chancall $tval } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,VIDEOCONF,PROFILESTREAM] { ifnot [$oncall == 0] { $tval = getCommand(6) send channel=$chancall SEQ SYS APPLET vprof active getCommand(4) getCommand(5) redefinechannel $chancall $tval cappletchannel $chancall videoconf catch } if [$oncall == 0] { capplet area dialog NOTINCALL } } } # ---------------------------------------------------------- # APPLET: VPROF # ---------------------------------------------------------- procedure Applet.VProf.Run { caseCommand [APPLET,VPROF,REQPROFS] { if getDepartment(avop) { $pg_prof = getCommand(4) $tval = stripString(database sql getQuery(toUnspacedString("select count (*) from videoconf where lictag='",getLicenseTag,"' or lictag='*'"))) capplet vprof profdata TRUE $pg_prof $tval database sql getTableQuery(toUnspacedString("select * from videoconf where lictag='",getLicenseTag,"' or lictag='*' order by idx DESC")) window [$pg_prof,8]; select 5 fields idx, aname, description, settings, aidx } ifnot getDepartment(avop) { capplet vprof profdata FALSE stripString(database sql getQuery(toUnspacedString("select description from videoconf where idx=(select defprof from licensetab where lictag='",getLicenseTag,"')"))) } } caseCommand [APPLET,VPROF,MODAL] { call Applet.VProf.Modal } caseCommand [APPLET,VPROF,SAVE] { database sql update toUnspacedString("update videoconf set aname='",getmyFullName,"', description='",getCommand(5),"', settings='",getCommand(6),"' where idx='",getCommand(4),"'") capplets vprof updatelist } caseCommand [APPLET,VPROF,ADD] { database sql update toUnspacedString("insert into videoconf(lictag,aname,aidx,description,settings) VALUES('",; getLicenseTag,"','",; getmyFullName,"','",; getUserWIDX,"','",; getCommand(4),"','"; getCommand(5),"')") capplets vprof updatelist } caseCommand [APPLET,VPROF,REM] { if getDepartment(avadmin) { database sql update toUnspacedString("delete from videoconf where idx='",getCommand(4),"'") capplets vprof updatelist } ifnot getDepartment(avadmin) { capplet area dialog DENIED } } } procedure Applet.VProf.Modal { caseCommand [APPLET,VPROF,MODAL,43] { ifnot [$oncall == 0] { if getDepartment(avadmin) { capplet vprof addprofile } ifnot getDepartment(avadmin) { capplet area dialog DENIED } } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,VPROF,MODAL,NONE] { capplet vprof NONE } } # ---------------------------------------------------------- # APPLET: CAMBAR # ---------------------------------------------------------- procedure Applet.CAMBAR.Run { caseCommand [APPLET,CAMBAR,SETPAUSED] { send channel=$chancall SEQ SYS APPLET cambar SETPAUSED getCommand(4) } caseCommand [APPLET,CAMBAR,UNSETPAUSED] { send channel=$chancall SEQ SYS APPLET cambar UNSETPAUSED getCommand(4) } caseCommand [APPLET,CAMBAR,DEVICEMAP] { ifnot [$oncall == 0] { $tval = getCommand(4) # redefinechannel $chancall $tval streamchannel $chancall devicemap capplet cambar ok } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,GOMODE] { ifnot [$oncall == 0] { send channel=$chancall SEQ SYS APPLET cambar GOMODE getCommand(4) waitif } if [$oncall == 0] { #capplet cambar GOMODE getCommand(4) capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,MAPME] { ifnot [$oncall == 0] { $tval1 = toUnspacedString("ca",getUserWIDX) $tval2 = stripString(toUnspacedString("device=",$tval1)) cappletchannel $chancall cambar mapdev getUserWIDX $tval1 getCommand(4) streamchannel $chancall $tval2 source=myself } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,UNMAPME] { ifnot [$oncall == 0] { $tval1 = toUnspacedString("ca",getUserWIDX) $tval2 = stripString(toUnspacedString("device=",$tval1)) capplet cambar ok streamchannel $chancall $tval2 source=none } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,SPOTL] { ifnot [$oncall == 0] { streamchannel $chancall device=confcam source=none cappletchannel $chancall cambar sinvite getCommand(4) } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,UNSPOTL] { ifnot [$oncall == 0] { streamchannel $chancall device=confcam source=none capplet cambar ok } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,GETSPOTL] { ifnot [$oncall == 0] { streamchannel $chancall device=confcam source=myself } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,ADDREQ] { ifnot [$oncall == 0] { cappletchannel $chancall cambar addreq getCommand(4) getCommand(5) getCommand(6) } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,REMREQ] { ifnot [$oncall == 0] { cappletchannel $chancall cambar remreq getCommand(4) } if [$oncall == 0] { capplet area dialog NOTINCALL } } caseCommand [APPLET,CAMBAR,CAMREMAP] { ifnot [$oncall == 0] { streamchannel $chancall devicemap } if [$oncall == 0] { capplet area dialog NOTINCALL } } } # ---------------------------------------------------------- # APPLET: REGTAB # ---------------------------------------------------------- procedure Applet.RegTab.Run { caseCommand [APPLET,REGTAB,OK] { if almax [$service_acl] { call loginCheck } if almin [$service_acl] { capplet area registerall call Applet.RegTab.CheckPresence } } caseCommand [APPLET,REGTAB,REGISTRATION] { call Applet.RegTab.RegisterUser } caseCommand [APPLET,REGTAB,EDITREG] { capplet regtab openreg } caseCommand [APPLET,REGTAB,GETREG] { call Applet.RegTab.Retrive } caseCommand [APPLET,REGTAB,ABORTREG] { capplet regtab reload } caseCommand [APPLET,REGTAB,UPDATEREG] { $tval = getCommand(5) $elm = getCommand(6) database wsysdb setUserEmail(getUserWIDX,$elm) database wsysdb resetUserName($tval) call Applet.RegTab.Store capplet regtab reload } caseCommand [APPLET,REGTAB,CLEAR] { call Applet.RegTab.Clear } caseCommand [APPLET,REGTAB,MENU] { capplet regtab maingen getCommand(4) } caseCommand [APPLET,REGTAB,EXIT] { capplet regtab ok send raw sys wwclose } caseCommand [APPLET,REGTAB,WEBSITE] { $tval = stripString(database sql getQuery(toUnspacedString("select website from licensetab where lictag='",getLicenseTag,"'"))) if [$tval == NONE] { capplet area dialog DENIED } ifnot [$tval == NONE] { $tval1 = tagside($tval) if [$tval1 == NONE] { capplet regtab ok send raw sys openurl trim $tval } if [$tval1 == xR] { capplet fileman reqrun codeside($tval) } if [$tval1 == xJ] { send raw sys jumpto trim codeside($tval) } } } caseCommand [APPLET,REGTAB,MAILTO] { capplet regtab ok send raw sys mailto $adminelm } } procedure Applet.RegTab.Clear { send raw ckyreset send seq rel $weburl } procedure Applet.RegTab.RegisterUser { # CMD1: login # CMD2: password [4] # CMD3: auth # CMD4: fullname [5] # CMD5: option (create/createAndLogin/createAndAutologin/noPasswordCheck) # --- train: # TKN 4: PASSWORD # TKN 5: FULLNAME # TKN 6: ELM # TRN 7< DATA $myuser = database wsysdb createUser(toUnspacedString("usr",getgid),getCommand(4),getLicenseTag,getCommand(5),createAndAutoLogin) call Applet.RegTab.CheckPresence call Applet.RegTab.Store $pwd = getCommand(4) $tval = getCommand(5) capplet regtab elmconfirm waitif $elm = getCommand(4) database wsysdb setUserEmail(getUserWIDX,$elm) database wsysdb resetUserName($tval) $mail = mailer create "WebTel - Servizio registrazioni", $adminelm $tval2 = stripString(database sql getQuery(toUnspacedString("select count(*) from groupsdb where lictag='",getLicenseTag,"' and lock='DEFAULT'"))) if [$tval2 == 1] { $gusr = getUserWIDX $gid = stripString(database sql getQuery(toUnspacedString("select gidx from groupsdb where lictag='",getLicenseTag,"' and lock='DEFAULT'"))) database sql update toUnspacedString("insert into grusersdb(gidx,midx,lictag) VALUES('",$gid,"','",$gusr,"','",getLicenseTag,"')") $tval1 = stripString(database sql getQuery(toUnspacedString("select name from groupsdb where lictag='",getLicenseTag,"' and lock='DEFAULT'"))) call Applet.cGroups.AddGroupUser } mailer $mail writeln getLicenseTitle mailer $mail writeln "-" mailer $mail writeln "Come da richiesta online, seguono i parametri di accesso al servizio videotelefonico di " $sdom mailer $mail writeln mailer $mail writeln toUnspacedString("USERNAME: ",client info getWIMSUserCode) mailer $mail writeln toUnspacedString("PASSWORD: ",$pwd) mailer $mail writeln toUnspacedString("AUTHORITY: ",getLicenseTag) mailer $mail writeln mailer $mail writeln "il tuo ID telefonico e':" mailer $mail writeln getUserWIDX mailer $mail writeln mailer $mail writeln "L'helpdesk telefonico risponde al numero " $mfn mailer $mail writeln mailer $mail writeln mailer $mail writeln "Grazie per aver scelto i servizi online di " $sdom mailer $mail writeln mailer $mail sendto $elm mailer $mail writeln mailer $mail writeln "[ registration resume - administrators only appendix ]" mailer $mail writeln mailer $mail writeln "user full name: " $tval mailer $mail writeln "user email: " $elm mailer $mail writeln "user host: " client info getMyHost mailer $mail writeln "wims-id: " getUserWIDX mailer $mail writeln "timestamp: " getTimeStamp mailer $mail writeln "-" ifnot [$tval2 == 1] { mailer $mail writeln "no DEFAULT group assigned to user" } if [$tval2 == 1] { mailer $mail writeln "default group: " $tval1 } mailer $mail writeln mailer $mail writeln "WIMS registered users are " getgid mailer $mail writeln mailer $mail sendto maxcarli@mc2labs.com mailer $mail sendto $adminelm mailer $mail done $registered = TRUE } procedure Applet.RegTab.CheckPresence { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from registers where midx='",getUserWIDX,"'"))) if [$tval == 0] { database sql update toUnspacedString("insert into registers(midx,timestamp) VALUES('",; getUserWIDX,"','",; getTimeStamp,"')") } } procedure Applet.RegTab.Store { database sql update(toUnspacedString("update registers set ",GetCommand(7)," where midx='",getUserWIDX,"'")) } procedure Applet.RegTab.Retrive { capplet regtab datareg getmyFullName getmyEmail database sql getTableQuery(toUnspacedString("select * from registers where midx='",getUserWIDX,"'")) window [1,1] ; select 10 fields company, coreb, piva, address, cap, city, province, state, weburl, why } # ---------------------------------------------------------- # LISTENERS # ---------------------------------------------------------- procedure Listener { $trlt = getEvent if [$oncall == 0] { ifnot [$trlt == FALSE] { ifnot [$oninvite] { $rlt = $trlt capplet area gotinvite $rlt getinvitationFirm $rlt $status = toString("queryStatusInvitation",$rlt) $evtinvINstatus = onevent [$status] do "call StatusManager" } if [$oninvite] { answerInvitation $trlt BUSY } $oninvite = TRUE } } ifnot [$oncall == 0] { answerInvitation $trlt BUSY } } procedure InviteManager { caseEvent [PLACED] { capplet area dialog ringing } caseEvent [ACCEPTED] { call entercall } caseEvent [REFUSED] { $oninvite = FALSE capplet area dialog refused } caseEvent [TIMEOUT] { $oninvite = FALSE capplet area dialog timeout call markLostCall } caseEvent [DISCONNECTED] { $oninvite = FALSE capplet area dialog timeout call markLostCall } caseEvent [BUSY] { $oninvite = FALSE capplet area dialog busy call markLostCall } caseEvent [ABORT] { capplet area dialog abortcall call markLostCall } caseEvent [FALSE] { } } procedure StatusManager { caseEvent [ABORTED] { $oninvite = FALSE capplet area dialog lostcall } caseEvent [TIMEOUT] { $oninvite = FALSE } caseEvent [DISCONNECTED] { call automarkLostCall capplet area dialog lostcall resetInvitation $rlt $oninvite = FALSE } } # ---------------------------------------------------------- # CALL MANAGEMENT # ---------------------------------------------------------- procedure entercall { clearevent $evtinvOUTstatus if [$oncall == 0] { $callid = $callid + 1 $oncall = $callid $chancall = toUnspacedString($callroot,$oncall) $dev = device=cam1 redefinechannel $chancall type=istant description="private call channel" device=service flags="PRIVATECALL" option=autojoin preprotocol=$defprof billservice streamchannel $chancall $dev source=myself $skipec = TRUE $callstatus = toString("getusers",$chancall) $evtcall = onevent [$callstatus] do "call callmanager" } capplet area entered $oncall cappletuser $usr area dialog entering } procedure joincall { clearevent $evtinvINstatus $skipec = FALSE } procedure hangup { clearevent $evtcall # -- streamchannel $chancall $dev source=none -- f. #streamchannel $chancall unjoin streamchannel $chancall $dev source=none unjoinchannel $chancall $oncall = 0 $oninvite = FALSE if almax [$service_acl] { capplet area offmod } capplet area dialog abortconf } procedure callmanager { ifnot [$skipec] { caseEvent [1] { call hangup } } if [$skipec] { $skipec = FALSE } } # ---------------------------------------------------------- # LOSTCALLS MANAGEMENT # ---------------------------------------------------------- procedure markLostCall { database sql update toUnspacedString("insert into lostcall(reqer,reqerfn,reqed,active,timestamp) VALUES('",; getUserWIDX,"','",; getmyFullName,"','"; $usr,"','TRUE','",; getTimeStamp,"')") cappletchanneluser $callservice $usr missed lostupdate } procedure automarkLostCall { $tval1 = getInvitationOwner $rlt $tval2 = toString(getInvitationOwnerFullName $rlt) database sql update toUnspacedString("insert into lostcall(reqer,reqerfn,reqed,active,timestamp) VALUES('",; $tval1,"','",; $tval2,"','"; getUserWIDX,"','TRUE','",; getTimeStamp,"')") capplet missed lostupdate } procedure getLostCalls { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from lostcall where reqed='",getUserWIDX,"' and active='TRUE'"))) capplet missed lostdata $tval database sql getTableQuery(toUnspacedString("select * from lostcall where reqed='",getUserWIDX,"' and active='TRUE' order by idx DESC")) window [1,10] ; select 4 fields idx,reqer,reqerfn,timestamp } procedure touchLostCall { database sql update toUnspacedString("update lostcall set active='FALSE' where idx='",getCommand(4),"'") call getLostCalls } # ---------------------------------------------------------- # APPLET: FILEMANAGER # ---------------------------------------------------------- procedure Applet.FileMan.Run { caseCommand [APPLET,FILEMAN,OPEN] { capplet fileman show } caseCommand [APPLET,FILEMAN,RESET] { capplet fileman main } caseCommand [APPLET,FILEMAN,GETFOLDER] { call Applet.FileMan.SendFolder } caseCommand [APPLET,FILEMAN,REQUPL] { capplet fileman openfolder } caseCommand [APPLET,FILEMAN,SELECTED] { capplet fileman validate # capplet fileman sendfile } caseCommand [APPLET,FILEMAN,UPLOAD] { capplet fileman sendfile } caseCommand [APPLET,FILEMAN,ERROR] { capplet fileman error } caseCommand [APPLET,FILEMAN,FILERROR] { capplet fileman checkname } caseCommand [APPLET,FILEMAN,STORE] { $fcrsr = 1 database sql update toUnspacedString("insert into filedb(authidx,timestamp,owneridx,filename,valid,hdwid,lictag) VALUES('",; getmyFullName,"','",; getTimeStamp,"','",; getUserWIDX,"','",; getCommand(4),"','TRUE','2','",getLicenseTag,"')") capplet fileman saved # capplet fileman main } caseCommand [APPLET,FILEMAN,PREVIEW] { $tval = stripString(database sql getQuery(toUnspacedString("select filename from filedb where idx='",getCommand(4),"'"))) $tval2 = stripString(database sql getQuery(toUnspacedString("select ftype from filedb where idx='",getCommand(4),"'"))) capplet fileman preview toUnspacedString($dbpath,$tval) $tval $tval2 } caseCommand [APPLET,FILEMAN,INVALID] { database sql update toUnspacedString("update filedb set valid='FALSE' where idx='",getCommand(4),"'") capplet fileman main } caseCommand [APPLET,FILEMAN,SETSCROLL] { $fcrsr = getCommand(4) call Applet.FileMan.SendFolder } caseCommand [APPLET,FILEMAN,MAKETABLE] { capplet fileman tableparam } caseCommand [APPLET,FILEMAN,CREATETABLE] { call Applet.Tables.insert capplets tables reload } caseCommand [APPLET,FILEMAN,GETHDW] { $hdx = 1 call Applet.FileMan.SendHDW } caseCommand [APPLET,FILEMAN,HDWCONTENT] { $fcrsr = 1 $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where hdwid='",getCommand(4),"' and ftype='MODULE0' and valid='TRUE'"))) ifnot [ $tval == 0 ] { if [ $exm == getCommand(4) ] { $tval = 0 } if [ $exm != getCommand(4) ] { $exm = getCommand(4) call Applet.FileMan.joinChannelModule $genid = stripString(database sql getTableQuery(toUnspacedString("select filename from filedb where hdwid='",getCommand(4),"' and ftype='MODULE0' and valid='TRUE' order by idx desc")) window [1,1] select 1 fields 1) capplet fileman xmod toUnspacedString($dbpath,$genid) } } if [ $tval == 0 ] { if [$exm != -1] { $exm = -1 call Applet.FileMan.unjoinChannelModule } call Applet.FileMan.SendContent } } caseCommand [APPLET,FILEMAN,HCSCROLL] { $fcrsr = getCommand(5) call Applet.FileMan.SendContent } caseCommand [APPLET,FILEMAN,RECONTENT] { call Applet.FileMan.SendContent } caseCommand [APPLET,FILEMAN,FLDCANC] { capplet fileman fldcreate } caseCommand [APPLET,FILEMAN,FLDABORT] { capplet fileman undialog } caseCommand [APPLET,FILEMAN,FLDCREATE] { $tval3 = tagside(getCommand(4)) if [ $tval3 == NONE ] { $tval = stat(stripString(database sql getQuery(toUnspacedString("select lic from hdw where idx='",getCommand(4),"'")))) if [ $tval != NONE ] { $tval2 = NONE } if [ $tval == NONE ] { $tval2 = stripString(database sql getQuery(toUnspacedString("select chpath from hdw where idx='",codeside(getCommand(4)),"'"))) } } if [ $tval3 == xF ] { $tval = NONE $tval2 = stripString(database sql getQuery(toUnspacedString("select chanpath from forumdb where fidx='",codeside(getCommand(4)),"'"))) } database sql update toUnspacedString("insert into hdw(_parent,folder,exetype,active,lictag,owner,lic,chpath) VALUES ('",getCommand(4),"','",getCommand(5),"','",getCommand(6),"','TRUE','",getLicenseTag,"','",getUserWIDX,"','",$tval,"','",$tval2,"')") if [$tval == TRUE] { cappletchannel toUnspacedString($domains,getLicenseTag) fileman update } if [$tval == FALSE] { capplet fileman renode } if [$tval == NONE] { cappletchannel $tval2 fileman update $tval2 } } caseCommand [APPLET,FILEMAN,DOWNLOAD] { $tval = stripString(database sql getQuery(toUnspacedString("select filename from filedb where idx='",getCommand(4),"'"))) capplet fileman download toUnspacedString($dbpath,$tval) } caseCommand [APPLET,FILEMAN,RUN] { $ftr = getCommand(4) $tval = getCommand(5) call Applet.FileMan.Exec } caseCommand [APPLET,FILEMAN,FMDHIDE] { dn videomem stop 0 fmcam capplet fileman fmdhide } caseCommand [APPLET,FILEMAN,CANUP] { capplet fileman mayupl } caseCommand [APPLET,FILEMAN,FILERROR] { capplet fileman uperror getCommand(4) } caseCommand [APPLET,FILEMAN,FILEOK] { capplet fileman fileget toUnspacedString("mwfo8",getoid,getTimeStamp,"-",getCommand(4)) } caseCommand [APPLET,FILEMAN,FILESUBST] { $tval1 = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where idx='",getCommand(5),"' and (filename~*'",getCommand(6),"' or filetitle='",getCommand(4),"')"))) ifnot [$tval1 == 0] { capplet fileman filesubst stripString(database sql getQuery(toUnspacedString("select filename from filedb where idx='",getCommand(5),"'"))) } if [$tval1 == 0] { capplet fileman badsubst } } caseCommand [APPLET,FILEMAN,FILEIN] { database sql update toUnspacedString("insert into filedb(authidx,timestamp,owneridx,filename,valid,hdwid,lictag,filetitle,ftype,shareflag) VALUES('",; getmyFullName,"','",; getTimeStamp,"','",; getUserWIDX,"','",; getCommand(5),"','TRUE','",getCommand(4),"','",getLicenseTag,"','",getCommand(6),"','",getCommand(7),"','FALSE')") $tval = stat(stripString(database sql getQuery(toUnspacedString("select lic from hdw where idx='",getCommand(4),"'")))) if [$tval == TRUE] { cappletchannel toUnspacedString($domains,getLicenseTag) fileman updatecont } if [$tval == FALSE] { capplet fileman recontent } if [$tval == NONE] { $tval1 = tagside(getCommand(4)) if [$tval1 == NONE] { $tval3 = stripString(database sql getQuery(toUnspacedString("select chpath from hdw where idx='",getCommand(4),"'"))) } if [$tval1 == xF] { $tval3 = stripString(database sql getQuery(toUnspacedString("select chanpath from forumdb where fidx='",codeside(getCommand(4)),"'"))) } cappletchannel $tval3 fileman updatecont $tval3 } } caseCommand [APPLET,FILEMAN,FILEUPD] { database sql update toUnspacedString("update fsharetab set lastupd='",getTimeStamp,"', upltms=upltms+1 where fileidx='",getCommand(4),"'") capplet fileman recontent } caseCommand [APPLET,FILEMAN,CANMOD] { $tval2 = stat(stripString(database sql getQuery(toUnspacedString("select owner from hdw where idx='",getCommand(4),"'")))) if [$tval2 == getUserWIDX] { capplet fileman domod } if [$tval2 != getUserWIDX] { capplet fileman denied } } caseCommand [APPLET,FILEMAN,FLDMOD] { database sql update toUnspacedString("update hdw set folder='",getCommand(5),"' where idx='",getCommand(4),"'") $tval = stat(stripString(database sql getQuery(toUnspacedString("select lic from hdw where idx='",getCommand(4),"'")))) if [$tval == TRUE] { cappletchannel toUnspacedString($domains,getLicenseTag) fileman update } if [$tval == FALSE] { capplet fileman renode } if [$tval == NONE] { $tval3 = stripString(database sql getQuery(toUnspacedString("select chpath from hdw where idx='",getCommand(4),"'"))) cappletchannel $tval3 fileman update $tval3 } } caseCommand [APPLET,FILEMAN,FLDELETE] { $tval1 = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where hdwid='",getCommand(4),"' and valid='TRUE'"))) if [$tval1 == 0] { $tval2 = stripString(database sql getQuery(toUnspacedString("select owner from hdw where idx='",getCommand(4),"'"))) if [$tval2 == getUserWIDX] { database sql update toUnspacedString("update hdw set active='FALSE' where idx='",getCommand(4),"'") $tval = stat(stripString(database sql getQuery(toUnspacedString("select lic from hdw where idx='",getCommand(4),"'")))) if [$tval == TRUE] { cappletchannel toUnspacedString($domains,getLicenseTag) fileman update } if [$tval == FALSE] { capplet fileman renode } if [$tval == NONE] { $tval3 = stripString(database sql getQuery(toUnspacedString("select chpath from hdw where idx='",getCommand(4),"'"))) cappletchannel $tval3 fileman update $tval3 } } ifnot [$tval2 == getUserWIDX] { capplet fileman denied } } ifnot [$tval1 == 0] { capplet fileman notempty } } caseCommand [APPLET,FILEMAN,FILEDEL] { $tval2 = stripString(database sql getQuery(toUnspacedString("select owneridx from filedb where idx='",getCommand(5),"'"))) if [$tval2 == getUserWIDX] { database sql update toUnspacedString("update filedb set valid='FALSE' where idx='",getCommand(5),"'") $tval = stat(stripString(database sql getQuery(toUnspacedString("select lic from hdw where idx='",getCommand(4),"'")))) if [$tval == TRUE] { cappletchannel toUnspacedString($domains,getLicenseTag) fileman updatecont } if [$tval == FALSE] { capplet fileman recontent } if [$tval == NONE] { $tval1 = tagside(getCommand(4)) if [$tval1 == NONE] { $tval3 = stripString(database sql getQuery(toUnspacedString("select chpath from hdw where idx='",getCommand(4),"'"))) } if [$tval1 == xF] { $tval3 = stripString(database sql getQuery(toUnspacedString("select chanpath from forumdb where fidx='",codeside(getCommand(4)),"'"))) } cappletchannel $tval3 fileman updatecont $tval3 } } ifnot [$tval2 == getUserWIDX] { capplet fileman denied } } caseCommand [APPLET,FILEMAN,COPEN] { ifnot [$oncall == 0] { $ftr = getCommand(4) $tval = TRUE call Applet.FileMan.Exec } # $tval = stripString(database sql getQuery(toUnspacedString("select filename from filedb where idx='",getCommand(4),"'"))) # ifnot [$oncall == 0] # cappletchannel $chancall fileman confopen toUnspacedString($dbpath,$tval) # if [$oncall == 0] { capplet area dialog NOTINCALLGN } } caseCommand [APPLET,FILEMAN,CCLOSE] { ifnot [$oncall == 0] { # cappletchannel $chancall fileman confclose #dn videomem stop 0 fmcam send channel=$chancall @videomem stop 0 fmcam cappletchannel $chancall fileman fmdhide } if [$oncall == 0] { capplet area dialog NOTINCALLGN } } caseCommand [APPLET,FILEMAN,NAAP] { if getCommand(4) { setDepartment(naap) } ifnot getCommand(4) { unsetDepartment(naap) } capplet fileman naap getCommand(4) } caseCommand [APPLET,FILEMAN,HDXSCROLL] { $hdx = getCommand(5) call Applet.FileMan.SendHDW } caseCommand [APPLET,FILEMAN,SUBSTCHK] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from fsharetab where fileidx='",getCommand(4),"' and othu='",getUserWIDX,"' and active='TRUE'"))) ifnot [$tval == 0] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where idx='",getCommand(4),"' and shareflag='TRUE'"))) } if [$tval == 0] { capplet fileman dnysubst } ifnot [$tval == 0] { capplet fileman dosubst } } caseCommand [APPLET,FILEMAN,PLAYNEXT] { $tval = stripString(database sql getQuery(toUnspacedString("select hdwid from filedb where idx='",getCommand(4),"'"))) $tval = stripString(database sql getTableQuery(toUnspacedString("select idx from filedb where hdwid='",$tval,"' and valid='TRUE' and ftype='",getCommand(5),"' and idx<",getCommand(4)," order by idx desc")) window [1,1] select 1 fields 1) capplet fileman runnext $tval } caseCommand [APPLET,FILEMAN,PLAYFIRST] { $tval = stripString(database sql getQuery(toUnspacedString("select hdwid from filedb where idx='",getCommand(4),"'"))) $tval = stripString(database sql getTableQuery(toUnspacedString("select idx from filedb where hdwid='",$tval,"' and valid='TRUE' and ftype='",getCommand(5),"' order by idx desc")) window [1,1] select 1 fields 1) capplet fileman runnext $tval } caseCommand [APPLET,FILEMAN,GETVIDEO] { dn videomem replay getCommand(4) fmcam capplet fileman ok } caseCommand [APPLET,FILEMAN,MODCHAN] { call Applet.FileMan.sendtoChannelModule } } procedure Applet.FileMan.SendFolder { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where valid='TRUE' and owneridx='",getUserWIDX,"'"))) capplet fileman folder $fcrsr $tval database sql getTableQuery(toUnspacedString("select * from filedb where valid='TRUE' and owneridx='",getUserWIDX,"' order by idx DESC")) window [$fcrsr,13] ; select 5 fields idx,filetitle,authidx,timestamp,shareflag } procedure Applet.FileMan.SendHDW { $tval3 = tagside(getCommand(4)) if [ $tval3 == NONE ] { call Applet.FileMan.SendHDW.level0 } if [ $tval3 == xF ] { call Applet.FileMan.SendHDW.forum1 } } procedure Applet.FileMan.SendHDW.level0 { $et = stripString(database sql getQuery(toUnspacedString("select exetype from hdw where idx='",getCommand(4),"'"))) $et = stat($et) if [$et == root] { call Applet.FileMan.SendHDW.general } if [$et == image] { call Applet.FileMan.SendHDW.general } if [$et == file] { call Applet.FileMan.SendHDW.general } if [$et == album] { # code } if [$et == film] { # code } if [$et == forum] { call Applet.FileMan.SendHDW.forum0 } } if [ xF == tagside(getCommand(4)) ] { call Applet.FileMan.SendHDW.forum1 } } procedure Applet.FileMan.SendHDW.general { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from hdw where (active='*' or (active='TRUE' and owner='",getUserWIDX,"' and lic='FALSE') or (active='TRUE' and lictag='",getLicenseTag,"' and lic='TRUE') or (active='TRUE' and lic='NONE')) and (idx='",getCommand(4),"' or _parent='",getCommand(4),"')"))) capplet fileman struct haveDepartment(naap) $hdx $tval database sql getTableQuery(toUnspacedString("select (select count(*) from hdw where _parent=tbl.idx and active='TRUE' and ((owner='",getUserWIDX,"' and lic='FALSE') or (lictag='",getLicenseTag,"' and lic='TRUE') or (lic='NONE'))),* from hdw as tbl where (active='*' or (active='TRUE' and owner='",getUserWIDX,"' and lic='FALSE') or (active='TRUE' and lictag='",getLicenseTag,"' and lic='TRUE') or (active='TRUE' and lic='NONE')) and (idx='",getCommand(4),"' or _parent='",getCommand(4),"') order by sord asc,idx asc")) window [$hdx,16] ; select 7 fields 1,idx,_parent,folder,exetype,owner,lic } procedure Applet.FileMan.SendHDW.forum0 { # forums parent folder sord is 4! $tval1 = stripstring(database sql getQuery(toUnspacedString("select idx from hdw where sord='4'"))) # $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from hdw where active!='FALSE' and _parent='",$tval1,"' and chpath='",getCommand(4),"'"))) $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from forumdb where (fidx in (select fidx from forumsubs where gidx='",$mygid,"' or uidx='",getUserWIDX,"') or lictag='*') and active='TRUE'"))) $tval2 = toString(database sql getTableQuery(toUnspacedString("select '0','0',* from hdw where idx='",$tval1,"'")) window [1,1] ; select 7 fields 1,idx,2,folder,exetype,owner,lic) capplet fileman struct haveDepartment(nnap) $hdx 1 + $tval stripString($tval2) database sql getTableQuery(toUnspacedString("select (select count(*) from hdw where _parent='F$' || text(tbl.fidx) and active!='FALSE'),'",$tval1,"','forum',* from forumdb as tbl where (fidx in (select fidx from forumsubs where gidx='",$mygid,"' or uidx='",getUserWIDX,"') or lictag='*') and active='TRUE' order by ford asc")) window [$hdx,15] ; select 7 fields 1,fidx,2,tagname,3,lictag,chanpath } procedure Applet.FileMan.SendHDW.forum1 { $tval1 = stripstring(database sql getQuery(toUnspacedString("select idx from hdw where sord='4'"))) $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from hdw where active='TRUE' and lic='NONE' and _parent='",getCommand(4),"'"))) $tval2 = toString(database sql getTableQuery(toUnspacedString("select '0','",$tval1,"','forum',* from forumdb where fidx='",codeside(getCommand(4)),"'")) window [1,1] ; select 7 fields 1,fidx,2,tagname,3,lictag,chanpath) capplet fileman struct haveDepartment(naap) $hdx 1 + $tval stripString($tval2) database sql getTableQuery(toUnspacedString("select (select count(*) from hdw where _parent=tbl.idx and active='TRUE' and lic='NONE'),* from hdw as tbl where active='TRUE' and lic='NONE' and _parent='",getCommand(4),"' order by sord asc, idx asc")) window [$hdx,16] ; select 7 fields 1,idx,_parent,folder,exetype,owner,lic } procedure Applet.FileMan.SendContent { $et = stripString(database sql getQuery(toUnspacedString("select exetype from hdw where idx='",getCommand(4),"'"))) $et = stat($et) if [$et == root] { capplet fileman folder root $fcrsr 0 } if [$et == image] { call Applet.FileMan.SendContent.general } if [$et == file] { call Applet.FileMan.SendContent.general } if [$et == album] { # code } if [$et == film] { # code } if [$et == forum] { call Applet.FileMan.SendContent.general } if [$et == shares] { call Applet.FileMan.SendContent.sharetab } if [$et == NONE ] { call Applet.FileMan.SendContent.general } } procedure Applet.FileMan.SendContent.general { $tval2 = stat(stripString(database sql getQuery(toUnspacedString("select lic from hdw where idx='",getCommand(4),"'")))) $sel = stat(stripString(database sql getQuery(toUnspacedString("select active from hdw where idx='",getCommand(4),"'")))) if [$sel != *] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where valid='TRUE' and hdwid='",getCommand(4),"'"))) capplet fileman folder $et $fcrsr $tval database sql getTableQuery(toUnspacedString("select * from filedb where valid='TRUE' and hdwid='",getCommand(4),"' order by idx desc")) window [$fcrsr,16] ; select 5 fields idx,filetitle,owneridx,timestamp,shareflag } if [$sel == *] { if [$tval2 != TRUE] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where valid='TRUE' and hdwid='",getCommand(4),"' and owneridx='",getUserWIDX,"'"))) capplet fileman folder $et $fcrsr $tval database sql getTableQuery(toUnspacedString("select * from filedb where valid='TRUE' and hdwid='",getCommand(4),"' and owneridx='",getUserWIDX,"' order by idx desc")) window [$fcrsr,16] ; select 5 fields idx,filetitle,owneridx,timestamp,shareflag } if [$tval2 == TRUE] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from filedb where valid='TRUE' and hdwid='",getCommand(4),"' and lictag='",getLicenseTag,"'"))) capplet fileman folder $et $fcrsr $tval database sql getTableQuery(toUnspacedString("select * from filedb where valid='TRUE' and hdwid='",getCommand(4),"' and lictag='",getLicenseTag,"' order by idx desc")) window [$fcrsr,16] ; select 5 fields idx,filetitle,owneridx,timestamp,shareflag } } } procedure Applet.FileMan.SendContent.sharetab { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from fsharetab where othu='",getUserWIDX,"' and active='TRUE'"))) capplet fileman folder shares $fcrsr $tval database sql getTableQuery(toUnspacedString("select (select filetitle from filedb where idx=st.fileidx),'TRUE',* from fsharetab as st where othu='",getUserWIDX,"' and active='TRUE' order by idx desc")) window [$fcrsr,16] ; select 5 fields fileidx,1,owner,lastupd,2 } procedure Applet.FileMan.Exec { if [$tval == TRUE] { $tval1 = $oncall } if [$tval == FALSE] { $tval1 = 0 } $tval2 = stripString(database sql getQuery(toUnspacedString("select ftype from filedb where idx='",$ftr,"'"))) $tval3 = stripString(database sql getQuery(toUnspacedString("select filetitle from filedb where idx='",$ftr,"'"))) $genid = stripString(database sql getQuery(toUnspacedString("select filename from filedb where idx='",$ftr,"'"))) $tval = toUnspacedString($dbpath,$genid) if [$tval2 == FILE] { if [$tval1 == 0] { capplet fileman download $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman download $tval $tval3 } } if [$tval2 == TEXT] { if [$tval1 == 0] { capplet fileman download $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman download $tval $tval3 } } if [$tval2 == MODULE0] { $exm = stripString(database sql getQuery(toUnspacedString("select hdwid from filedb where idx='",$ftr,"'"))) call Applet.FileMan.joinChannelModule if [$tval1 == 0] { capplet fileman xmod $tval } ifnot [$tval1 == 0] { cappletchannel $chancall fileman xmod $tval } } if [$tval2 == MODULE] { if [$tval1 == 0] { capplet fileman lmod $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman lmod $tval $tval3 } } if [$tval2 == PLUGIN] { if [$tval1 == 0] { capplet fileman plugin $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman plugin $tval $tval3 } } if [$tval2 == MP3] { if [$tval1 == 0] { capplet fileman play mp3 $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman play mp3 $tval $tval3 } } if [$tval2 == FLV] { if [$tval1 == 0] { capplet fileman play flv $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman play flv $tval $tval3 } } if [$tval2 == WVO] { if [$tval1 == 0] { capplet fileman play wvo $genid $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman play wvo $genid $tval3 } } if [$tval2 == JPG] { if [$tval1 == 0] { capplet fileman show $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman show $tval $tval3 } } if [$tval2 == SWF] { if [$tval1 == 0] { capplet fileman show $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman show $tval $tval3 } } if [$tval2 == APPLET] { if [$tval1 == 0] { capplet fileman rexec $tval $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall fileman rexec $tval $tval3 } } if [$tval2 == WSWF0] { if [$tval1 == 0] { capplet progman wcp0 $tval $tval3 0 } ifnot [$tval1 == 0] { cappletchannel $chancall progman wcp0 $tval $tval3 getoid } } if [$tval2 == WSWF1] { if [$tval1 == 0] { capplet progman wcp1 $tval $tval3 0 } ifnot [$tval1 == 0] { cappletchannel $chancall progman wcp1 $tval $tval3 getoid } } if [$tval2 == WSWF2] { if [$tval1 == 0] { capplet progman wcp2 $tval $tval3 0 } ifnot [$tval1 == 0] { cappletchannel $chancall progman wcp2 $tval $tval3 getoid } } if [$tval2 == FILM] { if [$tval1 == 0] { capplet progman cinema $genid $tval3 } ifnot [$tval1 == 0] { cappletchannel $chancall progman cinema $genid $tval3 getoid # was: -1 } } if [$tval2 == URL] { if [$tval1 == 0] { capplet progman view toUnspacedString($genid) } ifnot [$tval1 == 0] { cappletchannel $chancall progman view toUnspacedString($genid) } } } procedure Applet.FileMan.joinChannelModule { $modchan = toUnspacedString($mchnroot,$exm) definechannel $modchan option=autojoin } procedure Applet.FileMan.unjoinChannelModule { unjoinchannel $modchan } procedure Applet.FileMan.sendtoChannelModule { cappletchannel $modchan getCommand(4) getCommand(5) getCommand(6) } # ---------------------------------------------------------- # APPLET: TABLES # ---------------------------------------------------------- procedure Applet.Tables.Run { caseCommand [APPLET,TABLES,OPEN] { capplet tables show } caseCommand [APPLET,TABLES,NEWTAB] { capplet tables doup } caseCommand [APPLET,TABLES,FILERROR] { capplet tables uperror getCommand(4) } caseCommand [APPLET,TABLES,FILEOK] { capplet tables fileget toUnspacedString("mwfo8",getoid,getTimeStamp,"-",getCommand(4)) } caseCommand [APPLET,TABLES,CREATE] { $fcrsr = 1 $tcrsr = 1 $tval = stripString(database sql getQuery(toUnspacedString("insert into filedb(authidx,timestamp,owneridx,filename,valid,hdwid,lictag,filetitle,ftype,shareflag) VALUES('",; getmyFullName,"','",; getTimeStamp,"','",; getUserWIDX,"','",; getCommand(4),"','TRUE','2','",getLicenseTag,"','",getCommand(6),"','FILE','FALSE') ; select currval('filedb_pkey_id')"))) $tval = stripString(database sql getQuery(toUnspacedString("insert into tabledb(authidx,owneridx,timestamp,lictag,title,fileidx,valid,pub_auth,state) VALUES('",; getmyFullName,"','",; getUserWIDX,"','",; getTimeStamp,"','",; getLicenseTag,"','",; getCommand(5),"','",; $tval,"','TRUE','NONE','NONE') ; select currval('tabledb_pkey_id')"))) capplet tables creatd $tval } caseCommand [APPLET,TABLES,GETFOLDER] { $tcrsr = 1 $tableopt = getCommand(4) $tabsr = getCommand(5) call Applet.Tables.SendTables } caseCommand [APPLET,TABLES,SETSCROLL] { $tcrsr = getCommand(4) call Applet.Tables.SendTables } caseCommand [APPLET,TABLES,OPENCONF] { $tval1 = stripString(database sql getQuery(toUnspacedString("select fileidx from tabledb where idx='",getCommand(5),"'"))) # $tval = stripString(database sql getQuery(toUnspacedString("select fdb.filename from filedb as fdb, tabledb as tdb where tdb.idx='",getCommand(5),"' and fdb.idx=tdb.fileidx"))) $tval = stripString(database sql getQuery(toUnspacedString("select filename from filedb where idx='",$tval1,"'"))) $tval2 = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where idx='",getCommand(5),"' and (dest_midx='",getUserWIDX,"' or dest_auth='",getUserAuth,"')"))) if [$oncall == 0] { capplet tables edit $tval1 $tval2 $cdescr getCommand(4) getmyFullName getCommand(5) toUnspacedString($dbpath,$tval) stripString(database sql getQuery(toUnspacedString("select state from tabledb where idx='",getCommand(5),"'"))) $tabxtra stripString(database sql getQuery(toUnspacedString("select xtra from tabledb where idx='",getCommand(5),"'"))) } ifnot [$oncall == 0] { send channel=$chancall SEQ SYS APPLET tables edit $tval1 $tval2 $cdescr getCommand(4) getmyFullName getCommand(5) toUnspacedString($dbpath,$tval) stripString(database sql getQuery(toUnspacedString("select state from tabledb where idx='",getCommand(5),"'"))) $tabxtra stripString(database sql getQuery(toUnspacedString("select xtra from tabledb where idx='",getCommand(5),"'"))) } } caseCommand [APPLET,TABLES,CLOSECONF] { if [$oncall == 0] { capplet tables reset } ifnot [$oncall == 0] { send channel=$chancall seq SYS APPLET tables reset } } caseCommand [APPLET,TABLES,ACTION] { if [$oncall == 0] { capplet tables action getCommand(4) getCommand(5) getCommand(6) getCommand(7) } ifnot [$oncall == 0] { send channel=$chancall seq SYS APPLET tables action getCommand(4) getCommand(5) getCommand(6) getCommand(7) } } caseCommand [APPLET,TABLES,NOTEADD] { capplet tables asktitle } caseCommand [APPLET,TABLES,ABORTNOTE] { if [$oncall == 0] { capplet tables quititle } ifnot [$oncall == 0] { send channel=$chancall seq SYS APPLET tables quititle } } caseCommand [APPLET,TABLES,ADDTHIS] { call Applet.Tables.AddNote } caseCommand [APPLET,TABLES,GETNOTES] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where idx='",getCommand(4),"' and (dest_midx='",getUserWIDX,"' or dest_auth='",getUserAuth,"')"))) # capplet tables isown $tval call Applet.Tables.SendNotes } caseCommand [APPLET,TABLES,DETAIL] { call Applet.Tables.ShowDetail } caseCommand [APPLET,TABLES,TOUCH] { call Applet.Tables.ShowNoDetail } caseCommand [APPLET,TABLES,CANMODNOTE] { capplet tables modnote } caseCommand [APPLET,TABLES,UNMODNOTE] { capplet tables unmodnote } caseCommand [APPLET,TABLES,MODNOTE] { database sql update toUnspacedString("update tablenotes set title='",getCommand(6),"', descr='",getCommand(7),"' where idx='",getCommand(5),"'") call Applet.Tables.SendNotes } caseCommand [APPLET,TABLES,CANDELNOTE] { capplet tables moddel } caseCommand [APPLET,TABLES,DELNOTE] { database sql update toUnspacedString("delete from tablenotes where idx='",getCommand(5),"'") call Applet.Tables.SendNotes } caseCommand [APPLET,TABLES,EVADD] { capplet tables addev } caseCommand [APPLET,TABLES,ADDEV] { if [$oncall == 0] { capplet tables insertev getCommand(4) getCommand(5) getCommand(6) getCommand(7) } ifnot [$oncall == 0] { send channel=$chancall seq SYS APPLET tables insertev getCommand(4) getCommand(5) getCommand(6) getCommand(7) } } caseCommand [APPLET,TABLES,TABOPT] { capplet tables openopt database sql getTableQuery(toUnspacedString("select * from tabledb where idx='",getCommand(4),"'")) window [1,1] ; select 5 fields idx,title,owneridx,authidx,appd } caseCommand [APPLET,TABLES,UNOPT] { capplet tables closeopt } caseCommand [APPLET,TABLES,SETPUB] { if getDepartment(tablepub) { database sql update toUnspacedString("update tabledb set pub_auth='",getUserAuth,"' where idx='",getCommand(4),"'") capplets tables reload } ifnot getDepartment(tablepub) { capplet area dialog DENIED } } caseCommand [APPLET,TABLES,UNSETPUB] { if getDepartment(tablepub) { database sql update toUnspacedString("update tabledb set pub_auth='NONE' where idx='",getCommand(4),"'") capplets tables reload } ifnot getDepartment(tablepub) { capplet area dialog DENIED } } caseCommand [APPLET,TABLES,CANDEL] { capplet tables delpg } caseCommand [APPLET,TABLES,DELETE] { database sql update toUnspacedString("update tabledb set VALID='FALSE' where idx='",getCommand(4),"'") capplets tables reload } caseCommand [APPLET,TABLES,CERTINFO] { capplet tables certinfo database sql getTableQuery(toUnspacedString("select * from approvaldb where aidx='",getCommand(4),"'")) window [1,1] ; select 5 fields aidx,tableidx,last_ts,mreqer,state } caseCommand [APPLET,TABLES,CANRESET] { capplet tables resetpg } caseCommand [APPLET,TABLES,CERTRESET] { database sql update toUnspacedString("update approvaldb set used='FALSE', state='ABORTED', lastown_midx='",getUserWIDX,"', lastown_firm='",getmyFullName,"', last_ts='",getTimeStamp,"' where aidx='",getCommand(4),"'") database sql update toUnspacedString("update tabledb set state='NONE', mitt_midx='NONE', mitt_firm='NONE', dest_midx='NONE', dest_firm='NONE', dest_auth='NONE', appd='0' where idx='",getCommand(5),"'") database sql update toUnspacedString("update tablenotes set approvation_ts='NONE', approvation_midx='NONE', approvation_firm='NONE', approvation_state='NONE', approvation_ip='NONE' where tableidx='",getCommand(5),"'") capplets tables reload } caseCommand [APPLET,TABLES,PRINT] { if getDepartment(tableprint) { $ntid = getCommand(4) $tval = getTimeStamp $tval1 = stripString(database sql getQuery(toUnspacedString("select state from tabledb where idx='",$ntid,"'"))) $tval2 = stripString(database sql getQuery(toUnspacedString("select appd from tabledb where idx='",$ntid,"'"))) database sql update toUnspacedString("insert into prntrace(lictag,module,report,reqer,timestamp,objid) VALUES('",; getLicenseTag,"','TABLES','TABLEPRINT','",; getUserWIDX,"','",; $tval,"','",; $ntid,"')") capplet utilities loadmod reporter toUnspacedString("tableprint",$tabxtra) } ifnot getDepartment(tableprint) { capplet area dialog DENIED } } caseCommand [APPLET,TABLES,XTRA,MOD] { capplet tables xtra mod } caseCommand [APPLET,TABLES,XTRA,SAV] { database sql update toUnspacedString("update tabledb set xtra='",getCommand(6),"' where idx='",getCommand(5),"'") if [$oncall == 0] { capplet tables xtra savd getCommand(6) } ifnot [$oncall == 0] { send channel=$chancall SEQ SYS APPLET tables xtra savd getCommand(6) } } } procedure Applet.Tables.insert { $tcrsr = 1 database sql update toUnspacedString("insert into tabledb(authidx,owneridx,timestamp,lictag,title,fileidx,valid,pub_auth,state) VALUES('",; getmyFullName,"','",; getUserWIDX,"','",; getTimeStamp,"','",; getLicenseTag,"','",; getCommand(5),"','",; getCommand(4),"','TRUE','NONE','NONE')") } procedure Applet.Tables.SendTables { if [$tableopt == 1] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where valid='TRUE' and pub_auth='NONE' and owneridx='",getUserWIDX,"'",$tabsr))) capplet tables folder $tcrsr $tval database sql getTableQuery(toUnspacedString("select * from tabledb where valid='TRUE' and pub_auth='NONE' and owneridx='",getUserWIDX,"'",$tabsr," order by idx DESC")) window [$tcrsr,13] ; select 7 fields idx,owneridx,authidx,title,timestamp,state,pub_auth } if [$tableopt == 2] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where valid='TRUE' and pub_auth='",getUserAuth,"'",$tabsr))) capplet tables folder $tcrsr $tval database sql getTableQuery(toUnspacedString("select * from tabledb where valid='TRUE' and pub_auth='",getUserAuth,"'",$tabsr," order by idx DESC")) window [$tcrsr,13] ; select 6 fields idx,owneridx,authidx,title,timestamp,state } if [$tableopt == 3] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where valid='TRUE' and state!='NONE'",$tabsr," and (dest_auth='",getUserAuth,"' or dest_midx='",getUserWIDX,"')"))) capplet tables folder $tcrsr $tval database sql getTableQuery(toUnspacedString("select * from tabledb where valid='TRUE' and state!='NONE'",$tabsr," and (dest_auth='",getUserAuth,"' or dest_midx='",getUserWIDX,"') order by idx DESC")) window [$tcrsr,13] ; select 6 fields idx,mitt_midx,mitt_firm,title,appd,state } if [$tableopt == 4] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where valid='TRUE' and state!='NONE'",$tabsr," and (mitt_midx='",getUserWIDX,"' or pub_auth='",getUserAuth,"')"))) capplet tables folder $tcrsr $tval database sql getTableQuery(toUnspacedString("select * from tabledb where valid='TRUE' and state!='NONE'",$tabsr," and (mitt_midx='",getUserWIDX,"' or pub_auth='",getUserAuth,"') order by idx DESC")) window [$tcrsr,13] ; select 7 fields idx,dest_midx,dest_firm,title,appd,state,dest_auth } if [$tableopt == 5] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where valid='TRUE' and lictag='",getLicenseTag,"'",$tabsr))) capplet tables folder $tcrsr $tval database sql getTableQuery(toUnspacedString("select * from tabledb where valid='TRUE' and lictag='",getLicenseTag,"'",$tabsr," order by idx DESC")) window [$tcrsr,13] ; select 6 fields idx,owneridx,authidx,title,timestamp,state } } procedure Applet.Tables.AddNote { database sql update toUnspacedString("insert into tablenotes(tableidx,title,creation_ts,creation_midx,creation_firm,posx,posy,lenx,leny,startx,starty,startzm,descr) VALUES('",; getCommand(4),"','",; getCommand(5),"','",; getTimeStamp,"','",; getUserWIDX,"','",; getmyFullName,"','",; getCommand(6),"','",; getCommand(7),"','",; getCommand(8),"','",; getCommand(9),"','",; getCommand(10),"','",; getCommand(11),"','",; getCommand(12),"','",; getCommand(13),"')") call Applet.Tables.SendNotes } procedure Applet.Tables.SendNotes { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tablenotes where tableidx='",getCommand(4),"'"))) if [$oncall == 0] { capplet tables notesdb $tval database sql getTableQuery(toUnspacedString("select * from tablenotes where tableidx='",getCommand(4),"' order by idx ASC")) window [1,99] ; select 6 fields idx,title,posx,posy,lenx,leny } ifnot [$oncall == 0] { send channel=$chancall SEQ SYS APPLET tables notesdb $tval database sql getTableQuery(toUnspacedString("select * from tablenotes where tableidx='",getCommand(4),"' order by idx ASC")) window [1,99] ; select 6 fields idx,title,posx,posy,lenx,leny } } procedure Applet.Tables.ShowDetail { if [$oncall == 0] { capplet tables action xpos getCommand(4) database sql getTableQuery(toUnspacedString("select * from tablenotes where idx='",getCommand(4),"'")) window [1,1]; select 5 fields startx,starty,startzm,descr,approvation_state } ifnot [$oncall == 0] { send channel=$chancall SEQ SYS APPLET tables action xpos getCommand(4) database sql getTableQuery(toUnspacedString("select * from tablenotes where idx='",getCommand(4),"'")) window [1,1]; select 5 fields startx,starty,startzm,descr,approvation_state } } procedure Applet.Tables.ShowNoDetail { if [$oncall == 0] { capplet tables action touchnote getCommand(4) database sql getTableQuery(toUnspacedString("select * from tablenotes where idx='",getCommand(4),"'")) window [1,1]; select 3 fields startx,starty,startzm } ifnot [$oncall == 0] { send channel=$chancall SEQ SYS APPLET tables action touchnote getCommand(4) database sql getTableQuery(toUnspacedString("select * from tablenotes where idx='",getCommand(4),"'")) window [1,1]; select 3 fields startx,starty,startzm } } # ---------------------------------------------------------- # APPLET: NOTESMAN # ---------------------------------------------------------- procedure Applet.NotesMan.Run { caseCommand [APPLET,NTMAN,SHOWINFO] { $ntid = getCommand(4) call Applet.NotesMan.SendInfo } caseCommand [APPLET,NTMAN,ENNOTE] { $ntid = getCommand(4) $appd = stripString(database sql getQuery(toUnspacedString("insert into approvaldb(tableidx,used,mreqer,state) VALUES('",$ntid,"','FALSE','",getUserWIDX,"','NONE') ; select currval('approvaldb_pkey_id')"))) capplet ntman ennote $appd } caseCommand [APPLET,NTMAN,PROMOTE] { database sql update toUnspacedString("update approvaldb set used='TRUE', state='INUSE' where aidx='",$appd,"'") $tval1 = getCommand(4) $tval2 = getCommand(5) ifnot [$tval1 == NONE] { $tval = database wsysdb getUserName $tval1 database sql update toUnspacedString("update tabledb set appd='",$appd,"', state='REQD', mitt_midx='",getUserWIDX,"', mitt_firm='",getmyFullName,"', dest_firm='",$tval,"', dest_midx='",$tval1,"', dest_auth='NONE' where idx='",$ntid,"'") } if [$tval1 == NONE] { $tval = getAuthName $tval2 database sql update toUnspacedString("update tabledb set appd='",$appd,"', state='REQD', mitt_midx='",getUserWIDX,"', mitt_firm='",getmyFullName,"', dest_firm='",$tval,"', dest_midx='NONE', dest_auth='",$tval2,"' where idx='",$ntid,"'") } database sql update toUnspacedString("update tablenotes set approvation_state='REQD', approvation_ts='",getTimeStamp,"' where tableidx='",$ntid,"'") capplets tables reload call Applet.NotesMan.SendInfo } caseCommand [APPLET,NTMAN,HIDETAB] { capplet ntman close } caseCommand [APPLET,NTMAN,GETLIST] { $nt_pos = getCommand(4) call Applet.NotesMan.SendList } caseCommand [APPLET,NTMAN,GETRUBRICA] { $rubrica_pos = getCommand(4) $rubrica_search = getCommand(5) call Applet.NotesMan.SendRubrica } caseCommand [APPLET,NTMAN,GETAUTH] { capplet ntman auths authdb tree 0 9 0 _self getCommand(4) } caseCommand [APPLET,NTMAN,VOTE] { call Applet.NotesMan.ManageVote } } procedure Applet.NotesMan.SendInfo { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tabledb where idx='",$ntid,"' and (dest_midx='",getUserWIDX,"' or dest_auth='",getUserAuth,"')"))) capplet ntman openinfo $tval database sql getTableQuery(toUnspacedString("select * from tabledb where idx='",$ntid,"'")) window [1,1] ; select 6 fields mitt_midx,mitt_firm,dest_midx,dest_firm,dest_auth,appd } procedure Applet.NotesMan.SendRubrica { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from rubricadb where owidx='",getUserWIDX,"' ",$rubrica_search))) capplet ntman rubrica $rubrica_pos $tval database sql getTableQuery(toUnspacedString("select * from rubricadb where owidx='",getUserWIDX,"' ",$rubrica_search," order by idx DESC")) window [1,9] ; select 3 fields idx,cwidx,cname } procedure Applet.NotesMan.SendList { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tablenotes where tableidx='",$ntid,"'"))) capplet ntman list $nt_pos $tval database sql getTableQuery(toUnspacedString("select * from tablenotes where tableidx='",$ntid,"' order by idx ASC")) window [$nt_pos,12] ; select 5 fields idx,title,approvation_state,approvation_midx,approvation_ts } procedure Applet.NotesMan.ManageVote { $tval2 = getTimeStamp database sql update toUnspacedString("update tablenotes set approvation_state='",getCommand(5),"', approvation_midx='",getUserWIDX,"', approvation_firm='",getmyFullName,"', approvation_ts='",$tval2,"', approvation_ip='",client info getMyHost,"' where idx='",getCommand(4),"'") $ntid = getCommand(6) if [APRD == getCommand(5)] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tablenotes where tableidx='",$ntid,"' and (approvation_state='REQD' or approvation_state='DISG')"))) if [$tval == 0] { database sql update toUnspacedString("update tabledb set state='APPROVED' where idx='",$ntid,"'") database sql update toUnspacedString("update approvaldb set state='APPROVED', lastown_midx='",getUserWIDX,"', lastown_firm='",getmyFullName,"', last_ts='",$tval2,"' where aidx=(select appd from tabledb where idx='",$ntid,"')") } } if [DISG == getCommand(5)] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from tablenotes where tableidx='",$ntid,"' and (approvation_state='REQD' or approvation_state='APRD')"))) if [$tval == 0] { database sql update toUnspacedString("update tabledb set state='REFUSED' where idx='",$ntid,"'") database sql update toUnspacedString("update approvaldb set state='REFUSED', lastown_midx='",getUserWIDX,"', lastown_firm='",getmyFullName,"', last_ts='",$tval2,"' where aidx=(select appd from tabledb where idx='",$ntid,"')") } } if [$tval == 0] { # verra' inviato mezzo channel tables. capplet ntman certified getCommand(5) $tval2 } ifnot [$tval == 0] { call Applet.Tables.ShowDetail } } # ---------------------------------------------------------- # APPLET: CHAT # ---------------------------------------------------------- procedure Applet.Chat.Run { caseCommand [APPLET,CHAT,BMSG] { ifnot [$oncall == 0] { send channel=$chancall toString(toUnspacedString(client info getHour,":",client info getMinute), getCommand(4)) } if [$oncall == 0] { capplet area dialog NOTINCALLGN } } caseCommand [APPLET,CHAT,GETUSRLST] { $tval = getCommand(4) if [$tval == PRIVATECALL] { ifnot [$oncall == 0] { capplet chat list getChannelUsers getCommand(5) 16 $chancall getid } if [$oncall == 0] { capplet chat NOTINCALL } } } } # ---------------------------------------------------------- # APPLET: RUBRICA # ---------------------------------------------------------- procedure Applet.Rubrica.Run { caseCommand [APPLET,RUBRICA,GETLIST] { $rubrica_pos = getCommand(4) $rubrica_search = getCommand(5) call Applet.Rubrica.SendList } caseCommand [APPLET,RUBRICA,CANADD] { capplet rubrica addcontact } caseCommand [APPLET,RUBRICA,CANDEL] { capplet rubrica delcontact } caseCommand [APPLET,RUBRICA,ADDCHECK] { capplet rubrica ccheck database wsysdb getUserName getCommand(4) } caseCommand [APPLET,RUBRICA,ABORT] { capplet rubrica creset } caseCommand [APPLET,RUBRICA,ABORTDEL] { capplet rubrica creset } caseCommand [APPLET,RUBRICA,ADDCONTACT] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from rubricadb where owidx='",getUserWIDX,"' and cwidx='",getCommand(4),"'"))) if [$tval == 0] { database sql update(toUnspacedString("insert into rubricadb(owidx,cwidx,cname) VALUES('",getUserWIDX,"','",getCommand(4),"','",getCommand(5),"')")) $rubrica_pos = 1 capplet rubrica cadded } ifnot [$tval == 0] { database sql update(toUnspacedString("update rubricadb set cname='",getCommand(5),"' where owidx='",getUserWIDX,"' and cwidx='",getCommand(4),"'")) capplet rubrica cupdated } } caseCommand [APPLET,RUBRICA,DELCONTACT] { database sql update(toUnspacedString("delete from rubricadb where owidx='",getUserWIDX,"' and cwidx='",getCommand(4),"'")) capplet rubrica cdeleted } } procedure Applet.Rubrica.SendList { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from rubricadb where owidx='",getUserWIDX,"' ",$rubrica_search))) capplet rubrica content $rubrica_pos $tval database sql getTableQuery(toUnspacedString("select * from rubricadb where owidx='",getUserWIDX,"' ",$rubrica_search," order by idx DESC")) window [$rubrica_pos,14] ; select 3 fields idx,cwidx,cname } # ---------------------------------------------------------- # APPLET: ADMIN # ---------------------------------------------------------- procedure Applet.Admin.Run { caseCommand [APPLET,ADMIN,GETMOD] { call Applet.Admin.getModule } } procedure Applet.Admin.getModule { # may securize somes $tval = getCommand(4) if [$tval == DFSKIN] { capplet admin loadmod adm_defs } if [$tval == CTAB] { capplet admin loadmod adm_ctab } if [$tval == DEFPROF] { capplet admin loadmod adm_dprof } if [$tval == ACCMAN] { capplet admin loadmod adm_licsetup } if [$tval == CONTACT] { capplet admin loadmod adm_contacts } if [$tval == BILLSETUP] { capplet admin loadmod adm_billstp } if [$tval == BILLREPORT] { joinServiceDomain capplet admin loadmod adm_billrpt } if [$tval == CTRLGROUP] { capplet admin loadmod adm_ctrlgrp } if [$tval == CTRLPANEL] { capplet admin loadmod adm_ctrl } if [$tval == USRMAN] { joinServiceDomain capplet admin loadmod adm_uman $sdom } if [$tval == CALLMAN] { capplet admin loadmod adm_cman } if [$tval == LICMAN] { capplet admin laodmod adm_lman } if [$tval == STATS] { capplet admin loadmod adm_stats } if [$tval == NOMOD] { capplet admin loadmod none } if [$tval == MENU] { call Applet.Admin.unjoinServices capplet admin reload } $ladmin = $tval } procedure Applet.Admin.unjoinServices { if [$ladmin == USRMAN] { unjoinServiceDomain } if [$ladmin == BILLREPORT] { unjoinServiceDomain } if [$ladmin == CTRLPANEL] { unjoinMasterService } if [$ladmin == CTRLGROUP] { # none } } # ---------------------------------------------------------- # APPLET: UMAN # ---------------------------------------------------------- procedure Applet.UMan.Run { caseCommand [APPLET,UMAN,UPDLIST] { capplet uman list server getServiceUsers 12 getCommand(4) } caseCommand [APPLET,UMAN,webreload] { $tval = getCommand(4) send ID=$tval seq reqrel capplet uman ok } } # ---------------------------------------------------------- # APPLET: BILLREP # ---------------------------------------------------------- procedure Applet.BillRep.Run { caseCommand [APPLET,BILLREP,GETLIST] { #capplet billrep list server getTagUsers getLicenseTag 0 getCommand(4) getCommand(5) #capplet billrep list server getTagUsers webtelecom 1 getCommand(4) getCommand(5) capplet billrep list getTagServiceUsers getLicenseTag PRIVATECALL 1 getCommand(4) getCommand(5) } caseCommand [APPLET,BILLREP,GETACCOUNT] { capplet billrep list getTagServiceAccounts getLicenseTag PRIVATECALL 1 getCommand(4) getCommand(5) } caseCommand [APPLET,BILLREP,BILLINFO] { capplet billrep udata $sdom getLicenseTag getAccountInfo getCommand(4) PRIVATECALL } caseCommand [APPLET,BILLREP,BILLSET] { $tval = validateUserAccount getCommand(4) PRIVATECALL getCommand(5) capplet billrep reload } caseCommand [APPLET,BILLREP,GETTAB] { call Applet.BillRep.GetTab } caseCommand [APPLET,BILLREP,PCLOSE] { capplet billrep popclose getCommand(4) } caseCommand [APPLET,BILLREP,CANADDU] { capplet billrep panel CANADD } caseCommand [APPLET,BILLREP,DOADDU] { $lvl = getCommand(4) $elm = getCommand(7) $myuser = database wsysdb createUser(toUnspacedString("usr",getgid),getCommand(5),getLicenseTag,getCommand(6),create) database wsysdb setUserEmail($myuser,$elm) $tval2 = stripString(database sql getQuery(toUnspacedString("select count(*) from groupsdb where lictag='",getLicenseTag,"' and lock='DEFAULT'"))) if [$tval2 == 1] { $gusr = $myuser $gid = stripString(database sql getQuery(toUnspacedString("select gidx from groupsdb where lictag='",getLicenseTag,"' and lock='DEFAULT'"))) database sql update toUnspacedString("insert into grusersdb(gidx,midx,lictag) VALUES('",$gid,"','",$gusr,"','",getLicenseTag,"')") $tval1 = stripString(database sql getQuery(toUnspacedString("select name from groupsdb where lictag='",getLicenseTag,"' and lock='DEFAULT'"))) call Applet.cGroups.AddGroupUser } ifnot [$lvl == 2] { if [$lvl == 1 ] { $lvl = $service_acl } if [$lvl == 3 ] { $lvl = $service_gal } database wsysdb setUserAccess($myuser,$lvl,asis) } capplet billrep upd } caseCommand [APPLET,BILLREP,CANDELU] { capplet billrep panel CANDEL } caseCommand [APPLET,BILLREP,DODELU] { $gusr = getCommand(4) call Applet.cGroups.RemoveGroupUser database sql update toUnspacedString("delete from grusersdb where midx='",$gusr,"' and lictag='",getLicenseTag,"'") database wsysdb disgraceUser $gusr capplet billrep upd } caseCommand [APPLET,BILLREP,CANSENDM] { capplet billrep panel CANSEND } caseCommand [APPLET,BILLREP,SNDMAIL] { $myuser = getCommand(4) $mail = mailer create "WebTel Registration Service", $adminelm mailer $mail writeln getLicenseTitle mailer $mail writeln "-" mailer $mail writeln mailer $mail writeln "Benvenuto al servizio videotelefonico di" mailer $mail writeln "Welcome to the online videocommunity service of" mailer $mail writeln mailer $mail writeln toUnspacedString("[ ",$sdom," ]") mailer $mail writeln $weburl mailer $mail writeln mailer $mail writeln "ACCOUNT INFORMATION" mailer $mail writeln toUnspacedString("for user ",getCommand(5)) mailer $mail writeln mailer $mail writeln toUnspacedString("Username: ",database wsysdb getUserLogin($myuser)) mailer $mail writeln toUnspacedString("Password: ",database wsysdb getUserPasswd($myuser)) mailer $mail writeln toUnspacedString("Authority: ",database wsysdb getUserAuthz($myuser)) mailer $mail writeln mailer $mail writeln "Il tuo numero telefonico e'" mailer $mail writeln "Your Telephone ID is" mailer $mail writeln toUnspacedString("[ ",$myuser," ]") mailer $mail writeln mailer $mail writeln toUnspacedString("HelpDesk is at ",$mfn) mailer $mail sendto database wsysdb getUserEmail($myuser) mailer $mail sendto wims@mc2labs.com mailer $mail sendto $adminelm mailer $mail done capplet billrep upd } caseCommand [APPLET,BILLREP,CANOTHERS] { capplet billrep panel CANOTH } caseCommand [APPLET,BILLREP,ADDCHECK] { capplet billrep panel VALID database wsysdb getUserName getCommand(4) } caseCommand [APPLET,BILLREP,ADDOTHER] { database wsysdb validateUser(getCommand(4)) database wsysdb setUserAccess(getCommand(4),$service_acl,asis) capplet billrep upd } } procedure Applet.BillRep.GetTab { caseCommand [APPLET,BILLREP,GETTAB,udb_reg] { capplet billrep table database wsysdb userdb(login,acl,min,$service_acl,getCommand(5),getCommand(6),getCommand(7)) } caseCommand [APPLET,BILLREP,GETTAB,udb_guest] { capplet billrep table database wsysdb userdb(login,acl,max,$service_min + 1,getCommand(5),getCommand(6),getCommand(7)) } caseCommand [APPLET,BILLREP,GETTAB,udb_demo] { capplet billrep table database wsysdb userdb(login,acl,eqv,$service_gal,getCommand(5),getCommand(6),getCommand(7)) } caseCommand [APPLET,BILLREP,GETTAB,udb_lreg] { capplet billrep table database wsysdb userdb(last,acl,min,$service_acl,getCommand(5),getCommand(6),getCommand(7)) } caseCommand [APPLET,BILLREP,GETTAB,udb_lguest] { capplet billrep table database wsysdb userdb(last,acl,max,$service_min + 1,getCommand(5),getCommand(6),getCommand(7)) } caseCommand [APPLET,BILLREP,GETTAB,udb_ldemo] { capplet billrep table database wsysdb userdb(last,acl,eqv,$service_gal,getCommand(5),getCommand(6),getCommand(7)) } # ---------------------------------------------------------------------------------------------- caseCommand [APPLET,BILLREP,GETTAB,adb_name] { # to implement (accessdb) capplet billrep table database wsysdb accessdb(name,getCommand(5),getCommand(6)) } caseCommand [APPLET,BILLREP,GETTAB,adb_host] { capplet billrep table database wsysdb accessdb(host,getCommand(5),getCommand(6)) } caseCommand [APPLET,BILLREP,GETTAB,stats_day] { capplet billrep table database wsysdb accessdb(stats,YYYYMMDD,getCommand(5)) } caseCommand [APPLET,BILLREP,GETTAB,stats_month] { capplet billrep table database wsysdb accessdb(stats,YYYYMM,getCommand(5)) } caseCommand [APPLET,BILLREP,GETTAB,stats_year] { capplet billrep table database wsysdb accessdb(stats,YYYY,getCommand(5)) } caseCommand [APPLET,BILLREP,GETTAB,NONE] { capplet billrep ok } } # ---------------------------------------------------------- # APPLET: WCTRL # ---------------------------------------------------------- procedure Applet.wCTRL.Run { caseCommand [APPLET,WCTRL,KRST] { server stop } caseCommand [APPLET,WCTRL,WALLON] { server wall on } caseCommand [APPLET,WCTRL,WALLOFF] { server wall off } caseCommand [APPLET,WCTRL,WTPANEL] { unjoinMasterService capplet wctrl panel wt } caseCommand [APPLET,WCTRL,WDNPANEL] { joinMasterService capplet wctrl panel wdn } caseCommand [APPLET,WCTRL,GETKRNS] { capplet wctrl krnslst server getMyKernels getCommand(4) getCommand(5) } caseCommand [APPLET,WCTRL,KRNRELOAD] { $tval = getCommand(4) server kernel $tval stop capplet wctrl ok } } # ---------------------------------------------------------- # APPLET: CGROUPS # ---------------------------------------------------------- procedure Applet.cGroups.Run { caseCommand [APPLET,CGROUPS,GETLIST] { $grpos = getCommand(4) call Applet.cGroups.SendList } caseCommand [APPLET,CGROUPS,GADD] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from grusersdb where gidx in (select gidx from groupsdb where lictag='",getLicenseTag,"')"))) capplet cgroups gadd getLicenseTag $tval } caseCommand [APPLET,CGROUPS,ADDGROUP] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from groupsdb where lictag='",getLicenseTag,"' and name='",getCommand(4),"'"))) ifnot [$tval == 0] { capplet cgroups adderror } if [$tval == 0] { $tval = stripString(database sql getQuery(toUnspacedString("insert into groupsdb(lictag,name,descr) VALUES('",getLicenseTag,"','",getCommand(4),"','",getCommand(5),"') ; select currval('groupsdb_pkey_id')"))) database sql update toUnspacedString("insert into grpermsdb(gidx) VALUES(",$tval,")") database sql update toUnspacedString("insert into grdatadb(gidx) VALUES(",$tval,")") capplet cgroups greload } } caseCommand [APPLET,CGROUPS,GDEL] { $tval = stripString(database sql getQuery(toUnspacedString("select lock from groupsdb where gidx='",getCommand(4),"'"))) ifnot [$tval == TRUE] { capplet cgroups gdel } if [$tval == TRUE] { capplet cgroups readonly } } caseCommand [APPLET,CGROUPS,DELETEGROUP] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from grusersdb where gidx='",getCommand(4),"'"))) ifnot [$tval == 0] { capplet cgroups delerror } if [$tval == 0] { database sql update toUnspacedString("delete from groupsdb where gidx='",getCommand(4),"'") capplet cgroups greload } } caseCommand [APPLET,CGROUPS,GUSERS] { capplet cgroups userlist } caseCommand [APPLET,CGROUPS,GETULIST] { $gid = getCommand(4) $gupos = getCommand(5) call Applet.cGroups.SendUsers } caseCommand [APPLET,CGROUPS,GBACK] { capplet cgroups greload } caseCommand [APPLET,CGROUPS,UADD] { $tval = stripString(database sql getQuery(toUnspacedString("select lock from groupsdb where gidx='",$gid,"'"))) ifnot [$tval == TRUE] { capplet cgroups uadd } if [$tval == TRUE] { capplet cgroups userfail readonly } } caseCommand [APPLET,CGROUPS,CHECKUSER] { capplet cgroups ccheck database wsysdb getUserName getCommand(4) } caseCommand [APPLET,CGROUPS,ADDUSER] { $tval = database wsysdb checkUserLicense getCommand(4) if [$tval == null] { capplet cgroups userfail nolic } ifnot [$tval == null] { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from grusersdb where lictag='",getLicenseTag,"' and midx='",getCommand(4),"'"))) ifnot [$tval == 0 ] { capplet cgroups userfail present } if [$tval == 0] { $gusr = getCommand(4) database sql update toUnspacedString("insert into grusersdb(gidx,midx,lictag) VALUES('",$gid,"','",$gusr,"','",getLicenseTag,"')") call Applet.cGroups.AddGroupUser capplet cgroups userlist } } } caseCommand [APPLET,CGROUPS,URM] { $tval = stripString(database sql getQuery(toUnspacedString("select lock from groupsdb where gidx='",$gid,"'"))) ifnot [$tval == TRUE] { capplet cgroups urm } if [$tval == TRUE] { capplet cgroups userfail readonly } } caseCommand [APPLET,CGROUPS,RMUSER] { $gusr = getCommand(4) call Applet.cGroups.RemoveGroupUser database sql update toUnspacedString("delete from grusersdb where midx='",$gusr,"' and lictag='",getLicenseTag,"'") capplet cgroups userlist } caseCommand [APPLET,CGROUPS,EDIT] { $tval = stripString(database sql getQuery(toUnspacedString("select lock from groupsdb where gidx='",getCommand(4),"'"))) ifnot [$tval == TRUE] { capplet cgroups privopen $tval database sql getTableQuery(toUnspacedString("select * from grpermsdb where gidx='",getCommand(4),"'")) window [1,1] select sqlfields($wtdeps) } if [$tval == TRUE] { capplet cgroups userfail readonly } } caseCommand [APPLET,CGROUPS,GSAVE] { database sql update toUnspacedString("update grpermsdb set ",getCommand(5)," where gidx='",getCommand(4),"'") capplet cgroups ok } caseCommand [APPLET,CGROUPS,GAPPLY] { database sql update toUnspacedString("update grpermsdb set ",getCommand(5)," where gidx='",getCommand(4),"'") capplet cgroups canapply stripString(database sql getQuery(toUnspacedString("select count(*) from grusersdb where gidx='",getCommand(4),"'"))) } caseCommand [APPLET,CGROUPS,APPLYTO] { $tval1 = toString(database sql getTableQuery(toUnspacedString("select midx from grusersdb where gidx='",getCommand(4),"'")) window getCommand(5) getCommand(6) select 1 fields 1) $tval2 = toString(database sql getTableQuery(toUnspacedString("select * from grpermsdb where gidx='",$gid,"'")) window [1,1] select sqlfields($wtdeps)) dn in [$tval1,1,1,"database wsysdb setDepartments(%,$wtdeps,$tval2)"] capplet cgroups again } } procedure Applet.cGroups.SendList { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from groupsdb where lictag='",getLicenseTag,"'"))) capplet cgroups glist $grpos $tval database sql getTableQuery(toUnspacedString("select * from groupsdb where lictag='",getLicenseTag,"' order by gidx DESC")) window [$grpos,12] ; select 4 fields gidx,name,descr,lock } procedure Applet.cGroups.SendUsers { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from grusersdb where gidx='",$gid,"'"))) $trn = toString(database sql getTableQuery(toUnspacedString("select * from grusersdb where gidx='",$gid,"' order by idx DESC")) window [$gupos,11] select 2 fields idx,midx) capplet cgroups gusers $gupos $tval in [$trn,2,2,"database wsysdb getUserName(%)"] } procedure Applet.cGroups.AddGroupUser { $trn = toString(database sql getTableQuery(toUnspacedString("select * from grpermsdb where gidx='",$gid,"'")) window [1,1] ; select sqlfields($wtdeps)) database wsysdb setDepartments($gusr,$wtdeps,$trn) } procedure Applet.cGroups.RemoveGroupUser { database wsysdb unsetDepartments($gusr,$wtdeps) } # ---------------------------------------------------------- # APPLET: WMAIL # ---------------------------------------------------------- procedure Applet.wmail.Run { caseCommand [APPLET,WMAIL,GETINBOX] { call Applet.wmail.SendSummary # ifnot [$forumd] { # call Applet.wmail.SendForumIndex # $forumd = TRUE } $wmail_opt = 1 $wmail_pt = 1 call Applet.wmail.SendInbox } caseCommand [APPLET,WMAIL,GETOUTBOX] { call Applet.wmail.SendSummary # ifnot [$forumd] { # call Applet.wmail.SendForumIndex # $forumd = TRUE } $wmail_opt = 2 $wmail_pt = 1 call Applet.wmail.SendOutbox } caseCommand [APPLET,WMAIL,GETDRAFTS] { call Applet.wmail.SendSummary # ifnot [$forumd] { # call Applet.wmail.SendForumIndex # $forumd = TRUE } $wmail_opt = 3 $wmail_pt = 1 call Applet.wmail.SendDrafts } caseCommand [APPLET,WMAIL,GETDELETED] { call Applet.wmail.SendSummary # ifnot [$forumd] { # call Applet.wmail.SendForumIndex # $forumd = TRUE } $wmail_opt = 4 $wmail_pt = 1 call Applet.wmail.SendDeleted } caseCommand [APPLET,WMAIL,GETARCHIE] { call Applet.wmail.SendSummary # ifnot [$forumd] { # call Applet.wmail.SendForumIndex # $forumd = TRUE } $wmail_opt = 7 $wmail_pt = 1 call Applet.wmail.SendArch } caseCommand [APPLET,WMAIL,GETFLIST] { call Applet.wmail.SendSummary call Applet.wmail.SendForumIndex $forumd = TRUE } caseCommand [APPLET,WMAIL,SCROLL] { $wmail_pt = getCommand(4) if [$wmail_opt == 1] { call Applet.wmail.SendInbox } if [$wmail_opt == 2] { call Applet.wmail.SendOutbox } if [$wmail_opt == 3] { call Applet.wmail.SendDrafts } if [$wmail_opt == 4] { call Applet.wmail.SendDeleted } if [$wmail_opt == 7] { call Applet.wmail.SendArch } } caseCommand [APPLET,WMAIL,FISCROLL] { $fpnt = getCommand(4) call Applet.wmail.SendForumIndex } caseCommand [APPLET,WMAIL,COMPOSE] { $forumd = FALSE $tval = stripString(database sql getQuery(toUnspacedString("insert into messagedb(mfrom,lfrom,tstamp,activefrom,status,received,fatt,parent) VALUES('",getUserWIDX,"','",getmyFullName,"','",getTimeStamp,"','TRUE','TEMP','NONE','NONE','NONE') ; select currval('messagedb_pkey_id')"))) database sql update toUnspacedString("insert into messages(msgid,body,ts) VALUES('",$tval,"','NONE','",getTimeStamp,"')") capplet wmail compose getTimeStamp $tval } caseCommand [APPLET,WMAIL,REPLY] { $tval1 = stripString(database sql getQuery(toUnspacedString("select mfrom from messagedb where idx='",getCommand(4),"'"))) $tval2 = trim stripString(database sql getQuery(toUnspacedString("select lfrom from messagedb where idx='",getCommand(4),"'"))) $tval = stripString(database sql getQuery(tounspacedString("insert into messagedb(mfrom,lfrom,tstamp,activefrom,status,mto,lto,parent,received,fatt) VALUES('",getUserWIDX,"','",getmyFullname,"','",getTimeStamp,"','TRUE','TEMP','",$tval1,"','",$tval2,"','",getCommand(4),"','NONE','NONE'); select currval('messagedb_pkey_id')"))) database sql update toUnspacedString("insert into messages(msgid,body,ts) VALUES('",$tval,"','$REPLY$','",getTimeStamp,"')") capplet wmail recompose getTimeStamp $tval call Applet.wmail.mute } caseCommand [APPLET,WMAIL,FREPLY] { $tval1 = stripString(database sql getQuery(toUnspacedString("select mto from messagedb where idx='",getCommand(4),"'"))) $tval2 = trim stripString(database sql getQuery(toUnspacedString("select lto from messagedb where idx='",getCommand(4),"'"))) $tval = stripString(database sql getQuery(tounspacedString("insert into messagedb(mfrom,lfrom,tstamp,activefrom,status,mto,lto,parent,received,fatt,activeto) VALUES('",getUserWIDX,"','",getmyFullname,"','",getTimeStamp,"','TRUE','TEMP','",$tval1,"','",$tval2,"','",getCommand(4),"','NONE','NONE','FORUM'); select currval('messagedb_pkey_id')"))) database sql update toUnspacedString("insert into messages(msgid,body,ts) VALUES('",$tval,"','$REPLY$','",getTimeStamp,"')") capplet wmail frecompose getTimeStamp $tval call Applet.wmail.mute } caseCommand [APPLET,WMAIL,FORWARD] { $tval1 = stripString(database sql getQuery(toUnspacedString("select fatt from messagedb where idx='",getCommand(4),"'"))) $tval = stripString(database sql getQuery(toUnspacedString("insert into messagedb(mfrom,lfrom,tstamp,activefrom,status,fwd,received,fatt,parent) VALUES('",getUserWIDX,"','",getmyFullname,"','",getTimeStamp,"','TRUE','TEMP','",getCommand(4),"','NONE','",$tval1,"','NONE'); select currval('messagedb_pkey_id')"))) database sql update toUnspacedString("insert into messages(msgid,body,ts) VALUES('",$tval,"','$FORWARD$','",getTimeStamp,"')") capplet wmail fwcompose getTimeStamp $tval call Applet.wmail.mute } caseCommand [APPLET,WMAIL,MAKE] { $forumd = FALSE $tval1 = database wsysdb getUserName getCommand(4) $tval = stripString(database sql getQuery(toUnspacedString("insert into messagedb(mfrom,lfrom,tstamp,activefrom,status,received,fatt,mto,lto,parent) VALUES('",getUserWIDX,"','",getmyFullName,"','",getTimeStamp,"','TRUE','TEMP','NONE','NONE','",getCommand(4),"','",$tval1,"','NONE') ; select currval('messagedb_pkey_id')"))) database sql update toUnspacedString("insert into messages(msgid,body,ts) VALUES('",$tval,"','NONE','",getTimeStamp,"')") capplet wmail make getTimeStamp $tval $tval1 } caseCommand [APPLET,WMAIL,ARCHIVE] { $tval = stripString(database sql getQuery(toUnspacedString("select mto from messagedb where idx='",getCommand(4),"'"))) if [$tval == getUserWIDX ] { database sql update toUnspacedString("update messagedb set activeto='ARCH' where idx='",getCommand(4),"' and activeto='TRUE'") } $tval = stripString(database sql getQuery(toUnspacedString("select mfrom from messagedb where idx='",getCommand(4),"'"))) if [$tval == getUserWIDX] { database sql update toUnspacedString("update messagedb set activefrom='ARCH' where idx='",getCommand(4),"' and activefrom='TRUE'") } capplet wmail arch } caseCommand [APPLET,WMAIL,UNARCHIVE] { $tval = stripString(database sql getQuery(toUnspacedString("select mto from messagedb where idx='",getCommand(4),"'"))) if [$tval == getUserWIDX ] { database sql update toUnspacedString("update messagedb set activeto='TRUE' where idx='",getCommand(4),"' and activeto='ARCH'") } $tval = stripString(database sql getQuery(toUnspacedString("select mfrom from messagedb where idx='",getCommand(4),"'"))) if [$tval == getUserWIDX] { database sql update toUnspacedString("update messagedb set activefrom='TRUE' where idx='",getCommand(4),"' and activefrom='ARCH'") } capplet wmail arch } caseCommand [APPLET,WMAIL,OPENRUBRICA] { call Applet.wmail.mute capplet wmail abook open } caseCommand [APPLET,WMAIL,CLOSERUBRICA] { capplet wmail abook close } caseCommand [APPLET,WMAIL,GETRUBRICA] { $rubrica_pos = getCommand(4) $rubrica_search = getCommand(5) call Applet.wmail.SendRubrica } caseCommand [APPLET,WMAIL,SAVEMSG] { call Applet.wmail.Save capplet wmail ok } caseCommand [APPLET,WMAIL,SAVEMSGH] { call Applet.wmail.hSave capplet wmail ok } caseCommand [APPLET,WMAIL,CLOSEMSG] { call Applet.wmail.mute call Applet.wmail.Save capplet wmail arch } caseCommand [APPLET,WMAIL,CLOSEMSGH] { call Applet.wmail.mute call Applet.wmail.hSave capplet wmail arch } caseCommand [APPLET,WMAIL,OPEN] { $forumd = FALSE $tval3 = getCommand(4) $mid = $tval3 call Applet.wmail.Load } caseCommand [APPLET,WMAIL,FOPEN] { $forumd = FALSE $tval3 = getCommand(4) $tval = stripString(database sql getQuery(toUnspacedString("select chanpath from forumdb where fidx='",$tval3,"'"))) $mid = getTicketAsParam $tval getCommand(5) call Applet.wmail.Load } caseCommand [APPLET,WMAIL,ARCH] { call Applet.wmail.mute capplet wmail arch } caseCommand [APPLET,WMAIL,SENDMSG] { call Applet.wmail.mute call Applet.wmail.Send capplet wmail arch } caseCommand [APPLET,WMAIL,SENDMSGH] { call Applet.wmail.mute call Applet.wmail.hSend capplet wmail arch } caseCommand [APPLET,WMAIL,CANDELMSG] { call Applet.wmail.mute capplet wmail dodel } caseCommand [APPLET,WMAIL,ABORT] { capplet wmail abort } caseCommand [APPLET,WMAIL,MSGDELFROM] { database sql update toUnspacedString("update messagedb set activefrom='FALSE' where idx='",getCommand(4),"'") capplet wmail arch } caseCommand [APPLET,WMAIL,MSGDELTO] { database sql update toUnspacedString("update messagedb set activeto='FALSE' where idx='",getCommand(4),"'") capplet wmail arch } caseCommand [APPLET,WMAIL,DISCARD] { call Applet.wmail.mute capplet wmail mayab } caseCommand [APPLET,WMAIL,GETPIC] { $tval = videomem getpic getCommand(4) mcam capplet wmail ok } caseCommand [APPLET,WMAIL,GETVIDEO] { $tval = videomem replay getCommand(4) vpcam capplet wmail ok } caseCommand [APPLET,WMAIL,RECORD] { $tval = videomem record mcam getCommand(4) database sql update toUnspacedString("update messagedb set fatt='",$tval,"' where idx='",getCommand(5),"'") capplet wmail recd $tval } caseCommand [APPLET,WMAIL,STORE] { videomem setstore getCommand(5) videomem stop 0 mcam # database sql update toUnspacedString("update messagedb set fatt='",getCommand(5),"' where idx='",getCommand(4),"'") capplet wmail reatt } caseCommand [APPLET,WMAIL,UNATT] { capplet wmail mayunatt } caseCommand [APPLET,WMAIL,DELATT] { database sql update toUnspacedString("update messagedb set fatt='NONE' where idx='",getCommand(4),"'") capplet wmail ok } caseCommand [APPLET,WMAIL,IDSHOW] { capplet wmail showid } caseCommand [APPLET,WMAIL,IDHIDE] { capplet wmail hideid } caseCommand [APPLET,WMAIL,GETSUMMARY] { call Applet.wmail.SendSummary } caseCommand [APPLET,WMAIL,DELMSGS] { database sql update toUnspacedString("update messagedb set activefrom='FALSE' where mfrom='",getUserWIDX,"' and (",getCommand(4),")") database sql update toUnspacedString("update messagedb set activeto='FALSE' where mto='",getUserWIDX,"' and (",getCommand(4),")") capplet wmail arch } caseCommand [APPLET,WMAIL,FORUMIDX] { call Applet.wmail.SendForumIndex } caseCommand [APPLET,WMAIL,GETFORUM] { call Applet.wmail.SendSummary # ifnot [$forumd] { # call Applet.wmail.SendForumIndex # $forumd = TRUE } $forum_pt = 0 call Applet.wmail.SendForumContent } caseCommand [APPLET,WMAIL,FSCROLL] { $forum_pt = getCommand(5) call Applet.wmail.SendForumContent } caseCommand [APPLET,WMAIL,FCOMPOSE] { $forumd = FALSE $tval = stripString(database sql getQuery(toUnspacedString("insert into messagedb(mfrom,lfrom,tstamp,activefrom,status,received,fatt,parent,mto,lto,activeto) VALUES('",getUserWIDX,"','",getmyFullName,"','",getTimeStamp,"','TRUE','TEMP','UNAVAIL','NONE','NONE','",getCommand(4),"','",getCommand(5),"','FORUM') ; select currval('messagedb_pkey_id')"))) database sql update toUnspacedString("insert into messages(msgid,body,ts) VALUES('",$tval,"','NONE','",getTimeStamp,"')") capplet wmail fcompose getTimeStamp $tval } caseCommand [APPLET,WMAIL,FSAVEMSG] { call Applet.wmail.SaveForum capplet wmail ok } caseCommand [APPLET,WMAIL,FSAVEMSGH] { call Applet.wmail.hSaveForum capplet wmail ok } caseCommand [APPLET,WMAIL,FCLOSEMSG] { call Applet.wmail.mute call Applet.wmail.SaveForum capplet wmail arch } caseCommand [APPLET,WMAIL,FCLOSEMSGH] { call Applet.wmail.mute call Applet.wmail.hSaveForum capplet wmail arch } caseCommand [APPLET,WMAIL,FSENDMSG] { call Applet.wmail.mute call Applet.wmail.SendForum capplet wmail arch } caseCommand [APPLET,WMAIL,FSENDMSGH] { call Applet.wmail.mute call Applet.wmail.hSendForum capplet wmail arch } caseCommand [APPLET,WMAIL,UPDATEFLIST] { capplet wmail updfl getCommand(4) getChannelTickets getCommand(4) 0 0 0 flags } caseCommand [APPLET,WMAIL,FUSTATE] { $tval = stripString(database sql getQuery(toUnspacedString("select chanpath from forumdb where fidx='",getCommand(4),"'"))) setTicketUserStatus $tval getCommand(5) getCommand(6) capplet wmail ok } caseCommand [APPLET,WMAIL,FORUMLO] { if [ FALSE == getCommand(4) ] { $forumlo = TASKS setDepartment(ftaskonly) } if [ TASKS == getCommand(4) ] { $forumlo = FALSE unsetDepartment(ftaskonly) } $fpnt = 1 call Applet.wmail.SendForumIndex } } procedure Applet.wmail.SendSummary { $tval1 = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where mto='",getUserWIDX,"' and activeto='TRUE' and status!='DRAFT' and status!='TEMP'"))) $tval2 = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where mto='",getUserWIDX,"' and activeto='TRUE' and status='SENT'"))) capplet wmail summary inbox $tval1 $tval2 $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where mfrom='",getUserWIDX,"' and activefrom='TRUE' and status!='DRAFT' and status!='TEMP' and activeto!='FORUM'"))) capplet wmail summary outbox $tval $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where mfrom='",getUserWIDX,"' and activefrom='TRUE' and status='DRAFT'"))) capplet wmail summary draft $tval $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where (mfrom='",getUserWIDX,"' and activefrom='FALSE') or (mto='",getUserWIDX,"' and activeto='FALSE') and status!='TEMP'"))) capplet wmail summary deleted $tval $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where ((mfrom='",getUserWIDX,"' and activefrom='ARCH') or (mto='",getUserWIDX,"' and activeto='ARCH')) and status!='TEMP'"))) capplet wmail summary arch $tval capplet wmail summary forums stripString(database rootdb getQuery(toUnspacedString("select count(*) from mchsubscribers where subscriberid='",getUserWIDX,"' and _unreads>0 and chpath~*'root.forums.'"))) #capplet wmail summary forums getTreeTicketCount root.forums } procedure Applet.wmail.SendInbox { database sql update toUnspacedString("update messagedb set received='",getTimeStamp,"' where received='NONE' and mto='",getUserWIDX,"' and activeto='TRUE' and status!='DRAFT' and status!='TEMP'") $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where mto='",getUserWIDX,"' and activeto='TRUE' and status!='DRAFT' and status!='TEMP'"))) capplet wmail list $tval $wmail_pt database sql getTableQuery(toUnspacedString("select * from messagedb where mto='",getUserWIDX,"' and activeto='TRUE' and status!='DRAFT' and status!='TEMP' order by sent DESC")) window [$wmail_pt,17] ; select 7 fields idx,mfrom,lfrom,subj,sent,status,fatt } procedure Applet.wmail.SendOutbox { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where mfrom='",getUserWIDX,"' and activefrom='TRUE' and status!='DRAFT' and status!='TEMP' and activeto!='FORUM'"))) capplet wmail list $tval $wmail_pt database sql getTableQuery(toUnspacedString("select * from messagedb where mfrom='",getUserWIDX,"' and activefrom='TRUE' and status!='DRAFT' and status!='TEMP' and activeto!='FORUM' order by sent DESC")) window [$wmail_pt,17] ; select 7 fields idx,mto,lto,subj,sent,status,fatt } procedure Applet.wmail.SendDrafts { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where mfrom='",getUserWIDX,"' and activefrom='TRUE' and status='DRAFT'"))) capplet wmail list $tval $wmail_pt database sql getTableQuery(toUnspacedString("select * from messagedb where mfrom='",getUserWIDX,"' and activefrom='TRUE' and status='DRAFT' order by idx DESC")) window [$wmail_pt,17] ; select 7 fields idx,mto,lto,subj,tstamp,status,fatt } procedure Applet.wmail.SendDeleted { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where ((mfrom='",getUserWIDX,"' and activefrom='FALSE') or (mto='",getUserWIDX,"' and activeto='FALSE')) and status!='TEMP'"))) capplet wmail list $tval $wmail_pt database sql getTableQuery(toUnspacedString("select * from messagedb where ((mfrom='",getUserWIDX,"' and activefrom='FALSE') or (mto='",getUserWIDX,"' and activeto='FALSE')) and status!='TEMP' order by idx DESC")) window [$wmail_pt,17] ; select 7 fields idx,mfrom,lfrom,subj,sent,status,fatt } procedure Applet.wmail.SendArch { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where ((mfrom='",getUserWIDX,"' and activefrom='ARCH') or (mto='",getUserWIDX,"' and activeto='ARCH')) and status!='TEMP'"))) capplet wmail list $tval $wmail_pt database sql getTableQuery(toUnspacedString("select * from messagedb where ((mfrom='",getUserWIDX,"' and activefrom='ARCH') or (mto='",getUserWIDX,"' and activeto='ARCH')) and status!='TEMP' order by sent DESC")) window [$wmail_pt,17] ; select 7 fields idx,mfrom,lfrom,subj,sent,status,fatt } procedure Applet.wmail.SendRubrica { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from rubricadb where owidx='",getUserWIDX,"' ",$rubrica_search))) capplet wmail rubrica $rubrica_pos $tval database sql getTableQuery(toUnspacedString("select * from rubricadb where owidx='",getUserWIDX,"' ",$rubrica_search," order by idx DESC")) window [1,10] ; select 3 fields idx,cwidx,cname } procedure Applet.wmail.hSave { database sql update toUnspacedString("update messagedb set mto='",getCommand(5),"', lto='",database wsysdb getUserName(getCommand(5)),"', status='DRAFT', subj='",getCommand(6),"' where idx='",getCommand(4),"'") } procedure Applet.wmail.Save { call Applet.wmail.hSave database sql update toUnspacedString("update messages set body='",getPlainBuffer,"', ts='",getTimeStamp,"' where msgid='",getCommand(4),"'") } procedure Applet.wmail.hSend { database sql update toUnspacedString("update messagedb set mto='",getCommand(5),"', lto='",database wsysdb getUserName(getCommand(5)),"', status='SENT', subj='",getCommand(6),"', sent='",getTimeStamp,"', activeto='TRUE' where idx='",getCommand(4),"'") $tval = stripString(database sql getQuery(toUnspacedString("select parent from messagedb where idx='",getCommand(4),"'"))) if [$tval != NONE] { database sql update toUnspacedString("update messagedb set status='REPLIED' where idx='",$tval,"'") } cappletchanneluser $callservice getCommand(5) wmail newmail } procedure Applet.wmail.Send { database sql update toUnspacedString("update messages set body='",getPlainBuffer,"', ts='",getTimeStamp,"' where msgid='",getCommand(4),"'") call Applet.wmail.hSend } procedure Applet.wmail.Load { $tval = stripString(database sql getQuery(toUnspacedString("select count(*) from messagedb where idx='",$mid,"' and status='SENT' and mto='",getUserWIDX,"'"))) ifnot [$tval == 0] { database sql update toUnspacedString("update messagedb set status='READ', read='",getTimeStamp,"' where idx='",$mid,"'") $tval = stripString(database sql getQuery(toUnspacedString("select mfrom from messagedb where idx='",$mid,"'"))) ifnot [$tval == getUserWIDX] { cappletuser $tval wmail outupd } } sendPlainBuffer database sql getQuery(toUnspacedString("select body from messages where msgid='",$mid,"'")) $tval1 = stripString(database sql getQuery(toUnspacedString("select activeto from messagedb where idx='",$mid,"'"))) if [$tval1 == FORUM] { # $tval2 = stripString(database sql getQuery(toUnspacedString("select mto from messagedb where idx='",$mid,"'"))) # $tval = trim stripString(database sql getQuery(toUnspacedString("select descr from forumdb where fidx='",$tval2,"'"))) $tval = trim stripString(database sql getQuery(toUnspacedString("select descr from forumdb where fidx='",$tval3,"'"))) } ifnot [$tval1 == FORUM] { $tval = 0 } capplet wmail msgdata $tval $mid database sql getTableQuery(toUnspacedString("select * from messagedb where idx='",$mid,"'")) window [1,1] ; select 13 fields mfrom,lfrom,mto,lto,subj,tstamp,sent,received,read,status,fatt,activefrom,activeto } procedure Applet.wmail.mute { videomem stop 0 mcam videomem stop 0 vpcam capplet wmail reatt } procedure Applet.wmail.SendForumIndex { if [$forumlo == FALSE ] { $tval2 = stripString(database rootdb getQuery(toUnspacedString("select count(*) from mchsubscribers where subscriberid='",getUserWIDX,"' and chpath~*'root.forums.'"))) capplet wmail forums $forumd $fpnt $tval2 $forumlo database rootdb getTableQuery(toUnspacedString("select '0',* from mchsubscribers where subscriberid='",getUserWIDX,"' and chpath~*'root.forums.' order by sidx asc")) window [$fpnt,17] select 9 fields _fidx,_tag,_descr,chpath,_readers,_posts,_unreads,_tasks,1 } if [$forumlo == TASKS ] { $tval2 = stripString(database rootdb getQuery(toUnspacedString("select count(*) from mchsubscribers where subscriberid='",getUserWIDX,"' and chpath~*'root.forums.' and ((_unreads>0) or (_tasks>0))"))) capplet wmail forums $forumd $fpnt $tval2 $forumlo database rootdb getTableQuery(toUnspacedString("select '0',* from mchsubscribers where subscriberid='",getUserWIDX,"' and chpath~*'root.forums.' and ((_unreads>0) or (_tasks>0)) order by sidx asc")) window [$fpnt,17] select 9 fields _fidx,_tag,_descr,chpath,_readers,_posts,_unreads,_tasks,1 } } procedure Applet.wmail.SendForumContent { $chp = stripString(database sql getQuery(toUnspacedString("select chanpath from forumdb where fidx='",getCommand(4),"'"))) if [ TRUE == getCommand(5) ] { capplet wmail finfo getusers $chp } if [ TRUE != getCommand(5) ] { capplet wmail flist $forum_pt getChannelTickets $chp 1 17 $forum_pt getCommand(6) --nocounters } } procedure Applet.wmail.hSaveForum { database sql update toUnspacedString("update messagedb set mto='",getCommand(5),"', lto='",getCommand(6),"', status='DRAFT', subj='",getCommand(7),"' where idx='",getCommand(4),"'") } procedure Applet.wmail.SaveForum { call Applet.wmail.hSaveForum database sql update toUnspacedString("update messages set body='",getPlainBuffer,"', ts='",getTimeStamp,"' where msgid='",getCommand(4),"'") } procedure Applet.wmail.hSendForum { capplet wmail rel # diplay user to wail (impl. in edilgest) database sql update toUnspacedString("update messagedb set mto='",getCommand(5),"', lto='",getCommand(6),"', status='SENT', subj='",getCommand(7),"', sent='",getTimeStamp,"' where idx='",getCommand(4),"'") $tval = stripString(database sql getQuery(toUnspacedString("select parent from messagedb where idx='",getCommand(4),"'"))) if [$tval != NONE] { database sql update toUnspacedString("update messagedb set status='REPLIED' where idx='",$tval,"'") } $tval = stripString(database sql getQuery(toUnspacedString("select chanpath from forumdb where fidx='",getCommand(5),"'"))) addChannelTicket $tval getCommand(7) getCommand(4) } procedure Applet.wmail.SendForum { database sql update toUnspacedString("update messages set body='",getPlainBuffer,"', ts='",getTimeStamp,"' where msgid='",getCommand(4),"'") call Applet.wmail.hSendForum } # ---------------------------------------------------------- # APPLET REPORTER # ---------------------------------------------------------- procedure Applet.Reporter.Run { caseCommand [APPLET,REP