CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Help putting ASP code into CCS 2.0

Print topic Send  topic

Author Message
Sean
Posted: 09/30/2003, 1:49 PM

I have a project setup using ASP 3.0 w/templates, and I want to input an existing ASP page that was not built in CCS. When I try to copy the code into CCS, it does not work. It uses different INCLUDE files than CCS auto-generates. Is there a way to do a simple copy/paste of an existing ASP page into a CCS page? If so, how? Here is the code below that I want to put into a CCS page. Also, I want it to include my header.

Thanks for any help (I am not very good at programming, which is why I bought this product in the first place).

<!--#INCLUDE FILE="dbcon.asp" -->
<%
Session.LCID = 2057

'--------------------------------------------------
Function DtPrevSunday(ByVal dt)
Do While WeekDay(dt) > vbSunday
dt = DateAdd("d", -1, dt)
Loop
DtPrevSunday = dt
End Function
'--------------------------------------------------


Sub Calendar(dtView)

Dim dtToday
dtToday = Date()

Dim dtCurViewMonth ' First day of the currently viewed month
Dim dtCurViewDay ' Current day of the currently viewed month

' Get first day of month
dttmp = dtView
dtday = day(dttmp)
dttmp = dateadd("d", (-dtday+1), dttmp)


dtCurViewMonth = dttmp

Dim iDay, iWeek, sFontColor
%>


<html>
<head>
<title></title>
<BODY bgcolor=#000066 alink=#FF0000 vlink=#800080 link=#000080>


<TABLE CELLPADDING=3 CELLSPACING=0 WIDTH="95%" BORDER=2 BGCOLOR="#99CCFF" BORDERCOLORDARK="#003399" BORDERCOLORLIGHT="#FFFFFF">
<TR VALIGN=MIDDLE ALIGN=CENTER>
<TD COLSPAN=7>
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%" BORDER=0>
<TR VALIGN=MIDDLE ALIGN=CENTER>
<TD WIDTH="10%" ALIGN=center>
<a href="view_day.asp?view_date=<%= dateadd("m", -1, dtCurViewMonth) %>"><</a>
</TD>
<TD WIDTH="80%">
<FONT FACE="Arial" COLOR="#000000">
<B><small><%=MonthName(Month(dtCurViewMonth)) & " " & Year(dtCurViewMonth)%></small></B>
</FONT>
</TD>
<TD WIDTH="10%" ALIGN=center>
<a href="view_day.asp?view_date=<%= dateadd("m", 1, dtCurViewMonth) %>">></a>
</TD>
</TR>
</TABLE>
</TD>
</TR>

<TR VALIGN=TOP ALIGN=CENTER BGCOLOR="#000099">

<% For iDay = vbSunday To vbSaturday %>
<TH WIDTH="14%"><FONT FACE="Arial" SIZE="-2" COLOR="#FFFFFF"><%=left(WeekDayName(iDay), 3)%></FONT></TH>
<%Next %>

</TR>


<%



dtCurViewDay = DtPrevSunday(dtCurViewMonth)

For iWeek = 0 To 5
Response.Write "<TR VALIGN=TOP>" & vbCrLf

Dim sBGCOLOR
sBGCOLOR = "#99ccff"


For iDay = 0 To 6
sBGCOLOR = "#99ccff"
If Month(dtCurViewDay) = Month(dtCurViewMonth) Then
If dtCurViewDay = dtToday Then sBGCOLOR = "#99ccbb"
else
sBGCOLOR = "#99ccff"

End If
Response.Write "<TD HEIGHT=20 bgcolor='" & sBGCOLOR & "' >"

If Month(dtCurViewDay) = Month(dtCurViewMonth) Then
If dtCurViewDay = dtToday Then
sFontColor = "#ff0000"

Else
sFontColor = "#00000"
End If

