Пример #1
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (lvwUsers.SelectedItems != null && lvwUsers.SelectedItems.Count == 1)
         {
             if (!IsList)
             {
                 if (objUIRights.DeleteRight)
                 {
                     DialogResult dr = new DialogResult();
                     dr = MessageBox.Show("Do You Want to Delete Record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                     if (dr == DialogResult.Yes)
                     {
                         User objUser = new User();
                         objUser = UserManager.GetItem(Convert.ToInt32(lvwUsers.SelectedItems[0].Name));
                         UserManager.Delete(objUser);
                         lvwUsers.Items.Remove(lvwUsers.SelectedItems[0]);
                     }
                 }
                 else
                 {
                     throw new Exception("Not Authorised.");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Пример #2
0
    /// <summary>
    /// Gets a collection of the current user's recently edited content items
    /// </summary>
    private IEnumerable <ContentData> loadContentData()
    {
        ContentManager cAPI = new ContentManager();
        UserManager    uAPI = new UserManager();

        var me = uAPI.GetItem(cAPI.UserId, true);

        ContentCriteria criteria = new ContentCriteria();

        criteria.OrderByField = ContentProperty.DateModified;
        criteria.AddFilter(ContentProperty.UserId, CriteriaFilterOperator.EqualTo, me.Id);
        criteria.AddFilter(ContentProperty.FolderName, CriteriaFilterOperator.NotEqualTo, "Workspace");
        criteria.AddFilter(ContentProperty.FolderName, CriteriaFilterOperator.NotEqualTo, "_meta_");

        if (this.DaysLimit > 0)
        {
            criteria.AddFilter(ContentProperty.DateModified, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.AddDays(-DaysLimit));
        }

        if (this.PublishedOnly)
        {
            criteria.AddFilter(ContentProperty.Status, CriteriaFilterOperator.EqualTo, "A");
        }

        var list = cAPI.GetList(criteria);

        if (this.ItemLimit > 0)
        {
            list = list.Take(this.ItemLimit).ToList();
        }

        return(list);
    }
Пример #3
0
 public frmMain(Int32 userID, Int32 companyID)
 {
     //Int32 appUserID, currentCompanyID;
     //appUserID = userID;
     //currentCompanyID = companyID;
     CurrentCompany = frmMainManager.LoadCompany(companyID);
     CurrentUser    = UserManager.GetItem(userID);
     curUserRights  = UserRightsManager.GetUserRights(userID);
     InitializeComponent();
 }
Пример #4
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwUsers.SelectedItems != null && lvwUsers.SelectedItems.Count == 1)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        if (objUIRights.ModifyRight)
                        {
                            User        objUser;
                            frmUserProp objFrmUser;

                            objUser = UserManager.GetItem(Convert.ToInt32(lvwUsers.SelectedItems[0].Name));
                            if (objUser != null)
                            {
                                objFrmUser                    = new frmUserProp(objUser, currentUser);
                                objFrmUser.IsNew              = false;
                                objFrmUser.MdiParent          = this.MdiParent;
                                objFrmUser.Entry_DataChanged += new frmUserProp.UserUpdateHandler(Entry_DataChanged);
                                objFrmUser.Show();
                            }
                            else
                            {
                                MessageBox.Show(this, "Record Can't be Displayed due to Null Object.", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
    protected void btncreateaccount_Click(object sender, EventArgs e)
    {
        Page.Validate();
        if (Page.IsValid)
        {
            //try
            //{
            string emailAddress = txtEmail.Text;
            if (!string.IsNullOrEmpty(emailAddress))
            {
                try
                {

                    System.Net.Mail.MailAddress addr = new System.Net.Mail.MailAddress(emailAddress);
                }
                catch
                {
                    litErrorMsg.Text = "Please Enter Valid Email Address.";
                    return;
                }
            }
            UserData userToCreate = new UserData()
            {
                Username = txtUsername.Text,
                Password = txtPassword.Text,
                FirstName = txtFirstName.Text,
                LastName = txtLastname.Text,
                DisplayName = txtUsername.Text,
                Email = txtEmail.Text,
                IsMemberShip = true
            };
            userToCreate.CustomProperties = userManager.GetCustomPropertyList();
            userToCreate.CustomProperties["Phone"].Value = txtPhone.Text;
            userToCreate.CustomProperties["Country"].Value = ddlCountrylist.SelectedValue;
            userToCreate.CustomProperties["Time Zone"].Value = "GMT Standard Time";

            string userSubs = "";

            if (chkHotDeals.Checked)
                userSubs = Resources.ID.SubscriptionHotDealsId;

            if (chkNews.Checked)
                userSubs += "," + Resources.ID.SubscriptionNewsId;
            if (userSubs.StartsWith(","))
                userSubs = userSubs.Remove(0, 1);

            userToCreate.CustomProperties["Subscriptions"].Value = userSubs;

            Ektron.Cms.Framework.User.UserManager umanager = new UserManager();
            UserData userToEdit = umanager.GetItem(Ektron.Cms.CommonApi.Current.UserId, true);

            userToEdit.FirstName = userToCreate.FirstName;
            userToEdit.LastName = userToCreate.LastName;
            userToEdit.Email = userToCreate.Email;
            userToEdit.CustomProperties["Phone"].Value = userToCreate.CustomProperties["Phone"].Value;
            userToEdit.CustomProperties["Country"].Value = userToCreate.CustomProperties["Country"].Value;
            userToEdit.CustomProperties["Time Zone"].Value = userToCreate.CustomProperties["Time Zone"].Value;
            userToEdit.Username = userToCreate.Username;
            userToEdit.Password = userToCreate.Password;
            userToEdit.DisplayName = userToCreate.Email;

            umanager.Update(userToEdit);

            if (userToEdit.Id != 0)
            {
                divRegistrationwrapper.Visible = false;
                litErrorMsg.Text = "<br /><br />" + Resources.Text.UserCreatedSuccess + "<br /><br />";
            }
            else
            {
                litErrorMsg.Text = Resources.Text.UserCreatedFail;
            }
            //}

            //catch (Exception ex)
            //{
            //    litErrorMsg.Text = Resources.Text.UserCreatedFail;
            //}
        }
    }
Пример #6
0
    protected void Process_EditGroup()
    {
        string adminUsersValue = hdnAdminUsers.Value.ToString();

        if (!String.IsNullOrEmpty(adminUsersValue))
        {
            // An admin was selected, tidy and split into array
            if (hdnAdminUsers.Value.ToString().IndexOf(",") == 0)
            {
                hdnAdminUsers.Value = hdnAdminUsers.Value.ToString().Substring(1);
            }
            hdnAdminUsers.Value = hdnAdminUsers.Value.ToString().Replace(",,", ",");
            if (hdnAdminUsers.Value.ToString().Substring(hdnAdminUsers.Value.ToString().Length - 1) == ",")
            {
                hdnAdminUsers.Value = hdnAdminUsers.Value.ToString().Remove(hdnAdminUsers.Value.ToString().Length - 1);
            }

            char[] delimiter = new char[] { ',' };
            strAdminUsers = hdnAdminUsers.Value.ToString().Split(delimiter);
        }
        else
        {
            // Admin not selected, current user becomes admin
            strAdminUsers = new string[1]{ m_userId.ToString() };
        }

        if (bAccess)
        {
            if (m_iID > 0)
            {
                cgGroup = this.m_refCommunityGroupApi.GetCommunityGroupByID(this.m_iID);
                groupMessageBoardModerate = _MessageBoardApi.IsModerated(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup);
                if (groupMessageBoardModerate != false || chkMsgBoardModeration.Checked != false)
                {
                    _MessageBoardApi.Moderate(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup, m_userId, System.Convert.ToBoolean(this.chkMsgBoardModeration.Checked));
                }
            }
            else
            {
                cgGroup = new CommunityGroupData();
            }

            cgGroup.GroupName = (string)(this.GroupName_TB.Text.Trim());
            calendardata.Name = "ekCalendar";
            calendardata.Description = "";
            if (Request.Form["ektouserid__Page"] != "" && Information.IsNumeric(Request.Form["ektouserid__Page"]) && Convert.ToInt64(Request.Form["ektouserid__Page"]) > 0)
            {
                if (m_iID > 0)
                {
                    Ektron.Cms.Common.Cache.ApplicationCache.Invalidate((string)("GroupAccess_" + m_iID.ToString() + "_" + cgGroup.GroupAdmin.Id.ToString())); // old
                }
                cgGroup.GroupAdmin.Id = Convert.ToInt64(Request.Form["ektouserid__Page"]);
                if (m_iID > 0)
                {
                    Ektron.Cms.Common.Cache.ApplicationCache.Invalidate((string)("GroupAccess_" + m_iID.ToString() + "_" + cgGroup.GroupAdmin.Id.ToString())); // new
                }
            }
            cgGroup.GroupShortDescription = (string)this.ShortDescription_TB.Text;
            cgGroup.GroupLongDescription = (string)this.Description_TB.Text;
            if (m_iID > 0 && !(cgGroup.GroupEnroll == this.PublicJoinYes_RB.Checked))
            {
                Ektron.Cms.Common.Cache.ApplicationCache.Invalidate((string)("GroupEnroll_" + m_iID.ToString()));
            }
            cgGroup.GroupEnroll = System.Convert.ToBoolean(this.PublicJoinYes_RB.Checked);
            cgGroup.GroupLocation = (string)this.Location_TB.Text;
            cgGroup.GroupHidden = System.Convert.ToBoolean(this.PublicJoinHidden_RB.Checked);
            cgGroup.GroupEnableDistributeToSite = System.Convert.ToBoolean(this.EnableDistributeToSite_CB.Checked);
            cgGroup.AllowMembersToManageFolders = System.Convert.ToBoolean(this.AllowMembersToManageFolders_CB.Checked);

            cgGroup.EnableDocumentsInNotifications = System.Convert.ToBoolean(this.chkEnableDocumentNotifications.Checked);
            cgGroup.EnableGroupEmail = System.Convert.ToBoolean(this.chkEnableEmail.Checked);
            cgGroup.EmailAccountName = EkFunctions.HtmlEncode(this.txtEmailAccount.Text);
            cgGroup.EmailAddress = EkFunctions.HtmlEncode(this.txtEmailAddressValue.Text);

            if (this.txtEmailPassword.Text != "*****")
            {
                cgGroup.EmailPassword = (string)this.txtEmailPassword.Text;
            }

            // taxonomy
            TaxonomyTreeIdList = Request.Form[taxonomyselectedtree.UniqueID];
            if (TaxonomyTreeIdList.Trim().EndsWith(","))
            {
                TaxonomyTreeIdList = TaxonomyTreeIdList.Substring(0, TaxonomyTreeIdList.Length - 1);
            }
            TaxonomyRequest tax_request = new TaxonomyRequest();
            tax_request.TaxonomyIdList = TaxonomyTreeIdList;
            cgGroup.GroupCategory = TaxonomyTreeIdList;
            // taxonomy
            // file
            string sfileloc = "";
            if (fileupload1.PostedFile != null && fileupload1.PostedFile.FileName != "") //Check to make sure we actually have a file to upload
            {
                string strLongFilePath = (string)fileupload1.PostedFile.FileName;
                string[] aNameArray = Strings.Split((string)fileupload1.PostedFile.FileName, "\\", -1, 0);
                string strFileName = "";
                if (aNameArray.Length > 0)
                {
                    strFileName = aNameArray[(aNameArray.Length - 1)];
                }
                strFileName = (string)((System.Guid.NewGuid().ToString()).Substring(0, 5) + "_g_" + strFileName);
                if ((((string)fileupload1.PostedFile.ContentType == "image/pjpeg") || ((string)fileupload1.PostedFile.ContentType == "image/jpeg")) || ((string)fileupload1.PostedFile.ContentType == "image/gif")) //Make sure we are getting a valid JPG/gif image
                {
                    fileupload1.PostedFile.SaveAs(Server.MapPath(m_refCommunityGroupApi.SitePath + "uploadedimages/" + strFileName));
                    lbStatus.Text = string.Format(m_refCommunityGroupApi.EkMsgRef.GetMessage("lbl success avatar uploaded"), strFileName, m_refCommunityGroupApi.SitePath + "uploadedimages/" + strFileName);
                    Utilities.ProcessThumbnail(Server.MapPath(m_refCommunityGroupApi.SitePath + "uploadedimages/"), strFileName);
                }
                else
                {
                    //Not a valid jpeg/gif image
                    lbStatus.Text = m_refCommunityGroupApi.EkMsgRef.GetMessage("lbl err avatar not valid extension");
                }
                sfileloc = m_refCommunityGroupApi.SitePath + "uploadedimages/thumb_" + Utilities.GetCorrectThumbnailFileWithExtn(strFileName);
                cgGroup.GroupImage = sfileloc;
            }
            else
            {
                cgGroup.GroupImage = (string)this.GroupAvatar_TB.Text;
            }
            // file
            if (m_iID > 0)
            {
                m_refCommunityGroupApi.UpdateCommunityGroup(cgGroup);
                UpdateGroupTags(false);
                InitiateProcessAction();
                RemoveCurrentAdminUsers();//Need to remove all admins then re-added
                AddMultipleGroupAdmins(strAdminUsers);
            }
            else
            {
                UserManager Usermanager = new UserManager();
                UserData userBaseData = null;
                List<UserData> userlist = new List<UserData>();
                long longUserId;
                foreach (string userId in strAdminUsers)
                {
                    if (long.TryParse(userId, out longUserId) && longUserId > 0)
                        userBaseData = Usermanager.GetItem(longUserId);
                    if (userBaseData != null && userBaseData.Id > 0)
                        userlist.Add(userBaseData);
                }
                cgGroup.Admins = userlist;
                m_iID = m_refCommunityGroupApi.AddCommunityGroup(cgGroup);

                //ADDTAXONOMYITEM to Group eIntranet
                if (!(string.IsNullOrEmpty(TaxonomyTreeIdList)))
                {
                    TaxonomyTreeIdList = TaxonomyTreeIdList + ",";
                }
                else
                {
                    TaxonomyTreeIdList = "";
                }
                if (profileTaxonomyId > 0)
                {
                    m_refCommunityGroupApi.EkContentRef.AddDirectoryItem(TaxonomyTreeIdList + profileTaxonomyId.ToString(), m_iID.ToString(), Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group);
                }
                else
                {
                    profileTaxonomyId = m_refCommunityGroupApi.EkContentRef.GetTaxonomyIdByPath("\\" + m_refCommunityGroupApi.UserId + "\\Groups", 1);
                    m_refCommunityGroupApi.EkContentRef.AddDirectoryItem(TaxonomyTreeIdList + profileTaxonomyId.ToString(), m_iID.ToString(), Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group);
                }

                groupMessageBoardModerate = _MessageBoardApi.IsModerated(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup);
                if (groupMessageBoardModerate != false || chkMsgBoardModeration.Checked != false)
                {
                    _MessageBoardApi.Moderate(m_iID, Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup, m_userId, System.Convert.ToBoolean(chkMsgBoardModeration.Checked));
                }

                if (cgGroup.GroupCategory != "")
                {
                    TaxonomyId = 0;
                }
                if (m_iID > 0)
                {
                    UpdateGroupTags(true);
                    InitiateProcessAction();
                }
                else
                {
                    EmitJavascript();
                    RenderRecipientSelect();
                    EditGroup();
                    SetTaxonomy(this.m_iID);
                    SetAlias(this.m_iID);
                    errmsg.InnerHtml = "Error occured while adding this group. Please verify the group name is unique and try again.";
                    errmsg.Attributes.Add("class", "excpt");
                    // GroupName_TB.Attributes.Add("onkeypress", "ClearErr();")
                    GroupName_TB.Focus();
                }
            }
            if (FeaturesCalendar_CB.Checked == true)
            {
                _CalendarApi.Add(calendardata, Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, m_iID);
            }
            if (FeaturesForum_CB.Checked == true && FeaturesForum_CB.Enabled != false)
            {
                m_refCommunityGroupApi.AddCommunityGroupForum(Ektron.Cms.Common.EkEnumeration.WorkSpace.Group, m_iID);
            }

            if (FeaturesTodo_CB.Checked == true)
            {
                AddGroupTodoList();
            }

        }
        else
        {
            throw (new Exception(GetMessage("err no perm add cgroup")));
        }
    }
Пример #7
0
    void context_AcquireRequestState(object sender, EventArgs e)
    {
        HttpApplication app = sender as HttpApplication;
            if (HttpContext.Current.Session != null)
            {

                if (HttpContext.Current.Session["ecmComplianceRequired"] != null
                    && HttpContext.Current.Session["ecmLastAccessed"] != null)
                {
                    bool complianceRequired = (bool)HttpContext.Current.Session["ecmComplianceRequired"];
                    DateTime lastAccessed = (DateTime)HttpContext.Current.Session["ecmLastAccessed"];

                    if (complianceRequired
                        && lastAccessed.Add(IDLE_TIMEOUT) < DateTime.Now)
                    {
                        DeleteEcmCookie();
                        DeleteFormsCookie();
                    }
                    else
                        HttpContext.Current.Session["ecmLastAccessed"] = DateTime.Now;
                }
                else
                {

                    bool complianceMode = GetComplianceModeFromRequestInfo();
                    if (complianceMode && (ComingFromFolderAction(app) || IsCommerceAdmin()))
                    {
                        bool validFolderAction = false;
                        if (ComingFromFolderAction(app))
                        {
                            UserManager userManager = new UserManager();
                            UserData user = userManager.GetItem(userManager.RequestInformation.UserId);
                            DateTime lastAccessed = user.DateModified;
                            validFolderAction = (DateTime.Now.Subtract(lastAccessed).Seconds < 45);
                            if (validFolderAction)
                            {
                                HttpContext.Current.Session["ecmComplianceRequired"] = complianceMode;
                                HttpContext.Current.Session["ecmLastAccessed"] = lastAccessed;
                            }
                        }

                        if (!validFolderAction)
                        {
                            DeleteEcmCookie();
                            DeleteFormsCookie();
                        }
                    }
                    else
                    {
                        HttpContext.Current.Session["ecmLastAccessed"] = DateTime.Now;
                        HttpContext.Current.Session["ecmComplianceRequired"] = false;
                    }
                }
            }
    }