ActionResultBase IDomainEdit.Edit(DomainItem DomainToEdit, IOptionData properties)
        {
            cPanel_Domain cpDomain = DomainToEdit as cPanel_Domain;

            if (cpDomain == null)
            {
                throw new ArgumentException("Wrong type of argument, the expected cPanel_Domain type.", "Domain");
            }
            cPanel_ActionResult result = new cPanel_ActionResult();

            result.DataNodeProccessor = new cPanel_ActionResult.DataNodeHandler((nodeList) =>
            {
                if (nodeList != null)
                {
                    return(ActionResultCode.Success);
                }
                return(ActionResultCode.Error_UknowError);
            });
            CommandArgs[] commands = new CommandArgs[]
            {
                new CommandArgs("rootdomain", cpDomain.ExtViewData["rootdomain"]),
                new CommandArgs("subdomain", cpDomain.ExtViewData["subdomain"]),
                properties.ToCommandArgs(cpDomain.Name)[0]
            };
            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("SubDomain", "changedocroot", commands), this.Account.WebSession));
            return(result);
        }
        ActionResultBase IDomainAdd.Add(DomainItem Domain, IOptionData properties)
        {
            cPanel_ActionResult result = new cPanel_ActionResult();

            result.DataNodeProccessor = new cPanel_ActionResult.DataNodeHandler((nodeList) =>
            {
                if (nodeList != null)
                {
                    string status = nodeList[0]["reason"].InnerText;
                    if (status.Contains("already exists") || status.Contains("Deleted domain: "))
                    {
                        return(ActionResultCode.Error_ItemAlreadyExist);
                    }
                    //you are not allowed to add any more than
                    if (!status.Contains("was successfully parked"))
                    {
                        return(ActionResultCode.Error_UknowError);
                    }
                }
                return(ActionResultCode.Success);
            });

            CommandArgs[] commands = new CommandArgs[]
            {
                properties.ToCommandArgs(Domain.Name)[0],
                new CommandArgs("newdomain", Domain.Name),
                new CommandArgs("subdomain", Domain.Name.Replace(".", ""))
            };
            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("AddonDomain", "addaddondomain", commands), this.Account.WebSession));
            return(result);
        }
예제 #3
0
        ActionResultBase IDomainEdit.Edit(DomainItem Domain2Edit, IOptionData properties)
        {
            ISPmanager_ActionResult result   = new ISPmanager_ActionResult();
            List <CommandArgs>      commands = new List <CommandArgs>(properties.ToCommandArgs(Domain2Edit.Name));

            commands.Add(new CommandArgs("elid", Domain2Edit.Name));
            commands.Add(new CommandArgs("admin", "admin@" + Domain2Edit.Name));
            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("wwwdomain.edit", commands.ToArray()), this.Account.WebSession));
            return(result);
        }
예제 #4
0
 ActionResultBase IAdd.Add(WebPanelItemBase addObject, IOptionData properties)
 {
     if (addObject is SubDomainItem && this is IWebPanelObjectActions.ISubDomainActions.ISubDomainAdd)
     {
         return(((IWebPanelObjectActions.ISubDomainActions.ISubDomainAdd) this).Add(addObject as SubDomainItem, properties));
     }
     else if (addObject is DomainItem && this is IWebPanelObjectActions.IDomainActions.IDomainAdd)
     {
         return(((IWebPanelObjectActions.IDomainActions.IDomainAdd) this).Add(addObject as DomainItem, properties));
     }
     throw new ArgumentException("Not Supported add object type!");
 }
예제 #5
0
 ActionResultBase IEdit.Edit(WebPanelItemBase editObject, IOptionData properties)
 {
     if (editObject is SubDomainItem && this is IWebPanelObjectActions.ISubDomainActions.ISubDomainEdit)
     {
         return(((IWebPanelObjectActions.ISubDomainActions.ISubDomainEdit) this).Edit(editObject as SubDomainItem, properties));
     }
     else if (editObject is DomainItem && this is IWebPanelObjectActions.IDomainActions.IDomainEdit)
     {
         return(((IWebPanelObjectActions.IDomainActions.IDomainEdit) this).Edit(editObject as DomainItem, properties));
     }
     throw new ArgumentException("Not Supported object type!");
 }
        ActionResultBase ISubDomainAdd.Add(SubDomainItem SubDomain2Add, IOptionData properties)
        {
            DirectAdmin_ActionResult result = new DirectAdmin_ActionResult();

            CommandArgs[] commands = new CommandArgs[]
            {
                new CommandArgs("domain", SubDomain2Add.RootDomain),
                new CommandArgs("subdomain", SubDomain2Add.SubDomainName),
            };
            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("CMD_API_SUBDOMAINS", "create", commands), this.Account.WebSession));
            return(result);
        }
