示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check permissions
        if (ActivityHelper.AuthorizedReadActivity(CMSContext.CurrentSiteID, true))
        {
            if (!QueryHelper.ValidateHash("hash"))
            {
                return;
            }

            int bizId = QueryHelper.GetInteger("bizid", 0);
            int recId = QueryHelper.GetInteger("recid", 0);

            if ((bizId > 0) && (recId > 0))
            {
                BizFormInfo bfi = BizFormInfoProvider.GetBizFormInfo(bizId);

                if (bfi == null)
                {
                    return;
                }

                bizRecord.ItemID   = recId;
                bizRecord.SiteName = SiteInfoProvider.GetSiteName(bfi.FormSiteID);
                bizRecord.FormName = bfi.FormName;
            }

            CurrentMaster.Title.TitleText  = GetString("om.activitydetals.viewrecorddetail");
            CurrentMaster.Title.TitleImage = GetImagePath("Objects/OM_Activity/object.png");
        }
    }
    protected void SetupControl()
    {
        // In design mode is processing of control stopped
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (MembershipContext.AuthenticatedUser.UserID == UserID)
            {
                gridElem.ZeroRowsText = GetString("blogsubscripitons.userhasnosubscriptions");
            }
            else
            {
                gridElem.ZeroRowsText = GetString("blogsubscripitons.NoDataUser");
            }
            gridElem.IsLiveSite           = IsLiveSite;
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.OnDataReload        += gridElem_OnDataReload;
            gridElem.ShowActionsMenu      = true;
            gridElem.Columns              = "SubscriptionID, SubscriptionEmail, DocumentName, NodeAliasPath, DocumentCulture, SubscriptionApproved";

            // Get all possible columns to retrieve
            gridElem.AllColumns = SqlHelper.JoinColumnList(ObjectTypeManager.GetColumnNames(BlogPostSubscriptionInfo.OBJECT_TYPE, PredefinedObjectType.NODE, PredefinedObjectType.DOCUMENTLOCALIZATION));

            mSiteName = SiteInfoProvider.GetSiteName(SiteID);
        }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string currSiteName = null;
        int    currSiteId   = 0;

        // Get current site ID/name
        if (ContactHelper.IsSiteManager)
        {
            currSiteId   = SiteID;
            currSiteName = SiteInfoProvider.GetSiteName(currSiteId);
        }
        else
        {
            currSiteName = CMSContext.CurrentSiteName;
            currSiteId   = CMSContext.CurrentSiteID;
        }

        bool globalObjectsSelected = (currSiteId == UniSelector.US_GLOBAL_RECORD);
        bool allSitesSelected      = (currSiteId == UniSelector.US_ALL_RECORDS);

        // Show warning if activity logging is disabled (do not show anything if global objects or all sites is selected)
        ucDisabledModule.SettingsKeys = "CMSEnableOnlineMarketing";
        ucDisabledModule.InfoText     = GetString("om.onlinemarketing.disabled");
        ucDisabledModule.ParentPanel  = pnlDis;

        pnlDis.Visible = !globalObjectsSelected && !allSitesSelected && !ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(currSiteName);

        if (CurrentMaster.HeaderActions.ActionsList.Count > 0)
        {
            CurrentMaster.HeaderActions.ActionsList[0].RedirectUrl += URLHelper.Url.Query;
        }
    }
示例#4
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Check permissions
        if (!QueryHelper.ValidateHash("hash"))
        {
            return;
        }

        int bizId = QueryHelper.GetInteger("bizid", 0);
        int recId = QueryHelper.GetInteger("recid", 0);

        if ((bizId > 0) && (recId > 0))
        {
            var bfi = BizFormInfoProvider.GetBizFormInfo(bizId);

            if (bfi == null)
            {
                return;
            }

            bizRecord.ItemID   = recId;
            bizRecord.SiteName = SiteInfoProvider.GetSiteName(bfi.FormSiteID);
            bizRecord.FormName = bfi.FormName;
        }
    }
    /// <summary>
    /// Handles the PathChanged event of the ucPath control.
    /// </summary>
    protected void ucPath_PathChanged(object sender, EventArgs ea)
    {
        string[] parameters = SessionHelper.GetValue(PreviewObjectName) as string[];

        // Get old site ID
        int SiteID = SiteContext.CurrentSiteID;

        if ((parameters != null) && (parameters.Length == 4))
        {
            SiteID = ValidationHelper.GetInteger(parameters[1], 0);
        }

        // If site ID changed - register postback for reload update panel with culture selector
        if (SiteID != ucPath.SiteID)
        {
            String script = Page.ClientScript.GetPostBackEventReference(imgRefresh, "reloadculture");
            ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "UpdateImageScript", script, true);

            // If cultures from other site is shown
            DataSet siteCulturesDS = CultureSiteInfoProvider.GetSiteCultures(SiteInfoProvider.GetSiteName(ucPath.SiteID));
            if (!DataHelper.DataSourceIsEmpty(siteCulturesDS))
            {
                DataTable siteCultures = siteCulturesDS.Tables[0];
                // SelectedCulture may not be in site culture list
                DataRow[] dr = siteCulturesDS.Tables[0].Select("CultureCode= '" + ucSelectCulture.SelectedCulture + "'");
                if (dr.Length == 0)
                {
                    // In such case, select first site's culture
                    ucSelectCulture.SelectedCulture = ValidationHelper.GetString(siteCultures.Rows[0]["CultureCode"], MembershipContext.AuthenticatedUser.PreferredCultureCode);
                }
            }
        }

        UpdatePreview(true);
    }
