Exemple #1
0
 void controller_SelectedItemsAction(object sender, SelectedItemsActionCancelEventArgs e)
 {
     if (SelectedItemsAction != null)
     {
         SelectedItemsAction(this, e);
     }
 }
 private void OnSelectedItemsAction(SelectedItemsActionCancelEventArgs e)
 {
     if (SelectedItemsAction != null)
     {
         SelectedItemsAction(this, e);
     }
 }
        private string ProcessSelectedItemsAction(FileManagerItemInfo srcDir, FileManagerItemInfo destDir, FileManagerItemInfo[] items, SelectedItemsAction action)
        {
            if (items.Length == 0)
                return "";

            SelectedItemsActionCancelEventArgs cancelArg = new SelectedItemsActionCancelEventArgs(action);
            foreach (FileManagerItemInfo item in items)
            {
                if (item.Directory.Exists && destDir.Directory.FullName.StartsWith(item.Directory.FullName, StringComparison.InvariantCultureIgnoreCase))
                    return ClientMessageEventReference(GetResourceString("DestinationFolderIsSubfolder", "The destination folder is a subfolder of the source folder."));
                cancelArg.SelectedItems.Add(item);
            }
            cancelArg.DestinationDirectory = destDir;
            OnSelectedItemsAction(cancelArg);
            if (cancelArg.Cancel)
            {
                return ClientMessageEventReference(cancelArg.ClientMessage);
            }

            StringBuilder sb = new StringBuilder();

            switch (action)
            {
                case IZ.WebFileManager.SelectedItemsAction.Delete:
                    if (ProcessSelectedItemsDelete(items))
                        AddFolderTreeRefreshEventReference(sb, srcDir);
                    break;
                case IZ.WebFileManager.SelectedItemsAction.Move:
                    destDir.EnsureDirectoryExists();
                    if (ProcessSelectedItemsMoveTo(destDir, items))
                    {
                        AddFolderTreeRequireRefreshEventReference(sb, srcDir, destDir);
                        AddFolderTreeNavigateEventReference(sb, srcDir);
                    }
                    break;
                case IZ.WebFileManager.SelectedItemsAction.Copy:
                    destDir.EnsureDirectoryExists();
                    if (ProcessSelectedItemsCopyTo(destDir, items))
                    {
                        AddFolderTreeRequireRefreshEventReference(sb, srcDir, destDir);
                        AddFolderTreeNavigateEventReference(sb, srcDir);
                    }
                    break;
            }

            SelectedItemsActionEventArgs args = new SelectedItemsActionEventArgs();
            OnSelectedItemsActionComplete(args);

            sb.AppendLine(ClientRefreshEventReference);
            return sb.ToString();
        }
 private void OnSelectedItemsAction(SelectedItemsActionCancelEventArgs e)
 {
     if (SelectedItemsAction != null)
         SelectedItemsAction (this, e);
 }
        private string ProcessOpenCommand(FileManagerItemInfo item)
        {
            var cancelArg = new SelectedItemsActionCancelEventArgs(WebFileManager.SelectedItemsAction.Open);
            cancelArg.SelectedItems.Add(item);
            OnSelectedItemsAction(cancelArg);
            if (cancelArg.Cancel)
                return ClientMessageEventReference(cancelArg.ClientMessage);

            var sb = new StringBuilder();

            if (ClientOpenItemFunction.Length > 0)
            {
                sb.AppendLine("var href = '" + EncodeURIComponent(item.VirtualPath) + "';");
                sb.AppendLine(ClientOpenItemFunction + "(decodeURIComponent(href));");
            }
            else
            {
                sb.AppendLine("var href = '" + EncodeURIComponent(item.VirtualPath) + "';");
                sb.AppendLine(@"window.open(encodeURI(decodeURIComponent(href)).replace(/\+/g, '%2b').replace(/#/g, '%23'),'_blank');");
            }
            return sb.ToString();
        }
        private string ProcessOpenDirectory(FileManagerItemInfo item)
        {
            var cancelArg = new SelectedItemsActionCancelEventArgs(WebFileManager.SelectedItemsAction.Open);
            cancelArg.SelectedItems.Add(item);
            OnSelectedItemsAction(cancelArg);
            if (cancelArg.Cancel)
                return ClientMessageEventReference(cancelArg.ClientMessage);

            var sb = new StringBuilder();
            AddFolderTreeNavigateEventReference(sb, item);
            sb.AppendLine("var dir = '" + EncodeURIComponent(item.FileManagerPath) + "'");
            sb.AppendLine("WebForm_GetElementById(context.ClientID+'_Directory').value = dir;");
            sb.AppendLine("var address = WebForm_GetElementById(context.ClientID+'_Address');");
            sb.AppendLine("if(address) address.value = decodeURIComponent(dir);");
            sb.AppendLine("var searchTerm = WebForm_GetElementById(context.ClientID+'_SearchTerm');");
            sb.AppendLine("if(searchTerm) searchTerm.value = '';");
            sb.AppendLine("window['WFM_' + context.ClientID].ClearSearchBox();");
            sb.AppendLine(ClientRefreshEventReference);
            return sb.ToString();
            
        }
 void controller_SelectedItemsAction(object sender, SelectedItemsActionCancelEventArgs e)
 {
     if (SelectedItemsAction != null)
         SelectedItemsAction(this, e);
 }