protected void Page_Load(object sender, EventArgs e) { string intlistid = Request["INTID"]; string intuid = Request["ID"]; string control = Request["Control"]; if (intuid != "") { SPSecurity.RunWithElevatedPrivileges(delegate() { API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); SPListItem li = core.GetListItemFromExternalID(intlistid, intuid); if (li != null) { RedirectTo(li, control); } else { lblError.Text = "Could not find item"; } }); } else { RedirectTo(control); } }
protected void Page_Load(object sender, EventArgs e) { MenuTemplate propertyNameListMenu = new MenuTemplate(); propertyNameListMenu.ID = "PropertyNameListMenu"; MenuItemTemplate testMenu = new MenuItemTemplate("Edit Connection", "/_layouts/epmlive/images/integration/editcon.png"); testMenu.ClientOnClickNavigateUrl = "connection.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu); MenuItemTemplate testMenu2 = new MenuItemTemplate("Edit Properties", "/_layouts/images/edit.gif"); testMenu2.ClientOnClickNavigateUrl = "properties.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu2); MenuItemTemplate testMenu3 = new MenuItemTemplate("Edit Columns", "/_layouts/epmlive/images/integration/editcols.png"); testMenu3.ClientOnClickNavigateUrl = "columns.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu3); MenuItemTemplate testMenu4 = new MenuItemTemplate("View Log", "/_layouts/epmlive/images/integration/log.png"); testMenu4.ClientOnClickNavigateUrl = "log.aspx?intlistid=%INTLISTID%&LIST=" + Request["List"]; propertyNameListMenu.Controls.Add(testMenu4); MenuItemTemplate testMenu5 = new MenuItemTemplate("Delete Integration", "/_layouts/images/delete.gif"); testMenu5.ClientOnClickScript = "DeleteIntegration('%INTLISTID%');"; propertyNameListMenu.Controls.Add(testMenu5); this.Controls.Add(propertyNameListMenu); API.Integration.IntegrationCore integration = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); SPSecurity.RunWithElevatedPrivileges(delegate() { gvPlans.DataSource = integration.GetIntegrationsForList(new Guid(Request["List"])); gvPlans.DataBind(); }); }
/// <summary> /// An item was updated. /// </summary> public override void ItemUpdated(SPItemEventProperties properties) { SPSecurity.RunWithElevatedPrivileges(delegate() { API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(properties.SiteId, properties.Web.ID); core.SubmitListEvent(properties.ListItem, 1, properties.AfterProperties); }); }
protected void Page_Load(object sender, EventArgs e) { SPSecurity.RunWithElevatedPrivileges(delegate() { API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); data = core.GetProxyResult(new Guid(Request["IntegrationId"]), Request["ItemId"], Request["Control"], Request["Property"]); }); }
protected void Page_Load(object sender, EventArgs e) { SPSecurity.RunWithElevatedPrivileges(delegate() { Hashtable hshParms = new Hashtable(); hshParms.Add("intlistid", Request["intlistid"]); hshParms.Add("type", ddlLevel.SelectedValue); API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); DataSet dsLog = core.GetDataSet("SELECT * FROM INT_LOG WHERE INT_LIST_ID=@intlistid and LOGTYPE>=@type order by dtlogged desc", hshParms); gvLog.DataSource = dsLog.Tables[0]; gvLog.DataBind(); }); }
protected void Page_Load(object sender, EventArgs e) { SPSecurity.RunWithElevatedPrivileges(delegate() { try { intlistid = new Guid(Request["intlistid"]); } catch { } try { moduleid = new Guid(Request["module"]); } catch { } intcore = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid); PageHead = intadmin.GetIntegrationHeader(); Hashtable hshProps = new Hashtable(); if (intlistid != Guid.Empty) { hshProps = intcore.GetProperties(intlistid); } XmlDocument doc = intcore.GetModuleProperties(intlistid, moduleid); XmlNode ndCon = doc.FirstChild.SelectSingleNode("/Properties/Connection"); lblMain.Controls.AddAt(0, intadmin.GetPropertyPanel(ndCon, hshProps, this)); if (Request["wizard"] == "1") { Button1.Text = "Next >"; InputFormSection4.Visible = false; } Button1.OnClientClick = "CheckConnection();"; Button2.OnClientClick = "Install();"; }); }
internal IntegrationAdmin(API.Integration.IntegrationCore core, Guid Intlistid, Guid Moduleid) { _core = core; this.intlistid = Intlistid; this.ModuleID = Moduleid; hshProperties = new Hashtable(); ControlCollection = new ArrayList(); if (intlistid != Guid.Empty && ModuleID == Guid.Empty) { Hashtable hshProps = new Hashtable(); hshProps.Add("intlistid", intlistid); DataSet ds = _core.GetDataSet("SELECT MODULE_ID,LIST_ID FROM INT_LISTS where INT_LIST_ID=@intlistid", hshProps); try { ModuleID = new Guid(ds.Tables[0].Rows[0]["MODULE_ID"].ToString()); } catch { } ListId = new Guid(ds.Tables[0].Rows[0]["LIST_ID"].ToString()); } }
protected void Page_Load(object sender, EventArgs e) { bool removed = false; SPSecurity.RunWithElevatedPrivileges(delegate() { try { intlistid = new Guid(Request["intlistid"]); }catch {} try { moduleid = new Guid(Request["module"]); }catch {} intcore = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid); string message = ""; if (!intadmin.DeleteIntegration(intlistid, out message)) { lblError.Text = "Error: " + message; } else { removed = true; } }); if (removed) { SPUtility.Redirect("epmlive/integration/integrationlist.aspx?LIST=" + Request["List"], SPRedirectFlags.RelativeToLayoutsPage, System.Web.HttpContext.Current); } }
public void execute(SPSite site, SPWeb web, string data) { try { Guid intlistid = new Guid(base.key); API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(site.ID, web.ID); Hashtable hshParms = new Hashtable(); hshParms.Add("intlistid", intlistid); DateTime dtStarted = DateTime.Now; DataSet DS = core.GetDataSet("SELECT * FROM INT_LISTS where INT_LIST_ID=@intlistid", hshParms); DataRow drIntegration = DS.Tables[0].Rows[0]; Hashtable hshProperties = null; DataSet dsColumns = null; DataTable dtCols = null; DataTable dtItem = null; DataSet dsUserFields = null; DataTable dtUserFields = null; Hashtable hshUserMap = null; DataTable dtRet = null; DataSet dsItem = null; try { hshProperties = core.GetProperties(intlistid); dsColumns = core.GetDataSet("SELECT * FROM INT_COLUMNS where INT_LIST_ID=@intlistid", hshParms); dtCols = dsColumns.Tables[0]; dtItem = new DataTable(); dtItem.Columns.Add("ID"); foreach (DataRow drCol in dtCols.Rows) { dtItem.Columns.Add(drCol["IntegrationColumn"].ToString()); } DateTime dtLastSynch = new DateTime(1900, 1, 1); try { dtLastSynch = DateTime.Parse(drIntegration["LASTSYNCH"].ToString()); } catch { } if (drIntegration["TIMEINCOMING"].ToString() == "True") { dtItem = core.PullData(dtItem, intlistid, new Guid(drIntegration["LIST_ID"].ToString()), dtLastSynch); base.totalCount = dtItem.Rows.Count + 1; int count = 0; bool allowAdd = false; try { allowAdd = bool.Parse(hshProperties["AllowAddList"].ToString()); } catch { } SPList list = web.Lists[new Guid(drIntegration["LIST_ID"].ToString())]; GridGanttSettings settings = new GridGanttSettings(list); bool bBuildTeamSec = settings.BuildTeamSecurity; dsUserFields = core.GetDataSet(list, "", intlistid); dtUserFields = dsUserFields.Tables[1]; if (dtUserFields.Select("Type='1'").Length > 0 || bBuildTeamSec) { hshUserMap = core.GetUserMap(drIntegration["INT_LIST_ID"].ToString(), true); } bool bSPCol = false; try { if (hshProperties["SPColumn"].ToString() != "") { bSPCol = true; } } catch { } dtRet = new DataTable(); dtRet.Columns.Add("ID"); if (bSPCol) { dtRet.Columns.Add(hshProperties["SPColumn"].ToString()); } foreach (DataRow dr in dtItem.Rows) { int spid = core.iProcessItemRow(dr, list, dtCols, hshProperties, drIntegration["INT_COLID"].ToString(), intlistid, new Guid(drIntegration["MODULE_ID"].ToString()), allowAdd, dtUserFields, hshUserMap); try { if (spid != 0 && bSPCol) { dtRet.Rows.Add(new string[] { dr["ID"].ToString(), spid.ToString() }); } } catch { } base.updateProgress(count++); } if (bSPCol) { core.PostIntegrationUpdateToExternal(dtRet, intlistid, list.ID); } core.LogMessage(intlistid.ToString(), drIntegration["LIST_ID"].ToString(), "Timer: Imported " + dtItem.Rows.Count + " Items", 1); } else if (drIntegration["TIMEOUTGOING"].ToString() == "True") { SPList list = web.Lists[new Guid(drIntegration["LIST_ID"].ToString())]; core.OpenConnection(); dsItem = core.GetDataSet(list, "", intlistid); SPQuery query = new SPQuery(); query.Query = "<Where><Gt><FieldRef Name=\"Modified\" /><Value IncludeTimeValue=\"TRUE\" Type=\"DateTime\">" + Microsoft.SharePoint.Utilities.SPUtility.CreateISO8601DateTimeFromSystemDateTime(dtLastSynch) + "</Value></Gt></Where>"; SPListItemCollection lic = list.GetItems(query); base.totalCount = lic.Count * 2; int count = 0; foreach (SPListItem li in lic) { core.ProcessItem(dsItem, li, list); updateProgress(count++); } core.PostIntegration(dsItem.Tables[0].Copy(), dsItem.Tables[1], dsItem.Tables[2], list); core.LogMessage(intlistid.ToString(), drIntegration["LIST_ID"].ToString(), "Timer: Exported " + lic.Count + " Items", 1); } hshParms.Add("lastsynch", dtStarted.ToString()); core.ExecuteQuery("UPDATE INT_LISTS set lastsynch=@lastsynch where INT_LIST_ID=@intlistid", hshParms, true); core.CloseConnection(true); } catch (Exception ex) { core.LogMessage(intlistid.ToString(), drIntegration["LIST_ID"].ToString(), "Timer: " + ex.Message, 3); sErrors += "General Error: " + ex.Message; bErrors = true; } finally { hshParms = null; hshUserMap = null; hshProperties = null; if (DS != null) { DS.Dispose(); } if (dsColumns != null) { dsColumns.Dispose(); } if (dtCols != null) { dtCols.Dispose(); } if (dtItem != null) { dtItem.Dispose(); } if (dsUserFields != null) { dsUserFields.Dispose(); } if (dtUserFields != null) { dtUserFields.Dispose(); } if (dtRet != null) { dtRet.Dispose(); } if (dsItem != null) { dsItem.Dispose(); } } } catch (Exception ex) { sErrors += "General Error: " + ex.Message; bErrors = true; } finally { if (web != null) { web.Dispose(); } if (site != null) { site.Dispose(); } data = null; } }
protected void Page_Load(object sender, EventArgs e) { ddlTimed.Attributes.Add("OnChange", "ChangeTimed()"); ddlScheduleType.Attributes.Add("OnChange", "ChangeSchedule()"); //if(!IsPostBack) { for (int i = 1; i < 31; i++) { ddlDayOfMonth.Items.Add(i.ToString()); } for (int i = 0; i < 24; i++) { ddlHour.Items.Add(new ListItem(i.ToString() + ":00", i.ToString())); } } SPSecurity.RunWithElevatedPrivileges(delegate() { try { intlistid = new Guid(Request["intlistid"]); } catch { } lblID.Text = intlistid.ToString(); try { moduleid = new Guid(Request["module"]); } catch { } intcore = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid); PageHead = intadmin.GetIntegrationHeader(); Hashtable hshProps = new Hashtable(); if (intlistid != Guid.Empty) { hshProps = intcore.GetProperties(intlistid); } XmlDocument doc = intcore.GetModuleProperties(intlistid, moduleid); XmlNode ndCon = doc.FirstChild.SelectSingleNode("/Properties/General"); lblMain.Controls.AddAt(0, intadmin.GetPropertyPanel(ndCon, hshProps, this)); try { lblURL.Text = intcore.GetAPIUrl(Web.Site.WebApplication.Id); } catch { } Dictionary <string, string> sASO = intcore.GetDropDownProperties(intadmin.ModuleID, intadmin.intlistid, new Guid(Request["LIST"]), "AvailableSynchOptions", "") ?? new Dictionary <string, string>(); if (sASO.Count == 0) { sASO.Add("LI", "LI"); sASO.Add("LO", "LO"); sASO.Add("TO", "TO"); sASO.Add("TI", "TI"); } if (!sASO.ContainsKey("LI")) { chkLin.Enabled = false; } if (!sASO.ContainsKey("LO")) { chkLout.Enabled = false; } if (!sASO.ContainsKey("TO")) { ddlTimed.Items.Remove(ddlTimed.Items.FindByValue("out")); } if (!sASO.ContainsKey("TI")) { ddlTimed.Items.Remove(ddlTimed.Items.FindByValue("in")); } if (intlistid != Guid.Empty) { if (!IsPostBack) { Hashtable hshParms = new Hashtable(); hshParms.Add("intlistid", intlistid); DataSet dsInfo = intcore.GetDataSet("SELECT * FROM INT_LISTS where INT_LIST_ID=@intlistid", hshParms); DataRow dr = dsInfo.Tables[0].Rows[0]; lblKey.Text = dr["INT_KEY"].ToString(); if (dr["LIVEOUTGOING"].ToString() == "True") { chkLout.Checked = true; } if (dr["LiveIncoming"].ToString() == "True") { chkLin.Checked = true; } if (dr["TIMEOUTGOING"].ToString() == "True") { ddlTimed.SelectedValue = "out"; } if (dr["TIMEINCOMING"].ToString() == "True") { ddlTimed.SelectedValue = "in"; } try { chkDeleteList.Checked = bool.Parse(hshProps["AllowDeleteList"].ToString()); } catch { } try { chkDeleteInt.Checked = bool.Parse(hshProps["AllowDeleteInt"].ToString()); } catch { } try { chkAddList.Checked = bool.Parse(hshProps["AllowAddList"].ToString()); } catch { } try { chkAddInt.Checked = bool.Parse(hshProps["AllowAddInt"].ToString()); } catch { } } } else { chkLout.Checked = true; } if (lblKey.Text == "") { lblKey.Text = Guid.NewGuid().ToString("N") + Guid.NewGuid().ToString("N"); } if (Request["wizard"] == "1") { Button1.Text = "Next >"; } if (!IsPostBack) { if (ddlTimed.SelectedValue != "") { using (var connection = new SqlConnection(CoreFunctions.getConnectionString(Web.Site.WebApplication.Id))) { connection.Open(); using (var command = new SqlCommand("SELECT scheduletype, runtime, days from TIMERJOBS where listguid=@listguid and jobtype=70 and [key]=@key", connection)) { command.Parameters.AddWithValue("@listguid", Request["List"]); command.Parameters.AddWithValue("@key", Request["intlistid"]); using (var dataReader = command.ExecuteReader()) { if (dataReader.Read()) { ddlScheduleType.SelectedValue = dataReader.GetInt32(0).ToString(); if (ddlScheduleType.SelectedValue == "2") { ddlHour.SelectedValue = dataReader.GetInt32(1).ToString(); var arrayList = new ArrayList(dataReader.GetString(2).Split(',')); foreach (ListItem listItem in chkDayOfWeek.Items) { if (arrayList.Contains(listItem.Value)) { listItem.Selected = true; } } } else if (ddlScheduleType.SelectedValue == "3") { ddlDayOfMonth.SelectedValue = dataReader.GetInt32(1).ToString(); } } } } } } } }); }
protected void Page_Load(object sender, EventArgs e) { string url = ""; bool bIframe = false; string windowStyle = ""; SPSecurity.RunWithElevatedPrivileges(delegate() { if (!string.IsNullOrEmpty(Request["listid"])) { Guid listId = new Guid(Request["listid"]); API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); DataTable dt = core.GetIntegrationControl(listId, Request["Control"]); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; string intid = ""; try { SPList list = Web.Lists[listId]; SPListItem li = list.GetItemById(int.Parse(Request["itemid"])); intid = li["INTUID" + dr["INT_COLID"].ToString()].ToString(); } catch { } windowStyle = dr["WINDOWSTYLE"].ToString(); if (intid != "") { url = core.GetControlURL(new Guid(dr["INT_LIST_ID"].ToString()), listId, Request["Control"], intid); if (dr["WINDOWSTYLE"].ToString() == "4") { bIframe = true; } } else { error = "Could not find external itemid"; } } else { error = "Could not find control"; } } else { API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); DataTable dt = core.GetIntegrationControlByIntId(new Guid(Request["integrationid"]), Request["Control"]); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; Hashtable hshParams = new Hashtable(); hshParams.Add("intlistuid", Request["integrationid"]); url = core.GetControlURL(new Guid(Request["integrationid"]), new Guid(dr["LIST_ID"].ToString()), Request["Control"], ""); if (dr["WINDOWSTYLE"].ToString() == "4") { bIframe = true; } } else { error = "Could not find control"; } } }); if (!string.IsNullOrEmpty(url)) { if (bIframe) { error += "<script language=\"javascript\">\r\n"; //error += "function LoadInt2(){\r\n"; //error += "OpenIntegrationPage('" + Request["Control"] + ".1','','');\r\n"; //if (Request["isdlg"] == "1") //{ // error += "SP.SOD.execute('SP.UI.dialog.js', 'SP.UI.ModalDialog.commonModalDialogClose', 0, '');"; //} //else //{ // if (!System.IO.Path.GetFileName(Request.UrlReferrer.ToString()).StartsWith("gotoremote.aspx")) // error += "location.href='" + Request.UrlReferrer.ToString() + "';\r\n"; //} //error += "}\r\n"; //error += "function LoadInt(){\r\n"; //error += "var sandboxSupported = \"sandbox\" in document.createElement(\"iframe\");\r\n"; //error += "if(sandboxSupported){\r\n"; error += "ifrm = document.createElement(\"IFRAME\"); \r\n"; error += "ifrm.setAttribute(\"src\", \"" + url + "\");\r\n"; error += "ifrm.setAttribute(\"id\", \"frmRemote\");\r\n"; error += "ifrm.style.width = \"100%\"; \r\n"; error += "ifrm.style.height = 600 + \"px\"; \r\n"; //error += "ifrm.setAttribute(\"sandbox\", \"allow-scripts allow-forms allow-same-origin allow-popups\");\r\n"; error += "document.getElementById(\"DeltaPlaceHolderMain\").appendChild(ifrm); \r\n"; //error += "}else{\r\n"; //error += "ExecuteOrDelayUntilScriptLoaded(LoadInt2, 'EPMLive.js');\r\n"; //error += "}}\r\n"; //error += "SP.SOD.executeFunc(\"sp.js\", null, LoadInt);\r\n"; error += "</script>"; //<iframe src=\"" + url + "\" id=\"frmRemote\" style=\"width:100%;height:600px\" sandbox=\"allow-forms allow-scripts\">"; } else { Response.Redirect(url); /*if (Request["isdlg"] == "1") * { * error += "<script language=\"javascript\">\r\n"; * error += "function LoadInt(){\r\n"; * error += "var sandboxSupported = \"sandbox\" in document.createElement(\"iframe\");\r\n"; * error += "if(sandboxSupported){\r\n"; * error += "ifrm = document.createElement(\"IFRAME\"); \r\n"; * error += "ifrm.setAttribute(\"src\", \"" + url + "\");\r\n"; * error += "ifrm.style.width = \"100%\"; \r\n"; * error += "ifrm.style.height = 600 + \"px\"; \r\n"; * error += "ifrm.setAttribute(\"sandbox\", \"allow-scripts allow-forms allow-same-origin allow-popups\");\r\n"; * error += "document.getElementById(\"DeltaPlaceHolderMain\").appendChild(ifrm); \r\n"; * error += "}else{\r\n"; * error += "location.href='" + url + "'\r\n"; * error += "}}\r\n"; * error += "SP.SOD.executeFunc(\"sp.js\", null, LoadInt);\r\n"; * error += "</script>"; * } * else if (Request.UrlReferrer == null) * { * Response.Redirect(url); * } * else if (error == "") * { * error = "<script language=\"javascript\">\r\n"; * error += "function LoadInt1(){\r\n"; * error += "ExecuteOrDelayUntilScriptLoaded(LoadInt2, 'EPMLive.js');\r\n"; * error += "}\r\n"; * error += "function LoadInt2(){\r\n"; * error += "OpenIntegrationPage('" + Request["Control"] + "." + windowStyle + "','','');\r\n"; * if (!System.IO.Path.GetFileName(Request.UrlReferrer.ToString()).StartsWith("gotoremote.aspx")) * error += "location.href='" + Request.UrlReferrer.ToString() + "';\r\n"; * error += "}\r\n"; * error += "SP.SOD.executeFunc(\"sp.js\", null, LoadInt1);\r\n"; * error += "</script>"; * }*/ } } }
protected void Page_Load(object sender, EventArgs e) { SPSecurity.RunWithElevatedPrivileges(delegate() { try { intlistid = new Guid(Request["intlistid"]); } catch { } intcore = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); intadmin = new API.Integration.IntegrationAdmin(intcore, intlistid, moduleid); bool bWizard = false; try { if (Request["wizard"] == "1") { bWizard = true; } }catch {} PageHead = intadmin.GetIntegrationHeader(); Hashtable hshProps = new Hashtable(); if (intlistid != Guid.Empty) { hshProps = intcore.GetProperties(intlistid); } SPList list = Web.Lists[intadmin.ListId]; List <ColumnProperty> ColumnList = intcore.GetColumns(hshProps, intadmin.ModuleID, intlistid, list); DropDownList ddlColsTemp = new DropDownList(); foreach (ColumnProperty Column in ColumnList) { ListItem li1 = new ListItem(Column.DiplayName, Column.ColumnName); ddlIDColumn.Items.Add(li1); ListItem li2 = new ListItem(Column.DiplayName, Column.ColumnName); ddlSPColumn.Items.Add(li2); ListItem li3 = new ListItem(Column.DiplayName, Column.ColumnName); ddlSecMatch.Items.Add(li3); ListItem li4 = new ListItem(Column.DiplayName, Column.ColumnName); ddlIntegrationMatch.Items.Add(li4); } SPList List = Web.Lists[new Guid(Request["List"])]; pnlColumns.Controls.Add(new LiteralControl("<table>")); pnlColumns.Controls.Add(new LiteralControl("<tr><td><b>SharePoint Column</b></td><td><b>Integration Column</b></td></tr>")); SortedList sl = new SortedList(); foreach (SPField field in List.Fields) { if (field.Reorderable) { if (!sl.Contains(field.Title)) { sl.Add(field.Title, field.InternalName); } } } sl.Add("Created By", "Author"); Hashtable hshParams = new Hashtable(); hshParams.Add("intlistid", intlistid); DataSet ds = intcore.GetDataSet("SELECT * FROM INT_COLUMNS WHERE INT_LIST_ID=@intlistid", hshParams); DataTable dtColumns = ds.Tables[0]; foreach (DictionaryEntry de in sl) { DropDownList ddl = new DropDownList(); ddl.ID = de.Value.ToString(); ddl.Items.Add(new ListItem("--Select Column--", "")); ListItem li3 = new ListItem(de.Key.ToString(), de.Value.ToString()); ddlSharePointMatch.Items.Add(li3); string curCol = ""; if (!IsPostBack) { DataRow [] drCol = dtColumns.Select("SharePointColumn='" + de.Value.ToString() + "'"); if (drCol.Length > 0) { curCol = drCol[0]["IntegrationColumn"].ToString(); } } foreach (ColumnProperty Column in ColumnList) { ListItem li2 = new ListItem(Column.DiplayName, Column.ColumnName); if (!IsPostBack) { if (bWizard && Column.DefaultListColumn == de.Value.ToString()) { li2.Selected = true; } else if (curCol == Column.ColumnName) { li2.Selected = true; } } ddl.Items.Add(li2); } bool selectedFound = false; foreach (ListItem listItem in ddl.Items) { if (!selectedFound) { selectedFound = listItem.Selected; } else { listItem.Selected = false; } } ArrControls.Add(ddl); pnlColumns.Controls.Add(new LiteralControl("<tr><td>" + de.Key.ToString() + "</td><td>")); pnlColumns.Controls.Add(ddl); pnlColumns.Controls.Add(new LiteralControl("</td></tr>")); } pnlColumns.Controls.Add(new LiteralControl("</table>")); if (!IsPostBack) { if (bWizard) { foreach (ColumnProperty Column in ColumnList) { ListItem li2 = new ListItem(Column.DiplayName, Column.ColumnName); if (Column.DefaultListColumn == "INTUID") { ddlIDColumn.SelectedValue = Column.ColumnName; } if (Column.DefaultListColumn == "SPID") { ddlSPColumn.SelectedValue = Column.ColumnName; } if (Column.DefaultListColumn == "SECMATCH") { ddlSecMatch.SelectedValue = Column.ColumnName; } } } else { try { ddlIDColumn.SelectedValue = hshProps["IDColumn"].ToString(); } catch { } try { ddlSPColumn.SelectedValue = hshProps["SPColumn"].ToString(); } catch { } try { ddlSecMatch.SelectedValue = hshProps["SecMatch"].ToString(); } catch { } try { string[] match = hshProps["ItemMatch"].ToString().Split('|'); ddlSharePointMatch.SelectedValue = match[0]; ddlIntegrationMatch.SelectedValue = match[1]; } catch { } } } if (bWizard) { Button1.Text = "Finish"; Button1.OnClientClick = "Install();"; } else { Button1.OnClientClick = "DisableButtons();"; } }); }
protected override void OnPreRender(System.EventArgs e) { SPWeb Web = SPContext.Current.Web; SPList List = SPContext.Current.List; SPListItem ListItem = SPContext.Current.ListItem; CssRegistration.Register("/_layouts/epmlive/modal/modal.css"); ScriptLink.Register(Page, "/_layouts/epmlive/modal/modal.js", false); SPRibbon ribbon = SPRibbon.GetCurrent(this.Page); RegisterArchiveRestoreFormButtons(Web, List, ListItem, ribbon); ribbon.TrimById("Ribbon.ListForm.Display.Manage.EditItem"); XmlDocument ribbonExtensions = new XmlDocument(); if (NavigationService.LPPFEPermissionCheck(List, SPBasePermissions.EditListItems)) { ribbonExtensions.LoadXml(@"<Button Id=""Ribbon.ListForm.Display.Manage.EditItem2"" Sequence=""10"" Command=""Ribbon.ListForm.Display.Manage.EditItem2"" Image16by16=""/_layouts/" + Web.Language + @"/images/formatmap16x16.png"" Image16by16Top=""-128"" Image16by16Left=""-224"" Image32by32=""/_layouts/" + Web.Language + @"/images/formatmap32x32.png"" Image32by32Top=""-128"" Image32by32Left=""-96"" LabelText=""Edit Item"" TemplateAlias=""o1""/>"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } if (!NavigationService.LPPFEPermissionCheck(List, SPBasePermissions.DeleteListItems)) { ribbon.TrimById("Ribbon.ListForm.Display.Manage.DeleteItem"); } EPMLiveCore.GridGanttSettings gSettings = API.ListCommands.GetGridGanttSettings(List); ArrayList arrAssoc = API.ListCommands.GetAssociatedLists(List); if (gSettings.AssociatedItems) { StringBuilder sbLists = new StringBuilder(); foreach (EPMLiveCore.API.AssociatedListInfo ali in arrAssoc) { //sbLists.Append("<Button Id=\"Ribbon.ListForm.Display.Manage.LinkedItemsButton\" Sequence=\"20\" Command=\""); sbLists.Append("<Button Sequence=\"20\" Command=\""); sbLists.Append("Ribbon.ListForm.Display.Associated.LinkedItemsButton"); sbLists.Append("\" Id=\"Ribbon.ListForm.Display.Associated."); sbLists.Append(HttpUtility.HtmlEncode(ali.Title)); sbLists.Append("."); sbLists.Append(ali.LinkedField); sbLists.Append("\" LabelText=\""); sbLists.Append(HttpUtility.HtmlEncode(ali.Title)); sbLists.Append("\" TemplateAlias=\"o1\" Image16by16=\""); sbLists.Append(ali.icon); sbLists.Append("\"/>"); } if (sbLists.Length > 0) { StringBuilder sbLinkedItems = new StringBuilder(); sbLinkedItems.Append("<Group Id=\"Ribbon.ListForm.Display.Associated\" Sequence=\"41\" Command=\"Ribbon.ListForm.Display.Associated.LinkedItems\" Description=\"\" Title=\"Associated Items\" Template=\"Ribbon.Templates.Flexible2\">"); sbLinkedItems.Append("<Controls Id=\"Ribbon.ListForm.Display.Associated.Controls\">"); sbLinkedItems.Append(sbLists); sbLinkedItems.Append("</Controls>"); sbLinkedItems.Append("</Group>"); ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml(sbLinkedItems.ToString()); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Groups._children"); ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml("<MaxSize Id=\"Ribbon.ListForm.Display.Associated.MaxSize\" Sequence=\"10\" GroupId=\"Ribbon.ListForm.Display.Associated\" Size=\"MediumMedium\" />"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Scaling._children"); //StringBuilder sbLinkedItems = new StringBuilder(); //sbLinkedItems.Append("<FlyoutAnchor Id=\"Ribbon.ListForm.Display.Manage.LinkedItems\" Sequence=\"39\" Command=\""); //sbLinkedItems.Append("Ribbon.ListForm.Display.Manage.LinkedItems"); //sbLinkedItems.Append("\" Image32by32=\"/_layouts/epmlive/images/linkeditems.gif\" LabelText=\"Associated Items\" TemplateAlias=\"o1\">"); //sbLinkedItems.Append("<Menu Id=\"Ribbon.List.EPMLive.LinkedItems.Menu\">"); //sbLinkedItems.Append("<MenuSection Id=\"Ribbon.List.EPMLive.LinkedItems.Menu.Scope\" Sequence=\"10\" DisplayMode=\"Menu16\">"); //sbLinkedItems.Append("<Controls Id=\"Ribbon.List.EPMLive.LinkedItems.Menu.Scope.Controls\">"); //sbLinkedItems.Append(sbLists); //sbLinkedItems.Append("</Controls>"); //sbLinkedItems.Append("</MenuSection>"); //sbLinkedItems.Append("</Menu>"); //sbLinkedItems.Append("</FlyoutAnchor>"); //ribbonExtensions.LoadXml(sbLinkedItems.ToString()); //ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, //"Ribbon.ListForm.Display.Manage.Controls._children"); } } //======================Planner================== API.ListPlannerProps p = API.ListCommands.GetListPlannerInfo(List); if (p.PlannerV2Menu != "") { ribbonExtensions.LoadXml(p.PlannerV2Menu.Replace("EPMLivePlanner", "Ribbon.ListForm.Display.Manage.EPMLivePlanner").Replace("TaskPlanner", "Ribbon.ListForm.Display.Manage.TaskPlanner")); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); //if(bPlanner == 1) //{ // EPMLiveWorkPlanner.WorkPlannerAPI.PlannerProps props = EPMLiveWorkPlanner.WorkPlannerAPI.getSettings(Web, sPlannerID); // bUseTeam = props.bUseTeam; // ribbonExtensions.LoadXml("<Button Id=\"Ribbon.ListItem.EPMLive.BuildTeam\" Sequence=\"41\" Command=\"Ribbon.ListForm.Display.Manage.BuildTeam\" LabelText=\"Build Team\" TemplateAlias=\"o1\" Image32by32=\"/_layouts/epmlive/images/editteam32.gif\"/>"); // ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); //} } //=====================Create Workspace=========== if (gSettings.EnableRequests) { string childitem = ""; try { childitem = ListItem["WorkspaceUrl"].ToString(); } catch { } if ((ListItem.ModerationInformation == null || ListItem.ModerationInformation.Status == SPModerationStatusType.Approved) && childitem == "") { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml("<Button Id=\"Ribbon.ListItem.EPMLive.CreateWorkspace\" Sequence=\"50\" Command=\"Ribbon.ListForm.Display.Manage.CreateWorkspace\" LabelText=\"Create Workspace\" TemplateAlias=\"o2\" Image16by16=\"_layouts/images/epmlivelogosmall.gif\"/>"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } } //=====================Favorite if (Web.Features[new Guid("046f0200-30e5-4545-b00f-c8c73aef9f0e")] != null) { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml("<Button Id=\"Ribbon.ListItem.EPMLive.FavoriteStatus\" Sequence=\"100\" Command=\"Ribbon.ListForm.Display.Actions.Favorite\" LabelText=\"Favorite\" TemplateAlias=\"o1\" Image32by32=\"_layouts/epmlive/images/star32.png\" Image16by16=\"_layouts/epmlive/images/star16.png\"/>"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Actions.Controls._children"); ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml("<Button Id=\"Ribbon.ListItem.EPMLive.FavoriteStatus\" Sequence=\"100\" Command=\"Ribbon.ListForm.Display.Actions.Favorite\" LabelText=\"Favorite\" TemplateAlias=\"o1\" Image32by32=\"_layouts/epmlive/images/star32.png\" Image16by16=\"_layouts/epmlive/images/star16.png\"/>"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Edit.Actions.Controls._children"); ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml("<Button Id=\"Ribbon.ListItem.EPMLive.FavoriteStatus\" Sequence=\"100\" Command=\"Ribbon.ListForm.Display.Actions.Favorite\" LabelText=\"Favorite\" TemplateAlias=\"o1\" Image32by32=\"_layouts/epmlive/images/star32.png\" Image16by16=\"_layouts/epmlive/images/star16.png\"/>"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.DocLibListForm.Edit.Actions.Controls._children"); } EPMLiveCore.API.RibbonProperties rp = (EPMLiveCore.API.RibbonProperties)EPMLiveCore.Infrastructure.CacheStore.Current.Get("GR-" + Web.CurrentUser.ID, "GridSettings-" + List.ID, () => { return(EPMLiveCore.API.ListCommands.GetRibbonProps(List)); }).Value; //=====================Build Team=========== try { if (rp.bBuildTeam) { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml("<Button Id=\"Ribbon.ListItem.EPMLive.BuildTeam\" Sequence=\"50\" Command=\"Ribbon.ListForm.Display.Manage.BuildTeam\" LabelText=\"Edit Team\" TemplateAlias=\"o2\" Image16by16=\"_layouts/epmlive/images/buildteam16.gif\"/>"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } } catch { } //==========Go To Workspace================= string workspaceurl = ""; try { workspaceurl = ListItem["WorkspaceUrl"].ToString(); } catch { } if (workspaceurl != "") { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml("<Button Id=\"Ribbon.ListItem.EPMLive.GoToWorkspace\" Sequence=\"55\" Command=\"Ribbon.ListForm.Display.Manage.GoToWorkspace\" LabelText=\"Go To Workspace\" TemplateAlias=\"o1\" Image32by32=\"_layouts/images/spgraphic.gif\" Image32by32Top=\"7\" Image32by32Left=\"4\"/>"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } //================EPK=================== if (rp.aEPKButtons.Contains("costs")) { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml(@"<Button Id=""Ribbon.ListItem.Manage.EPKCosts"" Sequence=""101"" Command=""Ribbon.ListForm.Display.Manage.EPKCost"" Image32by32=""/_layouts/epmlive/images/editcosts.png"" LabelText=""Edit Costs"" TemplateAlias=""o1"" />"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } if (rp.aEPKButtons.Contains("resplan")) { if (rp.aEPKActivex.Contains("resplan")) { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml(@"<Button Id=""Ribbon.ListItem.Manage.EPKResourcePlanner"" Sequence=""103"" Command=""Ribbon.ListForm.Display.Manage.EPKRP"" Image32by32=""/_layouts/epmlive/images/ribbon32.png"" Image32by32Top=""-65"" LabelText=""Edit Resource Plan"" TemplateAlias=""o1"" />"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } else { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml(@"<Button Id=""Ribbon.ListItem.Manage.EPKResourcePlanner"" Sequence=""103"" Command=""Ribbon.ListForm.Display.Manage.EPKRPM"" Image16by16=""/_layouts/1033/images/formatmap16x16.png"" Image16by16Top=""-64"" Image16by16Left=""-128"" LabelText=""Resource Planner"" TemplateAlias=""o2"" />"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } } API.Integration.IntegrationCore core = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); string Errors = ""; int seq = 130; var commands = new List <IRibbonCommand>(); List <EPMLiveIntegration.IntegrationControl> ics = core.GetItemButtons(ListItem.ParentList.ID, ListItem, out Errors); foreach (EPMLiveIntegration.IntegrationControl ic in ics) { ribbonExtensions = new XmlDocument(); ribbonExtensions.LoadXml(@"<Button Id=""EPMINT." + ic.Control + @"." + (int)ic.Window + @""" Sequence=""" + (seq++).ToString() + @""" Command=""Ribbon.ListForm.Display.Manage.EPMINT"" Image32by32=""/_layouts/15/images/" + ic.Image + @""" LabelText=""" + ic.Title + @""" TemplateAlias=""o1"" />"); ribbon.RegisterDataExtension(ribbonExtensions.FirstChild, "Ribbon.ListForm.Display.Manage.Controls._children"); } //=============================================== // register the command at the ribbon. Include the callback to the server // to generate the xml //commands.Add(new SPRibbonCommand("Ribbon.ListForm.Display.Manage.EditItem2", "alert('test');", "true")); var manager = new SPRibbonScriptManager(); var methodInfo = typeof(SPRibbonScriptManager).GetMethod("RegisterInitializeFunction", BindingFlags.Instance | BindingFlags.NonPublic); methodInfo.Invoke(manager, new object[] { Page, "InitPageComponent", "/_layouts/epmlive/WEDispFormPageComponent.js", false, "WEDispFormPageComponent.PageComponent.initialize()" }); manager.RegisterGetCommandsFunction(Page, "getGlobalCommands", commands); manager.RegisterCommandEnabledFunction(Page, "commandEnabled", commands); manager.RegisterHandleCommandFunction(Page, "handleCommand", commands); }
protected void Page_Load(object sender, EventArgs e) { SPSecurity.RunWithElevatedPrivileges(delegate() { Act act = new Act(Web); API.Integration.IntegrationCore integration = new API.Integration.IntegrationCore(Web.Site.ID, Web.ID); DataSet dsIntegrations = integration.GetIntegrations(act.IsOnline); StringBuilder sb = new StringBuilder(); DataTable dtCat = dsIntegrations.Tables[0]; foreach (DataRow drCat in dtCat.Rows) { sb.Append("<div class=\"header-wrapper\">"); sb.Append("<h4>" + drCat["CATEGORY"].ToString() + "</h4>"); sb.Append("</div>"); sb.Append("<div style=\"width:100%;overflow: hidden;padding-bottom:30px;\">"); DataTable dtMods = dsIntegrations.Tables[drCat["INT_CAT_ID"].ToString()]; if (dtMods.Rows.Count == 0) { sb.Append("<div style=\"text-align:left;\">No integration modules available</div>"); } foreach (DataRow dr in dtMods.Rows) { sb.Append("<div style=\"width:270px;float:left;padding-right:20px\">"); string icon = dr["Icon"].ToString(); if (icon == "") { icon = "/_layouts/epmlive/images/integration/base.png"; } else { icon = "/_layouts/epmlive/images/integration/" + icon; } string desc = dr["Description"].ToString(); sb.Append("<TABLE border=0 cellSpacing=0 cellPadding=0 width=\"100%\" height=\"100%\"><tr>"); sb.Append("<td class=\"add-app-logo-box\">"); sb.Append("<img src=\""); sb.Append(((Web.ServerRelativeUrl == "/") ? "" : Web.ServerRelativeUrl)); sb.Append(icon); sb.Append("\"></td></tr><tr>"); sb.Append("<td class=\"titletd\"><b>"); sb.Append(dr["Title"].ToString()); sb.Append("</b>"); if (desc != "") { sb.Append("<div style=\"padding-top: 5px;padding-bottom:10px;padding-right:5px;work-wrap:break-word;\">"); sb.Append(desc); sb.Append("</div>"); } sb.Append("</td>"); sb.Append("</tr>"); sb.Append("<tr><td style=\"text-align:center;\">"); sb.Append("<a href=\"javascript:void(0);\" onclick=\"AddIntegration('"); sb.Append(dr["MODULE_ID"].ToString()); sb.Append("')\" class=\"btn btn-large btn-success\" style=\"text-decoration:none;\">Configure</a>"); sb.Append("</td></tr>"); sb.Append("</table>"); sb.Append("</div>"); } sb.Append("</div>"); } Integrations = sb.ToString(); }); }