示例#6
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (Contact == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        if (!IsAuthorized())
        {
            RedirectToAccessDenied(GetString("general.nopermission"));
        }

        // Initialize process selector
        ucSelector.UniSelector.SelectionMode = SelectionModeEnum.SingleButton;

        // Check permissions
        if (WorkflowStepInfoProvider.CanUserStartAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(Contact.ContactSiteID)))
        {
            ucSelector.UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
            ucSelector.UniSelector.SetValue("SiteID", SiteID);
            ucSelector.UniSelector.SetValue("IsLiveSite", false);
            ucSelector.IsSiteManager = ContactHelper.IsSiteManager;
            ucSelector.Enabled       = true;
        }
        else
        {
            ucSelector.Enabled = false;
        }


        listElem.ObjectID      = Contact.ContactID;
        listElem.ObjectType    = ContactInfo.OBJECT_TYPE;
        listElem.EditActionUrl = "Process_Detail.aspx?stateid={0}" + (IsSiteManager ? "&issitemanager=1" : String.Empty);
    }
示例#7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string currSiteName = null;

        // Get current site ID/name
        if (ContactHelper.IsSiteManager)
        {
            currSiteId   = SiteID;
            currSiteName = SiteInfoProvider.GetSiteName(currSiteId);
        }
        else
        {
            currSiteName = CMSContext.CurrentSiteName;
            currSiteId   = CMSContext.CurrentSiteID;
        }

        bool globalObjectsSelected = (currSiteId == UniSelector.US_GLOBAL_RECORD);
        bool allSitesSelected      = (currSiteId == UniSelector.US_ALL_RECORDS);

        // Show warning if activity logging is disabled (do not show anything if global objects or all sites is selected)
        if (!ActivitySettingsHelper.OnlineMarketingEnabled(currSiteName))
        {
            lblDis.ResourceString = "om.onlinemarketing.disabled";
        }
        pnlDis.Visible = !globalObjectsSelected && !allSitesSelected && !ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(currSiteName);

        // Initialize list and filter controls
        fltElem.SiteID  = currSiteId;
        listElem.SiteID = currSiteId;

        // Show site name column if activities of all sites are displayed
        listElem.ShowSiteNameColumn = allSitesSelected;
        fltElem.ShowSiteFilter      = allSitesSelected;

        fltElem.ShowIPFilter         = ActivitySettingsHelper.IPLoggingEnabled(currSiteName);
        listElem.ShowIPAddressColumn = fltElem.ShowIPFilter;

        listElem.OrderBy        = "ActivityCreated DESC";
        listElem.WhereCondition = fltElem.WhereCondition;

        if (QueryHelper.GetInteger("saved", 0) == 1)
        {
            lblInfo.Visible = true;
            lblInfo.Text    = GetString("general.changessaved");
        }

        // Set header actions (add button)
        string url = ResolveUrl("New.aspx?siteId=" + currSiteId);

        if (IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "isSiteManager", "1");
        }
        string[,] actions  = new string[1, 8];
        actions[0, 0]      = "HyperLink";
        actions[0, 1]      = GetString("om.activity.newcustom");
        actions[0, 3]      = url;
        actions[0, 5]      = GetImageUrl("Objects/OM_Activity/add.png");
        hdrActions.Actions = actions;
    }
