Exemple #1
0
    /// <summary>
    /// Initializes the label with specified user text.
    /// </summary>
    private void SetUserLabel(Label label, string columnName)
    {
        // Get the user ID
        int userId = ValidationHelper.GetInteger(Node.GetValue(columnName), 0);

        if (userId > 0)
        {
            // Get the user object
            UserInfo ui         = null;
            string   key        = "user_" + userId;
            object   userObject = RequestStockHelper.GetItem(key);
            if (userObject != null)
            {
                ui = (UserInfo)userObject;
            }
            else
            {
                // Get user object from database
                ui = UserInfoProvider.GetUserInfo(userId);
                RequestStockHelper.Add(key, ui);
            }

            if (ui != null)
            {
                label.Text = HTMLHelper.HTMLEncode(ui.FullName);
            }
        }
        else
        {
            label.Text = GetString("general.selectnone");
        }
    }
Exemple #2
0
    private string GetUserName(int userId)
    {
        string userName = null;

        if (userId != 0)
        {
            string key = "UserInfo_" + userId;
            // Get user name from request cache
            userName = RequestStockHelper.GetItem(key) as string;
            if (userName == null)
            {
                // Get user information
                DataSet users = UserInfoProvider.GetUsers("UserID=" + userId, null, 1, "UserName, FullName");
                if (!DataHelper.DataSourceIsEmpty(users))
                {
                    DataRow dr          = users.Tables[0].Rows[0];
                    string  usrName     = ValidationHelper.GetString(DataHelper.GetDataRowValue(dr, "UserName"), null);
                    string  usrFullName = ValidationHelper.GetString(DataHelper.GetDataRowValue(dr, "FullName"), null);
                    userName = Functions.GetFormattedUserName(usrName, usrFullName, IsLiveSite);
                    // Store to request cache
                    RequestStockHelper.Add(key, userName);
                }
            }
        }

        return(userName);
    }
    private static void TrackReferral(string siteName)
    {
        string referrerURL = (RequestStockHelper.GetItem("AnalyticsReferrerString") as string);

        if (!string.IsNullOrEmpty(referrerURL))
        {
            Uri referrer = new Uri(referrerURL);
            if ((referrer != null) && (CMSContext.ViewMode == ViewModeEnum.LiveSite))
            {
                if (!referrer.AbsoluteUri.StartsWithCSafe("/") && !referrer.IsLoopback && (referrer.Host.ToLowerCSafe() != URLHelper.Url.Host))
                {
                    // Check other site domains
                    SiteInfo rsi = SiteInfoProvider.GetRunningSiteInfo(referrer.Host, URLHelper.ApplicationPath);
                    if ((rsi == null) || (rsi.SiteName != siteName))
                    {
                        string path = URLHelper.RemoveQuery(referrer.AbsoluteUri);

                        // Save the referrer value
                        CMSContext.CurrentUser.URLReferrer = path;

                        // Log referral
                        string ip = HTTPHelper.UserHostAddress;
                        HitLogProvider.LogHit(HitLogProvider.URL_REFERRALS, siteName, null, path, 0);
                    }
                }
            }
        }
    }
    /// <summary>
    /// Returns column value for current search result item.
    /// </summary>
    /// <param name="columnName">Column</param>
    public object GetSearchValue(string columnName)
    {
        // Get id of the current row
        string id = ValidationHelper.GetString(Eval("id"), String.Empty);

        // Get Datarows for current results
        Hashtable resultRows = RequestStockHelper.GetItem(SearchHelper.RESULTS_KEY) as Hashtable;

        // Check whether id and datarow collection exists
        if ((id != String.Empty) && (resultRows != null))
        {
            // Get current datarow
            DataRow dr = resultRows[id] as DataRow;

            // Check whether datarow exists and contains required column
            if ((dr != null) && (dr.Table.Columns.Contains(columnName)))
            {
                // Return column value
                return(dr[columnName]);
            }
        }

        // Return nothing by default
        return(null);
    }
Exemple #5
0
    void Login1_LoginError(object sender, EventArgs e)
    {
        // Check if custom failure text is not set
        if (string.IsNullOrEmpty(FailureText))
        {
            LocalizedLabel failureLit = Login1.FindControl("FailureText") as LocalizedLabel;
            if (failureLit != null)
            {
                // Display account lock information
                if (AuthenticationHelper.DisplayAccountLockInformation(CMSContext.CurrentSiteName))
                {
                    // Check if account locked due to reaching maximum invalid logon attempts
                    string link = "<a href=\"#\" onclick=\"" + Page.ClientScript.GetCallbackEventReference(this, "null", "UpdateLabel_" + ClientID, "'" + failureLit.ClientID + "'") + ";\">" + GetString("general.clickhere") + "</a>";
                    if (ValidationHelper.GetBoolean(RequestStockHelper.GetItem("UserAccountLockedInvalidLogonAttempts"), false))
                    {
                        failureLit.Text = string.Format(GetString("invalidlogonattempts.unlockaccount.accountlocked") + GetString("invalidlogonattempts.unlockaccount.accountlockedlink"), link);
                    }

                    if (ValidationHelper.GetBoolean(RequestStockHelper.GetItem("UserAccountLockedPasswordExpired"), false))
                    {
                        failureLit.Text = string.Format(GetString("passwordexpiration.accountlocked") + GetString("invalidlogonattempts.unlockaccount.accountlockedlink"), link);
                    }
                }
            }
        }
    }
