or
Public
Sub
ProcessRequest(
ByVal
context
As
HttpContext)
Implements
IHttpHandler.ProcessRequest
'''The following 2 lines do not seem to make a difference, but were added when trying to test
context.Response.Clear
context.Response.BufferOutput =
True
'Get the filename
Dim
fileName
As
String
= context.Request.QueryString(
"i"
)
'Get the file type
Dim
fileType
As
String
= context.Request.QueryString(
"t"
)
'Get the project name
Dim
projectName
As
String
= Managers.SessionManager.ProjectName(context.Session)
'Get the userId
Dim
userId
As
Integer
= Managers.SessionManager.UserId(context.Session)
'Make sure the project and user name are valid
If
IsProjectAndUserValid(projectName, userId) =
True
Then
Dim
securePath
As
String
= Utilities.IO.GetSecureDirectory(Managers.ConfigManager.SecureOutput, projectName, userId)
'Create the full physical path to the file
Dim
fullPath
As
String
= IO.Path.Combine(securePath, fileName)
'See if the file exist
If
IO.File.Exists(fullPath)
Then
'Open a fileinfo object for the file
Dim
currentFileInfo
As
New
IO.FileInfo(fullPath)
Select
Case
fileType.ToLower
Case
"zip"
context.Response.AddHeader(
"Content-Disposition"
,
"attachment;filename=MyZip.zip"
)
context.Response.ContentType =
"application/zip"
Case
"export"
'Get the fileextension
Dim
fileExtension
As
String
= IO.Path.GetExtension(fullPath)
If
fileExtension =
".html"
OrElse
fileExtension =
".htm"
Then
context.Response.AddHeader(
"Content-Disposition"
,
"attachment;filename=Export.htm"
)
context.Response.ContentType =
"text/html"
ElseIf
fileExtension =
".txt"
Then
context.Response.AddHeader(
"Content-Disposition"
,
"attachment;filename=Export.txt"
)
context.Response.ContentType =
"text/plain"
ElseIf
fileExtension =
".xls"
Then
context.Response.AddHeader(
"Content-Disposition"
,
"attachment;filename=Export.xls"
)
context.Response.ContentType =
"application/vnd.ms-excel"
ElseIf
fileExtension =
".xlsx"
Then
context.Response.AddHeader(
"Content-Disposition"
,
"attachment;filename=Export.xlsx"
)
context.Response.ContentType =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
End
If
Case
"print"
context.Response.ContentType =
"text/html"
Case
"image"
context.Response.AddHeader(
"Content-Disposition"
,
"inline;filename=Print.jpg"
)
context.Response.ContentType =
"image/jpeg"
End
Select
'''The following line has had inconsistant results in some browsers
'context.Response.CacheControl = "no-cache"
'''Is the following line is another (unconfirmed) problem for RadCompression?
context.Response.AddHeader(
"Content-Length"
, currentFileInfo.Length.ToString)
context.Response.StatusCode = 200
''''The following line breaks RadCompression in IIS7
'context.Flush()
context.Response.WriteFile(fullPath)
context.Response.Flush()
context.Response.
End
()
Else
context.Response.StatusCode = 200
context.Response.Write(
"No data located for this request."
)
context.Response.
End
()
End
If
End
If
End
Sub
<
script
type
=
"text/javascript"
>
function rowDropping(sender, eventArgs) {
// Fired when the user drops a grid row
var htmlElement = eventArgs.get_destinationHtmlElement();
var scheduler = $find('<%= RadScheduler1.ClientID %>');
if (isPartOfSchedulerAppointmentArea(htmlElement)) {
// The row was dropped over the scheduler appointment area
// Find the exact time slot and save its unique index in the hidden field
var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);
alert(timeSlot.get_index());
$get("TargetSlotHiddenField").value = timeSlot.get_index();
// The HTML needs to be set in order for the postback to execute normally
eventArgs.set_destinationHtmlElement("TargetSlotHiddenField");
}
else {
// The node was dropped elsewhere on the document
eventArgs.set_cancel(true);
}
}
function isPartOfSchedulerAppointmentArea(htmlElement) {
return $telerik.$(htmlElement).parents().is("div.rsAllDay") ||
$telerik.$(htmlElement).parents().is("div.rsContent")
}
function onRowDoubleClick(sender, args) {
sender.get_masterTableView().editItem(args.get_itemIndexHierarchical());
}
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"grdActivity"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"grdActivity"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<
div
id
=
"RecentActivityContent"
class
=
"QuickViewContent"
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"grdActivity"
DataSourceID
=
"objActivity"
Width
=
"360px"
GridLines
=
"Horizontal"
Skin
=
"Sunset"
ShowHeader
=
"false"
>
<
HeaderStyle
CssClass
=
"HistoryGridHeader"
/>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
></
PagerStyle
>
<
MasterTableView
AutoGenerateColumns
=
"false"
CssClass
=
"GridRecentActivity"
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldAlias
=
"Date"
FieldName
=
"Date"
FormatString
=
"{0:D}"
HeaderValueSeparator
=
" from date: "
/>
</
SelectFields
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"Date"
SortOrder
=
"Descending"
>
</
telerik:GridGroupByField
>
</
GroupByFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
<
Columns
>
<
telerik:GridTemplateColumn
DataField
=
"Message"
HeaderText
=
"Message"
UniqueName
=
"Message"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
id
=
"Label1"
Text='<%# Eval("Type") %>' CssClass="FirstColumn" /> -
<
asp:Label
runat
=
"server"
id
=
"lblMessage"
Text='<%# Eval("Message") %>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
ReorderColumnsOnClient
=
"True"
AllowDragToGroup
=
"True"
AllowColumnsReorder
=
"True"
>
<
Selecting
AllowRowSelect
=
"True"
></
Selecting
>
<
Resizing
AllowRowResize
=
"True"
AllowColumnResize
=
"True"
EnableRealTimeResize
=
"True"
ResizeGridOnColumnResize
=
"False"
></
Resizing
>
</
ClientSettings
>
</
telerik:RadGrid
>