示例#8
0
    /// <summary>
    /// Initializes contact selector.
    /// </summary>
    private void InitContactSelector()
    {
        // Initialize contact selector
        ucSelector.UniSelector.SelectionMode = SelectionModeEnum.SingleButton;

        WorkflowInfo process = WorkflowInfoProvider.GetWorkflowInfo(ProcessID);

        if (process == null)
        {
            RedirectToInformation("editedobject.notexists");
        }

        // Check permissions
        if (WorkflowStepInfoProvider.CanUserStartAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(listContacts.SiteID)) && (listContacts.SiteID != UniSelector.US_GLOBAL_AND_SITE_RECORD) && ((process != null) && process.WorkflowEnabled))
        {
            ucSelector.UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
            ucSelector.SiteID        = listContacts.SiteID;
            ucSelector.IsLiveSite    = false;
            ucSelector.IsSiteManager = ContactHelper.IsSiteManager;
            ucSelector.Enabled       = true;
            ucSelector.UniSelector.DialogButton.ToolTipResourceString = "automenu.startstatedesc";
        }
        else
        {
            ucSelector.Enabled = false;
            ucSelector.UniSelector.DialogButton.ToolTipResourceString = process.WorkflowEnabled ? "general.nopermission" : "autoMenu.DisabledStateDesc";
        }
    }
        /// <summary>
        /// Gets the Page's Url Slug based on the given NodeID and Culture.  If Culture not found, then will prioritize the Site's Default Culture, then Cultures by alphabetical order.
        /// </summary>
        /// <param name="NodeID">The NodeID</param>
        /// <param name="DocumentCulture">The Document Culture, if not provided will use default Site's Culture.</param>
        /// <param name="SiteName">The Site Name, if not provided then will query the NodeID to find it's site.</param>
        /// <returns>The UrlSlug (with ~ prepended) or Null if page not found.</returns>
        public static string GetPageUrl(int NodeID, string DocumentCulture = null, string SiteName = null)
        {
            if (SiteName == null)
            {
                TreeNode Page = DocumentHelper.GetDocuments().WhereEquals("NodeID", NodeID).Columns("NodeSiteID").FirstOrDefault();
                if (Page != null)
                {
                    SiteName = SiteInfoProvider.GetSiteName(Page.NodeSiteID);
                }
                else
                {
                    // No page found, so won't find a Url Slug either
                    return(null);
                }
            }

            if (string.IsNullOrWhiteSpace(DocumentCulture))
            {
                DocumentCulture = CultureHelper.GetDefaultCultureCode(SiteName);
            }

            UrlSlugInfo UrlSlug = UrlSlugInfoProvider.GetUrlSlugs()
                                  .WhereEquals("UrlSlugNodeID", NodeID)
                                  .OrderBy($"case when UrlSlugCultureCode = '{SqlHelper.EscapeQuotes(DocumentCulture)}' then 0 else 1 end, case when UrlSlugCultureCode = '{CultureHelper.GetDefaultCultureCode(SiteName)}' then 0 else 1 end, UrlSlugCultureCode")
                                  .FirstOrDefault();

            return(UrlSlug != null ? "~" + UrlSlug.UrlSlug : null);
        }
    /// <summary>
    /// Initializes controls on the page.
    /// </summary>
    private void SetupControls()
    {
        if (this.UserID > 0)
        {
            this.boardSubscriptions.Visible = true;

            if (CMSContext.CurrentUser.UserID == this.UserID)
            {
                this.boardSubscriptions.ZeroRowsText = GetString("boardsubscripitons.userhasnosubscriptions");
            }
            else
            {
                this.boardSubscriptions.ZeroRowsText = GetString("boardsubscripitons.NoDataUser");
            }

            // Setup UniGrid control
            this.boardSubscriptions.IsLiveSite            = this.IsLiveSite;
            this.boardSubscriptions.Pager.DefaultPageSize = 10;
            this.boardSubscriptions.OnAction            += new OnActionEventHandler(boardSubscriptions_OnAction);
            this.boardSubscriptions.OnExternalDataBound += new OnExternalDataBoundEventHandler(boardSubscriptions_OnExternalDataBound);
            boardSubscriptions.OnDataReload             += new OnDataReloadEventHandler(boardSubscriptions_OnDataReload);
            boardSubscriptions.ShowActionsMenu           = true;
            BoardSubscriptionInfo bsi = new BoardSubscriptionInfo();
            boardSubscriptions.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bsi.ColumnNames.ToArray()), "BoardID, BoardDisplayName, BoardSiteID, NodeAliasPath, DocumentCulture");

            mSiteName = SiteInfoProvider.GetSiteName(SiteID);
        }
        else
        {
            this.boardSubscriptions.Visible = false;
        }
    }
        /// <summary>
        /// Gets the Page's Url Slug based on the given NodeGuid and Culture.  If Culture not found, then will prioritize the Site's Default Culture, then Cultures by alphabetical order.
        /// </summary>
        /// <param name="NodeGuid">The Node to find the Url Slug</param>
        /// <param name="DocumentCulture">The Document Culture, if not provided will use default Site's Culture.</param>
        /// <returns>The UrlSlug (with ~ prepended) or Null if page not found.</returns>
        public static string GetPageUrl(Guid NodeGuid, string DocumentCulture = null)
        {
            TreeNode Page = null;

            if (string.IsNullOrWhiteSpace(DocumentCulture))
            {
                Page = DocumentHelper.GetDocuments()
                       .WhereEquals("NodeGuid", NodeGuid)
                       .CombineWithDefaultCulture()
                       .CombineWithAnyCulture()
                       .Columns("NodeID, DocumentCulture, NodeSiteID")
                       .FirstOrDefault();
            }
            else
            {
                Page = DocumentHelper.GetDocuments()
                       .WhereEquals("NodeGuid", NodeGuid)
                       .Culture(DocumentCulture)
                       .CombineWithAnyCulture()
                       .Columns("NodeID, DocumentCulture, NodeSiteID")
                       .FirstOrDefault();
            }
            if (Page != null)
            {
                return(GetPageUrl(Page.NodeID, Page.DocumentCulture, SiteInfoProvider.GetSiteName(Page.NodeSiteID)));
            }
            else
            {
                return(null);
            }
        }
