private bool Display_EditConfiguration() { string[] arrOrg; string[] arrItem; long arrCount; string[] arrDomain; long arrCount2; string[] arrOrg2; bool isUnit = false; string[] arrServer; string[] arrLDAPDomain; string strLDAPDomain = ""; string[] arrLDAPDomainElement; bool first = true; string adselectedstate = ""; m_refUserApi = new UserAPI(); m_refSiteApi = new SiteAPI(); AppImgPath = m_refUserApi.AppImgPath; AppName = m_refUserApi.AppName; setting_data = m_refSiteApi.GetSiteVariables(-1); mapping_data = m_refUserApi.GetADMapping(m_refUserApi.UserId, "userprop", 1, 0, 1); cGroup = m_refUserApi.GetUserGroupById(1); sync_data = m_refUserApi.GetADStatus(); try { domain_data = m_refUserApi.GetDomains(1, 0); } catch { domain_data = null; } EditToolBar(); //POPULATE TOOL BAR //VERSION versionNumber.InnerHtml = m_refMsg.GetMessage("version") + " " + m_refSiteApi.Version + " " + m_refSiteApi.ServicePack; //BUILD NUMBER buildNumber.InnerHtml = "<i>(" + m_refMsg.GetMessage("build") + m_refSiteApi.BuildNumber + ")</i>"; if ((sync_data.SyncUsers) || (sync_data.SyncGroups) || (sync_data.SyncRelationships) || (sync_data.DeSyncUsers) || (sync_data.DeSyncGroups)) { if (setting_data.ADAuthentication == 1) { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad enabled not configured") + "</a>"; } else { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad disabled not configured") + "</a>"; } } //Ektron.Cms.Sync doesn't have "visible" //else //{ // Ektron.Cms.Sync.visible = false; //} if (setting_data.IsAdInstalled) { installed.InnerHtml = m_refMsg.GetMessage("active directory installed"); } else { installed.InnerHtml = m_refMsg.GetMessage("active directory not installed"); } if (setting_data.ADAuthentication == 1) { EnableADAuth.Checked = true; adselectedstate = ""; //OrgUnitText.Disabled = True OrgText.Disabled = true; ServerText.Disabled = true; drp_LDAPtype.Enabled = false; PortText.Disabled = true; LDAPDomainText.Disabled = true; txtLDAPAttribute.Enabled = false; LDAP_SSL.Disabled = true; admingroupdomain.Disabled = false; admingroupname.Disabled = false; drpAutoAddType.Enabled = true; } else if (setting_data.ADAuthentication == 0) { DisableAD.Checked = true; adselectedstate = "disabled"; //OrgUnitText.Disabled = True OrgText.Disabled = true; ServerText.Disabled = true; drp_LDAPtype.Enabled = false; PortText.Disabled = true; LDAPDomainText.Disabled = true; txtLDAPAttribute.Enabled = false; LDAP_SSL.Disabled = true; admingroupdomain.Disabled = true; admingroupname.Disabled = true; } else { EnableLDAP.Checked = true; adselectedstate = "disabled"; //OrgUnitText.Disabled = False OrgText.Disabled = false; ServerText.Disabled = false; drp_LDAPtype.Enabled = true; PortText.Disabled = false; LDAPDomainText.Disabled = false; txtLDAPAttribute.Enabled = true; LDAP_SSL.Disabled = false; admingroupdomain.Disabled = true; admingroupname.Disabled = true; } lgd_autoAddType.InnerHtml = m_refMsg.GetMessage("lbl auto add header"); autoAddTypeProperty.InnerHtml = m_refMsg.GetMessage("lbl auto add user type"); drpAutoAddType.Items.Add(new ListItem(m_refMsg.GetMessage("lbl author"), "0")); drpAutoAddType.Items.Add(new ListItem(m_refMsg.GetMessage("lbl member"), "1")); drpAutoAddType.SelectedIndex = setting_data.ADAutoUserAddType.GetHashCode(); if (setting_data.ADIntegration) { EnableADInt.Checked = true; } if (!(setting_data.ADAuthentication == 1)) { EnableADInt.Disabled = true; } if (setting_data.ADAutoUserAdd) { EnableAutoUser.Checked = true; } if (!(setting_data.ADAuthentication == 1)) { EnableAutoUser.Disabled = true; } //EnableAutoUserToGroup if (setting_data.ADAutoUserToGroup) { EnableAutoUserToGroup.Checked = true; } if (!(setting_data.ADAuthentication == 1)) { EnableAutoUserToGroup.Disabled = true; } userProperty.InnerHtml = m_refMsg.GetMessage("user property mapping"); cmsProperty.InnerHtml = m_refMsg.GetMessage("cms property value"); activeDirectoryProperty.InnerHtml = m_refMsg.GetMessage("active directory property value"); userpropcount.Value = mapping_data.Length.ToString(); int i; System.Text.StringBuilder result = new System.Text.StringBuilder(); if (!(mapping_data == null)) { for (i = 0; i <= mapping_data.Length - 1; i++) { result.Append("<tr>"); result.Append("<td class=\"label\">" + GetResourseText(mapping_data[i].CmsName) + ":</td>"); result.Append("<td>"); result.Append("<input type=\"hidden\" maxlength=\"50\" size=\"50\" name=\"userpropname" + (i + 1) + "\" id=\"userpropname" + (i + 1) + "\" value=\"" + mapping_data[i].CmsName + "\">"); result.Append("<input type=\"text\" maxlength=\"50\" size=\"25\" " + adselectedstate + " name=\"userpropvalue" + (i + 1) + "\" id=\"userpropvalue" + (i + 1) + "\" value=\"" + mapping_data[i].AdName + "\">"); result.Append("</td>"); result.Append("</tr>"); } mapping_list.Text = result.ToString(); result = null; } adminGroupMap.InnerHtml = m_refMsg.GetMessage("cms admin group map"); adGroupName.InnerHtml = m_refMsg.GetMessage("AD Group Name"); adDomain.InnerHtml = m_refMsg.GetMessage("AD Domain"); admingroupname.Value = cGroup.GroupName; admingroupdomain.Value = cGroup.GroupDomain; drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP AD"), "AD")); drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP NO"), "NO")); drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP SU"), "SU")); drp_LDAPtype.Items.Add(new ListItem(m_refMsg.GetMessage("LDAP OT"), "OT")); drp_LDAPtype.Attributes.Add("onchange", "javascript:CheckLDAP(\'\', true);"); if (setting_data.ADAuthentication == 2) { if (setting_data.ADDomainName.IndexOf("</p>") + 1 > 0) //defect 17813 - SMK { setting_data.ADDomainName = setting_data.ADDomainName.Replace("<", "<"); setting_data.ADDomainName = setting_data.ADDomainName.Replace(">", ">"); setting_data.ADDomainName = setting_data.ADDomainName.Replace(""", "\""); setting_data.ADDomainName = setting_data.ADDomainName.Replace("'", "\'"); } LDAPSettingsData ldapsettings; ldapsettings = Ektron.Cms.Common.EkFunctions.GetLDAPSettings(setting_data.ADDomainName); /* From VB source arrDomain = Split(setting_data.ADDomainName, "</server>") arrServer = Split(arrDomain(0), "</p>") */ string tempDomainName = setting_data.ADDomainName; tempDomainName = tempDomainName.Replace("</server>", "|").Replace("</p>", "^"); arrDomain = tempDomainName.Split("|".ToCharArray()); arrServer = arrDomain[0].ToString().Split("^".ToCharArray()); ServerText.Value = ldapsettings.Server; PortText.Value = ldapsettings.Port.ToString(); LDAPjs.Text += "<script language=\"javascript\" type=\"text/javascript\">" + Environment.NewLine; drp_LDAPtype.SelectedIndex = ldapsettings.ServerType.GetHashCode(); LDAPjs.Text += " CheckLDAP(\'" + drp_LDAPtype.Items[drp_LDAPtype.SelectedIndex].Value + "\', false);" + Environment.NewLine; LDAP_SSL.Checked = ldapsettings.EncryptionType == Ektron.Cms.Common.EkEnumeration.LDAPEncryptionType.SSL; txtLDAPAttribute.Text = ldapsettings.Attribute; if ((arrServer.Length - 1) > 1) { // arrLDAPDomain = Split(arrServer(2), ",") VB Source arrLDAPDomain = arrServer[2].Split(','); for (arrCount = 0; arrCount <= (arrLDAPDomain.Length - 1); arrCount++) { arrLDAPDomainElement = arrLDAPDomain.GetValue(arrCount).ToString().Split('='); if (arrLDAPDomainElement[0] == "dc") { if (!(strLDAPDomain == "")) { strLDAPDomain += "."; } strLDAPDomain += arrLDAPDomainElement[1]; } } LDAPDomainText.Value = strLDAPDomain; } arrOrg2 = arrDomain[1].Split(new string[] {"</>"}, StringSplitOptions.None); for (arrCount2 = 0; arrCount2 <= (arrOrg2.Length - 1); arrCount2++) { //Response.Write(arrOrg2(arrCount2) & "<br/>") if (!(arrOrg2.GetValue(arrCount2).ToString() == "")) { arrOrg = arrOrg2.GetValue(arrCount2).ToString().Split(','); for (arrCount = 0; arrCount <= (arrOrg.Length - 1); arrCount++) { if (!(arrOrg.GetValue(arrCount).ToString() == "")) { //arrItem = Strings.Split(arrOrg(arrCount), "=", -1, 0); arrItem = arrOrg.GetValue(arrCount).ToString().Split('='); if ((arrItem[0].Trim() == "o") && arrCount2 == (arrOrg2.Length - 1)) { OrgText.Value = arrItem.GetValue(1).ToString(); //ElseIf (arrItem(0) = "ou" Or arrItem(0) = " ou") Then // If (Not first) Then // OrgUnitText.Value &= "," // End If // OrgUnitText.Value &= "ou=" & arrItem(1) // isUnit = True // first = False } else { if (! first) { OrgUnitText.Value += ","; } OrgUnitText.Value += arrOrg.GetValue(arrCount); isUnit = true; first = false; } } } if (isUnit) { OrgUnitText.Value += "</>"; isUnit = false; first = true; } } } } if (domain_data == null) { searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:alert(\'" + m_refMsg.GetMessage("javascript: alert cannot search no domains") + "\\n" + m_refMsg.GetMessage("generic check ad config msg") + "\'); return false;\">" + m_refMsg.GetMessage("generic Search") + "</a>"; } else if (domain_data.Length == 0) { searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:alert(\'" + m_refMsg.GetMessage("javascript: alert cannot search no domains") + "\\n" + m_refMsg.GetMessage("generic check ad config msg") + "\'); return false;\">" + m_refMsg.GetMessage("generic Search") + "</a>"; } else { searchLink.InnerHtml = "<a href=\"#\" OnClick=\"javascript:DoSearch();\">" + m_refMsg.GetMessage("generic Search") + "</a>"; } domain.InnerHtml = m_refMsg.GetMessage("domain title") + ":"; result = new System.Text.StringBuilder(); result.Append(" "); if (domain_data == null && !m_refUserApi.RequestInformationRef.ADAdvancedConfig) { string selected = ""; result.Append("<select " + adselectedstate + " name=\"domainname\" id=\"domainname\">"); if (setting_data.ADDomainName == "") { selected = " selected"; } // Keep the "All Domains" drop down for continuity result.Append("<option value=\"\" " + selected + ">" + m_refMsg.GetMessage("all domain select caption") + "</option>"); result.Append("</select>"); } else if ((domain_data == null && m_refUserApi.RequestInformationRef.ADAdvancedConfig) || domain_data.Length == 0) { result.Append("<font color=\"red\"><strong>" + m_refMsg.GetMessage("generic no domains found") + " " + m_refMsg.GetMessage("generic check ad config msg") + "</strong></font>"); } else { if (m_refUserApi.RequestInformationRef.ADAdvancedConfig) { for (i = 0; i <= domain_data.Length - 1; i++) { if (i > 0) result.Append(" "); result.Append(domain_data[i].Name).Append("<br/>"); } } else { string selected = ""; result.Append("<select " + adselectedstate + " name=\"domainname\" id=\"domainname\">"); if (setting_data.ADDomainName == "") { selected = " selected"; } result.Append("<option value=\"\" " + selected + ">" + m_refMsg.GetMessage("all domain select caption") + "</option>"); for (i = 0; i <= domain_data.Length - 1; i++) { if (domain_data[i].Name == setting_data.ADDomainName) { selected = " selected"; } else { selected = ""; } result.Append("<option value=\"" + domain_data[i].Name + "\"" + selected + ">" + domain_data[i].Name + "</option>"); } result.Append("</select>"); } } domainDropdown.InnerHtml = result.ToString(); return false; }
public bool Display_ViewConfiguration() { m_refUserApi = new UserAPI(); m_refSiteApi = new SiteAPI(); AppImgPath = m_refUserApi.AppImgPath; AppName = m_refUserApi.AppName; RegisterResources(); setting_data = m_refSiteApi.GetSiteVariables(m_refUserApi.UserId); mapping_data = m_refUserApi.GetADMapping(m_refUserApi.UserId, "userprop", 1, 0, 1); group_data = m_refUserApi.GetUserGroupById(1); sync_data = m_refUserApi.GetADStatus(); //domain_data = m_refUserApi.GetDomains(1, 0) AdValid = setting_data.AdValid; //CBool(siteVars("AdValid")) ViewToolBar(); //VERSION versionNumber.InnerHtml = m_refMsg.GetMessage("version") + " " + m_refSiteApi.Version + " " + m_refSiteApi.ServicePack; //BUILD NUMBER buildNumber.InnerHtml = "<i>(" + m_refMsg.GetMessage("build") + m_refSiteApi.BuildNumber + ")</i>"; licenseMessageContainer.Visible = false; if (!(AdValid)) { TR_domaindetail.Visible = false; licenseMessageContainer.Visible = true; licenseMessage.InnerHtml = m_refMsg.GetMessage("entrprise license with AD required msg"); } else { if ((sync_data.SyncUsers) || (sync_data.SyncGroups) || (sync_data.SyncRelationships) || (sync_data.DeSyncUsers) || (sync_data.DeSyncGroups)) { if (setting_data.ADAuthentication == 1) { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad enabled not configured") + "</a>"; } else { ltr_status.Text = "<a href=\"adreports.aspx?action=ViewAllReportTypes\">" + m_refMsg.GetMessage("ad disabled not configured") + "</a>"; } } else {sync.Visible =false; } if (setting_data.IsAdInstalled) { installed.InnerHtml = m_refMsg.GetMessage("active directory installed") + " "; } else { installed.InnerHtml = m_refMsg.GetMessage("active directory not installed") + " "; } TD_flag.InnerHtml = m_refMsg.GetMessage("active directory authentication flag"); if (setting_data.ADAuthentication == 1) { TD_flagenabled.InnerHtml = m_refMsg.GetMessage("AD enabled"); } else if (setting_data.ADAuthentication == 2) { TD_flagenabled.InnerHtml = m_refMsg.GetMessage("LDAP enabled"); } else { TD_flagenabled.InnerHtml = m_refMsg.GetMessage("disabled"); } TD_dirflag.InnerHtml = m_refMsg.GetMessage("active directory flag"); if (setting_data.ADIntegration) { TD_intflag.InnerHtml = m_refMsg.GetMessage("enabled"); } else { TD_intflag.InnerHtml = m_refMsg.GetMessage("disabled"); } TD_autouser.InnerHtml = m_refMsg.GetMessage("auto add user flag"); if (setting_data.ADAutoUserAdd) { TD_autouserflag.InnerHtml = m_refMsg.GetMessage("enabled"); } else { TD_autouserflag.InnerHtml = m_refMsg.GetMessage("disabled"); } lgd_autoAddType.InnerHtml = m_refMsg.GetMessage("lbl auto add header"); autoAddTypeProperty.InnerHtml = m_refMsg.GetMessage("lbl auto add user type"); if (setting_data.ADAutoUserAddType == Ektron.Cms.Common.EkEnumeration.AutoAddUserTypes.Member) { autoAddTypeValue.InnerHtml = m_refMsg.GetMessage("lbl member"); } else { autoAddTypeValue.InnerHtml = m_refMsg.GetMessage("lbl author"); } TD_autogroup.InnerHtml = m_refMsg.GetMessage("auto add user to group flag"); if (setting_data.ADAutoUserToGroup) { TD_autogroupflag.InnerHtml = m_refMsg.GetMessage("enabled"); } else { TD_autogroupflag.InnerHtml = m_refMsg.GetMessage("disabled"); } userProperty.InnerHtml = m_refMsg.GetMessage("user property mapping title"); TD_cmstitle.InnerHtml = m_refMsg.GetMessage("cms property title"); TD_dirproptitle.InnerHtml = m_refMsg.GetMessage("active directory property title"); int i = 0; if (!(mapping_data == null)) { System.Text.StringBuilder result = new System.Text.StringBuilder(); for (i = 0; i <= mapping_data.Length - 1; i++) { result.Append("<tr>"); result.Append("<td class=\"label\">" + GetResourseText(mapping_data[i].CmsName) + ":</td>"); result.Append("<td class=\"readOnlyValue\">" + mapping_data[i].AdName + "</td>"); result.Append("<tr>"); } mapping_list.Text = result.ToString(); } adminGroupMap.InnerHtml = m_refMsg.GetMessage("cms admin group map"); TD_grpnameval.InnerHtml = group_data.GroupName; TD_grpDomainVal.InnerHtml = group_data.GroupDomain; domain.InnerHtml = m_refMsg.GetMessage("domain title") + ":"; //If (domain_data.Length = 0) Then //domainValue.InnerHtml += "<font color=""red""><strong>" & m_refMsg.GetMessage("generic no domains found") & " " & m_refMsg.GetMessage("generic check ad config msg") & "</strong></font>" //Else if (setting_data.ADDomainName == "") { domainValue.InnerHtml += m_refMsg.GetMessage("all domain select caption"); } else if (setting_data.ADAuthentication == 2) { domainValue.InnerHtml += m_refMsg.GetMessage("all domain select caption"); } else { domainValue.InnerHtml += setting_data.ADDomainName; } //End If } return false; }
private void ViewAllReportTypes() { AdReportsGrid.ShowHeader = false; m_refSiteApi = new SiteAPI(); m_refUserApi = new UserAPI(); settings_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId); sync_data = m_refUserApi.GetADStatus(); System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "TITLE"; colBound.HeaderText = ""; colBound.HeaderStyle.Height = Unit.Empty; if ((settings_data.ADAuthentication == 1) || (settings_data.AdValid == true)) { colBound.ItemStyle.Wrap = false; } else { colBound.ItemStyle.Wrap = true; } colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; AdReportsGrid.Columns.Add(colBound); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("TITLE", typeof(string))); if ((sync_data.SyncUsers) || (sync_data.SyncGroups) || (sync_data.SyncRelationships) || (sync_data.DeSyncGroups) || (sync_data.DeSyncUsers)) { if (settings_data.ADAuthentication == 1) { ltr_status.Text += m_refMsg.GetMessage("ad enabled not configured"); } else { ltr_status.Text += m_refMsg.GetMessage("ad disabled not configured"); } status.Visible = true; dr = dt.NewRow(); if (sync_data.SyncUsers) { dr = dt.NewRow(); dr[0] = "<a class=\"itemstatus\" href=\"adreports.aspx?action=GetUsersForSynch\" title=\"" + m_refMsg.GetMessage("match cms u to ad") + "\">" + m_refMsg.GetMessage("match cms u to ad") + "</a>"; dt.Rows.Add(dr); } if (sync_data.SyncGroups) { dr = dt.NewRow(); dr[0] = "<a class=\"itemstatus\" href=\"adreports.aspx?action=GetGroupsForSynch\" title=\"" + m_refMsg.GetMessage("match cms g to ad") + "\">" + m_refMsg.GetMessage("match cms g to ad") + "</a>"; dt.Rows.Add(dr); } if (sync_data.SyncRelationships) { dr = dt.NewRow(); dr[0] = "<a class=\"itemstatus\" href=\"adreports.aspx?action=GetRelationshipsForSynch\" title=\"" + m_refMsg.GetMessage("match cms r to ad") + "\">" + m_refMsg.GetMessage("match cms r to ad") + "</a>"; dt.Rows.Add(dr); } if (sync_data.DeSyncUsers) { dr = dt.NewRow(); dr[0] = "<a class=\"itemstatus\" href=\"adreports.aspx?action=DeSynchUsers\" title=\"" + m_refMsg.GetMessage("make u unique") + "\">" + m_refMsg.GetMessage("make u unique") + "</a>"; dt.Rows.Add(dr); } if (sync_data.DeSyncGroups) { dr = dt.NewRow(); dr[0] = "<a class=\"itemstatus\" href=\"adreports.aspx?action=DeSynchGroups\" title=\"" + m_refMsg.GetMessage("make g unique") + "\">" + m_refMsg.GetMessage("make g unique") + "</a>"; dt.Rows.Add(dr); } } else { if (settings_data.ADAuthentication == 1) { ltr_status.Text = m_refMsg.GetMessage("ad enabled and configured"); } else if (settings_data.AdValid == true) { ltr_status.Text = m_refMsg.GetMessage("alt Active Directory is not enabled and configured."); } else // { ltr_status.Text = "<span class=\"important\">" + m_refMsg.GetMessage("entrprise license with AD required msg") + "</span>"; } status.Visible = true; } DataView dv = new DataView(dt); AdReportsGrid.DataSource = dv; AdReportsGrid.DataBind(); ViewAllReportTypesToolBar(); }