/// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        uniSelector.IsLiveSite = IsLiveSite;

        // Return form name or ID according to type of field (if no field specified form name is returned)
        if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
        {
            // Store old value
            object value = uniSelector.Value;
            uniSelector.ReturnColumnName = "FormID";
            uniSelector.SelectionMode    = SelectionModeEnum.SingleDropDownList;
            ShowSiteFilter         = false;
            uniSelector.AllowEmpty = true;
            // Reset previously saved value
            uniSelector.Value = value;
        }
        else
        {
            uniSelector.ReturnColumnName = "FormName";
        }

        // Add sites filter
        if (ShowSiteFilter)
        {
            uniSelector.FilterControl = "~/CMSFormControls/Filters/SiteFilter.ascx";
            uniSelector.SetValue("DefaultFilterValue", (SiteID > 0) ? SiteID : SiteContext.CurrentSiteID);
            uniSelector.SetValue("FilterMode", "bizform");
        }
        // Select bizforms depending on a site if not filtered by uniselector site filter
        else
        {
            int siteId = (SiteID == 0) ? SiteContext.CurrentSiteID : SiteID;
            uniSelector.WhereCondition = SqlHelper.AddWhereCondition(uniSelector.WhereCondition, "FormSiteID = " + siteId);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Return GroupID if field type is integer
        if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
        {
            usGroups.ReturnColumnName = "GroupID";
            usGroups.AllowEmpty       = true;
            DisplayCurrentGroup       = DisplayNoneValue = DisplayNoneWhenEmpty = false;
        }

        if (StopProcessing)
        {
            usGroups.StopProcessing = true;
        }
        else
        {
            EnsureChildControls();

            // Ensure correct livesite setting for uniselector
            IsLiveSite = IsLiveSite;

            usGroups.WhereCondition      = BuildWhereCondition();
            usGroups.OnSelectionChanged += new EventHandler(usGroups_OnSelectionChanged);
        }
    }