示例#12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int ContactID = QueryHelper.GetInteger("ContactID", 0);

        if (ContactID > 0)
        {
            // Change redirect URL when new custom activity is created under edited contact
            EditForm.RedirectUrlAfterCreate = "~/CMSModules/ContactManagement/Pages/Tools/Contact/Tab_Activities.aspx?saved=1&contactid=" + ContactID;
        }

        if (QueryHelper.GetBoolean("issitemanager", false))
        {
            EditForm.RedirectUrlAfterCreate += "&issitemanager=1";
        }

        if (!RequestHelper.IsPostBack())
        {
            EditForm.FieldControls["ActivityCreated"].Value = DateTime.Now;

            if (ContactID > 0)
            {
                EditForm.FieldControls["ActivityActiveContactID"].Value = ContactID;
            }
        }

        EditForm.FieldControls["ActivityActiveContactID"].SetValue("ObjectSiteName", SiteInfoProvider.GetSiteName(QueryHelper.GetInteger("SiteID", 0)));
    }
示例#13
0
    protected DataSet gridAttachments_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        if (Node != null)
        {
            dsAttachments.Path = Node.NodeAliasPath;
            // Prefer culture from the node
            dsAttachments.CultureCode = !string.IsNullOrEmpty(Node.DocumentCulture) ? Node.DocumentCulture : CMSContext.PreferredCultureCode;
            dsAttachments.SiteName    = SiteInfoProvider.GetSiteName(Node.OriginalNodeSiteID);
        }

        // Versioned attachments
        dsAttachments.DocumentVersionHistoryID = VersionHistoryID;
        dsAttachments.AttachmentGroupGUID      = GroupGUID;
        dsAttachments.AttachmentFormGUID       = FormGUID;
        dsAttachments.TopN            = currentTopN;
        dsAttachments.WhereCondition  = GetWhereConditionInternal();
        dsAttachments.SelectedColumns = columns;
        dsAttachments.OrderBy         = currentOrder;
        dsAttachments.LoadData(true);

        // Ensure right column name (for attachments under workflow)
        if (!DataHelper.DataSourceIsEmpty(dsAttachments.DataSource))
        {
            DataSet ds = (DataSet)dsAttachments.DataSource;
            if (ds != null)
            {
                DataTable dt = (ds).Tables[0];
                if (!dt.Columns.Contains("AttachmentFormGUID"))
                {
                    dt.Columns.Add("AttachmentFormGUID");
                }
            }
        }
        return((DataSet)dsAttachments.DataSource);
    }
    /// <summary>
    /// Returns true if the contact visited specified page.
    /// </summary>
    /// <param name="contact">Contact which should be checked</param>
    /// <param name="nodeAliasPath">Page node alias path</param>
    /// <param name="culture">Culture of the document</param>
    /// <param name="lastXDays">Constraint for last X days (if zero or negative value is given, no constraint is applied)</param>
    public static bool VisitedPage(object contact, string nodeAliasPath, string culture, int lastXDays)
    {
        ContactInfo ci = contact as ContactInfo;

        if (ci == null)
        {
            return(false);
        }

        if (ci.ContactSiteID == 0)
        {
            return(false);
        }

        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
        TreeNode     node = tree.SelectSingleNode(SiteInfoProvider.GetSiteName(ci.ContactSiteID), nodeAliasPath, CMSContext.PreferredCultureCode);

        if (node != null)
        {
            if (string.IsNullOrEmpty(culture))
            {
                return(DidActivity(contact, PredefinedActivityType.PAGE_VISIT, null, lastXDays, "ActivityNodeID = " + node.NodeID));
            }
            else
            {
                return(DidActivity(contact, PredefinedActivityType.PAGE_VISIT, null, lastXDays, "ActivityNodeID = " + node.NodeID + " AND ActivityCulture = '" + culture + "'"));
            }
        }
        return(false);
    }
示例#15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string currSiteName = null;
        int    currSiteId   = 0;

        // Get current site ID/name
        if (ContactHelper.IsSiteManager)
        {
            currSiteId   = this.SiteID;
            currSiteName = SiteInfoProvider.GetSiteName(currSiteId);
        }
        else
        {
            currSiteName = CMSContext.CurrentSiteName;
            currSiteId   = CMSContext.CurrentSiteID;
        }

        bool globalObjectsSelected = (currSiteId == UniSelector.US_GLOBAL_RECORD);
        bool allSitesSelected      = (currSiteId == UniSelector.US_ALL_RECORDS);

        // Show warning if activity logging is disabled (do not show anything if global objects or all sites is selected)
        if (!ActivitySettingsHelper.OnlineMarketingEnabled(currSiteName))
        {
            lblDis.ResourceString = "om.onlinemarketing.disabled";
        }
        pnlDis.Visible = !globalObjectsSelected && !allSitesSelected && !ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(currSiteName);

        CurrentMaster.HeaderActions.Actions[0, 3] = AddSiteQuery(CurrentMaster.HeaderActions.Actions[0, 3], QueryHelper.GetInteger("siteid", 0));
    }
