Example #1
0
 protected void chkPageVisitInherit_CheckedChanged(object sender, EventArgs e)
 {
     chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked;
     if (chkPageVisitInherit.Checked && (node != null))
     {
         string siteName = CMSContext.CurrentSiteName;
         if (!String.IsNullOrEmpty(siteName))
         {
             chkLogPageVisit.Checked = ValidationHelper.GetBoolean(node.GetInheritedValue("DocumentLogVisitActivity", SiteInfoProvider.CombineWithDefaultCulture(siteName)), false);
         }
     }
 }
Example #2
0
    /// <summary>
    /// Logs rating activity
    /// </summary>
    /// <param name="value">Rating value</param>
    private void LogActivity(double value)
    {
        if ((CMSContext.ViewMode != ViewModeEnum.LiveSite) || !ActivitySettingsHelper.ActivitiesEnabledForThisUser(CMSContext.CurrentUser))
        {
            return;
        }

        string siteName = CMSContext.CurrentSiteName;

        if (!ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(siteName) || !ActivitySettingsHelper.ContentRatingEnabled(siteName))
        {
            return;
        }

        bool     logActivity = false;
        TreeNode currentDoc  = CMSContext.CurrentDocument;

        if (currentDoc != null)
        {
            if (CMSContext.CurrentDocument.DocumentLogVisitActivity == null)
            {
                logActivity = ValidationHelper.GetBoolean(currentDoc.GetInheritedValue("DocumentLogVisitActivity", SiteInfoProvider.CombineWithDefaultCulture(siteName)), false);
            }
            else
            {
                logActivity = currentDoc.DocumentLogVisitActivity == true;
            }

            if (logActivity)
            {
                var data = new ActivityData()
                {
                    ContactID = ModuleCommands.OnlineMarketingGetCurrentContactID(),
                    SiteID    = CMSContext.CurrentSiteID,
                    Type      = PredefinedActivityType.RATING,
                    TitleData = String.Format("{0} ({1})", value.ToString(), currentDoc.DocumentName),
                    URL       = URLHelper.CurrentRelativePath,
                    NodeID    = currentDoc.NodeID,
                    Value     = value.ToString(),
                    Culture   = currentDoc.DocumentCulture,
                    Campaign  = CMSContext.Campaign
                };
                ActivityLogProvider.LogActivity(data);
            }
        }
    }