Ejemplo n.º 1
0
 /// <summary>
 /// Disables groups drop-down list when empty.
 /// </summary>
 private void HandleGroupEmpty()
 {
     if (disableGroupSelector && ModuleEntry.IsModuleRegistered(ModuleEntry.COMMUNITY) && ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && (groupsSelector != null))
     {
         groupsSelector.Enabled = false;
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Initializes group selector.
    /// </summary>
    private void HandleGroupsSelection()
    {
        // Display group selector only when group module is present
        if (ModuleEntry.IsModuleRegistered(ModuleEntry.COMMUNITY) && ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && (groupsSelector != null))
        {
            // Global libraries item into group selector
            if (GlobalLibraries != AvailableLibrariesEnum.None)
            {
                // Add special item
                groupsSelector.SetValue("UseDisplayNames", true);
                groupsSelector.SetValue("DisplayGlobalValue", true);
                groupsSelector.SetValue("SiteID", SiteID);
                groupsSelector.SetValue("GlobalValueText", GetString("dialogs.media.globallibraries"));
                groupsSelector.IsLiveSite = IsLiveSite;
            }
            else
            {
                groupsSelector.SetValue("DisplayGlobalValue", false);
            }

            // If all groups should be displayed
            switch (Groups)
            {
            case AvailableGroupsEnum.All:
                // Set condition to load only groups realted to the current site
                groupsSelector.SetValue("WhereCondition", String.Format("(GroupSiteID={0})", SiteID));
                break;

            case AvailableGroupsEnum.OnlyCurrentGroup:
                // Load only current group and disable control
                int groupId = ModuleCommands.CommunityGetCurrentGroupID();
                groupsSelector.SetValue("WhereCondition", String.Format("(GroupID={0})", groupId));
                break;

            case AvailableGroupsEnum.OnlySingleGroup:
                if (!string.IsNullOrEmpty(GroupName))
                {
                    groupsSelector.SetValue("WhereCondition", String.Format("(GroupName = N'{0}' AND GroupSiteID={1})", SqlHelperClass.GetSafeQueryString(GroupName, false), SiteID));
                }
                break;

            case AvailableGroupsEnum.None:
                // Just '(none)' displayed in the selection
                if (GlobalLibraries == AvailableLibrariesEnum.None)
                {
                    groupsSelector.SetValue("DisplayNoneWhenEmpty", true);
                    groupsSelector.SetValue("EnabledGroups", false);
                }
                groupsSelector.SetValue("WhereCondition", String.Format("({0})", SqlHelperClass.NO_DATA_WHERE));
                break;
            }

            // Reload group selector based on recently passed settings
            ((IDataUserControl)groupsSelector).ReloadData(true);
        }
        else
        {
            plcGroupSelector.Visible = false;
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Loads media library data
    /// </summary>
    public void LoadLibraryData()
    {
        if (mLibraryDataLoaded)
        {
            return;
        }

        // Display group selector only when group module is present
        if (ModuleEntry.IsModuleRegistered(ModuleEntry.COMMUNITY) && ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && (groupsSelector != null))
        {
            HandleGroupsSelection();
        }
        else
        {
            // Reload libraries
            LoadLibrarySelection();

            // Pre-select library
            PreselectLibrary();

            RaiseOnLibraryChanged();
        }

        mLibraryDataLoaded = true;
    }
    /// <summary>
    /// Resets all boxes.
    /// </summary>
    public void ResetControls()
    {
        txtCodeName.Text    = null;
        txtDisplayName.Text = null;

        //Fill drop down list
        DataHelper.FillWithEnum <AnalyzerTypeEnum>(drpAnalyzer, "srch.index.", SearchIndexInfoProvider.AnalyzerEnumToString, true);

        drpAnalyzer.SelectedValue        = SearchIndexInfoProvider.AnalyzerEnumToString(AnalyzerTypeEnum.StandardAnalyzer);
        chkAddIndexToCurrentSite.Checked = true;

        // Create sorted list for drop down values
        SortedList sortedList = new SortedList();

        sortedList.Add(GetString("srch.index.doctype"), PredefinedObjectType.DOCUMENT);
        // Allow forum only if module is available
        if ((ModuleEntry.IsModuleRegistered(ModuleEntry.FORUMS) && ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS)))
        {
            sortedList.Add(GetString("srch.index.forumtype"), PredefinedObjectType.FORUM);
        }
        sortedList.Add(GetString("srch.index.usertype"), PredefinedObjectType.USER);
        sortedList.Add(GetString("srch.index.customtabletype"), SettingsObjectType.CUSTOMTABLE);
        sortedList.Add(GetString("srch.index.customsearch"), SearchHelper.CUSTOM_SEARCH_INDEX);
        sortedList.Add(GetString("srch.index.doctypecrawler"), SearchHelper.DOCUMENTS_CRAWLER_INDEX);
        sortedList.Add(GetString("srch.index.general"), SearchHelper.GENERALINDEX);

        drpType.DataValueField = "value";
        drpType.DataTextField  = "key";
        drpType.DataSource     = sortedList;
        drpType.DataBind();

        // Pre-select documents index
        drpType.SelectedValue = PredefinedObjectType.DOCUMENT;
    }
Ejemplo n.º 5
0
    protected override void OnPreRender(EventArgs e)
    {
        if (!RequestHelper.IsPostBack())
        {
            // Display group selector only when group module is present
            if (ModuleEntry.IsModuleRegistered(ModuleEntry.COMMUNITY) && ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && (groupsSelector != null))
            {
                HandleGroupsSelection();
            }
            else
            {
                // Reload libraries
                LoadLibrarySelection();

                // Pre-select library
                PreselectLibrary();

                RaiseOnLibraryChanged();
            }
        }

        HandleSiteEmpty();

        HandleGroupEmpty();

        if (librarySelector.MediaLibraryID == 0)
        {
            SetLibrariesEmpty();
        }
        else
        {
            SetLibraries();
        }

        base.OnPreRender(e);
    }
Ejemplo n.º 6
0
    private TreeNode CreateNode(XmlNode xmlNode)
    {
        string module     = xmlNode.Attributes["module"].InnerText;
        string moduleName = "CMS." + module;
        bool   loadModule = true;

        // Check if module is loaded
        if (ModuleEntry.IsModuleRegistered(moduleName) && !ModuleEntry.IsModuleLoaded(moduleName))
        {
            loadModule = false;
        }

        if (loadModule)
        {
            // Get node atributes
            string text = xmlNode.Attributes["text"].InnerText;
            string url  = (xmlNode.Attributes["url"] != null) ? xmlNode.Attributes["url"].InnerText : null;
            string img  = (xmlNode.Attributes["img"] != null) ? xmlNode.Attributes["img"].InnerText : null;
            string id   = (xmlNode.Attributes["id"] != null) ? xmlNode.Attributes["id"].InnerText : null;

            // Get default icon
            if (string.IsNullOrEmpty(img))
            {
                img = string.Format("CMSModules/CMS_{0}/list.png", module.Replace(" ", ""));
            }

            string imgUrl = GetImageUrl(img);

            if (string.IsNullOrEmpty(id))
            {
                id = module;
            }

            string onClickScript = "";

            // Create new node
            TreeNode node = new TreeNode();
            node.Collapse();


            if (!string.IsNullOrEmpty(url))
            {
                string urlStr = ScriptHelper.GetString(url);

                if (reqId.ToLower() == id.ToLower())
                {
                    selectOnStartupScript = string.Format("var node = document.getElementById('node_{0}'); if(node != null){{ShowExample({1}, node);}}", id, urlStr);
                }

                node.SelectAction = TreeNodeSelectAction.None;

                // Prepare selection script
                onClickScript = string.Format("ShowExample({0}, this);", urlStr);
            }
            else
            {
                // Expand category node when clicked
                node.SelectAction = TreeNodeSelectAction.Expand;
            }

            // Create node text
            node.Text = String.Format("<span class=\"ContentTreeItem\" name=\"treeNode\" id=\"node_{3}\" onclick=\"{1}\"><img src=\"{2}\" class=\"TreeItemImage\" alt=\"{0}\" /><span class=\"Name\">{0}</span></span>", text, onClickScript, imgUrl, id);

            return(node);
        }
        return(null);
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Validate query string
        if (!QueryHelper.ValidateHash("hash"))
        {
            // Do nothing
        }
        else
        {
            String identifier = QueryHelper.GetString("identifier", null);
            if (String.IsNullOrEmpty(identifier))
            {
                return;
            }

            properties = WindowHelper.GetItem(identifier) as Hashtable;
            if (properties == null)
            {
                return;
            }

            CurrentMaster.DevelopmentMode = false;

            // Get information on current source type
            string sourceType = ValidationHelper.GetString(properties["source"], "attachments");
            SourceType = CMSDialogHelper.GetMediaSource(sourceType);

            // Ensure additional styles
            CurrentMaster.HeadElements.Visible = true;
            CurrentMaster.HeadElements.Text   += CSSHelper.GetStyle("*{direction:ltr !important;}body{background:transparent !important;}input,input:focus,input:hover,input:active{border:none;border-color:transparent;outline:none;}");

            // Get uploader control based on the current source type
            string uploaderPath = "";
            if (SourceType == MediaSourceEnum.MediaLibraries)
            {
                // If media library module is running
                if (ModuleEntry.IsModuleRegistered(ModuleEntry.MEDIALIBRARY) && ModuleEntry.IsModuleLoaded(ModuleEntry.MEDIALIBRARY))
                {
                    uploaderPath = "~/CMSModules/MediaLibrary/Controls/Dialogs/DirectFileUploader/DirectMediaFileUploaderControl.ascx";
                }
            }
            else
            {
                uploaderPath = "~/CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploaderControl.ascx";
            }

            // Load direct file uploader
            if (uploaderPath != "")
            {
                DirectFileUploader fileUploaderElem = this.LoadUserControl(uploaderPath) as DirectFileUploader;
                if (fileUploaderElem != null)
                {
                    // Insert uploader to parent container
                    pnlUploaderElem.Controls.Add(fileUploaderElem);

                    // Initialize uploader control properties by query string values
                    fileUploaderElem.AttachmentGUID           = ValidationHelper.GetGuid(properties["attachmentguid"], Guid.Empty);
                    fileUploaderElem.AttachmentGroupGUID      = ValidationHelper.GetGuid(properties["attachmentgroupguid"], Guid.Empty);
                    fileUploaderElem.AttachmentGUIDColumnName = ValidationHelper.GetString(properties["attachmentguidcolumnname"], null);
                    fileUploaderElem.FormGUID         = ValidationHelper.GetGuid(properties["formguid"], Guid.Empty);
                    fileUploaderElem.DocumentID       = ValidationHelper.GetInteger(properties["documentid"], 0);
                    fileUploaderElem.NodeParentNodeID = ValidationHelper.GetInteger(properties["parentid"], 0);
                    fileUploaderElem.NodeClassName    = ValidationHelper.GetString(properties["classname"], "");
                    fileUploaderElem.InsertMode       = ValidationHelper.GetBoolean(properties["insertmode"], false);
                    fileUploaderElem.OnlyImages       = ValidationHelper.GetBoolean(properties["onlyimages"], false);
                    fileUploaderElem.ParentElemID     = QueryHelper.GetString("parentelemid", String.Empty);
                    fileUploaderElem.CheckPermissions = ValidationHelper.GetBoolean(properties["checkperm"], true);
                    fileUploaderElem.IsLiveSite       = ValidationHelper.GetBoolean(properties["islive"], true);
                    fileUploaderElem.RaiseOnClick     = ValidationHelper.GetBoolean(properties["click"], false);
                    fileUploaderElem.NodeSiteName     = ValidationHelper.GetString(properties["sitename"], null);
                    fileUploaderElem.SourceType       = SourceType;
                    fileUploaderElem.NodeGroupID      = ValidationHelper.GetInteger(properties["nodegroupid"], 0);

                    // Metafile upload
                    fileUploaderElem.SiteID     = ValidationHelper.GetInteger(properties["siteid"], 0);
                    fileUploaderElem.Category   = ValidationHelper.GetString(properties["category"], String.Empty);
                    fileUploaderElem.ObjectID   = ValidationHelper.GetInteger(properties["objectid"], 0);
                    fileUploaderElem.ObjectType = ValidationHelper.GetString(properties["objecttype"], String.Empty);
                    fileUploaderElem.MetaFileID = ValidationHelper.GetInteger(properties["metafileid"], 0);

                    // Library info initialization;
                    fileUploaderElem.LibraryID          = ValidationHelper.GetInteger(properties["libraryid"], 0);
                    fileUploaderElem.MediaFileID        = ValidationHelper.GetInteger(properties["mediafileid"], 0);
                    fileUploaderElem.MediaFileName      = ValidationHelper.GetString(properties["filename"], null);
                    fileUploaderElem.IsMediaThumbnail   = ValidationHelper.GetBoolean(properties["ismediathumbnail"], false);
                    fileUploaderElem.LibraryFolderPath  = ValidationHelper.GetString(properties["path"], "");
                    fileUploaderElem.IncludeNewItemInfo = ValidationHelper.GetBoolean(properties["includeinfo"], false);

                    string siteName = CMSContext.CurrentSiteName;
                    string allowed  = ValidationHelper.GetString(properties["allowedextensions"], null);
                    if (allowed == null)
                    {
                        if (fileUploaderElem.SourceType == MediaSourceEnum.MediaLibraries)
                        {
                            allowed = SettingsKeyProvider.GetStringValue(siteName + ".CMSMediaFileAllowedExtensions");
                        }
                        else
                        {
                            allowed = SettingsKeyProvider.GetStringValue(siteName + ".CMSUploadExtensions");
                        }
                    }
                    fileUploaderElem.AllowedExtensions = allowed;

                    // Auto resize width
                    int autoResizeWidth = ValidationHelper.GetInteger(properties["autoresize_width"], -1);
                    if (autoResizeWidth == -1)
                    {
                        autoResizeWidth = SettingsKeyProvider.GetIntValue(siteName + ".CMSAutoResizeImageWidth");
                    }
                    fileUploaderElem.ResizeToWidth = autoResizeWidth;

                    // Auto resize height
                    int autoResizeHeight = ValidationHelper.GetInteger(properties["autoresize_height"], -1);
                    if (autoResizeHeight == -1)
                    {
                        autoResizeHeight = SettingsKeyProvider.GetIntValue(siteName + ".CMSAutoResizeImageHeight");
                    }
                    fileUploaderElem.ResizeToHeight = autoResizeHeight;

                    // Auto resize max side size
                    int autoResizeMaxSideSize = ValidationHelper.GetInteger(properties["autoresize_maxsidesize"], -1);
                    if (autoResizeMaxSideSize == -1)
                    {
                        autoResizeMaxSideSize = SettingsKeyProvider.GetIntValue(siteName + ".CMSAutoResizeImageMaxSideSize");
                    }
                    fileUploaderElem.ResizeToMaxSideSize = autoResizeMaxSideSize;

                    fileUploaderElem.AfterSaveJavascript = ValidationHelper.GetString(properties["aftersave"], String.Empty);
                    fileUploaderElem.TargetFolderPath    = ValidationHelper.GetString(properties["targetfolder"], String.Empty);
                    fileUploaderElem.TargetFileName      = ValidationHelper.GetString(properties["targetfilename"], String.Empty);
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Show panel with message how to enable indexing
        ucDisabledModule.SettingsKeys = "CMSSearchIndexingEnabled";
        ucDisabledModule.InfoText     = GetString("srch.searchdisabledinfo");

        // Module forums is not available
        if (!(ModuleEntry.IsModuleRegistered(ModuleEntry.FORUMS) && ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS)))
        {
            return;
        }

        selForum = this.LoadUserControl("~/CMSModules/Forums/FormControls/ForumSelector.ascx") as FormEngineUserControl;
        if (selForum != null)
        {
            selForum.IsLiveSite = false;
            plcForumSelector.Controls.Add(selForum);
        }

        selSite.AllowAll = false;
        selSite.UseCodeNameForSelection = true;

        string siteWhere = String.Empty;

        DataSet ds = SearchIndexSiteInfoProvider.GetIndexSites("SiteID", "IndexID = " + ItemID, null, 0);

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                siteWhere += dr["SiteID"] + ",";
            }

            siteWhere = "," + siteWhere;

            // Preselect current site if it is assigned to index
            if (!RequestHelper.IsPostBack() && siteWhere.Contains("," + CMSContext.CurrentSiteID + ","))
            {
                selSite.Value = CMSContext.CurrentSiteName;
            }

            siteWhere = siteWhere.Trim(',');
            siteWhere = "SiteID IN (" + siteWhere + ")";
            selSite.UniSelector.WhereCondition = siteWhere;
        }
        else
        {
            selSite.Enabled  = false;
            selForum.Enabled = false;
            btnOk.Enabled    = false;

            ShowError(GetString("srch.index.nositeselected"));
        }

        // Set default vaules for forum selector
        selForum.SetValue("selectionmode", SelectionModeEnum.MultipleTextBox);
        selForum.SetValue("DisplayAdHocOption", false);
        selForum.SetValue("SiteName", Convert.ToString(selSite.Value));

        // Set events and default values for site selector
        selSite.UniSelector.OnSelectionChanged   += new EventHandler(UniSelector_OnSelectionChanged);
        selSite.DropDownSingleSelect.AutoPostBack = true;

        LoadControls();

        if (ItemType == SearchIndexSettingsInfo.TYPE_ALLOWED)
        {
            selSite.AllowAll = true;
        }

        // Init controls
        if (!RequestHelper.IsPostBack())
        {
            selForum.Enabled = true;

            string siteName = ValidationHelper.GetString(selSite.Value, String.Empty);
            if (String.IsNullOrEmpty(siteName) || (siteName == "-1"))
            {
                selForum.Enabled = false;
            }
            else
            {
                selForum.SetValue("SiteName", siteName);
                SetControlsStatus(false);
            }
        }
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = GetString("attach.uploadfile");
        CurrentMaster.Title.TitleText  = Page.Title;
        CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        // Validate query string
        if (!QueryHelper.ValidateHash("hash"))
        {
            // Do nothing
        }
        else
        {
            // Get information on current source type
            string sourceType = QueryHelper.GetString("source", "attachments");
            SourceType = CMSDialogHelper.GetMediaSource(sourceType);

            // Get uploader control based on the current source type
            string uploaderPath = "";
            if (SourceType == MediaSourceEnum.MediaLibraries)
            {
                // If media library module is running
                if (ModuleEntry.IsModuleRegistered(ModuleEntry.MEDIALIBRARY) && ModuleEntry.IsModuleLoaded(ModuleEntry.MEDIALIBRARY))
                {
                    uploaderPath = "~/CMSModules/MediaLibrary/Controls/Dialogs/DirectFileUploader/FileUpload.ascx";
                }
            }
            else
            {
                uploaderPath = "~/CMSModules/Content/Controls/Attachments/FileUpload.ascx";
            }

            // Load direct file uploader
            if (uploaderPath != "")
            {
                FileUpload fileUploaderElem = LoadControl(uploaderPath) as FileUpload;
                if (fileUploaderElem != null)
                {
                    // Initialize uploader control properties by query string values
                    fileUploaderElem.ID                       = "uploader";
                    fileUploaderElem.ImageWidth               = QueryHelper.GetInteger("imagewidth", 24);
                    fileUploaderElem.ImageHeight              = QueryHelper.GetInteger("imageheight", 24);
                    fileUploaderElem.ImageUrl                 = QueryHelper.GetString("imageurl", GetImageUrl("Design/Controls/DirectUploader/upload.png"));
                    fileUploaderElem.ImageUrlOver             = QueryHelper.GetString("imageurlover", String.Empty);
                    fileUploaderElem.InnerDivHtml             = QueryHelper.GetString("innerdivhtml", String.Empty);
                    fileUploaderElem.InnerDivClass            = QueryHelper.GetString("innerdivclass", String.Empty);
                    fileUploaderElem.InnerLoadingDivHtml      = QueryHelper.GetString("innerloadingdivhtml", String.Empty);
                    fileUploaderElem.InnerLoadingDivClass     = QueryHelper.GetString("innerloadingdivclass", String.Empty);
                    fileUploaderElem.LoadingImageUrl          = QueryHelper.GetString("loadingimageurl", GetImageUrl("Design/Preloaders/preload16.gif"));
                    fileUploaderElem.AttachmentGUID           = QueryHelper.GetGuid("attachmentguid", Guid.Empty);
                    fileUploaderElem.AttachmentGroupGUID      = QueryHelper.GetGuid("attachmentgroupguid", Guid.Empty);
                    fileUploaderElem.AttachmentGUIDColumnName = QueryHelper.GetString("attachmentguidcolumnname", null);
                    fileUploaderElem.FormGUID                 = QueryHelper.GetGuid("formguid", Guid.Empty);
                    fileUploaderElem.DocumentID               = QueryHelper.GetInteger("documentid", 0);
                    fileUploaderElem.NodeParentNodeID         = QueryHelper.GetInteger("parentid", 0);
                    fileUploaderElem.NodeClassName            = QueryHelper.GetString("classname", "");
                    fileUploaderElem.InsertMode               = QueryHelper.GetBoolean("insertmode", false);
                    fileUploaderElem.OnlyImages               = QueryHelper.GetBoolean("onlyimages", false);
                    fileUploaderElem.ParentElemID             = QueryHelper.GetString("parentelemid", String.Empty);
                    fileUploaderElem.CheckPermissions         = QueryHelper.GetBoolean("checkperm", true);
                    fileUploaderElem.IsLiveSite               = QueryHelper.GetBoolean("islive", true);
                    fileUploaderElem.SourceType               = SourceType;

                    // Library info initialization
                    fileUploaderElem.LibraryID          = QueryHelper.GetInteger("libraryid", 0);
                    fileUploaderElem.LibraryFolderPath  = QueryHelper.GetString("path", "");
                    fileUploaderElem.IncludeNewItemInfo = QueryHelper.GetBoolean("includeinfo", false);

                    string siteName = CMSContext.CurrentSiteName;
                    string allowed  = QueryHelper.GetString("allowedextensions", "");
                    if (allowed == "")
                    {
                        if (fileUploaderElem.SourceType == MediaSourceEnum.MediaLibraries)
                        {
                            allowed = SettingsKeyProvider.GetStringValue(siteName + ".CMSMediaFileAllowedExtensions");
                        }
                        else
                        {
                            allowed = SettingsKeyProvider.GetStringValue(siteName + ".CMSUploadExtensions");
                        }
                    }
                    fileUploaderElem.AllowedExtensions   = allowed;
                    fileUploaderElem.ResizeToWidth       = QueryHelper.GetInteger("autoresize_width", 0);
                    fileUploaderElem.ResizeToHeight      = QueryHelper.GetInteger("autoresize_height", 0);
                    fileUploaderElem.ResizeToMaxSideSize = QueryHelper.GetInteger("autoresize_maxsidesize", 0);

                    fileUploaderElem.AfterSaveJavascript = QueryHelper.GetString("aftersave", String.Empty);

                    // Insert uploader to parent container
                    pnlUploaderElem.Controls.Add(fileUploaderElem);
                }
            }
        }
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserImpersonate();
        CheckTrial();

        // Facebook Connect sign out
        if (CMSContext.CurrentUser.IsAuthenticated())
        {
            if (QueryHelper.GetInteger("logout", 0) > 0)
            {
                // Stop processing for all controls during logout
                ucUsers.StopProcessing      = true;
                siteSelector.StopProcessing = true;
                ucUICultures.StopProcessing = true;
                btnSignOut_Click(this, EventArgs.Empty);
                return;
            }
        }

        // Display the techPreview info if there is a key in the web.config
        pnlTechPreview.Visible = ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CMSUseTechnicalPreview"], false);

        InitializeVersion();

        lnkTestingMode.Text        = GetString("cmstesting.headerlink");
        lnkTestingMode.Visible     = SettingsKeyProvider.TestingMode;
        lnkTestingMode.NavigateUrl = "~/CMSPages/GetTestingModeReport.aspx";

        lblUserInfo.Text = HTMLHelper.HTMLEncode(CMSContext.CurrentUser.FullName);

        pnlBody.CssClass = IsAPIExampleHeader ? "APIExamplesHeader" : (IsCMSDesk ? "CMSDeskHeader" : "SMHeader");

        tabControl.Visible = !IsCMSDesk && !IsAPIExampleHeader || IsCMSDesk;

        lblSignOut.Text = GetString("signoutbutton.signout");

        lnkCMSDesk.Text        = GetString("Header.CMSDesk");
        lnkCMSDesk.NavigateUrl = EnsureViewModeParam("~/CMSDesk/default.aspx", "returnviewmode");
        lnkCMSDesk.Target      = "_parent";

        lnkCMSSiteManager.Text        = GetString("Header.SiteManager");
        lnkCMSSiteManager.NavigateUrl = EnsureViewModeParam("~/CMSSiteManager/default.aspx", "returnviewmode");
        lnkCMSSiteManager.Target      = "_parent";

        string eventLogText = GetString("administration.ui.eventlog");

        lnkLog.NavigateUrl   = ResolveUrl("~/CMSModules/EventLog/EventLog.aspx");
        lnkLog.ToolTip       = eventLogText;
        imgLog.ImageUrl      = GetImageUrl("Objects/CMS_EventLog/list.png");
        imgLog.AlternateText = eventLogText;

        string debugText = GetString("administration-system.debug");

        lnkDebug.NavigateUrl   = ResolveUrl("~/CMSModules/System/Debug/System_DebugFrameset.aspx");
        lnkDebug.ToolTip       = debugText;
        imgDebug.ImageUrl      = GetImageUrl("CMSModules/CMS_System/debug.png");
        imgDebug.AlternateText = debugText;

        pwdExpiration.ShowChangePasswordLink      = true;
        pwdExpiration.ExpirationTextBefore        = GetString("passwordexpiration.expired");
        pwdExpiration.ExpirationWarningTextBefore = string.Format(GetString("passwordexpiration.willexpire"), CMSContext.CurrentUser.UserPasswordExpiration);

        // Displays windows azure and EMS icons
        if (AzureHelper.IsRunningOnAzure && SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSShowAzureLogo"))
        {
            imgWindowsAzure.Visible  = true;
            imgWindowsAzure.ImageUrl = GetImageUrl("General/IconWindowsAzure.png");
            pnlExtraIcons.Visible    = true;
        }
        if (LicenseHelper.CurrentEdition == ProductEditionEnum.EnterpriseMarketingSolution)
        {
            imgEnterpriseSolution.Visible  = true;
            imgEnterpriseSolution.ImageUrl = GetImageUrl("General/IconEnterpriseSolution.png");
            pnlExtraIcons.Visible          = true;
        }
        if (!CMSContext.CurrentUser.UserSiteManagerAdmin)
        {
            plcLog.Visible   = false;
            plcDebug.Visible = false;
        }
        string redirectURL = null;

        string scHideWarning = @"
function HideWarning() {
  var panel = document.getElementById('" + pnlPwdExp.ClientID + @"');
  if(panel)
  {
    panel.style.display = ""none"";
    window.top.layouts[0].resizeAll(); 
  }
}";

        ScriptHelper.RegisterStartupScript(this, typeof(string), "HideHeaderWarning", scHideWarning, true);

        SiteInfo si = CMSContext.CurrentSite;

        if ((si != null) && (!si.SiteIsOffline))
        {
            // Initialize variables from query string
            int    nodeId      = QueryHelper.GetInteger("nodeid", 0);
            string culture     = QueryHelper.GetText("culture", null);
            string liveSiteUrl = "~";

            // Set url to node from which CMSDesk was opened
            if (IsCMSDesk && (nodeId > 0) && !String.IsNullOrEmpty(culture))
            {
                TreeProvider treeProvider = new TreeProvider(CMSContext.CurrentUser);
                TreeNode     node         = treeProvider.SelectSingleNode(nodeId, culture, false, false);
                if (node != null)
                {
                    liveSiteUrl = CMSContext.GetUrl(node.NodeAliasPath, node.DocumentUrlPath);
                }
            }
            // Resolve Url and add live site view mode
            liveSiteUrl             = ResolveUrl(liveSiteUrl);
            liveSiteUrl             = URLHelper.AddParameterToUrl(liveSiteUrl, "viewmode", "livesite");
            liveSiteUrl             = EnsureViewModeParam(liveSiteUrl, "viewmode");
            lnkLiveSite.Text        = ResHelper.GetString("Header.LiveSite");
            lnkLiveSite.NavigateUrl = liveSiteUrl;
            lnkLiveSite.Target      = "_parent";
        }

        if (IsCMSDesk)
        {
            // Make 'Site manager' link visible for global administrators
            CurrentUserInfo ui = CMSContext.CurrentUser;
            if (ui.UserSettings != null)
            {
                plcSiteManagerRedirect.Visible = ui.UserSiteManagerAdmin;
            }

            // Site selector settings
            siteSelector.DropDownSingleSelect.CssClass = "HeaderSiteDrop";
            siteSelector.UpdatePanel.RenderMode        = UpdatePanelRenderMode.Inline;
            siteSelector.AllowAll = false;
            siteSelector.UniSelector.OnSelectionChanged   += SiteSelector_OnSelectionChanged;
            siteSelector.UniSelector.OnBeforeClientChanged = "if (!CheckChanges()) { this.value = this.originalValue; return false; }";
            siteSelector.DropDownSingleSelect.AutoPostBack = true;
            siteSelector.OnlyRunningSites = true;

            if (!RequestHelper.IsPostBack())
            {
                siteSelector.Value = CMSContext.CurrentSiteID;
            }

            // Show only assigned sites for not global admins
            if (!CMSContext.CurrentUser.IsGlobalAdministrator)
            {
                siteSelector.UserId = CMSContext.CurrentUser.UserID;
            }

            StringBuilder script = new StringBuilder();
            script.Append(
                @"function SetActivePage() {}
  function SiteRedirect(url) { parent.location = url; }
  function CheckChanges() {
    try { if (!parent.frames['cmsdesktop'].CheckChanges()) return false; } catch (ex) { }
    return true;
  }
");
            ScriptHelper.RegisterStartupScript(this, typeof(string), "headerScript", ScriptHelper.GetScript(script.ToString()));

            lnkLogo.NavigateUrl = "~/CMSDesk/default.aspx";
            lnkLogo.Target      = "_parent";

            redirectURL = URLHelper.CurrentURL;

            tabControl.UrlTarget          = "cmsdesktop";
            tabControl.QueryParameterName = "section";
            tabControl.ModuleName         = "CMS.Desk";
            tabControl.ModuleAvailabilityForSiteRequired = true;
            tabControl.OnTabCreated += tabControl_OnTabCreated;

            if (RequestHelper.IsWindowsAuthentication())
            {
                pnlSignOut.Visible = false;
                pnlRight.CssClass += " HeaderWithoutSignOut";
            }
            else
            {
                // Init Facebook Connect and join logout script to sign out button
                string logoutScript = FacebookConnectHelper.FacebookConnectInitForSignOut(CMSContext.CurrentSiteName, ltlFBConnectScript);
                if (!String.IsNullOrEmpty(logoutScript))
                {
                    // If Facebook Connect initialized include 'CheckChanges()' to logout script
                    logoutScript = "if (CheckChanges()) { " + logoutScript + " } return false; ";
                }
                else
                {
                    // If Facebook Connect not initialized just return 'CheckChanges()' script
                    logoutScript = "return CheckChanges();";
                }
                lnkSignOut.OnClientClick = logoutScript;
            }
        }
        else
        {
            plcSiteSelector.Visible = false;
            pnlSeparator.Visible    = true;

            lblUserInfo.Text               = HTMLHelper.HTMLEncode(CMSContext.CurrentUser.FullName);
            plcCMSDeskRedirect.Visible     = true;
            plcSiteManagerRedirect.Visible = IsAPIExampleHeader;

            lnkTestingMode.Text        = GetString("cmstesting.headerlink");
            lnkTestingMode.Visible     = SettingsKeyProvider.TestingMode;
            lnkTestingMode.NavigateUrl = "~/CMSPages/GetTestingModeReport.aspx";

            string url = null;
            if (IsAPIExampleHeader)
            {
                url = "~/CMSAPIExamples/default.aspx";
            }
            else
            {
                url = "~/CMSSiteManager/default.aspx";
            }
            lnkLogo.NavigateUrl = url;
            lnkLogo.Target      = "_parent";

            redirectURL = "~/CMSMessages/Redirect.aspx?frame=top&url=" + url;

            tabControl.OnTabCreated      += new UITabs.TabCreatedEventHandler(tabControl_OnTabCreated);
            tabControl.UrlTarget          = "cmsdesktop";
            tabControl.QueryParameterName = "section";
            tabControl.ModuleName         = "CMS.SiteManager";
            tabControl.UseClientScript    = true;

            if (RequestHelper.IsWindowsAuthentication())
            {
                pnlSignOut.Visible = false;
                pnlRight.CssClass += " HeaderWithoutSignOut";
            }
            else
            {
                lblSignOut.Text          = GetString("signoutbutton.signout");
                lnkSignOut.OnClientClick = FacebookConnectHelper.FacebookConnectInitForSignOut(CMSContext.CurrentSiteName, ltlFBConnectScript);
            }
        }

        CheckUICultureChange(redirectURL);

        if (ModuleEntry.IsModuleRegistered("CMS.Chat") && ModuleEntry.IsModuleLoaded("CMS.Chat") && (CMSContext.CurrentSiteID > 0))
        {
            CMSUserControl supportChatControl = Page.LoadUserControl("~/CMSModules/Chat/Controls/SupportChatHeader.ascx") as CMSUserControl;
            if (supportChatControl != null)
            {
                plcSupportChatControl.Controls.Add(supportChatControl);
                pnlSupportChat.Visible = true;
            }
        }
    }