示例#16
0
    void UniSelector_OnItemsSelected(object sender, EventArgs e)
    {
        try
        {
            int contactId             = ValidationHelper.GetInteger(ucSelector.Value, 0);
            AutomationManager manager = AutomationManager.GetInstance(CurrentUser);
            var infoObj = ContactInfoProvider.GetContactInfo(contactId);
            if (WorkflowStepInfoProvider.CanUserStartAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(infoObj.ContactSiteID)))
            {
                using (CMSActionContext context = new CMSActionContext())
                {
                    context.AllowAsyncActions = false;

                    manager.StartProcess(infoObj, ProcessID);
                }
            }
        }
        catch (ProcessRecurrenceException ex)
        {
            ShowError(ex.Message);
        }
        catch (Exception ex)
        {
            LogAndShowError("Automation", "STARTPROCESS", ex);
        }

        listContacts.ReloadData();
        pnlUpdate.Update();
    }
示例#17
0
    /// <summary>
    /// Returns where condition for uniselector. This condition filters records contained in currently selected values
    /// and site-specific records according to edited objects site ID.
    /// </summary>
    protected string GetSelectorWhereCondition()
    {
        // Select nothing
        string where = "";

        // Add records which are used by parent object
        if (!string.IsNullOrEmpty(mCurrentValues))
        {
            where = SqlHelperClass.AddWhereCondition(where, "TaxClassID IN (" + mCurrentValues.Replace(';', ',') + ")", "OR");
        }

        int taxSiteId = 0;

        // Add site specific records when editing site shipping option and not using global tax classes
        if ((mDepartmentInfoObj != null) && (mDepartmentInfoObj.DepartmentSiteID > 0))
        {
            if (!ECommerceSettings.UseGlobalTaxClasses(SiteInfoProvider.GetSiteName(mDepartmentInfoObj.DepartmentSiteID)))
            {
                taxSiteId = mDepartmentInfoObj.DepartmentSiteID;
            }
        }

        where = SqlHelperClass.AddWhereCondition(where, "ISNULL(TaxClassSiteID, 0) = " + taxSiteId, "OR");

        return(where);
    }
示例#18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblAvialable.Text = GetString("conversion.avaiblecampaign");
        conversionID      = QueryHelper.GetInteger("campaignid", 0);

        ConversionInfo ci = ConversionInfoProvider.GetConversionInfo(conversionID);

        if (ci != null)
        {
            int siteID = CMSContext.CurrentSiteID;
            if (ci.ConversionSiteID != siteID)
            {
                if (!CMSContext.CurrentUser.IsInSite(SiteInfoProvider.GetSiteName(ci.ConversionSiteID)))
                {
                    RedirectToAccessDenied(GetString("conversion.currentsite"));
                    return;
                }
            }
        }

        // Get the conversions
        currentValues = GetConversions();

        if (!RequestHelper.IsPostBack())
        {
            usCampaigns.Value = currentValues;
        }

        usCampaigns.WhereCondition      = "CampaignSiteID = " + CMSContext.CurrentSiteID;
        usCampaigns.OnSelectionChanged += usConversions_OnSelectionChanged;
    }
