protected void Page_Load(object sender, EventArgs e)
    {
        if (mDialogMode)
        {
            SetDialogMode();
        }
        else
        {
            InitBreadcrumbs();

            CurrentSiteInfo currentSite = CMSContext.CurrentSite;
            if (currentSite != null)
            {
                chkAssign.Text    = string.Format("{0} {1}", GetString("General.AssignWithWebSite"), currentSite.DisplayName);
                chkAssign.Visible = true;
            }
        }

        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "newedit_container";
        CurrentMaster.Title.TitleText     = GetString("Container_Edit.NewHeaderCaption");
        CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/CMS_WebPartContainer/new.png");

        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");
        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");

        this.plcCssLink.Visible = String.IsNullOrEmpty(txtContainerCSS.Text);
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Main menu
        string menuId       = ContextMenu.MenuID;
        string parentElemId = ContextMenu.ParentElementClientID;

        string actionPattern = "return ContextBinAction_" + parentElemId + "('{0}', GetContextMenuParameter('" + menuId + "'));";
        string confPattern   = "if(confirm('" + ResHelper.GetString("objectversioning.recyclebin.confirmrestore") + "')) {0} return false;";

        imgRestoreBindings.ImageUrl = UIHelper.GetImageUrl(Page, "Design/Controls/UniGrid/Actions/undo.png");
        pnlRestoreBindings.Attributes.Add("onclick", string.Format(confPattern, string.Format(actionPattern, "restorewithoutbindings")));

        // Display restore to current site only if current site available
        CurrentSiteInfo si = CMSContext.CurrentSite;

        if (si != null)
        {
            imgRestoreCurrent.ImageUrl = UIHelper.GetImageUrl(Page, "CMSModules/CMS_RecycleBin/restorecurrentsite.png");
            pnlRestoreCurrent.Attributes.Add("onclick", string.Format(confPattern, string.Format(actionPattern, "restorecurrentsite")));
            lblRestoreCurrent.Text = String.Format(ResHelper.GetString("objectversioning.recyclebin.restoretocurrentsite"), HTMLHelper.HTMLEncode(si.DisplayName));
        }
        else
        {
            pnlRestoreCurrent.Visible = false;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        txtContainerCSS.FullScreenParentElementID = txtContainerText.FullScreenParentElementID = "divContent";

        if (mDialogMode)
        {
            SetDialogMode();
        }
        else
        {
            InitBreadcrumbs();

            CurrentSiteInfo currentSite = CMSContext.CurrentSite;
            if (currentSite != null)
            {
                chkAssign.Text    = string.Format("{0} {1}", GetString("General.AssignWithWebSite"), HTMLHelper.HTMLEncode(currentSite.DisplayName));
                chkAssign.Visible = true;
            }
        }

        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "newedit_container";
        CurrentMaster.Title.TitleText     = GetString("Container_Edit.NewHeaderCaption");
        CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/CMS_WebPartContainer/new.png");

        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");
        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");

        plcCssLink.Visible = String.IsNullOrEmpty(txtContainerCSS.Text);

        if (!RequestHelper.IsPostBack())
        {
            txtContainerText.Text = "<div>\n  " + WebPartContainerInfoProvider.WP_CHAR + "\n</div>";
        }
    }
    /// <summary>
    /// OnClick handler (Set password).
    /// </summary>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        // Get current user info object
        CurrentUserInfo ui = MembershipContext.AuthenticatedUser;

        // Get current site info object
        CurrentSiteInfo si = SiteContext.CurrentSite;

        if ((ui != null) && (si != null))
        {
            string userName = ui.UserName;
            string siteName = si.SiteName;

            // new password correctly filled
            if (txtConfirmPassword.Text == passStrength.Text)
            {
                if (passStrength.IsValid())
                {
                    // Old password match
                    if (!UserInfoProvider.IsUserPasswordDifferent(ui, txtOldPassword.Text.Trim()))
                    {
                        UserInfoProvider.SetPassword(userName, passStrength.Text.Trim());
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("ChangePassword.ChangesSaved");
                        SendEmail();
                    }
                    else
                    {
                        lblError.Visible = true;
                        lblError.Text    = GetString("ChangePassword.ErrorOldPassword");
                    }
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = AuthenticationHelper.GetPolicyViolationMessage(SiteContext.CurrentSiteName);
                }
            }
            else
            {
                lblError.Visible = true;
                lblError.Text    = GetString("ChangePassword.ErrorNewPassword");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        currentSite = CMSContext.CurrentSite;
        if (currentSite != null)
        {
            chkAssign.Text = string.Format("{0} {1}", GetString("General.AssignWithWebSite"), HTMLHelper.HTMLEncode(currentSite.DisplayName));
            chkAssign.Visible = true;
        }

        rfvServerName.ErrorMessage = GetString("SMTPServer_New.NoServerName");

        ddlPriorities.Items.Add(new ListItem("SMTPServerPriorityEnum.Low", SMTPServerPriorityEnum.Low.ToString()));
        ddlPriorities.Items.Add(new ListItem("SMTPServerPriorityEnum.Normal", SMTPServerPriorityEnum.Normal.ToString()));
        ddlPriorities.Items.Add(new ListItem("SMTPServerPriorityEnum.High", SMTPServerPriorityEnum.High.ToString()));

        if (!RequestHelper.IsPostBack())
        {
            ddlPriorities.SelectedIndex = 1;
        }
    }
Exemple #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        currentSite = CMSContext.CurrentSite;
        if (currentSite != null)
        {
            chkAssign.Text    = string.Format("{0} {1}", GetString("General.AssignWithWebSite"), HTMLHelper.HTMLEncode(currentSite.DisplayName));
            chkAssign.Visible = true;
        }

        rfvServerName.ErrorMessage = GetString("SMTPServer_New.NoServerName");

        ddlPriorities.Items.Add(new ListItem("SMTPServerPriorityEnum.Low", SMTPServerPriorityEnum.Low.ToString()));
        ddlPriorities.Items.Add(new ListItem("SMTPServerPriorityEnum.Normal", SMTPServerPriorityEnum.Normal.ToString()));
        ddlPriorities.Items.Add(new ListItem("SMTPServerPriorityEnum.High", SMTPServerPriorityEnum.High.ToString()));

        if (!RequestHelper.IsPostBack())
        {
            ddlPriorities.SelectedIndex = 1;
        }
    }
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get resource strings
        lblUploader.Text = GetString("filelist.btnupload") + ResHelper.Colon;

        // Setup site info
        site = CMSContext.CurrentSite;

        // Create id for div with selected image preview
        divId         = ClientID + "imgDiv";
        placeholderId = plcImageActions.ClientID;

        // Setup delete image properties
        btnDeleteImage.ImageUrl      = GetImageUrl("Design/Controls/UniGrid/Actions/delete.png");
        btnDeleteImage.OnClientClick = "return deleteAvatar('" + hiddenDeleteAvatar.ClientID + "', '" + hiddenAvatarGuid.ClientID + "', '" + placeholderId + "' );";
        btnDeleteImage.AlternateText = GetString("general.delete");

        // Setup show gallery button
        btnShowGallery.Text    = GetString("avat.selector.select");
        btnShowGallery.Visible = SettingsKeyProvider.GetBoolValue(site.SiteName + ".CMSEnableDefaultAvatars");

        // Register dialog script
        string resolvedAvatarsPage = string.Empty;

        if (IsLiveSite)
        {
            if (CMSContext.CurrentUser.IsAuthenticated())
            {
                resolvedAvatarsPage = CMSContext.ResolveDialogUrl("~/CMSModules/Avatars/CMSPages/AvatarsGallery.aspx");
            }
            else
            {
                resolvedAvatarsPage = CMSContext.ResolveDialogUrl("~/CMSModules/Avatars/CMSPages/PublicAvatarsGallery.aspx");
            }
        }
        else
        {
            resolvedAvatarsPage = ResolveUrl("~/CMSModules/Avatars/Dialogs/AvatarsGallery.aspx");
        }

        ScriptHelper.RegisterDialogScript(Page);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SelectAvatar",
                                               ScriptHelper.GetScript("function SelectAvatar(avatarType, clientId) { " +
                                                                      "modalDialog('" + resolvedAvatarsPage + "?avatartype=' + avatarType + '&clientid=' + clientId, 'permissionDialog', 600, 270); return false;}"));
        ltlScript.Text = ScriptHelper.GetScript("function UpdateForm(){ ; } \n");

        // Setup btnShowGallery action
        btnShowGallery.Attributes.Add("onclick", "SelectAvatar('" + AvatarInfoProvider.GetAvatarTypeString(avatarType) + "', '" + ClientID + "'); return false;");

        // Get image size param(s) for preview
        string sizeParams = string.Empty;

        // Keep aspect ratio is set - property was set directly or indirectly by max side size property.
        if (KeepAspectRatio)
        {
            sizeParams += "&maxsidesize=" + (MaxPictureWidth > MaxPictureHeight ? MaxPictureWidth : MaxPictureHeight);
        }
        else
        {
            sizeParams += "&width=" + MaxPictureWidth + "&height=" + MaxPictureHeight;
        }

        // Javascript which creates selected image preview and saves image guid  to hidden field
        string getAvatarPath      = ResolveUrl("~/CMSModules/Avatars/CMSPages/GetAvatar.aspx");
        string updateHiddenScript = ScriptHelper.GetScript("function " + ClientID + "updateHidden(guidPrefix, clientId)" +
                                                           "{" +
                                                           "if ( clientId == '" + ClientID + "')" +
                                                           "{" +
                                                           "avatarGuid = guidPrefix.substring(4);" +
                                                           "if ( avatarGuid != '')" +
                                                           "{" +
                                                           "hidden = document.getElementById('" + hiddenAvatarGuid.ClientID + "');" +
                                                           "hidden.value = avatarGuid ;" +
                                                           "div = document.getElementById('" + divId + "');" +
                                                           "div.style.display='';" +
                                                           "div.innerHTML = '<img src=\"" + getAvatarPath + "?avatarguid=" + "'+ avatarGuid + '" + sizeParams + "\" />" +
                                                           "&#13;&#10;&nbsp;<img src=\"" + btnDeleteImage.ImageUrl + "\" border=\"0\" onclick=\"deleteImagePreview(\\'" + hiddenAvatarGuid.ClientID + "\\',\\'" + divId + "\\')\" style=\"cursor:pointer\"/>';" +
                                                           "placeholder = document.getElementById('" + plcImageActions.ClientID + "');" +
                                                           "if ( placeholder != null)" +
                                                           "{" +
                                                           "placeholder.style.display='none';" +
                                                           "}" +
                                                           "}" +
                                                           "}" +
                                                           "}");

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), ClientID + "updateHidden", updateHiddenScript);

        // Javascript which deletes image preview
        string deleteImagePreviewScript = ScriptHelper.GetScript("function deleteImagePreview(hiddenId, divId)" +
                                                                 "{" +
                                                                 "if( confirm(" + ScriptHelper.GetString(GetString("myprofile.pictdeleteconfirm")) + "))" +
                                                                 "{" +
                                                                 "hidden = document.getElementById(hiddenId);" +
                                                                 "hidden.value = '' ;" +
                                                                 "div = document.getElementById(divId);" +
                                                                 "div.style.display='none';" +
                                                                 "div.innerHTML = ''; " +
                                                                 "}" +
                                                                 "}");

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "deleteImagePreviewScript", deleteImagePreviewScript);

        // Javascript which pseudo deletes avatar
        string deleteAvatarScript = ScriptHelper.GetScript("function deleteAvatar(hiddenDeleteId, hiddenGuidId, placeholderId)" +
                                                           "{" +
                                                           "if( confirm(" + ScriptHelper.GetString(GetString("myprofile.pictdeleteconfirm")) + "))" +
                                                           "{" +
                                                           "hidden = document.getElementById(hiddenDeleteId);" +
                                                           "hidden.value = 'true' ;" +
                                                           "placeholder = document.getElementById(placeholderId);" +
                                                           "placeholder.style.display='none';" +
                                                           "hidden = document.getElementById(hiddenGuidId);" +
                                                           "hidden.value = '' ;" +
                                                           "}" +
                                                           "return false; " +
                                                           "}");

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "deleteAvatar", deleteAvatarScript);

        // Try to load avatar
        if ((GroupInfo == null) && (!RequestHelper.IsPostBack()))
        {
            if (avatarID != 0)
            {
                plcImageActions.Visible = true;
                picGroup.AvatarID       = avatarID;
            }
        }
    }
    /// <summary>
    /// OK click event handler.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if ((uploadAvatar.PostedFile == null) && (ai == null))
        {
            ShowError(GetString("avat.fileinputerror"));
        }
        else
        {
            CurrentSiteInfo site = CMSContext.CurrentSite;

            int width    = 0;
            int height   = 0;
            int sidesize = 0;

            // Get resize values
            if (drpAvatarType.SelectedValue != "all")
            {
                // Get right settings key
                string siteName = ((site != null) ? (site.SiteName + ".") : "");
                string prefix   = "CMSAvatar";

                if (drpAvatarType.SelectedValue == "group")
                {
                    prefix = "CMSGroupAvatar";
                }

                width    = SettingsKeyProvider.GetIntValue(siteName + prefix + "Width");
                height   = SettingsKeyProvider.GetIntValue(siteName + prefix + "Height");
                sidesize = SettingsKeyProvider.GetIntValue(siteName + prefix + "MaxSideSize");
            }

            // Check if avatar name is unique
            string     newAvatarName      = txtAvatarName.Text.Trim();
            AvatarInfo avatarWithSameName = AvatarInfoProvider.GetAvatarInfoWithoutBinary(newAvatarName);
            if (avatarWithSameName != null)
            {
                if (ai != null)
                {
                    // Check unique avatar name of existing avatar
                    if (avatarWithSameName.AvatarID != ai.AvatarID)
                    {
                        ShowError(GetString("avat.uniqueavatarname"));
                        return;
                    }
                }
                // Check unique avatar name of new avatar
                else
                {
                    ShowError(GetString("avat.uniqueavatarname"));
                    return;
                }
            }

            // Process form in these cases:
            // 1 - creating new avatar and uploaded file is not empty and it is image file
            // 2 - updating existing avatar and not uploading new image file
            // 3 - updating existing avatar and uploading image file
            if (((ai == null) && (uploadAvatar.PostedFile != null) && (uploadAvatar.PostedFile.ContentLength > 0) && (ImageHelper.IsImage(Path.GetExtension(uploadAvatar.PostedFile.FileName)))) ||
                ((ai != null) && ((uploadAvatar.PostedFile == null) || (uploadAvatar.PostedFile.ContentLength == 0))) ||
                ((ai != null) && (uploadAvatar.PostedFile != null) && (uploadAvatar.PostedFile.ContentLength > 0) && (ImageHelper.IsImage(Path.GetExtension(uploadAvatar.PostedFile.FileName)))))
            {
                if (ai == null)
                {
                    switch (drpAvatarType.SelectedValue)
                    {
                    case "user":
                        ai = new AvatarInfo(uploadAvatar.PostedFile, width, height, sidesize);
                        break;

                    case "group":
                        ai = new AvatarInfo(uploadAvatar.PostedFile, width, height, sidesize);
                        break;

                    case "all":
                        ai = new AvatarInfo(uploadAvatar.PostedFile, 0, 0, 0);
                        break;

                    default:
                        ai = new AvatarInfo(uploadAvatar.PostedFile, 0, 0, 0);
                        break;
                    }

                    ai.AvatarIsCustom = false;
                    ai.AvatarGUID     = Guid.NewGuid();
                }
                else if ((uploadAvatar.PostedFile != null) && (uploadAvatar.PostedFile.ContentLength > 0) && (ImageHelper.IsMimeImage(uploadAvatar.PostedFile.ContentType)))
                {
                    AvatarInfoProvider.DeleteAvatarFile(ai.AvatarGUID.ToString(), ai.AvatarFileExtension, false, false);
                    AvatarInfoProvider.UploadAvatar(ai, uploadAvatar.PostedFile, width, height, sidesize);
                }

                // Set new avatar name
                ai.AvatarName = newAvatarName;

                imgAvatar.Visible  = true;
                imgAvatar.ImageUrl = ResolveUrl("~/CMSModules/Avatars/CMSPages/GetAvatar.aspx?maxsidesize=250&avatarguid=" + ai.AvatarGUID);

                // If there was avatar type change clear possible default avatar settings
                if (ai.AvatarType != drpAvatarType.SelectedValue)
                {
                    if (drpAvatarType.SelectedValue == "group")
                    {
                        // Clear default user's avatar
                        ClearDefaultUserAvatars(ai);
                    }
                    else if (drpAvatarType.SelectedValue == "user")
                    {
                        //Clear group avatar
                        ClearDefaultGroupAvatar(ai);
                    }
                    // "all" option is doesn't have to clear anything
                }

                // Set new type
                ai.AvatarType = drpAvatarType.SelectedValue;

                // If user uncheck
                if (ai.DefaultUserAvatar && (!chkDefaultUserAvatar.Checked || ai.AvatarIsCustom))
                {
                    AvatarInfoProvider.ClearDefaultAvatar(DefaultAvatarTypeEnum.User, true);
                }
                // If male uncheck
                if (ai.DefaultMaleUserAvatar && (!chkDefaultMaleUserAvatar.Checked || ai.AvatarIsCustom))
                {
                    AvatarInfoProvider.ClearDefaultAvatar(DefaultAvatarTypeEnum.Male, true);
                }
                // If female uncheck
                if (ai.DefaultFemaleUserAvatar && (!chkDefaultFemaleUserAvatar.Checked || ai.AvatarIsCustom))
                {
                    AvatarInfoProvider.ClearDefaultAvatar(DefaultAvatarTypeEnum.Female, true);
                }
                // If group uncheck
                if (ai.DefaultGroupAvatar && (!chkDefaultGroupAvatar.Checked || ai.AvatarIsCustom))
                {
                    AvatarInfoProvider.ClearDefaultAvatar(DefaultAvatarTypeEnum.Group, true);
                }

                // If avatar is not global, can't be default any default avatar
                if (ai.AvatarIsCustom)
                {
                    // Set all default avatar options to false
                    ai.DefaultUserAvatar = ai.DefaultMaleUserAvatar = ai.DefaultFemaleUserAvatar = ai.DefaultGroupAvatar = false;
                }
                else
                {
                    // Set new default avatar settings
                    ai.DefaultUserAvatar       = chkDefaultUserAvatar.Checked;
                    ai.DefaultMaleUserAvatar   = chkDefaultMaleUserAvatar.Checked;
                    ai.DefaultFemaleUserAvatar = chkDefaultFemaleUserAvatar.Checked;
                    ai.DefaultGroupAvatar      = chkDefaultGroupAvatar.Checked;


                    // If this avatar is becoming to be new default avatar. Clear the mark from others avatar
                    ClearDefaultUserAvatars(ai);
                    ClearDefaultGroupAvatar(ai);
                }

                AvatarInfoProvider.SetAvatarInfo(ai);

                avatarId = ai.AvatarID;
                URLHelper.Redirect("Avatar_Edit.aspx?saved=1&avatarid=" + avatarId);
            }
            else
            {
                // If given file is not valid
                if ((uploadAvatar.PostedFile != null) && (uploadAvatar.PostedFile.ContentLength > 0) && !ImageHelper.IsImage(Path.GetExtension(uploadAvatar.PostedFile.FileName)))
                {
                    ShowError(GetString("avat.filenotvalid"));
                }
                else
                {
                    // If posted file is not given
                    ShowError(GetString("avat.fileinputerror"));
                }
            }
        }
    }
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get resource strings
        lblUploader.Text = GetString("filelist.btnupload") + ResHelper.Colon;

        // Setup site info
        site = CMSContext.CurrentSite;

        // Create id for div with selected image preview
        divId = ClientID + "imgDiv";
        placeholderId = plcImageActions.ClientID;

        // Setup delete image properties
        btnDeleteImage.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/delete.png");
        btnDeleteImage.OnClientClick = "return deleteAvatar('" + hiddenDeleteAvatar.ClientID + "', '" + hiddenAvatarGuid.ClientID + "', '" + placeholderId + "' );";
        btnDeleteImage.AlternateText = GetString("general.delete");

        // Setup show gallery button
        btnShowGallery.Text = GetString("avat.selector.select");
        btnShowGallery.Visible = SettingsKeyProvider.GetBoolValue(site.SiteName + ".CMSEnableDefaultAvatars");

        // Register dialog script
        string resolvedAvatarsPage = string.Empty;
        if (IsLiveSite)
        {
            if (CMSContext.CurrentUser.IsAuthenticated())
            {
                resolvedAvatarsPage = CMSContext.ResolveDialogUrl("~/CMSModules/Avatars/CMSPages/AvatarsGallery.aspx");
            }
            else
            {
                resolvedAvatarsPage = CMSContext.ResolveDialogUrl("~/CMSModules/Avatars/CMSPages/PublicAvatarsGallery.aspx");
            }
        }
        else
        {
            resolvedAvatarsPage = ResolveUrl("~/CMSModules/Avatars/Dialogs/AvatarsGallery.aspx");
        }

        ScriptHelper.RegisterDialogScript(this.Page);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SelectAvatar",
        ScriptHelper.GetScript("function SelectAvatar(avatarType, clientId) { " +
            "modalDialog('" + resolvedAvatarsPage + "?avatartype=' + avatarType + '&clientid=' + clientId, 'permissionDialog', 600, 270); return false;}"));
        ltlScript.Text = ScriptHelper.GetScript("function UpdateForm(){ ; } \n");

        // Setup btnShowGallery action
        btnShowGallery.Attributes.Add("onclick", "SelectAvatar('" + AvatarInfoProvider.GetAvatarTypeString(avatarType) + "', '" + ClientID + "'); return false;");

        // Get image size param(s) for preview
        string sizeParams = string.Empty;
        // Keep aspect ratio is set - property was set directly or indirectly by max side size property.
        if (KeepAspectRatio)
        {
            sizeParams += "&maxsidesize=" + (MaxPictureWidth > MaxPictureHeight ? MaxPictureWidth : MaxPictureHeight);
        }
        else
        {
            sizeParams += "&width=" + MaxPictureWidth + "&height=" + MaxPictureHeight;
        }

        // Javascript which creates selected image preview and saves image guid  to hidden field
        string getAvatarPath = ResolveUrl("~/CMSModules/Avatars/CMSPages/GetAvatar.aspx");
        string updateHiddenScript = ScriptHelper.GetScript("function " + ClientID + "updateHidden(guidPrefix, clientId)" +
        "{" +
        "if ( clientId == '" + ClientID + "')" +
        "{" +
        "avatarGuid = guidPrefix.substring(4);" +
        "if ( avatarGuid != '')" +
        "{" +
        "hidden = document.getElementById('" + hiddenAvatarGuid.ClientID + "');" +
        "hidden.value = avatarGuid ;" +
        "div = document.getElementById('" + divId + "');" +
        "div.style.display='';" +
        "div.innerHTML = '<img src=\"" + getAvatarPath + "?avatarguid=" + "'+ avatarGuid + '" + sizeParams + "\" />" +
        "&#13;&#10;&nbsp;<img src=\"" + btnDeleteImage.ImageUrl + "\" border=\"0\" onclick=\"deleteImagePreview(\\'" + hiddenAvatarGuid.ClientID + "\\',\\'" + divId + "\\')\" style=\"cursor:pointer\"/>';" +
        "placeholder = document.getElementById('" + plcImageActions.ClientID + "');" +
        "if ( placeholder != null)" +
        "{" +
        "placeholder.style.display='none';" +
        "}" +
        "}" +
        "}" +
        "}");
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), ClientID + "updateHidden", updateHiddenScript);

        // Javascript which deletes image preview
        string deleteImagePreviewScript = ScriptHelper.GetScript("function deleteImagePreview(hiddenId, divId)" +
        "{" +
        "if( confirm(" + ScriptHelper.GetString(GetString("myprofile.pictdeleteconfirm")) + "))" +
        "{" +
        "hidden = document.getElementById(hiddenId);" +
        "hidden.value = '' ;" +
        "div = document.getElementById(divId);" +
        "div.style.display='none';" +
        "div.innerHTML = ''; " +
        "}" +
        "}");

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "deleteImagePreviewScript", deleteImagePreviewScript);

        // Javascript which pseudo deletes avatar
        string deleteAvatarScript = ScriptHelper.GetScript("function deleteAvatar(hiddenDeleteId, hiddenGuidId, placeholderId)" +
        "{" +
        "if( confirm(" + ScriptHelper.GetString(GetString("myprofile.pictdeleteconfirm")) + "))" +
        "{" +
        "hidden = document.getElementById(hiddenDeleteId);" +
        "hidden.value = 'true' ;" +
        "placeholder = document.getElementById(placeholderId);" +
        "placeholder.style.display='none';" +
        "hidden = document.getElementById(hiddenGuidId);" +
        "hidden.value = '' ;" +
        "}" +
        "return false; " +
        "}");
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "deleteAvatar", deleteAvatarScript);

        // Try to load avatar
        if ((GroupInfo == null) && (!RequestHelper.IsPostBack()))
        {
            if (avatarID != 0)
            {
                plcImageActions.Visible = true;
                picGroup.AvatarID = avatarID;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register the main CMS script
        ScriptHelper.RegisterCMS(Page);

        if (StopProcessing)
        {
            return;
        }

        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // Set current UI culture
        currentCulture = CultureHelper.PreferredUICulture;

        if (!RequestHelper.IsCallback())
        {
            ControlsHelper.RegisterPostbackControl(btnOk);

            // Create action script
            StringBuilder actionScript = new StringBuilder();
            actionScript.Append(
                @"
function PerformAction(selectionFunction, selectionField, dropId, validationLabel, whatId) {
  var selectionFieldElem = document.getElementById(selectionField);
  var label = document.getElementById(validationLabel);
  var items = selectionFieldElem.value;
  var whatDrp = document.getElementById(whatId);
  var allDocs = whatDrp.value == '", (int)What.AllObjects, @"';
  var action = document.getElementById(dropId).value;
  if (action == '", (int)Action.SelectAction, @"') {
     label.innerHTML = '", GetString("massaction.selectsomeaction"), @"';
     return false;
  }
  
  if(!eval(selectionFunction) || allDocs) {
     var confirmed = false;
     var confMessage = '';
     switch(action) {
        case '", (int)Action.RestoreToCurrentSite, @"':
        case '", (int)Action.RestoreWithoutSiteBindings, @"':
        case '", (int)Action.Restore, @"':
          confMessage = '", GetString("objectversioning.recyclebin.confirmrestores"), @"';
          break;
        
        case '", (int)Action.Delete, @"':
          confMessage = allDocs ?  '", GetString("objectversioning.recyclebin.confirmemptyrecbin"), @"' : '", GetString("objectversioning.recyclebin.confirmdeleteselected") + @"';
          break;
     }
     return confirm(confMessage);
  }
  else {
    label.innerHTML = '", GetString("objectversioning.recyclebin.selectobjects"), @"';
    return false;
  }
}
function ContextBinAction_", ugRecycleBin.ClientID, @"(action, versionId) {
  document.getElementById('", hdnValue.ClientID, @"').value = action + ';' + versionId;",
                ControlsHelper.GetPostBackEventReference(btnHidden, null), @";
}");

            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "recycleBinScript", ScriptHelper.GetScript(actionScript.ToString()));

            // Set page size
            int itemsPerPage = ValidationHelper.GetInteger(ItemsPerPage, 0);
            if ((itemsPerPage > 0) && !RequestHelper.IsPostBack())
            {
                ugRecycleBin.Pager.DefaultPageSize = itemsPerPage;
            }

            // Add action to button
            btnOk.OnClientClick = "return PerformAction('" + ugRecycleBin.GetCheckSelectionScript() + "','" + ugRecycleBin.GetSelectionFieldClientID() + "','" + drpAction.ClientID + "','" + lblValidation.ClientID + "', '" + drpWhat.ClientID + "');";

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.Restore), Convert.ToInt32(Action.Restore).ToString()));
                drpAction.Items.Add(new ListItem(GetString("objectversioning.recyclebin." + Action.RestoreWithoutSiteBindings), Convert.ToInt32(Action.RestoreWithoutSiteBindings).ToString()));

                // Display restore to current site only if current site available
                CurrentSiteInfo si = CMSContext.CurrentSite;
                if (si != null)
                {
                    drpAction.Items.Add(new ListItem(String.Format(GetString("objectversioning.recyclebin." + Action.RestoreToCurrentSite), si.DisplayName), Convert.ToInt32(Action.RestoreToCurrentSite).ToString()));
                }
                drpAction.Items.Add(new ListItem(GetString("general." + Action.Delete), Convert.ToInt32(Action.Delete).ToString()));

                drpWhat.Items.Add(new ListItem(GetString("contentlisting." + What.SelectedObjects), Convert.ToInt32(What.SelectedObjects).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("contentlisting." + What.AllObjects), Convert.ToInt32(What.AllObjects).ToString()));

                ugRecycleBin.OrderBy = OrderBy;
            }

            string where = (IsSingleSite || (SiteName == "##global##")) ? "VersionObjectSiteID IS NULL" : null;
            if (CurrentSite != null)
            {
                where = SqlHelperClass.AddWhereCondition(where, "VersionObjectSiteID = " + CurrentSite.SiteID, "OR");
            }

            ugRecycleBin.WhereCondition         = GetWhereCondition(where);
            ugRecycleBin.HideControlForZeroRows = false;
            ugRecycleBin.OnExternalDataBound   += ugRecycleBin_OnExternalDataBound;
            ugRecycleBin.OnAction += ugRecycleBin_OnAction;

            // Register the dialog script
            ScriptHelper.RegisterDialogScript(Page);

            // Initialize buttons
            btnCancel.Attributes.Add("onclick", ctlAsync.GetCancelScript(true) + "return false;");

            string error = QueryHelper.GetString("displayerror", String.Empty);
            if (error != String.Empty)
            {
                lblError.Text = GetString("objectversioning.recyclebin.errorsomenotdestroyed");
            }

            // Set visibility of panels
            pnlLog.Visible = false;
        }
        else
        {
            ugRecycleBin.StopProcessing = true;
        }

        // Initialize filter
        ReloadFilter((CurrentSite != null) ? CurrentSite.SiteID : -1, IsSingleSite, false);

        // If filter is set
        if (filterBin.FilterIsSet)
        {
            ugRecycleBin.ZeroRowsText = GetString("unigrid.filteredzerorowstext");
        }
        else
        {
            ugRecycleBin.ZeroRowsText = IsSingleSite ? GetString("objectversioning.RecycleBin.NoObjects") : GetString("RecycleBin.Empty");
        }

        // Initialize events
        ctlAsync.OnFinished   += ctlAsync_OnFinished;
        ctlAsync.OnError      += ctlAsync_OnError;
        ctlAsync.OnRequestLog += ctlAsync_OnRequestLog;
        ctlAsync.OnCancel     += ctlAsync_OnCancel;
    }