protected void RadFileExplorer1_ItemCommand(object sender, RadFileExplorerEventArgs e) { if (e.Command.Equals("UploadFile")) { RadProgressContext context = RadProgressContext.Current; context.SecondaryTotal = "100"; for (int i = 1; i < 100; i++) { // A very time consumming task context.SecondaryValue = i.ToString(); context.SecondaryPercent = i.ToString(); context.CurrentOperationText = "Doing step " + i.ToString(); if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } // simulate a long time performing the current step System.Threading.Thread.Sleep(100); } try { //create the purgeResult object HostSite.Web.UI.ServiceReference1.PurgeResult r = new HostSite.Web.UI.ServiceReference1.PurgeResult(); HostSite.Web.UI.ServiceReference1.PurgeApiClient a; a = new HostSite.Web.UI.ServiceReference1.PurgeApiClient(); string[] options = new string[4]; string[] uri = new string[1]; //get the login credential and other data for Akamai from the web.config options[0] = ConfigurationManager.AppSettings["AkamaiCCUEmail"].ToString(); options[1] = ConfigurationManager.AppSettings["AkamaiCCUAction"].ToString(); options[2] = ConfigurationManager.AppSettings["AkamaiCCUType"].ToString(); options[3] = ConfigurationManager.AppSettings["AkamaiCCUDomain"].ToString(); //build the URL to the file that was uploaded uri[0] = "http://www.yourdomain.com" + e.Path; //request the content purge r = a.purgeRequest(ConfigurationManager.AppSettings["AkamaiCCUUserName"].ToString(), ConfigurationManager.AppSettings["AkamaiCCUPassword"].ToString(), "", options, uri); //log the activity Web.Core.Context.Current.LogMessage("Akamai CCU WebService Message: " + r.resultCode + " " + r.resultMsg + " " + r.sessionID + " " + uri[0].ToString()); } catch (Exception ex) { //something didn't work so let's report the issue Web.Core.Context.Current.LogMessage("Error Akamai CCU WebService Message: ", ex); } } }
public void FileExplorer1_ItemCommand(object sender, RadFileExplorerEventArgs e) { //lblAbout.Text = e.Command; switch (e.Command) { case "MoveDirectory": if (!CanEdit) { e.Cancel = true; } break; case "DeleteDirectory": if (UseRecycleBin && !string.IsNullOrEmpty(RecycleBinPath)) { //recyclebin is enabled string strSource = HttpContext.Current.Server.MapPath(e.Path); string[] straContent = Directory.GetDirectories(strSource); if (straContent != null && straContent.Length > 0) { //return ("When Recycle Bin is enabled only empty directories can be deleted!"); e.Cancel = true; //Response.Write("<script>alert('Folders with files can not be deleted when the Recycle Bin is enabled.');</script>"); } straContent = Directory.GetFiles(strSource); if (straContent != null && straContent.Length > 0) { //return ("When Recycle Bin is enabled only empty directories can be deleted!"); e.Cancel = true; //Response.Write("<script>alert('Folders with files can not be deleted when the Recycle Bin is enabled.');</script>"); } } break; case "DeleteFile": string strDidBackup = "NO"; if (UseRecycleBin && !string.IsNullOrEmpty(RecycleBinPath)) { //recyclebin is enabled strDidBackup = SendToRecycleBin(e.Path); if (strDidBackup != string.Empty) { //return ("File not deleted because of backup error: " + strDidBackup); e.Cancel = true; //Response.Write("<script>alert('Error sending file to the Recycle Bin.');</script>"); } BindRecycleBinGrid(); } break; case "MoveFile": if (!CanEdit) { e.Cancel = true; } int versionsMoved = MoveFileVersions(e.Path, e.NewPath); break; case "UploadFile": RadProgressContext context = RadProgressContext.Current; context.SecondaryTotal = "100"; for (int i = 1; i < 100; i++) {// A very time consumming task context.SecondaryValue = i.ToString(); context.SecondaryPercent = i.ToString(); context.CurrentOperationText = "Doing step " + i.ToString(); if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } // simulate a long time performing the current step //System.Threading.Thread.Sleep(100); } break; case "CreateDirectory": //Create new DNN folder and copy parent permissions FolderInfo newdNNFolder = (FolderInfo)FolderManager.Instance.AddFolder(PortalId, QuickDocsController.RemoveSitePath(e.Path + e.NewPath, PortalId)); FolderManager.Instance.CopyParentFolderPermissions(newdNNFolder); e.Cancel = true; break; case "Download": Response.Write("<script>alert('Download');</script>"); break; default: break; } FolderManager.Instance.Synchronize(PortalId, Settings["RootFolder"].ToString(), true, true); }