示例#19
0
    protected override void OnInit(EventArgs e)
    {
        string currSiteName = null;
        int    currSiteId   = 0;

        drpType.AdditionalDropDownCSSClass = "DropDownFieldFilter";

        // Get current site ID/name
        if (ContactHelper.IsSiteManager)
        {
            currSiteId   = SiteID;
            currSiteName = SiteInfoProvider.GetSiteName(currSiteId);
        }
        else
        {
            currSiteName = SiteContext.CurrentSiteName;
            currSiteId   = SiteContext.CurrentSiteID;
        }

        SiteID         = currSiteId;
        ShowSiteFilter = (currSiteId == UniSelector.US_ALL_RECORDS);
        ShowIPFilter   = ActivitySettingsHelper.IPLoggingEnabled(currSiteName);

        base.OnInit(e);
        btnReset.Text    = GetString("general.reset");
        btnReset.Click  += btnReset_Click;
        btnFilter.Click += btnSearch_Click;
    }
    /// <summary>
    /// Deletes the file binary from the file system.
    /// </summary>
    /// <param name="fileId">MetaFile ID</param>
    /// <param name="name">Returning the metafile name</param>
    protected bool DeleteFromFileSystem(int fileId, ref string name)
    {
        // Delete the file in file system
        MetaFileInfo mi = MetaFileInfoProvider.GetMetaFileInfo(fileId);

        if (mi != null)
        {
            name = mi.MetaFileName;

            // Ensure the binary column first (check if exists)
            DataSet ds = MetaFileInfoProvider.GetMetaFiles("MetaFileID = " + fileId, null, "CASE WHEN MetaFileBinary IS NULL THEN 0 ELSE 1 END AS HasBinary", -1);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                bool hasBinary = ValidationHelper.GetBoolean(ds.Tables[0].Rows[0][0], false);
                if (!hasBinary)
                {
                    // Copy the binary data to database
                    mi.MetaFileBinary = MetaFileInfoProvider.GetFile(mi, SiteInfoProvider.GetSiteName(mi.MetaFileSiteID));
                    mi.Generalized.UpdateData();
                }

                // Delete the file from the disk
                MetaFileInfoProvider.DeleteFile(SiteInfoProvider.GetSiteName(mi.MetaFileSiteID), mi.MetaFileGUID.ToString(), true, false);

                return(true);
            }
        }

        return(false);
    }
    /// <summary>
    /// Returns all e-mail addresses for specified newsletter.
    /// </summary>
    /// <param name="newsletterId">Newsletter</param>
    /// <param name="siteId">Site</param>
    private int GetEmailAddressCount(int newsletterId, int siteId)
    {
        // Get e-mail addresses for ordinary subscriber, user subriber and role subscriber
        string siteName       = SiteInfoProvider.GetSiteName(siteId);
        int    emailAddresses = NewsletterInfoProvider.GetEmailAddressCount(newsletterId, siteName);

        DataSet ContactID = SubscriberNewsletterInfoProvider.GetSubscriptions(
            String.Format("NewsletterID={0} AND (SubscriptionApproved=1 OR SubscriptionApproved IS NULL) AND (SubscriptionEnabled=1 OR SubscriptionEnabled IS NULL) AND SubscriberType='om.contactgroup'", newsletterId), null, 0, "DISTINCT(SubscriberRelatedID) AS SubscriberRelatedID");

        if (!DataHelper.DataSourceIsEmpty(ContactID))
        {
            int groupId = 0;
            foreach (DataRow dr in ContactID.Tables[0].Rows)
            {
                groupId = ValidationHelper.GetInteger(dr[0], 0);

                DataSet dsMembers = ModuleCommands.OnlineMarketingGetContactGroupMemberIDs(groupId, 0, 0,
                                                                                           NewsletterHelper.MonitorBouncedEmails(siteName),
                                                                                           NewsletterHelper.BouncedEmailsLimit(siteName), newsletterId);
                if (!DataHelper.DataSourceIsEmpty(dsMembers))
                {
                    emailAddresses += ValidationHelper.GetInteger(dsMembers.Tables[0].Rows.Count, 0);
                }
            }
        }

        return(emailAddresses);
    }
示例#22
0
    protected void SetupControl()
    {
        // In design mode is pocessing of control stoped
        if (this.StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (CMSContext.CurrentUser.UserID == this.UserID)
            {
                this.gridElem.ZeroRowsText = GetString("blogsubscripitons.userhasnosubscriptions");
            }
            else
            {
                this.gridElem.ZeroRowsText = GetString("blogsubscripitons.NoDataUser");
            }
            this.gridElem.IsLiveSite = this.IsLiveSite;
            this.gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction);
            this.gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(gridElem_OnExternalDataBound);
            this.gridElem.OnDataReload += new OnDataReloadEventHandler(gridElem_OnDataReload);
            gridElem.ShowActionsMenu = true;
            gridElem.Columns = "SubscriptionID, SubscriptionEmail, DocumentName, NodeAliasPath, DocumentCulture";

            // Get all possible columns to retrieve
            IDataClass nodeClass = DataClassFactory.NewDataClass("CMS.Tree");
            DocumentInfo di = new DocumentInfo();
            BlogPostSubscriptionInfo bpsi = new BlogPostSubscriptionInfo();
            gridElem.AllColumns = SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(SqlHelperClass.MergeColumns(bpsi.ColumnNames.ToArray()), SqlHelperClass.MergeColumns(di.ColumnNames.ToArray())), SqlHelperClass.MergeColumns(nodeClass.ColumnNames.ToArray()));

            mSiteName = SiteInfoProvider.GetSiteName(SiteID);
        }
    }