Exemple #3
0
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    /// <param name="forced">Indicates whether UniSelector Reload data should be called</param>
    public void ReloadData(bool forced)
    {
        // Return forum name or ID according to type of field (if no field specified forum name is returned)
        if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
        {
            uniSelector.WhereCondition   = "BoardSiteID = " + SiteID;
            uniSelector.ReturnColumnName = "BoardID";
            ShowGroupBoards = true;
        }
        else
        {
            uniSelector.WhereCondition = "BoardSiteID = " + SiteID + " AND " + (GroupID > 0 ? "BoardGroupID = " + GroupID : "((BoardGroupID = 0) OR (BoardGroupID IS NULL))");
        }

        uniSelector.IsLiveSite    = IsLiveSite;
        uniSelector.SelectionMode = SelectionModeEnum.SingleDropDownList;
        uniSelector.AllowEmpty    = false;
        uniSelector.AllowAll      = false;
        if (AddAllItemsRecord)
        {
            uniSelector.SpecialFields.Add(new SpecialField()
            {
                Text = GetString("general.selectall"), Value = String.Empty
            });
        }

        if (forced)
        {
            uniSelector.Reload(true);
        }
    }
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        // Return form name or ID according to type of field (if no field specified form name is returned)
        if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
        {
            object value = uniSelector.Value;
            uniSelector.SelectionMode = SelectionModeEnum.SingleDropDownList;
            uniSelector.AllowEmpty    = true;
            uniSelector.Value         = value;
            ShowGroupPolls            = true;
        }
        else
        {
            uniSelector.OnSelectionChanged += new EventHandler(uniSelector_OnSelectionChanged);
        }

        uniSelector.IsLiveSite       = IsLiveSite;
        uniSelector.ReturnColumnName = "PollID";

        // Check if running in group poll webpart
        if (IsGroupPollWidget() || IsGroupPollWebpart())
        {
            // Restrict list to current group
            int groupId = QueryHelper.GetInteger("groupid", 0);
            if ((groupId == 0) && (DocumentContext.CurrentPageInfo != null))
            {
                groupId = DocumentContext.CurrentPageInfo.NodeGroupID;
            }
            string where = "PollGroupID=" + groupId;
            uniSelector.WhereCondition = SqlHelper.AddWhereCondition(uniSelector.WhereCondition, where);
            uniSelector.ObjectType     = PollInfo.OBJECT_TYPE_GROUP;
        }
        else
        {
            if (ShowSiteFilter && AllowGlobalPolls)
            {
                // Init site filter
                uniSelector.FilterControl = "~/CMSModules/Polls/Controls/Filters/SiteSelector.ascx";
            }

            // Set selector WHERE condition according to user permissions
            int siteId = SiteContext.CurrentSiteID;
            string where = null;
            if (!ShowGroupPolls)
            {
                where = "PollGroupID IS NULL";
            }
            where = SqlHelper.AddWhereCondition(where, "PollSiteID=" + siteId);
            if (AllowGlobalPolls)
            {
                where = SqlHelper.AddWhereCondition(where, "PollSiteID IS NULL AND PollID IN (SELECT PollID FROM Polls_PollSite WHERE SiteID=" + siteId + ")", "OR");
            }
            uniSelector.WhereCondition = SqlHelper.AddWhereCondition(uniSelector.WhereCondition, where);
        }
    }
 /// <summary>
 /// Returns WHERE condition for selected form.
 /// </summary>
 public override string GetWhereCondition()
 {
     // Return correct WHERE condition for integer if none value is selected
     if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
     {
         int id = ValidationHelper.GetInteger(usGroups.Value, 0);
         if (id > 0)
         {
             return(base.GetWhereCondition());
         }
     }
     return(null);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set uniselector
        uniSelector.DisplayNameFormat = "{%ForumDisplayName%}";
        uniSelector.ReturnColumnName  = "ForumName";
        uniSelector.AllowEmpty        = false;
        uniSelector.AllowAll          = false;

        // Return forum name or ID according to type of field (if no field specified forum name is returned)
        if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
        {
            uniSelector.ReturnColumnName = "ForumID";
            uniSelector.AllowEmpty       = true;
            ShowGroupForums = true;
        }

        if (DependsOnAnotherField)
        {
            CheckAliasPath = true;
        }

        if (DisplayAllForumsOption)
        {
            uniSelector.SpecialFields.Add(new SpecialField()
            {
                Text = GetString("general.selectall"), Value = String.Empty
            });
        }

        if (ContainsAdHocForum())
        {
            uniSelector.SpecialFields.Add(new SpecialField()
            {
                Text = GetString("ForumSelector.AdHocForum"), Value = ADHOCFORUM_VALUE
            });
        }


        // Set resource prefix based on mode
        if ((SelectionMode == SelectionModeEnum.Multiple) || (SelectionMode == SelectionModeEnum.MultipleButton) || (SelectionMode == SelectionModeEnum.MultipleTextBox))
        {
            uniSelector.ResourcePrefix = "forumsselector";
            uniSelector.FilterControl  = "~/CMSModules/Forums/Filters/ForumGroupFilter.ascx";
        }
        else
        {
            uniSelector.ResourcePrefix = "forumselector";
        }

        SetupWhereCondition();
    }
    /// <summary>
    /// Configures the selector.
    /// </summary>
    private void SetupSelector()
    {
        if (mSetupFinished)
        {
            return;
        }

        uniSelector.SelectionMode = SelectionMode;
        uniSelector.AllowEmpty    = AllowEmpty;

        // If current control context is widget or livesite or SingleDropDownList mode hide site selector
        if (ControlsHelper.CheckControlContext(this, ControlContext.WIDGET_PROPERTIES) ||
            ControlsHelper.CheckControlContext(this, ControlContext.LIVE_SITE) ||
            SelectionMode == SelectionModeEnum.SingleDropDownList)
        {
            ShowSiteFilter = false;
        }

        uniSelector.IsLiveSite = IsLiveSite;

        // Return form name or ID according to type of field (if no field specified form name is returned)
        if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
        {
            uniSelector.ReturnColumnName = "FormID";
            ShowSiteFilter         = false;
            uniSelector.AllowEmpty = true;
        }
        else
        {
            uniSelector.ReturnColumnName = "FormName";
        }

        // Add sites filter
        if (ShowSiteFilter)
        {
            uniSelector.FilterControl = "~/CMSFormControls/Filters/SiteFilter.ascx";
            uniSelector.SetValue("DefaultFilterValue", (SiteID > 0) ? SiteID : SiteContext.CurrentSiteID);
            uniSelector.SetValue("FilterMode", "bizform");
        }
        // Select bizforms depending on a site if not filtered by uniselector site filter
        else
        {
            int siteId = (SiteID == 0) ? SiteContext.CurrentSiteID : SiteID;
            uniSelector.WhereCondition = SqlHelper.AddWhereCondition(uniSelector.WhereCondition, "FormSiteID = " + siteId);
        }

        mSetupFinished = true;
    }
 /// <summary>
 /// Returns WHERE condition for selected form.
 /// </summary>
 public override string GetWhereCondition()
 {
     // Return correct WHERE condition for integer if none value is selected
     if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
     {
         int id = ValidationHelper.GetInteger(uniSelector.Value, 0);
         if (id > 0)
         {
             return(base.GetWhereCondition());
         }
         // Check if 'ad-hoc-forum" has been selected and modify condition accordingly
         else if (ValidationHelper.GetString(uniSelector.Value, null) == ADHOCFORUM_VALUE)
         {
             return(String.Format("[{1}] IN (SELECT ForumID FROM Forums_Forum WHERE ForumSiteID={0} AND ForumName LIKE 'AdHoc-%')", SiteContext.CurrentSiteID, FieldInfo.Name));
         }
     }
     return(null);
 }
Exemple #9
0
    /// <summary>
    /// Setups control and reloads the data.
    /// </summary>
    protected void ReloadData()
    {
        usNewsletters.WhereCondition = "NewsletterSiteID = " + SiteContext.CurrentSiteID;

        if (!UseSimpleMode)
        {
            usNewsletters.SpecialFields.Add(new SpecialField {
                Text = GetString("NewsletterSelect.LetUserChoose"), Value = "NWSLetUserChoose"
            });
        }

        // Return newsletter name or newsletter ID according to type of field (if no field specified newsletter name is returned)
        if ((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType))
        {
            usNewsletters.AllowEmpty       = true;
            usNewsletters.ReturnColumnName = "NewsletterID";
        }
    }
Exemple #10
0
 /// <summary>
 /// Determines whether parent form field is integer.
 /// </summary>
 /// <returns>TRUE if parent form field is integer.</returns>
 private bool FieldIsInteger()
 {
     return((FieldInfo != null) && DataTypeManager.IsInteger(TypeEnum.Field, FieldInfo.DataType));
 }