Ejemplo n.º 1
0
 public void _contentView_UserAction(object sender, UserActionEventArgs e)
 {
     if (e.ActionName == "save")
     {
         e.ContentView.UpdateContent();
         if (e.ContentView.IsUserInputValid && _content.IsValid)
         {
             string t = RepositoryPath.Combine(_content.ContentHandler.ParentPath, _content.Fields["Name"].GetData() as string);
             //PathInfoRemove:
             //if (RepositoryPathInfo.GetPathInfo(t) == null)
             if (NodeHead.Get(t) == null)
             {
                 _content.Save();
                 ProcessUserAction();
             }
             else
             {
                 if (_content.ContentHandler.Id > 0)
                 {
                     _content.Save();
                     ProcessUserAction();
                 }
                 else
                 {
                     this._recreateEditContentView = false;
                     this._recreateNewContentView  = false;
                     this._displayMode             = GetViewModeName(ViewMode.Browse);
                     this._errorMessage            = HttpContext.GetGlobalResourceObject("SingleContentPortlet", "ContentNameAlreadyExists") as string;
                 }
             }
         }
         else
         {
             this._recreateNewContentView = true;
             _content.DontSave();
         }
     }
     else if (e.ActionName == "cancel")
     {
         _recreateNewContentView  = false;
         _recreateEditContentView = false;
         _displayMode             = GetViewModeName(ViewMode.Browse);
         _container.Controls.Clear();
         CreateChildControls();
     }
     else
     {
         this._recreateNewContentView  = false;
         this._recreateEditContentView = false;
         _container.Controls.Clear();
     }
 }