示例#23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsAuthorized())
        {
            RedirectToAccessDenied(GetString("general.nopermission"));
        }

        // Initialize contact selector
        ucSelector.UniSelector.SelectionMode = SelectionModeEnum.SingleButton;
        ucSelector.UniSelector.ButtonImage   = GetImageUrl("/Objects/MA_AutomationState/add.png");

        // Check permissions
        if (WorkflowStepInfoProvider.CanUserStartAutomationProcess(CurrentUser, SiteInfoProvider.GetSiteName(Contact.ContactSiteID)))
        {
            ucSelector.UniSelector.OnItemsSelected     += UniSelector_OnItemsSelected;
            ucSelector.UniSelector.DialogImage.CssClass = "NewItemImage";
            ucSelector.UniSelector.DialogLink.CssClass  = "MenuItemEdit";
            ucSelector.UniSelector.SetValue("SiteID", SiteID);
            ucSelector.UniSelector.SetValue("IsLiveSite", false);
            ucSelector.IsSiteManager = ContactHelper.IsSiteManager;
            ucSelector.Enabled       = true;
        }
        else
        {
            ucSelector.Enabled = false;
            ucSelector.UniSelector.DialogImage.CssClass = "NewItemImageDisabled";
            ucSelector.UniSelector.DialogLink.CssClass  = "MenuItemEditDisabled";
        }


        listElem.ObjectID      = Contact.ContactID;
        listElem.ObjectType    = PredefinedObjectType.CONTACT;
        listElem.EditActionUrl = "Process_Detail.aspx?stateid={0}" + (IsSiteManager ? "&issitemanager=1" : String.Empty);
    }
    /// <summary>
    /// Shows info message to prompt the user to select the winning A/B variant after the A/B test has finished.
    /// </summary>
    private void ShowPromoteWinnerInfoMessage()
    {
        if (TestStatus != ABTestStatusEnum.Finished || !UserHasPermissions)
        {
            return;
        }

        string message;

        if (DocumentManager.AllowSave || IsDialog)
        {
            message = GetString("abtesting.finishedtest.promotewinnerpromptmessage");
        }
        else
        {
            string siteName     = SiteInfoProvider.GetSiteName(ABTest.ABTestSiteID);
            int    nodeId       = TreePathUtils.GetNodeIdByAliasPath(siteName, ABTest.ABTestOriginalPage);
            string editPageLink = ApplicationUrlHelper.GetPageEditLink(nodeId, ABTest.ABTestCulture);
            var    link         = URLHelper.GetAbsoluteUrl(editPageLink);

            message = ResHelper.GetStringFormat("abtesting.finishedtest.promotewinnerpromptmessage.warning", link);
        }

        ShowInformation(message);
    }
示例#25
0
    /// <summary>
    /// Initializes controls on the page.
    /// </summary>
    private void SetupControls()
    {
        if (UserID > 0)
        {
            boardSubscriptions.Visible = true;

            if (MembershipContext.AuthenticatedUser.UserID == UserID)
            {
                boardSubscriptions.ZeroRowsText = GetString("boardsubscripitons.userhasnosubscriptions");
            }
            else
            {
                boardSubscriptions.ZeroRowsText = GetString("boardsubscripitons.NoDataUser");
            }

            // Setup UniGrid control
            boardSubscriptions.IsLiveSite            = IsLiveSite;
            boardSubscriptions.Pager.DefaultPageSize = 10;
            boardSubscriptions.OnAction            += boardSubscriptions_OnAction;
            boardSubscriptions.OnExternalDataBound += boardSubscriptions_OnExternalDataBound;
            boardSubscriptions.OnDataReload        += boardSubscriptions_OnDataReload;
            boardSubscriptions.ShowActionsMenu      = true;

            BoardSubscriptionInfo bsi = new BoardSubscriptionInfo();
            boardSubscriptions.AllColumns = SqlHelper.AddColumns(SqlHelper.JoinColumnList(bsi.ColumnNames), "BoardID, BoardDisplayName, BoardSiteID, NodeAliasPath, DocumentCulture");

            mSiteName = SiteInfoProvider.GetSiteName(SiteID);
        }
        else
        {
            boardSubscriptions.Visible = false;
        }
    }
示例#26
0
    /// <summary>
    /// Hides HTML or text area according to e-mail format in settings.
    /// </summary>
    protected void EnsureEmailFormatRegions()
    {
        string siteName = null;

        plcPlainText.Visible = true;
        plcText.Visible      = true;

        if (siteId > 0)
        {
            // Get site name
            siteName = SiteInfoProvider.GetSiteName(siteId);
        }

        // Get e-mail format from settings
        EmailFormatEnum emailFormat = EmailHelper.GetEmailFormat(siteName);

        switch (emailFormat)
        {
        case EmailFormatEnum.Html:
            plcPlainText.Visible = false;
            break;

        case EmailFormatEnum.PlainText:
            plcText.Visible = false;
            break;
        }
    }
示例#27
0
    /// <summary>
    /// Indicates if exchange rate from global main currency is needed.
    /// </summary>
    protected bool IsFromGlobalRateNeeded()
    {
        string siteName = SiteInfoProvider.GetSiteName(ConfiguredSiteID);

        if ((ConfiguredSiteID == 0) || (ECommerceSettings.UseGlobalCurrencies(siteName)))
        {
            return(false);
        }

        string globalMainCode = CurrencyInfoProvider.GetMainCurrencyCode(0);
        string siteMainCode   = CurrencyInfoProvider.GetMainCurrencyCode(ConfiguredSiteID);

        // Check whether main currencies are defined
        if (string.IsNullOrEmpty(siteMainCode) || string.IsNullOrEmpty(globalMainCode))
        {
            return(false);
        }

        // Check whether global and site main currency are the same
        if (globalMainCode.ToLowerCSafe() == siteMainCode.ToLowerCSafe())
        {
            return(false);
        }

        return(ECommerceSettings.AllowGlobalDiscountCoupons(siteName) ||
               ECommerceSettings.AllowGlobalProductOptions(siteName) ||
               ECommerceSettings.AllowGlobalProducts(siteName) ||
               ECommerceSettings.AllowGlobalShippingOptions(siteName) ||
               ECommerceSettings.UseGlobalCredit(siteName) ||
               ECommerceSettings.UseGlobalTaxClasses(siteName));
    }