예제 #7
0
        private void StartActionsButton_Click(object sender, EventArgs e)
        {
            this.LogRTBox.Clear();
            this.ProgressListBox.Items.Clear();
            this.workCollection = new WebPanelItemCollection(this.workType);
            System.Text.RegularExpressions.Regex domainPatern = new System.Text.RegularExpressions.Regex(".+\\..{2,8}$");
            for (int id = 0; id < this.DomaintBox.Lines.Length; id++)
            {
                string Domain = this.DomaintBox.Lines[id].Trim().ToLower().Replace("https://", "").Replace("http://", "");
                int    foundSlashSubdomain = Domain.IndexOf("/");
                if (foundSlashSubdomain != -1)
                {
                    Domain = Domain.Remove(foundSlashSubdomain, Domain.Length - foundSlashSubdomain);
                }
                if (Domain.StartsWith("www."))
                {
                    Domain = Domain.TrimStart('w', '.');
                }
                if (!String.IsNullOrEmpty(Domain) && domainPatern.IsMatch(Domain))
                {
                    this.ProgressListBox.Items.Add(new ListViewItem(Domain)
                    {
                        Name = Domain
                    });
                    this.workCollection.Add(new WebPanelItems.DomainItem(Domain));
                }
            }
            this.DomaintBox.Lines = this.workCollection.ToStringArray();
            if (this.workCollection.Count == 0)
            {
                this.StartAddButton.Enabled = false;
                MessageBox.Show("Прежде чем продолжить, укажите объекты для добавления в правильном формате!");
                this.tablessControl1.SelectedIndex = 0;
                return;
            }
            this.StopAddButton.Enabled = !(this.buttonStepBack.Enabled = this.StartAddButton.Enabled = false);

            this.LogRTBox.WriteToLog("Процесс начат.");
            this.ActionBackGroundWorker.PropertyData = this.PropertyData;
            this.ActionBackGroundWorker.RunWorkerAsync(this.workCollection);
        }
 public SettingsField()
 {
     Option = this;
 }
예제 #9
0
 public ActionsTaskForm(ActionsType _actionsType, WebPanelItemCollection ItemsToProcess, Type _workType, WebPanelOptionData.IOptionData ExtOptions)
 {
     InitializeComponent();
     this.actionsType = _actionsType;
     if (this.actionsType == ActionsType.Add)
     {
         this.ActionBackGroundWorker = new WebPanelActionsTask.ActionAddTask();
         this.TaskTypePict.Image     = global::BatchDomainTools.Properties.Resources.AddTaskIcon;
         this.Text       = "Добавления новых объектов";
         this.desription = new Dictionary <string, string>()
         {
             { "Укажите объекты для добавления", "Каждый добавляемый объект должен начинаться с новой строки" },
             { "Вы можете указать параметры для добавляемых объектов", "По умолчанию используются стандартные параметры для панели" },// из настроек программы"},
             { "Все готово, можно начинать процесс добавления", "Нажмите кнопку старта для начала процесса добавления" }
         };
     }
     else
     {
         if (this.actionsType == ActionsType.Edit)
         {
             this.ActionBackGroundWorker = new WebPanelActionsTask.ActionEditTask();
             this.TaskTypePict.Image     = global::BatchDomainTools.Properties.Resources.EditTaskIcon;
             this.Text       = "Редактирование выделенных объектов";
             this.desription = new Dictionary <string, string>()
             {
                 { "Укажите объекты для редактирования", "Каждый редактируемый объект должен начинаться с новой строки" },
                 { "Измените параметры для редактируемых объектов", "По умолчанию используются стандартные параметры для панели" },
                 { "Все готово, можно начинать процесс редактирования", "Нажмите кнопку старта для начала процесса редактирования" }
             };
         }
         else if (this.actionsType == ActionsType.Remove)
         {
             this.ActionBackGroundWorker = new WebPanelActionsTask.ActionRemoveTask();
             this.TaskTypePict.Image     = global::BatchDomainTools.Properties.Resources.DeleteTaskIcon;
             this.Text       = "Удаление выделенных объектов";
             this.desription = new Dictionary <string, string>()
             {
                 { "Укажите объекты для удаления", "Каждый удаляемый объект должен начинаться с новой строки" },
                 { "Измените параметры удаления объектов", "По умолчанию будут использованны параметры из настроек программы" },
                 { "Можно начинать процесс удаления", "Для начала процесса удаления нажмите на кнопку старта" }
             };
         }
     }
     if (ExtOptions == null)
     {
         this.tablessControl1.TabPages.Remove(this.PropertyChangeTabPage);
         this.desription.Remove(this.desription.ElementAt(1).Key);
     }
     else
     {
         this.PropertyData = ExtOptions;
         this.OptionsGrid.SelectedObject        = this.PropertyData;
         this.OptionsGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(OprionsGrid_PropertyValueChanged);
     }
     this.tablessControl1.SelectedIndexChanged      += new EventHandler(tablessControl1_SelectedIndexChanged);
     this.ActionBackGroundWorker.ProgressChanged    += new ProgressChangedEventHandler(bgWorker_ProgressChanged);
     this.ActionBackGroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ActionBackGroundWorker_RunWorkerCompleted);
     this.workType      = _workType;
     this.panel3.Paint += new PaintEventHandler((_sender, _e) =>
     {
         ControlPaint.DrawBorder(_e.Graphics, _e.ClipRectangle,
                                 Color.Transparent, 0, ButtonBorderStyle.None,
                                 Color.FromArgb(223, 223, 223), 1, ButtonBorderStyle.Solid,
                                 Color.Transparent, 0, ButtonBorderStyle.None,
                                 Color.Transparent, 0, ButtonBorderStyle.None);
     });
     this.panel2.Paint += new PaintEventHandler((__sender, __e) =>
     {
         ControlPaint.DrawBorder(__e.Graphics, __e.ClipRectangle,
                                 Color.Transparent, 0, ButtonBorderStyle.None,
                                 Color.Transparent, 0, ButtonBorderStyle.Solid,
                                 Color.Transparent, 0, ButtonBorderStyle.None,
                                 Color.FromArgb(223, 223, 223), 1, ButtonBorderStyle.Solid);
     });
     this.TitleLabel.Text      = desription.ElementAt(this.tablessControl1.SelectedIndex).Key;
     this.Desriptionlabel.Text = desription.ElementAt(this.tablessControl1.SelectedIndex).Value;
     if (ItemsToProcess != null)
     {
         this.DomaintBox.Lines = ItemsToProcess.ToStringArray();
     }
 }