Exemple #6
0
    /// <summary>
    /// Returns user full name.
    /// </summary>
    /// <param name="userId">User id</param>
    public static string GetUserFullName(object userId)
    {
        int id = ValidationHelper.GetInteger(userId, 0);

        if (id > 0)
        {
            string key = "TransfUserFullName_" + id;

            // Most of the post will be from the same user, store fullname to the request to minimize the DB access
            if (RequestStockHelper.Contains(key))
            {
                return(ValidationHelper.GetString(RequestStockHelper.GetItem(key), ""));
            }
            else
            {
                DataSet ds = CMS.Membership.UserInfoProvider.GetUsers();

                //DataSet ds = UserInfoProvider.GetUsers("UserID = " + id, null, 1, "FullName");
                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    string result = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ds.Tables[0].Rows[0]["FullName"], ""));
                    RequestStockHelper.Add(key, result);

                    return(result);
                }
            }
        }
        return("");
    }
    /// <summary>
    /// PreInit event handler.
    /// </summary>
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Init the page components
        manPortal.SetMainPagePlaceholder(plc);

        var ui = UIElementInfo.Provider.Get(QueryHelper.GetInteger("elementid", 0));

        // Clear UIContext data of element "Modules.UserInterface.Design" (put by UIElement attribute to check permissions)
        var ctx = pnlContext.UIContext;

        ctx.Data = null;
        ctx.HideControlOnError = false;

        if (ui != null)
        {
            ctx.UIElement = ui;

            // Store resource name
            ctx.ResourceName = ApplicationUrlHelper.GetResourceName(ui.ElementResourceID);

            // Provide empty object in case of editing
            if (!ui.RepresentsNew)
            {
                var objectType = UIContextHelper.GetObjectType(ctx);
                if (!String.IsNullOrEmpty(objectType))
                {
                    ctx.EditedObject = GetEmptyObject(objectType);
                }
            }

            int pageTemplateId = ui.ElementPageTemplateID;

            // If no page template is set, dont show any content
            if (pageTemplateId == 0)
            {
                RedirectToInformation(GetString("uielement.design.notemplate"));
            }

            DocumentContext.CurrentPageInfo = PageInfoProvider.GetVirtualPageInfo(pageTemplateId);

            // Set the design mode
            bool enable = (SystemContext.DevelopmentMode || (ui.ElementResourceID == QueryHelper.GetInteger("moduleId", 0) && ui.ElementIsCustom));
            PortalContext.SetRequestViewMode(ViewModeEnum.Design);

            // If displayed module is not selected, disable design mode
            if (!enable)
            {
                plc.ViewMode = ViewModeEnum.DesignDisabled;
            }

            RequestStockHelper.Add(CookieName.DisplayContentInDesignMode, PortalHelper.DisplayContentInUIElementDesignMode, true);

            ManagersContainer    = plcManagers;
            ScriptManagerControl = manScript;
        }
    }
Exemple #8
0
    /// <summary>
    /// Adds action.
    /// </summary>
    /// <param name="action">Action</param>
    public override void AddAction(HeaderAction action)
    {
        if (action == null)
        {
            return;
        }

        // Make sure the Save action is set only once
        string key     = string.Format("HeaderActionsSaveSet_{0}_{1}", action.CommandArgument, ClientID);
        bool   saveSet = ValidationHelper.GetBoolean(RequestStockHelper.GetItem(key), false);

        if (!(action is SaveAction) || !saveSet)
        {
            bool added = false;

            // Ensure correct index
            if (action.Index == -1)
            {
                action.Index = ActionsList.Count;
            }
            else
            {
                // Post processing of action attribute
                for (int i = 0; i < ActionsList.Count; i++)
                {
                    if (ActionsList[i].Index == action.Index)
                    {
                        // Replace action with the same index
                        ActionsList[i] = action;

                        // Button added
                        added = true;
                        break;
                    }
                }
            }

            // If action with the same index was not found, add it to the list
            if (!added)
            {
                ActionsList.Add(action);
            }

            // Keep flag
            if (action is SaveAction)
            {
                RequestStockHelper.Add(key, (action.BaseButton == null) || action.BaseButton.Visible);
            }
        }

        // Store base buttons
        if ((action.BaseButton != null) && !ProcessedBaseButtons.Contains(action.BaseButton))
        {
            ProcessedBaseButtons.Add(action.BaseButton);
        }
    }
Exemple #9
0
    /// <summary>
    /// Returns groupguid for community group specified as an URL parameter of the current request.
    /// </summary>
    private static Guid GetCurrentGroupGuid()
    {
        // Try to get the group info from the request items collection
        BaseInfo gi = (BaseInfo)RequestStockHelper.GetItem("CurrentGroup", true);

        if (gi == null)
        {
            // Try to get group by its GroupID first
            int groupId = QueryHelper.GetInteger("groupid", 0);
            if (groupId > 0)
            {
                gi = ModuleCommands.CommunityGetGroupInfo(groupId);
            }

            // If group was not found by its GroupID
            if (gi == null)
            {
                // Try to get group by its GroupName
                string groupName = QueryHelper.GetString("groupname", "");
                if (groupName != "")
                {
                    gi = ModuleCommands.CommunityGetGroupInfoByName(groupName, CMSContext.CurrentSiteName);
                }
            }

            if (gi == null)
            {
                // Try to get group by its GroupName
                Guid groupGuid = QueryHelper.GetGuid("groupguid", Guid.Empty);
                if (groupGuid != Guid.Empty)
                {
                    return(groupGuid);
                }
            }

            // If group was not found
            if ((gi == null) && (CMSContext.CurrentPageInfo != null))
            {
                // Try to get group from current document
                groupId = CMSContext.CurrentPageInfo.NodeGroupID;
                if (groupId > 0)
                {
                    gi = ModuleCommands.CommunityGetGroupInfo(groupId);
                }
            }

            // Save the group to the request items if new group was loaded from DB
            RequestStockHelper.Add("CurrentGroup", gi, true);
        }

        return(gi.Generalized.ObjectGUID);
    }
Exemple #10
0
    /// <summary>
    /// Returns true, if more than one currency is used and enabled, otherwise false.
    /// </summary>
    private bool MoreThanOneCurrencyUsed()
    {
        bool?moreUsed = RequestStockHelper.GetItem("MoreThanOneCurrencyUsed") as bool?;

        if (!moreUsed.HasValue)
        {
            InfoDataSet <CurrencyInfo> dataSet = CurrencyInfoProvider.GetCurrencies("CurrencyEnabled = 1", null, 2, "CurrencyID", CMSContext.CurrentSiteID);
            moreUsed = dataSet.Items.Count > 1;

            RequestStockHelper.Add("MoreThanOneCurrencyUsed", moreUsed);
        }

        return(moreUsed.Value);
    }
Exemple #11
0
    /// <summary>
    /// Procedures which automatically imports the upgrade export package with all WebParts, Widgets, Reports and TimeZones.
    /// </summary>
    private static void UpgradeImportPackage()
    {
        // Import
        try
        {
            RequestStockHelper.Remove("CurrentDomain", true);

            var importSettings = new SiteImportSettings(MembershipContext.AuthenticatedUser)
            {
                DefaultProcessObjectType = ProcessObjectEnum.All,
                SourceFilePath           = mUpgradePackagePath,
                WebsitePath = mWebsitePath
            };

            using (var context = new CMSActionContext())
            {
                context.DisableLogging();
                context.CreateVersion  = false;
                context.LogIntegration = false;

                ImportProvider.ImportObjectsData(importSettings);

                // Regenerate time zones
                TimeZoneInfoProvider.GenerateTimeZoneRules();

                // Delete the files for separable modules which are not install and therefore not needed
                DeleteWebPartsOfUninstalledModules();

                ImportMetaFiles(Path.Combine(mWebsitePath, "App_Data\\CMSTemp\\Upgrade"));
            }
        }
        catch (Exception ex)
        {
            EventLogProvider.LogException(EVENT_LOG_INFO, "Upgrade", ex);
        }
        finally
        {
            try
            {
                RefreshMacroSignatures();

                EventLogProvider.LogInformation(EVENT_LOG_INFO, "Upgrade - Finish");
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException(EVENT_LOG_INFO, "Upgrade", ex);
            }
        }
    }
