protected void Page_Load(object sender, EventArgs e) { var btnGeneral = new CMSButtonGroupAction() { Text = GetString("general.properties"), OnClientClick = "manageSelectedTab(1); return false;" }; var btnValidation = new CMSButtonGroupAction() { Text = GetString("formbuilder.validation"), OnClientClick = "manageSelectedTab(2); return false;", Enabled = !FieldIsPrimary }; btnGroup.Actions.Add(btnGeneral); btnGroup.Actions.Add(btnValidation); string manageSelectedTab = @"function pageLoad(sender, args) { var selectedTab = $cmsj('#" + hdnSelectedTab.ClientID + @"').val(); manageSelectedTab(selectedTab); } function manageSelectedTab(tabIndex) { if (tabIndex == 2) { $cmsj('#form-builder-properties').hide(); $cmsj('#form-builder-validation').show(); $cmsj('#" + btnGroup.ClientID + @"').children().eq(0).removeClass('active'); $cmsj('#" + btnGroup.ClientID + @"').children().eq(1).addClass('active'); } else { $cmsj('#form-builder-properties').show(); $cmsj('#form-builder-validation').hide(); $cmsj('#" + btnGroup.ClientID + @"').children().eq(0).addClass('active'); $cmsj('#" + btnGroup.ClientID + @"').children().eq(1).removeClass('active'); } $cmsj('#" + hdnSelectedTab.ClientID + @"').val(tabIndex); }"; ScriptHelper.RegisterStartupScript(this, typeof(string), "FormBuilder_" + ClientID, ScriptHelper.GetScript(manageSelectedTab)); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var btnGeneral = new CMSButtonGroupAction() { Text = GetString("general.properties"), OnClientClick = "manageSelectedTab(1); return false;" }; var btnValidation = new CMSButtonGroupAction() { Text = GetString("formbuilder.validation"), OnClientClick = "manageSelectedTab(2); return false;", Enabled = !FieldIsPrimary }; btnGroup.Actions.Add(btnGeneral); btnGroup.Actions.Add(btnValidation); string manageSelectedTab = @"function pageLoad(sender, args) { var selectedTab = $cmsj('#" + hdnSelectedTab.ClientID + @"').val(); manageSelectedTab(selectedTab); } function manageSelectedTab(tabIndex) { if (tabIndex == 2) { $cmsj('#form-builder-properties').hide(); $cmsj('#form-builder-validation').show(); $cmsj('#" + btnGroup.ClientID + @"').children().eq(0).removeClass('active'); $cmsj('#" + btnGroup.ClientID + @"').children().eq(1).addClass('active'); } else { $cmsj('#form-builder-properties').show(); $cmsj('#form-builder-validation').hide(); $cmsj('#" + btnGroup.ClientID + @"').children().eq(0).addClass('active'); $cmsj('#" + btnGroup.ClientID + @"').children().eq(1).removeClass('active'); } $cmsj('#" + hdnSelectedTab.ClientID + @"').val(tabIndex); }"; ScriptHelper.RegisterStartupScript(this, typeof(string), "FormBuilder_" + ClientID, ScriptHelper.GetScript(manageSelectedTab)); }
/// <summary> /// Init event handler. /// </summary> protected override void OnInit(EventArgs e) { base.OnInit(e); var btnExistingCustomer = new CMSButtonGroupAction { Text = GetString("com.ui.existingcustomer"), Name = "existing_customer" }; var btnNewCustomer = new CMSButtonGroupAction { Text = GetString("com.ui.newcustomer"), Name = "new_customer", Enabled = HasModifyCustomerPermission }; btnGroup.Actions.Add(btnExistingCustomer); btnGroup.Actions.Add(btnNewCustomer); btnGroup.AutomaticButtonSelection = true; // Hide default submit button customerForm.SubmitButton.Visible = false; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> protected void Page_Load(object sender, EventArgs e) { currentDevice = (SelectedDevice == null) ? DeviceProfileInfoProvider.GetCurrentDeviceProfileInfo(SiteContext.CurrentSiteName, true) : DeviceProfileInfoProvider.GetDeviceProfileInfo(SelectedDevice); LoadDevicesMenu(); if (UseSmallButton && (currentDevice != null) && ((PortalContext.ViewMode == ViewModeEnum.Preview) || DisplayRotateButtons) ) { bool isHorizontalDevice = (currentDevice.ProfilePreviewWidth > currentDevice.ProfilePreviewHeight); bool isHorizontalOrientation = isHorizontalDevice; // Define the rotation buttons CMSButtonGroupAction hButton = new CMSButtonGroupAction { UseIconButton = true, Name = LAYOUT_HORIZONTAL, OnClientClick = "return false;", IconCssClass = "icon-rectangle-o-h", ToolTip = GetString("device.landscape") }; CMSButtonGroupAction vButton = new CMSButtonGroupAction { UseIconButton = true, Name = LAYOUT_VERTICAL, OnClientClick = "return false;", IconCssClass = "icon-rectangle-o-v", ToolTip = GetString("device.portrait") }; // Append the rotation buttons rotationButtons.Actions.Add(hButton); rotationButtons.Actions.Add(vButton); rotationButtons.Visible = true; // Get the current device rotation state isRotated = ValidationHelper.GetBoolean(CookieHelper.GetValue(CookieName.CurrentDeviceProfileRotate), false); if (isRotated) { isHorizontalOrientation = !isHorizontalOrientation; } // Highlight the currently selected rotation button rotationButtons.SelectedActionName = (isHorizontalOrientation) ? LAYOUT_HORIZONTAL : LAYOUT_VERTICAL; StringBuilder sb = new StringBuilder(); sb.Append(@" var CMSDeviceProfile = { Rotated: ", isRotated.ToString().ToLower(), @", Initialized: false, OnRotationFunction: null, PreviewUrl: null, Init: function () { if (!this.Initialized) { this.Initialized = true; var rotateBtns = $cmsj('.device-rotation').find('button'); var activeClass = '", activeButtonCssClass, @"'; rotateBtns.bind('click', function () { var jThis = $cmsj(this); var selected = jThis.hasClass(activeClass); if (!selected) { rotateBtns.removeClass(activeClass); jThis.addClass(activeClass); $cmsj.cookie('", CookieName.CurrentDeviceProfileRotate, @"', !CMSDeviceProfile.Rotated, { path: '/' } ); if (CMSDeviceProfile.OnRotationFunction != null) { CMSDeviceProfile.OnRotationFunction(this, !CMSDeviceProfile.Rotated); } } }); } } } $cmsj(document).ready(function () { CMSDeviceProfile.Init(); });"); ScriptHelper.RegisterClientScriptBlock(this, typeof(String), "deviceProfileScript", sb.ToString(), true); } }