<% lvl=validate(0) '//// Receive Search Criteria //// text=request("text")&"" stext=replace(text,"'","''") name=request("name")&"" sname=replace(name,"'","''") deptid=request("deptid") cancmd=request("cancmd") psql="select * from xlaALScans where (canname like '%"&stext&"%' or canmsg like '%"&stext&"%') " if cancmd<>"" then psql=psql & " and cancmd="&cancmd if lvl=0 then deptid="m" if deptid<>"" then if deptid="m" then psql=psql &" and canscope=0 and canid in (select canid from xlaALSiUsersCans where userid="&getusrid&") " elseif deptid="g" then psql=psql &" and canscope=2" elseif deptid="p" then psql=psql &" and canscope=0 " else psql=psql & " and canid in (select canid from xlaALSiDeptsCans where deptid="&deptid&") " end if end if if sname<>"" then psql=psql & " and canid in (select canid from xlaALSiUsersCans where userid in (select userid from xlaALSUsers where name like '%"&name&"%')) " searchsql=psql mypage=request("whichpage") if mypage="" then mypage=1 mypagesize=10 scriptname="cans.asp?text="&server.urlencode(text)&"&name="&server.urlencode(name)&"&deptid="&deptid&"&cancmd="&cancmd set conn=server.createobject("ADODB.Connection") conn.open connection '/// Delete a can command //// kill=request("kill") if kill<>"" then if lvl=1 then deleteable=1 else psql="select * from xlaALScans where canid="&kill&" canscope=0 and canid in (select canid from iUsersCans where userid="&getusrid&")" set rs=conn.execute(psql) if rs.eof then deleteable=0 else deleteable=1 rs.close set rs=nothing end if if deleteable=1 then '/// Delete Can psql="delete from xlaALScans where canid="&kill conn.execute(psql) end if end if %> View Canned Commands
<%if lvl=1 then%> <%end if%>
View Canned Commands : Create a New Canned Command
Can Name / Keyword :
User Name :
Scope :
Command :
<% set rs=server.createobject("ADODB.Recordset") rs.open searchsql,conn,1 if not(rs.eof) then maxval=rs.recordcount rs.movefirst rs.pagesize=mypagesize maxcount=cint(rs.pagecount) rs.absolutepage=mypage howmanyrecs=0 howmanyfields=rs.fields.count-1 %> <%else%> <%end if%>
Cans Found : <%=maxval%>
Page <%=mypage%> of <%=maxcount%>
<% cc=(mypagesize*mypage)-mypagesize do until rs.eof or howmanyrecs>=rs.pagesize cc=cc+1 canid=rs("canid") canname=rs("canname") cancmd=rs("cancmd") canmsg=rs("canmsg") canscope=rs("canscope") select case canscope case 0 canscope="Personal Can" case 1 canscope="Several Reps. / Depts." case 2 canscope="All Representatives" end select %> <% rs.movenext howmanyrecs=howmanyrecs+1 loop%>
# Name
Command
Scope View / Edit Delete
<%=cc%>. <%=canname%>
<%=""&cantype(cancmd) &" : "&canmsg%> <%=canscope%> View / Edit Canned Command Delete Canned Command
Go to Page : <%if cint(mypage)>1 then response.write "<< " if cint(mypage)>>"%>

No canned commands were found
Create a New Canned Command

<% rs.close set rs=nothing conn.close set conn=nothing %>