Exemple #12
0
    /// <summary>
    /// Gets GUID from hidden field .. if not there create new one.
    /// </summary>
    private String CurrentGuid()
    {
        // For reloaddata (f.e. webpart save) store guid also in request helper, because hidden is empty after control is reloaded.
        Guid guid = ValidationHelper.GetGuid(RequestStockHelper.GetItem("wppreportselector"), Guid.Empty);

        if (hdnGuid.Value == String.Empty)
        {
            hdnGuid.Value = (guid == Guid.Empty) ? Guid.NewGuid().ToString() : guid.ToString();
        }

        if (guid == Guid.Empty)
        {
            RequestStockHelper.Add("wppreportselector", hdnGuid.Value);
        }

        return(hdnGuid.Value);
    }
Exemple #13
0
    protected override void Render(HtmlTextWriter writer)
    {
        // Do not render if nothing is displayed
        if (logCache.Visible ||
            logSQL.Visible ||
            logFiles.Visible ||
            logSec.Visible ||
            logState.Visible ||
            logMac.Visible ||
            logAn.Visible ||
            logReq.Visible)
        {
            base.Render(writer);

            RequestStockHelper.Add("DebugPresent", true, true);
        }
    }
    /// <summary>
    /// Hide all forum viewers except the sender.
    /// </summary>
    /// <param name="sender">Forum instance which requires single display</param>
    private static void DisplayOnlyMe(Control sender)
    {
        var viewers = RequestStockHelper.GetItem("ForumViewerCollection") as List <ForumViewer>;

        if ((viewers != null) && (viewers.Count > 0))
        {
            var senderType = sender as ForumViewer;

            foreach (var forumViewer in viewers)
            {
                if ((forumViewer != null) && (forumViewer != senderType))
                {
                    forumViewer.StopProcessing = true;
                    forumViewer.Visible        = false;
                }
            }
        }
    }
    /// <summary>
    /// Loads inner IFrame content.
    /// </summary>
    private void LoadIFrame()
    {
        // Set iframe attributes
        if ((ControlGroup == null) || !ValidationHelper.GetBoolean(RequestStockHelper.GetItem(DIRECT_FILE_UPLOADER_STORAGE_KEY, ControlKey, true), false))
        {
            uploaderFrame.Attributes.Add("src", ResolveUrl(IFrameUrl));

            if (ControlGroup != null)
            {
                uploaderFrame.Attributes.Add("onload", String.Format("(function tryLoadDFU_{0}() {{ if (window.DFULoadIframes_{0}) {{ window.DFULoadIframes_{0}(); }} else {{ setTimeout(tryLoadDFU_{0}, 200); }} }})();", ControlKey));
            }
            else
            {
                if (RequestHelper.IsCallback() && BrowserHelper.IsIE())
                {
                    uploaderFrame.Attributes.Add("allowTransparency", "true");
                }
                else
                {
                    string script = String.Format("var frameElem = document.getElementById('{0}'); if(frameElem) {{ frameElem.setAttribute('allowTransparency','true') }}", uploaderFrame.ClientID);
                    ScriptHelper.RegisterStartupScript(this, typeof(string), "DFUTrans_" + ClientID, ScriptHelper.GetScript(script));
                }
            }
        }
        else
        {
            uploaderFrame.Attributes.Add("style", "display:none;vertical-align:middle;");
            uploaderFrame.Attributes.Add("class", IFrameCSSClass);
            string script = String.Format("if(!window.DFUframes) {{ var DFUframes = new Object(); }}if(!window.DFUpanels) {{ var DFUpanels = new Object(); }}DFUframes['{0}'] = {1};",
                                          uploaderFrame.ClientID,
                                          ScriptHelper.GetString(ResolveUrl(IFrameUrl)));
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "DFUArrays_" + ClientID, ScriptHelper.GetScript(script));
            if (RequestHelper.IsAsyncPostback())
            {
                ScriptHelper.RegisterStartupScript(this, typeof(string), "DFUArrays_" + ClientID, ScriptHelper.GetScript(script));
            }
        }

        uploaderFrame.Attributes.Add("title", uploaderFrame.ID);
        uploaderFrame.Attributes.Add("name", uploaderFrame.ClientID);

        // Initialize design
        InitDesign();
    }
    /// <summary>
    /// Returns group member info, reult is cached in request.
    /// </summary>
    /// <param name="userId">User ID</param>
    /// <param name="groupId">Group ID</param>
    private GroupMemberInfo GetGroupMember(int userId, int groupId)
    {
        GroupMemberInfo gmi = RequestStockHelper.GetItem("CommunityShortCuts" + userId.ToString() + "_" + groupId.ToString()) as GroupMemberInfo;

        if ((gmi == null) && (!RequestStockHelper.Contains("CommunityShortCuts" + userId.ToString() + "_" + groupId.ToString())))
        {
            gmi = GroupMemberInfoProvider.GetGroupMemberInfo(userId, groupId);
            if (gmi != null)
            {
                RequestStockHelper.Add("CommunityShortCuts" + userId.ToString() + "_" + groupId.ToString(), gmi);
            }
            else
            {
                RequestStockHelper.Add("CommunityShortCuts" + userId.ToString() + "_" + groupId.ToString(), false);
            }
        }

        return(gmi);
    }
    /// <summary>
    /// OnPreRender override.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (RenderCssClasses)
        {
            formElem.SubmitButton.CssClass = "SubmitButton";
        }

        bool preloaderRequired = ValidationHelper.GetBoolean(RequestStockHelper.GetItem("CMSGraphAutoWidth"), false);

        if (UseProgressIndicator && (!preloaderRequired || RequestHelper.IsPostBack()))
        {
            ScriptHelper.RegisterProgress(Page);
        }

        wasPreRender = true;

        if (RequestHelper.IsPostBack() && (!UseExternalReload || DisplayFilter))
        {
            try
            {
                formElem.SaveData(null);
            }
            catch
            {
            }
        }

        if (!reportLoaded)
        {
            ReloadData(true);
        }


        // Disable CSS class for filter if filter isn't visible
        if ((mDisplayFilterResult == false) || (formElem == null) ||
            (ReportInfo == null) || (ReportInfo.ReportParameters == "") ||
            (ReportInfo.ReportParameters.ToLowerCSafe() == "<form></form>"))
        {
            formElem.CssClass = "";
        }

        base.OnPreRender(e);
    }