示例#28
0
    /// <summary>
    /// Deletes the file binary from the file system.
    /// </summary>
    /// <param name="attachmentId">Attachment ID</param>
    /// <param name="name">Returning the attachment name</param>
    protected bool DeleteFromFileSystem(int attachmentId, ref string name)
    {
        // Delete the file in file system
        var ai = AttachmentInfoProvider.GetAttachmentInfo(attachmentId, false);

        if (ai != null)
        {
            name = ai.AttachmentName;

            // Ensure the binary column first (check if exists)
            DataSet ds = AttachmentInfoProvider.GetAttachments()
                         .WhereEquals("AttachmentID", attachmentId)
                         .BinaryData(true)
                         .Columns("CASE WHEN AttachmentBinary IS NULL THEN 0 ELSE 1 END AS HasBinary");

            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                bool hasBinary = ValidationHelper.GetBoolean(ds.Tables[0].Rows[0][0], false);
                if (!hasBinary)
                {
                    // Copy the binary data to database
                    ai.AttachmentBinary = AttachmentBinaryHelper.GetAttachmentBinary((DocumentAttachment)ai);
                    ai.Generalized.UpdateData();
                }

                // Delete the file from the disk
                AttachmentBinaryHelper.DeleteFile(ai.AttachmentGUID, SiteInfoProvider.GetSiteName(ai.AttachmentSiteID), true);

                return(true);
            }
        }

        return(false);
    }
示例#29
0
    /// <summary>
    /// Returns value of the specified product public status column.
    /// If the product is evaluated as a new product in the store, public status set by 'CMSStoreNewProductStatus' setting is used, otherwise product public status is used.
    /// </summary>
    /// <param name="sku">SKU data</param>
    /// <param name="column">Name of the product public status column the value should be retrieved from</param>
    public static object GetSKUIndicatorProperty(SKUInfo sku, string column)
    {
        // Do not process
        if (sku == null)
        {
            return(null);
        }

        PublicStatusInfo status     = null;
        string           siteName   = SiteInfoProvider.GetSiteName(sku.SKUSiteID);
        string           statusName = ECommerceSettings.NewProductStatus(siteName);

        if (!string.IsNullOrEmpty(statusName) && SKUInfoProvider.IsSKUNew(sku))
        {
            // Get 'new product' status
            status = PublicStatusInfoProvider.GetPublicStatusInfo(statusName, siteName);
        }
        else
        {
            // Get product public status
            if (sku.SKUPublicStatusID > 0)
            {
                status = PublicStatusInfoProvider.GetPublicStatusInfo(sku.SKUPublicStatusID);
            }
        }

        // Get specified column value
        return(GetColumnValue(status, column));
    }
示例#30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterJQuery(Page);
        ScriptHelper.RegisterModule(Page, "CMS/ScrollPane", new { selector = "#language-menu" });

        CssRegistration.RegisterCssLink(Page, "~/CMSScripts/jquery/jquery-jscrollpane.css");

        string currentSiteName = (SiteID != 0) ? SiteInfoProvider.GetSiteName(SiteID) : SiteContext.CurrentSiteName;
        var    cultures        = CultureSiteInfoProvider.GetSiteCultures(currentSiteName).Items;

        if (cultures.Count > 1)
        {
            string      defaultCulture = CultureHelper.GetDefaultCultureCode(currentSiteName);
            CultureInfo ci             = CultureInfo.Provider.Get(SelectedCulture);

            imgLanguage.ImageUrl      = GetFlagIconUrl(SelectedCulture, "16x16");
            imgLanguage.AlternateText = imgLanguage.ToolTip = ResHelper.LocalizeString(ci.CultureName);
            lblLanguageName.Text      = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(ci.CultureShortName));

            // Generate sub-menu only if more cultures to choose from
            StringBuilder sb = new StringBuilder();
            foreach (var culture in cultures)
            {
                string cultureCode = culture.CultureCode;
                string cultureName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(culture.CultureName));

                if (CMSString.Compare(cultureCode, defaultCulture, true) == 0)
                {
                    cultureName += " " + GetString("general.defaultchoice");
                }

                string flagUrl = GetFlagIconUrl(cultureCode, "16x16");

                var click = String.Format("ChangeLanguage({0}); return false;", ScriptHelper.GetString(cultureCode));

                sb.AppendFormat("<li><a href=\"#\" onclick=\"{0}\"><img src=\"{1}\" alt=\"\" class=\"language-flag\"><span class=\"language-name\">{2}</span></a></li>", click, flagUrl, cultureName);
            }

            ltlLanguages.Text = sb.ToString();

            // Split view button
            btnCompare.ToolTip = GetString("SplitMode.CompareLangVersions");
            btnCompare.Text    = GetString("SplitMode.Compare");
            if (PortalUIHelper.DisplaySplitMode)
            {
                btnCompare.AddCssClass("active");
            }
            else
            {
                btnCompare.RemoveCssClass("active");
            }
        }
        else
        {
            // Hide language menu for one assigned culture on site
            Visible = false;
        }
    }