Response.Write "<FONT FACE=""Arial"" SIZE=""-2"" COLOR=""" & sFontColor & """><B>"
Response.Write "<a href=view_day.asp?" & "view_date=" & day(dtCurViewday) & "-" & monthname(month(dtCurViewday)) & "-" & year(dtCurViewday) & ">" & Day(dtCurViewDay) & "</a></B></FONT><BR>"

End If

Response.Write "</TD>" & vbCrLf
dtCurViewDay = DateAdd("d", 1, dtCurViewDay)
Next
Response.Write "</TR>" & vbCrLf
Next
%>
<%
' --------END OF DRAW CALENDAR SECTION--------
Response.Write "</table>"
End Sub
%>

<%

set my_conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open DBcon
StrSql= "Select * from Calendar where dte = #" & Request("view_Date") & "# ORDER BY dte"

rs = my_conn.Execute (StrSql)

' If no records found then no worries just trap error
on Error Resume next

%>

</table>
<DIV align=center><FONT color=#ffffff size=4><%= day(Request("view_date")) & " " & monthname(month(Request("view_date"))) & " " & year(Request("view_date")) %>
</FONT></DIV>
<DIV align=center><FONT color=#000080 face="Times new roman, arial" size=4>
<TABLE align=center border=0 borderColor=#dcdcdc cellPadding=2 cellSpacing=2 width="590">
<TR>
<TD align=center valign="top"><form action="add_date.asp" method="post">
<TEXTAREA name="txt" cols=35 rows =10><%= rs("text_field")%></TEXTAREA>

<input type="hidden" value="<%= Request("view_date") %>" name="view_date">
<P><INPUT id=submit1 name=submit1 type=submit value=Submit><INPUT id=reset1 name=reset1 type=reset value=Reset><br>
</FONT>
<a href="TDICalendar.asp?view_date=<%=Request("view_date")%>"><font face="Times new roman, arial" color="#FFFFFF" size="3">Back To TDI Calendar</font></a></P>
</TD><FONT color=#000080 face="Times new roman, arial" size=4>
</form>
<TD align=right width="100">
<%
' call Calendar(dateadd("m", -1, Request("view_date")))
call Calendar(Request("view_date"))
call Calendar(dateadd("m", 1, Request("view_date")))
%>

</TD>
</TR>
</TABLE>
</FONT></DIV>
</BODY>
</HTML>
<%
my_conn.Close
set my_conn = nothing
%>
ryan
Posted: 09/30/2003, 9:17 PM

Sean

I think you need to digest the entire CCS manuals, and the updated help file(chm). But that is my own sickness too. Here are some quick tips.

All your functions must be on a separate asp page name it
customfunc.asp for example.

Open CCS. Click common files on Project Explorer. Choose common.asp
then include the customfunc.asp below for example:

.....some CCS generated codes
'CCLogoutUser @0-DB93CE50
Sub CCLogoutUser()
Session("UserID") = Empty
Session("UserLogin") = Empty
Session("GroupID") = Empty
End Sub
'End CCLogoutUser

%>
<!-- #INCLUDE FILE="customfunc.asp" -->

Now this customfunc.asp contains your functions (I don't use subroutines
all functions)

Function DtPrevSunday(ByVal dt)
Do While WeekDay(dt) > vbSunday
dt = DateAdd("d", -1, dt)
Loop
DtPrevSunday = dt
End Function

The code you provided is mixed (HTML/ASP) you should convert this function
to ALL ASP codes and put it into function inside customfunc.asp, for example:

Function ShowTable()
dim display_
display_ = "<table>" & VBCrLf & _
"<tr>" & VBCrLf & _
"<td>" & VBCrLf & _
"your codes here" & VBCrLf & _
"</td>" & VBCrLf & _
"</tr>" & VBCrLf & _
"<table>"
ShowTable = display_
End Function

Now you can call function inside the CCS HTML template, inside curly braces
See the {ShowTable} below
--------------------------------
<html>
<head>
</head>

<body>
{ShowTable}
<!-- BEGIN Record OR_SubUnits1 --> 
<form name="OR_SubUnits1" action="{Action}" method="post">
<table class="GiantStepsFormTABLE" cellspacing="0" cellpadding="3" border="0">
<!-- BEGIN Error -->
<tr>
<td class="GiantStepsDataTD" colspan="2">{Error}</td>
</tr>
<!-- END Error -->
<tr>
<td class="GiantStepsFieldCaptionTD" valign="top"></td>
<td class="GiantStepsDataTD">
<input type="hidden" value="{Local_Addr}" name="Local_Addr">
</td>
</tr>

<tr>
<td nowrap align="right" colspan="2"> </td>
</tr>
</table>
</form>
<!-- END Record OR_SubUnits1 -->
</body>
</html>
--------------------------------

But there's more to that. You need a datasource to execute the
HTMLTemplate.Setvar "@ShowTable", ShowTable()

Now get rid of the dbcon.asp this is useless.

On menu click PROJECT then SETTINGS this is where you define the connection(sql server, oracle, msaccess), the publishing path, etc.

It seems that you're project is a calendar and you have already a site template. Mail me the mdb or sql and the asp files(image, js, css) I can guide you but you must finish the rest yourself. (arrowgance@yahoo.com)

For a simple master-record-login, editable grid, tree, CCS is already full featured. But adding custom site features like interactive poll, scrollable calendar, you need some programming skills but not solid, just basic.

You won't regret buying CCS, all my projects I try to do in CCS.
Sean
Posted: 10/01/2003, 7:50 AM

Ryan,

Thanks for the input. I'll email you my files so you can take a look.

I did read the manual and help, but I do get distracted easily.

It is a calendar, but I don't want anything too difficult. Just add, delete, change events, but with login required to do so and read access for everyone.

Thanks again,
Sean

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.