Exemple #18
0
    /// <summary>
    /// Login error handler.
    /// </summary>
    protected void loginElem_LoginError(object sender, EventArgs e)
    {
        // Check if custom failure text is not set
        if (string.IsNullOrEmpty(FailureText))
        {
            Label failureLit = loginElem.FindControl("FailureText") as Label;
            if (failureLit != null)
            {
                // Display account lock information
                if (AuthenticationHelper.DisplayAccountLockInformation(CMSContext.CurrentSiteName))
                {
                    // Check if account locked due to reaching maximum invalid logon attempts
                    string link = "<a href=\"#\" onclick=\"" + Page.ClientScript.GetCallbackEventReference(this, "null", "UpdateLabel_" + ClientID, "'" + failureLit.ClientID + "'") + ";\">" + GetString("general.clickhere") + "</a>";
                    if (ValidationHelper.GetBoolean(RequestStockHelper.GetItem("UserAccountLockedInvalidLogonAttempts"), false))
                    {
                        loginElem.FailureText = GetString("invalidlogonattempts.unlockaccount.accountlocked");
                        if (!ErrorAsPopup)
                        {
                            loginElem.FailureText += string.Format(GetString("invalidlogonattempts.unlockaccount.accountlockedlink"), link);
                        }
                    }

                    if (ValidationHelper.GetBoolean(RequestStockHelper.GetItem("UserAccountLockedPasswordExpired"), false))
                    {
                        loginElem.FailureText = GetString("passwordexpiration.accountlocked");
                        if (!ErrorAsPopup)
                        {
                            loginElem.FailureText += string.Format(GetString("invalidlogonattempts.unlockaccount.accountlockedlink"), link);
                        }
                    }
                }
            }
        }

        //Display the failure message in a client-side alert box
        if (ErrorAsPopup)
        {
            ScriptHelper.RegisterStartupScript(this, GetType(), "LoginError", ScriptHelper.GetScript("alert(" + ScriptHelper.GetString(loginElem.FailureText) + ");"));

            Label error = (Label)loginElem.FindControl("FailureText");
            error.Visible = false;
        }
    }
Exemple #19
0
    /// <summary>
    /// PreInit event handler.
    /// </summary>
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Init the page components
        PageManager = manPortal;
        manPortal.SetMainPagePlaceholder(plc);

        int pageTemplateId = QueryHelper.GetInteger("templateid", 0);

        UIContext.EditedObject = PageTemplateInfoProvider.GetPageTemplateInfo(pageTemplateId);

        DocumentContext.CurrentPageInfo = PageInfoProvider.GetVirtualPageInfo(pageTemplateId);

        // Set the design mode
        PortalContext.SetRequestViewMode(ViewModeEnum.Design);
        RequestStockHelper.Add(CookieName.DisplayContentInDesignMode, "0", true);

        ManagersContainer    = plcManagers;
        ScriptManagerControl = manScript;
    }
    private void Login1_LoginError(object sender, EventArgs e)
    {
        if (FailureLabel != null)
        {
            if (AuthenticationHelper.DisplayAccountLockInformation(CMSContext.CurrentSiteName))
            {
                string link = "<a href=\"#\" onclick=\"" + Page.ClientScript.GetCallbackEventReference(this, "null", "UpdateLabel_" + ClientID, "'" + FailureLabel.ClientID + "'") + ";\">" + GetString("general.clickhere") + "</a>";
                if (ValidationHelper.GetBoolean(RequestStockHelper.GetItem("UserAccountLockedInvalidLogonAttempts"), false))
                {
                    FailureLabel.Text = string.Format(GetString("invalidlogonattempts.unlockaccount.accountlocked") + GetString("invalidlogonattempts.unlockaccount.accountlockedlink"), link);
                }

                if (ValidationHelper.GetBoolean(RequestStockHelper.GetItem("UserAccountLockedPasswordExpired"), false))
                {
                    FailureLabel.Text = string.Format(GetString("passwordexpiration.accountlocked") + GetString("invalidlogonattempts.unlockaccount.accountlockedlink"), link);
                }
            }
            else
            {
                FailureLabel.Text = GetString("Login_FailureText");
            }
        }
    }
    /// <summary>
    /// OnPreRender override - set preloader area if is required.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        // Hide panel by default
        pnlPreLoader.Style.Add("display", "none");

        bool useAutoWidth = ValidationHelper.GetBoolean(RequestStockHelper.GetItem("CMSGraphAutoWidth"), false);

        // If is initial request, display preparing information
        if (!RequestHelper.IsPostBack() && useAutoWidth)
        {
            pnlPreLoader.Style.Clear();
            pnlPreLoader.Style.Add("position", "absolute");
            pnlPreLoader.Style.Add("top", "0");
            pnlPreLoader.Style.Add("left", "0");
            pnlPreLoader.Style.Add("width", "100%");
            pnlPreLoader.Style.Add("height", "100%");
            pnlPreLoader.Style.Add("z-index", "100000");
            pnlPreLoader.Style.Add("background-color", "#ffffff");
            pnlPreLoader.Style.Add("overflow", "hidden");
        }

        base.OnPreRender(e);
    }
