Esempio n. 1
0
    //To Publish Preferences for activities i.e privacy settings.
    private void UpdatePublishPreferences()
    {
        long uId = 0;
        Ektron.Cms.Framework.Notifications.NotificationPublishPreference _publishPrefApi = new Ektron.Cms.Framework.Notifications.NotificationPublishPreference();
        System.Collections.Generic.List<NotificationPublishPreferenceData> publishActivityTypeList;
        System.Collections.Generic.List<long> publishPreferenceIdList = new System.Collections.Generic.List<long>();

        if ((!(Request.QueryString["id"] == null)) && Information.IsNumeric(Request.QueryString["id"]))
        {
            long.TryParse(Request.QueryString["id"], out uId);
        }
        publishActivityTypeList = _publishPrefApi.GetList(uId);
        if (uId > 0)
        {
            for (int i = 0; i <= publishActivityTypeList.Count - 1; i++)
            {
                if ((Page.Request.Form["pref" + publishActivityTypeList[i].ActivityTypeId] != null) && Page.Request.Form["pref" + publishActivityTypeList[i].ActivityTypeId] == "on")
                {
                    publishPreferenceIdList.Add(publishActivityTypeList[i].ActivityTypeId);
                }
            }
            _publishPrefApi.Add(uId, publishPreferenceIdList);
        }
    }
Esempio n. 2
0
    private void EditPublishPreferencesGrid()
    {
        Ektron.Cms.Framework.Notifications.NotificationPublishPreference _publishPrefApi = new Ektron.Cms.Framework.Notifications.NotificationPublishPreference();
            System.Collections.Generic.List<NotificationPublishPreferenceData> publishPrefList = new System.Collections.Generic.List<NotificationPublishPreferenceData>();

            publishPrefList = _publishPrefApi.GetList(uId);
            publishPrefList.Sort(new NotificationPublishPreferenceData());
            PrivacyGrid.Columns.Add(_refStyle.CreateBoundField("TYPE", m_refMsg.GetMessage("generic actions"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(20), Unit.Percentage(20), false, false));
            PrivacyGrid.Columns.Add(_refStyle.CreateBoundField("ENABLED", "<center>" + m_refMsg.GetMessage("generic publish") + "</center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
            System.Data.DataTable dt = new System.Data.DataTable();
            System.Data.DataRow dr;
            dt.Columns.Add(new System.Data.DataColumn("TYPE", typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn("ENABLED", typeof(string)));
            foreach (NotificationPublishPreferenceData prefEntry in publishPrefList)
            {
                dr = dt.NewRow();
                dr["TYPE"] = GetResourceText(prefEntry.ActivityTypeName);
                if (prefEntry.IsEnabled)
                {
                    dr["ENABLED"] = "<center><input type=\"Checkbox\" name=\"pref" + prefEntry.ActivityTypeId + "\" id=\"pref" + prefEntry.ActivityTypeId + "\" checked=\"checked\"  /></center>";
                }
                else
                {
                    dr["ENABLED"] = "<center><input type=\"Checkbox\" name=\"pref" + prefEntry.ActivityTypeId + "\" id=\"pref" + prefEntry.ActivityTypeId + "\" /></center>";
                }
                dt.Rows.Add(dr);
            }
            System.Data.DataView dv = new System.Data.DataView(dt);
            PrivacyGrid.DataSource = dv;
            PrivacyGrid.DataBind();
    }
 private void EditPersonalSettings()
 {
     if (Page.IsPostBack)
     {
         Ektron.Cms.Framework.Notifications.NotificationPublishPreference _publishPrefApi = new Ektron.Cms.Framework.Notifications.NotificationPublishPreference();
         System.Collections.Generic.List<long> activityIds = new System.Collections.Generic.List<long>();
         publishPreferenceList = _publishPrefApi.GetList(-1);
         for (int i = 0; i <= publishPreferenceList.Count - 1; i++)
         {
             if ((Page.Request.Form["activitytype" + publishPreferenceList[i].ActivityTypeId] != null) && Page.Request.Form["activitytype" + publishPreferenceList[i].ActivityTypeId] == "on")
             {
                 activityIds.Add(publishPreferenceList[i].ActivityTypeId);
             }
         }
         try
         {
             _publishPrefApi.UpdateDefaultPreferences(activityIds);
         }
         catch (Exception ex)
         {
             Response.Redirect((string)("../reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message) + "&LangType=" + _refContentApi.GetCookieValue("LastValidLanguageID")), false);
         }
         Response.Redirect("DefaultNotificationPreferences.aspx?mode=privacy");
     }
     else
     {
         DisplayPersonalPrefGrid("");
     }
 }