Exemple #22
0
    /// <summary>
    /// OnPreRender override.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        bool preloaderRequired = ValidationHelper.GetBoolean(RequestStockHelper.GetItem("CMSGraphAutoWidth"), false);

        if (UseProgressIndicator && (!preloaderRequired || RequestHelper.IsPostBack()))
        {
            ScriptHelper.RegisterLoader(Page);
        }

        wasPreRender = true;

        if (RequestHelper.IsPostBack() && (!UseExternalReload || DisplayFilter))
        {
            try
            {
                formParameters.SaveData(null, false);
            }
            catch (Exception)
            {
            }
        }

        if (!reportLoaded)
        {
            ReloadData(true);
        }

        // Disable CSS class for filter if filter isn't visible
        if ((!mDisplayFilterResult) ||
            (ReportInfo == null) || (ReportInfo.ReportParameters == String.Empty) ||
            ReportInfo.ReportParameters.Equals("<form></form>", StringComparison.OrdinalIgnoreCase))
        {
            formParameters.CssClass = String.Empty;
        }

        base.OnPreRender(e);
    }
    public string LogHits(string pageGUID, string referrer)
    {
        string   siteName    = CMSContext.CurrentSiteName;
        UserInfo currentUser = CMSContext.CurrentUser;

        // Need to fake referrer and current page
        RequestStockHelper.Add("AnalyticsReferrerString", referrer);
        PageInfo currentPage = CMSContext.CurrentPageInfo = PageInfoProvider.GetPageInfo(new Guid(pageGUID));

        if (!AnalyticsHelper.JavascriptLoggingEnabled(siteName))
        {
            throw new InvalidOperationException("logging by JS not enabled");
        }

        // ONLINE MARKETING
        {
            // Log activities
            if (ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(siteName) && ActivitySettingsHelper.ActivitiesEnabledForThisUser(CMSContext.CurrentUser))
            {
                int contactId = ModuleCommands.OnlineMarketingGetCurrentContactID();

                CMSContext.ContactID = contactId;
                if (contactId > 0)
                {
                    ModuleCommands.OnlineMarketingLogLandingPage(0);
                    ModuleCommands.OnlineMarketingLogExternalSearch(0);
                    ModuleCommands.OnlineMarketingLogPageVisit(0);
                    UpdateContactsIPandUserAgent(siteName);
                }
            }
        }

        if (AnalyticsHelper.IsLoggingEnabled(siteName, currentPage.NodeAliasPath))
        {
            // PAGE VIEW
            if (AnalyticsHelper.TrackPageViewsEnabled(siteName))
            {
                HitLogProvider.LogHit(HitLogProvider.PAGE_VIEWS, siteName, currentUser.PreferredCultureCode, currentPage.NodeAliasPath, currentPage.NodeID);
            }


            // AGGREGATED VIEW
            /// not logged by JavaScript call


            // FILE DOWNLOADS
            /// file downloads are logged via special WebPart that directly outputs specified file (and before that logs a hit), so there is no way we can log this via JS


            // BROWSER CAPABILITIES
            /// are already logged by JavaScript via WebPart AnalayicsBrowserCapabilities


            // SEARCH CRAWLER
            /// not logged by JavaScript call


            // INVALID PAGES
            /// throw 404 and there's no need to call it via JavaScript (even if RSS gets 404, we should know about it)


            // URL REFFERALS
            /// RSS readers and crawlers might set custom referral, so this is needed
            /// cannot be loopback
            /// cannot be the same host
            if (AnalyticsHelper.TrackReferralsEnabled(siteName))
            {
                TrackReferral(siteName);
            }

            // ON-SITE SEARCH KEYWORDS
            /// separate method


            // BANNER HITS
            /// separate method


            // BANNER CLICKS


            // VISITOR
            // BROWSER TYPE
            // MOBILE DEVICES
            // BROWSER TYPE
            // COUNTRIES
            /// Cookies VisitorStatus, VisitStatus (a obsolete CurrentVisitStatus)
            /// IP
            /// method uses AnalyticsHelper.GetContextStatus and AnalyticsHelper.SetContextStatus and also logs all mobile devices
            AnalyticsMethods.LogVisitor(siteName);


            // REFERRING SITE
            // ALL TRAFFIC SOURCES (REFERRINGSITE + "_local") (REFERRINGSITE + "_direct") (REFERRINGSITE + "_search") (REFERRINGSITE + "_referring")
            // SEARCH KEYWORDS
            // LANDING PAGE
            // EXIT PAGE
            // TIME ON PAGE
            AnalyticsMethods.LogAnalytics(SessionHelper.GetSessionID(), currentPage, siteName);
        }

        return("ok");
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (Behavior == "hover")
        {
            StringBuilder sb = new StringBuilder();
            // If jQuery not loaded
            sb.AppendFormat(@"
if (typeof jQuery == 'undefined') {{ 
    var jQueryCore=document.createElement('script');
    jQueryCore.setAttribute('type','text/javascript'); 
    jQueryCore.setAttribute('src', '{0}');
    setTimeout('document.body.appendChild(jQueryCore)',100); 
    setTimeout('loadTooltip()',200);
}}", ScriptHelper.GetScriptUrl("~/CMSScripts/jquery/jquery-core.js"));

            // If jQuery tooltip plugin not loaded
            sb.AppendFormat(@"
var jQueryTooltips=document.createElement('script'); 
function loadTooltip() {{ 
    if (typeof jQuery == 'undefined') {{ setTimeout('loadTooltip()',200); return;}} 
    if (typeof jQuery.fn.tooltip == 'undefined') {{ 
        jQueryTooltips.setAttribute('type','text/javascript'); 
        jQueryTooltips.setAttribute('src', '{0}'); 
        setTimeout('document.body.appendChild(jQueryTooltips)',100); 
    }}
}}", ScriptHelper.GetScriptUrl("~/CMSScripts/jquery/jquery-tooltips.js"));


            string rtlDefinition = null;
            if (((IsLiveSite) && (CultureHelper.IsPreferredCultureRTL())) || (CultureHelper.IsUICultureRTL()))
            {
                rtlDefinition = "positionLeft: true,left: -15,";
            }

            sb.AppendFormat(@"
function hover(imgID, width, height, sizeInUrl) {{ 
    if ((typeof jQuery == 'undefined')||(typeof jQuery.fn.tooltip == 'undefined')) {{
        var imgIDForTimeOut = imgID.replace(/\\/gi,""\\\\"").replace(/'/gi,""\\'"");
        setTimeout(""loadTooltip();hover('""+imgIDForTimeOut+""',""+width+"",""+height+"",""+sizeInUrl+"")"",100); return;
    }}
    jQuery('img[id='+imgID+']').tooltip({{
        delay: 0,
        track: true,
        showBody: "" - "",
        showBody: "" - "", 
        extraClass: ""ImageExtraClass"",
        showURL: false, 
        {0}
        bodyHandler: function() {{
            var hidden = jQuery(""#"" + imgID + ""_src"");
            var source = this.src;
            if (hidden[0] != null) {{
                source = hidden[0].value;
            }}
            var hoverDiv = jQuery(""<div/>"");
            var hoverImg = jQuery(""<img/>"").attr(""class"", ""ImageTooltip"").attr(""src"", source);
            hoverImg.css({{'width' : width, 'height' : height}});
            hoverDiv.append(hoverImg);
            return hoverDiv;
        }}
    }});
}}", rtlDefinition);

            ScriptHelper.RegisterStartupScript(Page, typeof(Page), "JQueryImagePreview", ScriptHelper.GetScript(sb.ToString()));
        }

        ImageParameters imgParams = new ImageParameters();

        if (!String.IsNullOrEmpty(URL))
        {
            imgParams.Url = ResolveUrl(URL);
        }
        imgParams.Align           = Align;
        imgParams.Alt             = Alt;
        imgParams.Behavior        = Behavior;
        imgParams.BorderColor     = BorderColor;
        imgParams.BorderWidth     = BorderWidth;
        imgParams.Class           = Class;
        imgParams.Extension       = Extension;
        imgParams.Height          = Height;
        imgParams.HSpace          = HSpace;
        imgParams.Id              = (String.IsNullOrEmpty(ImageID) ? Guid.NewGuid().ToString() : ImageID);
        imgParams.Link            = Link;
        imgParams.MouseOverHeight = MouseOverHeight;
        imgParams.MouseOverWidth  = MouseOverWidth;
        imgParams.SizeToURL       = SizeToURL;
        imgParams.Style           = Style;
        imgParams.Target          = Target;
        imgParams.Tooltip         = Tooltip;
        imgParams.VSpace          = VSpace;
        imgParams.Width           = Width;

        if (ShowFileIcons && (Extension != null))
        {
            imgParams.Width  = 0;
            imgParams.Height = 0;
            imgParams.Url    = GetFileIconUrl(Extension, "List");
        }

        ltlImage.Text = MediaHelper.GetImage(imgParams);

        // Dynamic JQuery hover effect
        if (Behavior == "hover")
        {
            string imgId = HTMLHelper.HTMLEncode(HttpUtility.UrlDecode(imgParams.Id));
            string url   = HttpUtility.HtmlDecode(URL);
            if (SizeToURL)
            {
                if (MouseOverWidth > 0)
                {
                    url = URLHelper.UpdateParameterInUrl(url, "width", MouseOverWidth.ToString());
                }
                if (MouseOverHeight > 0)
                {
                    url = URLHelper.UpdateParameterInUrl(url, "height", MouseOverHeight.ToString());
                }
                url = URLHelper.RemoveParameterFromUrl(url, "maxsidesize");
            }
            ltlImage.Text += "<input type=\"hidden\" id=\"" + imgId + "_src\" value=\"" + ResolveUrl(url) + "\" />";

            ScriptHelper.RegisterStartupScript(Page, typeof(Page), "ImageHover_" + imgId, ScriptHelper.GetScript("hover(" + ScriptHelper.GetString(ScriptHelper.EscapeJQueryCharacters(imgId)) + ", " + MouseOverWidth + ", " + MouseOverHeight + ", " + (SizeToURL ? "true" : "false") + ");"));
            if (!RequestStockHelper.Contains("DialogsImageHoverStyle"))
            {
                RequestStockHelper.Add("DialogsImageHoverStyle", true);
                CSSHelper.RegisterCSSBlock(Page, "#tooltip {position: absolute;z-index:5000;}");
            }
        }
    }
Exemple #25
0
    /// <summary>
    /// Reload data.
    /// </summary>
    public override void ReloadData(bool forceLoad)
    {
        // If percent Width is Set and reloadonPrerender == false  - it means first run .. ad postback scripts and exit
        if ((GraphImageWidth != 0) && (ComputedWidth == 0))
        {
            string argument = Request.Params[Page.postEventArgumentID];
            string target   = Request.Params[Page.postEventSourceID];

            // Check for empty (invisible) div to prevent neverending loop
            // If refresh postback and still no computedwidth - display graph with default width
            if (!((target == btnRefresh.UniqueID) && (argument == "refresh")))
            {
                mRegisterWidthScript = true;
                ucChart.Visible      = false;
                RequestStockHelper.Add("CMSGraphAutoWidth", true);
                return;
            }
        }

        RequestStockHelper.Add("CMSGraphAutoWidth", false);
        mRegisterWidthScript = false;

        // ReportGraphName is set from AbstractReportControl parameter
        ReportGraphName = Parameter;

        // Preview
        if (GraphInfo != null)
        {
            GetReportGraph(GraphInfo);
        }
        else
        {
            ReportGraphInfo rgi = ReportGraphInfo;
            // If saved report guid is empty ==> create "live" graph, else load saved graph
            if (SavedReportGuid == Guid.Empty)
            {
                // Get graph info object
                if (rgi != null)
                {
                    GetReportGraph(rgi);
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = "[ReportGraph.ascx] Report graph '" + ReportGraphName + "' not found.";
                    EventLogProvider.LogException("Report graph", "E", new Exception("Report graph '" + ReportGraphName + "' not found."));
                }
            }
            else
            {
                if (rgi != null)
                {
                    int correctWidth = 0;
                    if (ComputedWidth != 0)
                    {
                        correctWidth = GetGraphWidth();
                    }

                    rgi.GraphTitle      = ResHelper.LocalizeString(rgi.GraphTitle);
                    rgi.GraphXAxisTitle = ResHelper.LocalizeString(rgi.GraphXAxisTitle);
                    rgi.GraphYAxisTitle = ResHelper.LocalizeString(rgi.GraphYAxisTitle);

                    QueryIsStoredProcedure = rgi.GraphQueryIsStoredProcedure;
                    QueryText = ResolveMacros(rgi.GraphQuery);

                    // Load data, generate image
                    ReportGraph rg = new ReportGraph()
                    {
                        Colors = Colors
                    };

                    // Save image
                    SavedGraphInfo sgi = new SavedGraphInfo();

                    string noRecordText = ResolveMacros(ValidationHelper.GetString(rgi.GraphSettings["QueryNoRecordText"], String.Empty));

                    try
                    {
                        rg.CorrectWidth = correctWidth;
                        DataSet ds = LoadData();
                        if (!DataHelper.DataSourceIsEmpty(ds) || !String.IsNullOrEmpty(noRecordText))
                        {
                            sgi.SavedGraphBinary = rg.CreateChart(rgi, LoadData(), ContextResolver, true);
                        }
                    }
                    catch (Exception ex)
                    {
                        EventLogProvider.LogException("Report graph", "E", ex);

                        byte[] invalidGraph = rg.CreateChart(rgi, null, ContextResolver, true);
                        sgi.SavedGraphBinary = invalidGraph;
                    }

                    if (sgi.SavedGraphBinary != null)
                    {
                        sgi.SavedGraphGUID          = SavedReportGuid;
                        sgi.SavedGraphMimeType      = "image/png";
                        sgi.SavedGraphSavedReportID = SavedReportID;

                        SavedGraphInfoProvider.SetSavedGraphInfo(sgi);

                        // Create graph image
                        imgGraph.Visible  = true;
                        ucChart.Visible   = false;
                        imgGraph.ImageUrl = ResolveUrl("~/CMSModules/Reporting/CMSPages/GetReportGraph.aspx") + "?graphguid=" + SavedReportGuid.ToString();
                    }
                    else
                    {
                        Visible = false;
                    }
                }
            }
        }
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            ScriptHelper.RegisterJQuery(Page);
            ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploader.js");

            if (!RequestHelper.IsPostBack() || ForceLoad)
            {
                ReloadData();
            }

            if (ControlGroup != null)
            {
                // First instance of the control is loaded
                RequestStockHelper.Add(DIRECT_FILE_UPLOADER_STORAGE_KEY, ControlKey, true, true);

                StringBuilder sb = new StringBuilder();
                sb.Append(
                    @"
function DFULoadIframes_", ControlKey, @"() {
    var iframe = document.getElementById('", uploaderFrame.ClientID, @"');
    if (iframe!=null) {
        iframe.setAttribute('allowTransparency','true');
        if (window.DFUframes != null) {
            var iframes = $j('iframe.", IFrameCSSClass, @"');
            for(var i = 0; i < iframes.length; i++) {
                var f = iframes[i];
                var p = f.parentNode.parentNode;
                var imgs = p.getElementsByTagName('img');
                if ((imgs != null) && (imgs[0] != null)) {
                    p.removeChild(imgs[0]);
                }
                var o = null;
                var cw = iframe.contentWindow;
                if (cw != null)
                { 
                    var cwd = cw.document;
                    if (cwd != null) {
                        var cn = cwd.childNodes;
                        if ((cn != null) && (cn.length > 0) && (cn[1].innerHTML != null)) {
                            var containerId = DFUframes[f.id].match(/containerid=([^&]+)/i)[1];
                    
                            o = cn[1].innerHTML;
                            o = o.replace(/action=[^\\s]+/, 'action=""' + DFUframes[f.id] + '""').replace('", ERROR_FUNCTION, @"','');
                            o = o.replace(/(\.\.\/)+App_Themes\//ig, '", ResolveUrl("~"), @"App_Themes/');
                            o = o.replace(/OnUploadBegin\('[^']+'\)/ig, 'OnUploadBegin(\'' + containerId + '\')');

                            var cd = f.contentWindow.document;
                            cd.write(o);
                            cd.close();

                            f.style.display = '';
                            f.setAttribute('allowTransparency','true');
                        }
                    }
                }
            }
        }
    }
}"
                    );

                string script = sb.ToString();

                ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "DFUIframesLoader_" + ControlKey, ScriptHelper.GetScript(script));

                if (RequestHelper.IsAsyncPostback())
                {
                    ScriptHelper.RegisterStartupScript(this, typeof(string), "DFUIframesLoader_" + ControlKey, ScriptHelper.GetScript(script));
                }
            }
        }
    }
    private static void Upgrade60Import()
    {
        EventLogProvider evp = new EventLogProvider();

        // Import
        try
        {
            RequestStockHelper.Remove("CurrentDomain", true);

            SiteImportSettings importSettings = new SiteImportSettings(CMSContext.CurrentUser)
            {
                DefaultProcessObjectType = ProcessObjectEnum.All,
                SourceFilePath           = mUpgradePackagePath,
                WebsitePath = mWebsitePath
            };

            ImportProvider.ImportObjectsData(importSettings);

            // Regenerate time zones
            TimeZoneInfoProvider.GenerateTimeZoneRules();

            #region "Separability"

            String        webPartsPath = mWebsitePath + "CMSWebParts\\";
            List <String> files        = new List <string>();
            // Create list of files to remove
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.BIZFORM))
            {
                files.AddRange(GetAllFiles(webPartsPath + "BizForms"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.BLOGS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Blogs"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Community"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ECOMMERCE))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Ecommerce"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.EVENTMANAGER))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Events"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Forums"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MEDIALIBRARY))
            {
                files.AddRange(GetAllFiles(webPartsPath + "MediaLibrary"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGEBOARD))
            {
                files.AddRange(GetAllFiles(webPartsPath + "MessageBoards"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGING))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Messaging"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NEWSLETTER))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Newsletters"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NOTIFICATIONS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Notifications"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING))
            {
                files.AddRange(GetAllFiles(webPartsPath + "OnlineMarketing"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.POLLS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Polls"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.PROJECTMANAGEMENT))
            {
                files.AddRange(GetAllFiles(webPartsPath + "ProjectManagement"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.REPORTING))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Reporting"));
            }

            // Remove webparts for separated modules
            foreach (String file in files)
            {
                try
                {
                    File.Delete(file);
                }
                catch (Exception ex)
                {
                    evp.LogEvent("Upgrade to 6.0", "Upgrade", ex);
                }
            }

            #endregion

            evp.LogEvent("I", DateTime.Now, "Upgrade to 6.0", "Upgrade - Finish");
        }
        catch (Exception ex)
        {
            evp.LogEvent("Upgrade to 6.0", "Upgrade", ex);
        }
    }
Exemple #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Keep current user object
        CurrentUserInfo currentUser = CMSContext.CurrentUser;

        // Title element settings
        titleElem.TitleImage = GetImageUrl("Objects/PM_ProjectTask/object.png");
        titleElem.TitleText  = GetString("pm.projecttask.edit");

        #region "Header actions"

        if (CMSContext.CurrentUser.IsAuthenticated())
        {
            // New task link
            string[,] actions = new string[1, 7];
            actions[0, 0]     = HeaderActions.TYPE_LINKBUTTON;
            actions[0, 1]     = GetString("pm.projecttask.newpersonal");
            actions[0, 2]     = null;
            actions[0, 4]     = null;
            actions[0, 5]     = GetImageUrl("Objects/PM_Project/add.png");
            actions[0, 6]     = "new_task";

            HeaderActions.Actions          = actions;
            HeaderActions.ActionPerformed += new CommandEventHandler(actionsElem_ActionPerformed);
            HeaderActions.ReloadData();
        }
        #endregion

        // Switch by display type and set correct list grid name
        switch (this.TasksDisplayType)
        {
        // Project tasks
        case TasksDisplayTypeEnum.ProjectTasks:
            ucTaskList.OrderByType   = ProjectTaskOrderByEnum.NotSpecified;
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/ProjectTasks.xml";
            pnlListActions.Visible   = false;
            break;

        // Tasks owned by me
        case TasksDisplayTypeEnum.TasksOwnedByMe:
            ucTaskList.OrderByType   = ProjectTaskOrderByEnum.NotSpecified;
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/TasksOwnedByMe.xml";
            break;

        // Tasks assigned to me
        case TasksDisplayTypeEnum.TasksAssignedToMe:
            // Set not specified order by default
            ucTaskList.OrderByType = ProjectTaskOrderByEnum.NotSpecified;
            // If sitename is not defined => display task from all sites => use user order
            if (String.IsNullOrEmpty(this.SiteName))
            {
                ucTaskList.OrderByType = ProjectTaskOrderByEnum.UserOrder;
            }
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/TasksAssignedToMe.xml";
            break;
        }

        #region "Force edit by TaskID in querystring"

        // Check whether is not postback
        if (!RequestHelper.IsPostBack())
        {
            // Try get value from request stroage which indicates whether force dialog is displayed
            bool isDisplayed = ValidationHelper.GetBoolean(RequestStockHelper.GetItem("cmspmforceitemdisplayed", true), false);

            // Try get task id from querystring
            int forceTaskId = QueryHelper.GetInteger("taskid", 0);
            if ((forceTaskId > 0) && (!isDisplayed))
            {
                ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(forceTaskId);
                ProjectInfo     pi  = ProjectInfoProvider.GetProjectInfo(pti.ProjectTaskProjectID);

                // Check whether task is defined
                // and if is assigned to some project, this project is assigned to current site
                if ((pti != null) && ((pi == null) || (pi.ProjectSiteID == CMSContext.CurrentSiteID)))
                {
                    bool taskIdValid = false;

                    // Switch by display type
                    switch (this.TasksDisplayType)
                    {
                    // Tasks created by me
                    case TasksDisplayTypeEnum.TasksOwnedByMe:
                        if (pti.ProjectTaskOwnerID == currentUser.UserID)
                        {
                            taskIdValid = true;
                        }
                        break;

                    // Tasks assigned to me
                    case TasksDisplayTypeEnum.TasksAssignedToMe:
                        if (pti.ProjectTaskAssignedToUserID == currentUser.UserID)
                        {
                            taskIdValid = true;
                        }
                        break;

                    // Project task
                    case TasksDisplayTypeEnum.ProjectTasks:
                        if (!String.IsNullOrEmpty(ProjectNames) && (pi != null))
                        {
                            string projectNames = ";" + ProjectNames.ToLower() + ";";
                            if (projectNames.Contains(";" + pi.ProjectName.ToLower() + ";"))
                            {
                                // Check whether user can see private task
                                if (!pti.ProjectTaskIsPrivate ||
                                    ((pti.ProjectTaskOwnerID == currentUser.UserID) || (pti.ProjectTaskAssignedToUserID == currentUser.UserID)) ||
                                    ((pi.ProjectGroupID > 0) && currentUser.IsGroupAdministrator(pi.ProjectGroupID)) ||
                                    ((pi.ProjectGroupID == 0) && (currentUser.IsAuthorizedPerResource("CMS.ProjectManagement", CMSAdminControl.PERMISSION_MANAGE))))
                                {
                                    taskIdValid = true;
                                }
                            }
                        }
                        break;
                    }

                    bool displayValid = true;

                    // Check whether do not display finished tasks is required
                    if (!this.ShowFinishedTasks)
                    {
                        ProjectTaskStatusInfo ptsi = ProjectTaskStatusInfoProvider.GetProjectTaskStatusInfo(pti.ProjectTaskStatusID);
                        if ((ptsi != null) && (ptsi.TaskStatusIsFinished))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether private task should be edited
                    if (!this.ShowPrivateTasks)
                    {
                        if (pti.ProjectTaskProjectID == 0)
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether ontime task should be edited
                    if (!this.ShowOnTimeTasks)
                    {
                        if ((pti.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) && (pti.ProjectTaskDeadline < DateTime.Now))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether overdue task should be edited
                    if (!this.ShowOverdueTasks)
                    {
                        if ((pti.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) && (pti.ProjectTaskDeadline > DateTime.Now))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether user is allowed to see project
                    if ((pi != null) && (ProjectInfoProvider.IsAuthorizedPerProject(pi.ProjectID, ProjectManagementPermissionType.READ, CMSContext.CurrentUser)))
                    {
                        displayValid = false;
                    }

                    // If task is valid and user has permissions to see this task display edit task dialog
                    if (displayValid && taskIdValid && ProjectTaskInfoProvider.IsAuthorizedPerTask(forceTaskId, ProjectManagementPermissionType.READ, CMSContext.CurrentUser, CMSContext.CurrentSiteID))
                    {
                        this.ucTaskEdit.ItemID = forceTaskId;
                        this.ucTaskEdit.ReloadData();
                        // Render dialog
                        this.ucPopupDialog.Visible = true;
                        this.ucPopupDialog.Show();
                        // Set "force dialog displayed" flag
                        RequestStockHelper.Add("cmspmforceitemdisplayed", true, true);
                    }
                }
            }
        }

        #endregion


        #region "Event handlers registration"

        // Register list action handler
        ucTaskList.OnAction += new CommandEventHandler(ucTaskList_OnAction);

        #endregion


        #region "Pager settings"

        // Paging
        if (!EnablePaging)
        {
            ucTaskList.Grid.PageSize = "##ALL##";
            ucTaskList.Grid.Pager.DefaultPageSize = -1;
        }
        else
        {
            ucTaskList.Grid.Pager.DefaultPageSize = PageSize;
            ucTaskList.Grid.PageSize    = this.PageSize.ToString();
            ucTaskList.Grid.FilterLimit = PageSize;
        }

        #endregion


        // Use postbacks on list actions
        ucTaskList.UsePostbackOnEdit = true;
        // Check delete permission
        ucTaskList.OnCheckPermissionsExtended += new CheckPermissionsExtendedEventHandler(ucTaskList_OnCheckPermissionsExtended);
        // Dont register JS edit script
        ucTaskList.RegisterEditScript = false;

        // Hide default ok button on edit
        ucTaskEdit.ShowOKButton = false;
        // Disable on site validators
        ucTaskEdit.DisableOnSiteValidators = true;
        // Check modify permission
        ucTaskEdit.OnCheckPermissionsExtended += new CheckPermissionsExtendedEventHandler(ucTaskEdit_OnCheckPermissionsExtended);
        // Build condition event
        ucTaskList.BuildCondition += new CMSModules_ProjectManagement_Controls_UI_ProjectTask_List.BuildConditionEvent(ucTaskList_BuildCondition);
    }