public Workarea_MenuActions() { m_CommonApi = new CommonApi(); m_ContentApi = new ContentAPI(); m_EkContent = m_ContentApi.EkContentRef; m_refMsg = m_ContentApi.EkMsgRef; }
protected WidgetControls_widget() { _contentApi = new ContentAPI(); _siteApi = new SiteAPI(); _ApplicationPath = _contentApi.ApplicationPath.TrimEnd(new char[] { '/' }); _SitePath = _contentApi.SitePath.TrimEnd(new char[] { '/' }); }
protected void Page_Init(object sender, EventArgs e) { var m_refMsg = new ContentAPI().EkMsgRef; BackLabel.Text = m_refMsg.GetMessage("btn back"); DeleteLabel.Text = m_refMsg.GetMessage("btn delete"); //Register CSS Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaIeCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronFixedPositionToolbarCss); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronJFunctJS); ltrlStyleSheetJS.Text = _styleHelper.GetClientScript(); _msgHelper = new EkMessageHelper(_contentApi.RequestInformationRef); Utilities.ValidateUserLogin(); if (_contentApi.RequestInformationRef.IsMembershipUser == 1 || !_contentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.AdminPersonalize)) { Response.Redirect(_contentApi.ApplicationPath + "reterror.aspx?info=" + _contentApi.EkMsgRef.GetMessage("msg login cms user"), true); return; } BindToolbars(); this.image_link_100.Attributes.Add("onclick", string.Format("return validateList('{0}');", _msgHelper.GetMessage("select target content"))); }
public static bool IsAdvancedWorkflowActive(long contentId, long folderId, int languageId) { var contentApi = new ContentAPI(); var cwfutilties = new ContentWorkflowUtilities(contentApi.RequestInformationRef); var workflowdefinitionid = cwfutilties.GetInheritedWorkflowDefinitionId(contentId, folderId, languageId); return (workflowdefinitionid > 0); }
public string GetFolderPath(long Id) { ContentAPI contentAPI = new ContentAPI(); SiteAPI siteAPI = new SiteAPI(); szdavfolder = "ekdavroot"; string sitePath = (string) (siteAPI.SitePath.ToString().TrimEnd(new char[] {'/'}).TrimStart(new char[] {'/'})); szdavfolder = (string) (szdavfolder.TrimEnd(new char[] {'/'}).TrimStart(new char[] {'/'})); if (Page.Request.Url.Host.ToLower() == "localhost") { szdavfolder = Page.Request.Url.Scheme + Uri.SchemeDelimiter + System.Net.Dns.GetHostName() + "/" + sitePath + "/" + szdavfolder + "_" + siteAPI.UserId + "_" + siteAPI.UniqueId + (((Context.Request.QueryString["LangType"] != null) ? ("_" + Context.Request.QueryString["LangType"].ToString()) : "") ) + "/"; } else { szdavfolder = Page.Request.Url.Scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + "/" + sitePath + "/" + szdavfolder + "_" + siteAPI.UserId + "_" + siteAPI.UniqueId + (((Context.Request.QueryString["LangType"] != null) ? ("_" + Context.Request.QueryString["LangType"].ToString()) : "") ) + "/"; } string szFolderPath = contentAPI.EkContentRef.GetFolderPath(Id); szFolderPath = szFolderPath.Replace("\\", "/"); szFolderPath = szFolderPath.TrimStart(new char[] {'/'}); szFolderPath = szFolderPath.Replace("\\\\", "/"); if (szFolderPath.Length > 0) { szFolderPath = szdavfolder + szFolderPath + "/"; } else { szFolderPath = szdavfolder; } return szFolderPath; }
public bool IsCurrentApprover(long userId, long contentId) { ContentAPI m_refContentApi = new ContentAPI(); bool isCurrent = false; ApprovalData[] approvaldata = null; if (approvaldata == null) { approvaldata = m_refContentApi.GetCurrentApprovalInfoByID(contentId); } if ((approvaldata != null) && approvaldata.Length > 0) { bool IsLastApproval = System.Convert.ToBoolean(approvaldata[approvaldata.Length - 1].IsCurrentApprover && (approvaldata[approvaldata.Length - 1].UserId == m_refContentApi.UserId || new UserAPI().IsAGroupMember(m_refContentApi.UserId, approvaldata[approvaldata.Length - 1].GroupId))); if (IsLastApproval) { isCurrent = true; } else { for (int i = 0; i <= (approvaldata.Length - 1); i++) { if (approvaldata[i].IsCurrentApprover) { isCurrent = System.Convert.ToBoolean(approvaldata[i].UserId == m_refContentApi.UserId || new UserAPI().IsAGroupMember(m_refContentApi.UserId, approvaldata[i].GroupId)); } } } } return isCurrent; }
public void GetFileTranslationTest() { ContentAPI client = ConstructServiceClient(); IEnumerable <File> files = client.ListFiles(); foreach (File file in files) { int assetID = file.AssetID; String languageCode = "en-us"; try { Byte[] content = client.GetFileTranslation(assetID.ToString(), languageCode); Assert.Fail("A file with an invalid translation should not have been retrieved."); } catch (OnDemandClientException odce) { Assert.AreEqual <HttpStatusCode>(HttpStatusCode.NotFound, odce.HttpStatusCode); Assert.AreEqual <Int32>(0, odce.ReasonCode); Assert.IsNotNull(odce.SimpleMessage); } break; } }
protected CatalogEntry_PageFunctions_Js() { _ContentApi = new ContentAPI(); _MessageHelper = _ContentApi.EkMsgRef; _JsLibrary = new workareajavascript(); _ApplicationPath = _ContentApi.ApplicationPath.TrimEnd(new char[] { '/' }); }
public void GetFileNullTest() { String assetID = null; ContentAPI client = ConstructServiceClient(); Byte[] content = client.GetFile(assetID); }
protected void Page_Load(object sender, EventArgs e) { Response.ContentType = "application/javascript"; // initialize additional variables for later use m_refMsg = m_refSiteApi.EkMsgRef; // instantiate contentAPI reference ContentAPI contentApi = new ContentAPI(); // assign the resource text values as needed jsAddPage.Text = m_refMsg.GetMessage("lbl pagebuilder add page"); jsAppPath.Text = contentApi.AppPath; jsBack.Text = m_refMsg.GetMessage("back"); jsCancel.Text = m_refMsg.GetMessage("btn cancel"); jsFinish.Text = m_refMsg.GetMessage("btn finish"); jsNext.Text = m_refMsg.GetMessage("btn next"); jsOk.Text = m_refMsg.GetMessage("lbl ok"); jsSavePageAs.Text = m_refMsg.GetMessage("lbl pagebuilder save page"); jsWizardsPath.Text = (contentApi.AppPath + "pagebuilder/wizards/"); jsErrorPageTitle.Text = m_refMsg.GetMessage("lbl pagebuilder error page title"); jsErrorSelectLayout.Text = m_refMsg.GetMessage("lbl pagebuilder error select layout"); jsErrorUrlAlias.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias"); jsErrorUrlAliasExists.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias exists"); jsdropdownMustMatch.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias selection must match"); jsinvalidExtension.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias invalid extension"); jsselectExtension.Text = m_refMsg.GetMessage("lbl pagebuilder error url alias select extension"); jserrorMetadata.Text = m_refMsg.GetMessage("lbl pagebuilder error metadata"); jserrorTaxonomy.Text = m_refMsg.GetMessage("lbl pagebuilder error taxonomy"); jsloading.Text = m_refMsg.GetMessage("lbl sync loading"); jsAddMaster.Text = m_refMsg.GetMessage("lbl Add Master Layout"); }
public void CreateAccountBadCountryTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "XX"; String vatID = "12334455544"; try { Account account = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); Assert.Fail("Created an account with an invalid invalid country code."); } catch (OnDemandClientException odce) { Assert.AreEqual <Int32>(400, odce.ReasonCode); Assert.IsNotNull(odce.SimpleMessage); Assert.IsNotNull(odce.DetailedMessage); } }
public void CreateAccountEmailConflictTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "US"; String vatID = "12334455544"; Account account1 = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); Assert.IsNotNull(account1, "The account should have been created."); try { Account account2 = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); Assert.Fail("Created an account with a duplicate email address."); } catch (OnDemandClientException odce) { Assert.AreEqual <HttpStatusCode>(HttpStatusCode.Conflict, odce.HttpStatusCode); Assert.AreEqual <Int32>(404, odce.ReasonCode); Assert.IsNotNull(odce.SimpleMessage); Assert.IsNotNull(odce.DetailedMessage); } }
private void Page_Load(object sender, System.EventArgs e) { _ContentApi = new ContentAPI(); _MessageHelper = _ContentApi.EkMsgRef; if (Request.RawUrl.ToLower().Contains("<script")) { Utilities.ShowError(_MessageHelper.GetMessage("invalid querstring")); return; } this.RegisterWorkareaCssLink(); this.RegisterDialogCssLink(); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronStringJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronXmlJS); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekxbrowser.js", "ekxbrowserJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekutil.js", "ekutilJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../RadWindow.js", "RadWindowJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekformfields.js", "ekformfieldsJS"); this.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitializeRadWindow", "InitializeRadWindow();", true); this.Title.Text = this.GetMessage("lbl group box"); this.RadTabStrip1.Tabs[0].Text = this.GetMessage("tab general"); this.RadTabStrip1.Tabs[0].ToolTip = this.RadTabStrip1.Tabs[0].Text + "Tab"; this.RadTabStrip1.Tabs[1].Text = this.GetMessage("tab advanced"); this.RadTabStrip1.Tabs[1].ToolTip = this.RadTabStrip1.Tabs[1].Text + "Tab"; this.RadTabStrip1.Tabs[2].Text = this.GetMessage("tab relevance"); this.RadTabStrip1.Tabs[2].ToolTip = this.RadTabStrip1.Tabs[2].Text + "Tab"; this.lblAppearance.InnerHtml = this.GetMessage("lbl appearance"); this.lblNoBorder.InnerHtml = this.GetMessage("lbl no border"); this.lblShowBorder.InnerHtml = this.GetMessage("lbl show border"); this.lblCaption.InnerHtml = this.GetMessage("lbl caption c"); this.txtCaption.Value = this.GetMessage("lbl fields"); this.sEnterCaption.Text = this.GetMessage("msg enter caption"); }
protected void Page_Load(object sender, EventArgs e) { try { contentAPI = new ContentAPI(); siteAPI = new SiteAPI(); switch( Request.QueryString["action"]) { case "getdavurl": Response.Write(GetSharepointUploadPath()); break; case "getdetails": Response.Write( "showRedistributionStatusCallback(\"" + EscapeString(GetRedistributionDetails()) + "\");cleanUp(\"" + Request.QueryString["cleanupid"] + "\");"); break; default: Response.Write( "distributeCallback(" + IsDocumentPromoted().ToString().ToLowerInvariant() + ");cleanUp(\"" + Request.QueryString["cleanupid"] + "\");"); break; } } catch (Exception ex) { DisplayError(ex.Message); } }
private void Page_Load(object sender, System.EventArgs e) { _ContentApi = new ContentAPI(); _MessageHelper = _ContentApi.EkMsgRef; if (EkFunctions.UrlDecode(Request.RawUrl).ToLower().Contains("<script") | EkFunctions.UrlDecode(Request.RawUrl).ToLower().Contains("</script")) { Utilities.ShowError(_MessageHelper.GetMessage("invalid querstring")); return; } this.RegisterWorkareaCssLink(); this.RegisterDialogCssLink(); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronStringJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronXmlJS); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekxbrowser.js", "ekxbrowserJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekutil.js", "ekutilJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../RadWindow.js", "RadWindowJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekformfields.js", "ekformfieldsJS"); this.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitializeRadWindow", "InitializeRadWindow();", true); this.Title.Text = this.GetMessage("lbl checkbox field"); this.RadTabStrip1.Tabs[0].Text = this.GetMessage("tab general"); ; this.RadTabStrip1.Tabs[0].ToolTip = this.GetMessage("tab general") + " Tab"; ; this.RadTabStrip1.Tabs[1].Text = this.GetMessage("tab validation"); ; this.RadTabStrip1.Tabs[1].ToolTip = this.GetMessage("tab validation") + " Tab"; ; this.RadTabStrip1.Tabs[2].Text = this.GetMessage("tab advanced"); ; this.RadTabStrip1.Tabs[2].ToolTip = this.GetMessage("tab advanced") + " Tab"; ; this.lblDefVal.InnerHtml = this.GetMessage("lbl default value"); this.lblDefValT.InnerHtml = this.GetMessage("lbl def val true"); this.lblDefValF.InnerHtml = this.GetMessage("lbl def val false"); this.lblCaption.InnerHtml = this.GetMessage("lbl caption c"); }
protected void Page_Load(object sender, System.EventArgs e) { m_refMsg = m_refCommon.EkMsgRef; AppImgPath = m_refCommon.AppImgPath; AppPath = m_refCommon.AppPath; m_strPageAction = Request.QueryString["action"]; Utilities.SetLanguage(m_refCommon); MenuLanguage = m_refCommon.ContentLanguage; MenuId = Convert.ToInt64(Request.QueryString["menuid"]); if (Request.QueryString["view"] != null) { m_strViewItem = Request.QueryString["view"]; } m_refContent = m_refCommon.EkContentRef; m_refContentApi = new ContentAPI(); Utilities.SetLanguage(m_refContentApi); sitePath = m_refCommon.SitePath; m_strBackPage = Request.QueryString.ToString(); // strip off refresh indicator if (m_strBackPage.EndsWith("&rf=1")) { // refresh is needed after we edit a submenu, but we don't want to keep refreshing if we use the same URL m_strBackPage = m_strBackPage.Substring(0, m_strBackPage.Length - 5); } DisplayPage(); }
public void GetFileEmptyTest() { String assetID = String.Empty; ContentAPI client = ConstructServiceClient(); Byte[] content = client.GetFile(assetID); }
/// <summary> /// Constructor /// </summary> /// <param name="context">Current HTTP context</param> public LoadBalanceManager(HttpContext context) { _contentApi = new ContentAPI(); _siteApi = new SiteAPI(); _loadBalanceSyncManager = new LoadBalanceSynchronizationManager(); _context = context; }
protected void Page_Load(object sender, EventArgs e) { contentAPI = new ContentAPI(); string action = string.Empty; Utilities.ValidateUserLogin(); RegisterResources(); try { if (!contentAPI.IsAdmin()) { Response.Redirect(contentAPI.ApplicationPath + "reterror.aspx?info=" + contentAPI.EkMsgRef.GetMessage("msg login cms administrator"), true); return; } if (!string.IsNullOrEmpty(Request.QueryString["action"])) { action = Request.QueryString["action"].ToString(); } switch (action.ToLower()) { case "viewalldeviceconfigurations": ViewAllDeviceConfigurations m_vd; m_vd = (ViewAllDeviceConfigurations)(LoadControl("controls/DeviceConfiguration/ViewAllDeviceConfigurations.ascx")); m_vd.ID = "deviceConfiguration"; DataHolder.Controls.Add(m_vd); break; case "adddeviceconfiguration": case "editdeviceconfiguration": AddEditDeviceConfiguration m_ad; m_ad = (AddEditDeviceConfiguration)(LoadControl("controls/DeviceConfiguration/AddEditDeviceConfiguration.ascx")); m_ad.ID = "deviceConfiguration"; DataHolder.Controls.Add(m_ad); break; case "viewdeviceconfiguration": ViewDeviceConfiguration m_vsd; m_vsd = (ViewDeviceConfiguration)(LoadControl("controls/DeviceConfiguration/ViewDeviceConfiguration.ascx")); m_vsd.ID = "deviceConfiguration"; DataHolder.Controls.Add(m_vsd); break; case "reorderdeviceconfigurations": ReorderDeviceConfigurations m_rd; m_rd = (ReorderDeviceConfigurations)(LoadControl("controls/DeviceConfiguration/ReorderDeviceConfigurations.ascx")); m_rd.ID = "deviceConfiguration"; DataHolder.Controls.Add(m_rd); break; case "deletedeviceconfiguration": DeleteDeviceConfiguration m_dd; m_dd = (DeleteDeviceConfiguration)(LoadControl("controls/DeviceConfiguration/DeleteDeviceConfiguration.ascx")); m_dd.ID = "deviceConfiguration"; DataHolder.Controls.Add(m_dd); break; } } catch (Exception ex) { Utilities.ShowError(ex.InnerException.ToString()); } }
/// <summary> /// /// </summary> /// <param name="element"></param> /// <param name="client"></param> public ProjectNotification(XElement element, ContentAPI client) : this() { if (element != null) { this.ProjectID = element.GetChildValueAsInt32("ProjectID"); this.Status = element.GetChildValue("Status"); this.URL = new Uri(element.GetChildValue("URL")); this.CreationDate = element.GetChildValueAsDateTime("CreationDate"); this.DueDate = element.GetChildValueAsDateTime("DueDate"); this.CompletionDate = element.GetChildValueAsDateTime("CompletionDate"); XElement errors = element.Element("Errors"); if (errors != null) { foreach (XElement error in errors.Elements("Error")) { this.ErrorsList.Add(error.Value); } } XElement sourceLanguage = element.Element("SourceLanguage"); if (sourceLanguage != null) { this.SourceLanguage = sourceLanguage.GetChildValue("LanguageCode"); } XElement targetLanguages = element.Element("TargetLanguages"); if (targetLanguages != null) { foreach (XElement targetLanguage in targetLanguages.Descendants("LanguageCode")) { this.TargetLanguagesList.Add(targetLanguage.Value); } } XElement products = element.Element("Products"); if (products != null) { this.Products = Product.CreateEnumerable(products, client); } XElement files = element.Element("Files"); if (files != null) { this.Files = File.CreateEnumerable(files, client); } } }
public void GetFileTranslationNullTest() { String assetID = null; String languageCode = "en-us"; ContentAPI client = ConstructServiceClient(); Byte[] content = client.GetFileTranslation(assetID, languageCode); }
public void GetFileTranslationValidEmptyTest() { String assetID = "1234"; String languageCode = String.Empty; ContentAPI client = ConstructServiceClient(); Byte[] content = client.GetFileTranslation(assetID, languageCode); }
public void RejectNullQuoteTest() { ContentAPI client = ConstructServiceClient(); RejectQuoteStatus result = client.RejectQuote(0); Assert.AreEqual(result, RejectQuoteStatus.BadRequest); }
public void ListProjectsTest() { ContentAPI client = ConstructServiceClient(); IEnumerable <Project> projects = client.ListProjects(); Assert.IsTrue(projects.Count() > 0); }
public void GetNullQuoteTest() { ContentAPI client = ConstructServiceClient(); Quote quote = client.GetQuote(0); Assert.IsNull(quote); }
private void Page_Init(System.Object sender, System.EventArgs e) { m_refContentApi = new ContentAPI(); Utilities.ValidateUserLogin(); //register page components this.RegisterJS(); this.RegisterCSS(); }
protected Membership() { _ContentApi = new ContentAPI(); _SiteApi = new SiteAPI(); this.SitePath = _ContentApi.SitePath.TrimEnd(new char[] { '/' }); this.ApplicationPath = _SiteApi.ApplicationPath.TrimEnd(new char[] { '/' }); }
protected Attributes() { _contentApi = new ContentAPI(); _siteApi = new SiteAPI(); _MessageHelper = _contentApi.EkMsgRef; this.SitePath = _contentApi.SitePath.TrimEnd(new char[] { '/' }); this.ApplicationPath = _siteApi.ApplicationPath.TrimEnd(new char[] { '/' }); }
protected void Page_Load(object sender, System.EventArgs e) { try { m_refContentApi = new ContentAPI(); AppImgPath = m_refContentApi.AppImgPath; m_refMsg = m_refContentApi.EkMsgRef; Utilities.ValidateUserLogin(); RegisterResources(); if (!(Request.QueryString["folderid"] == null)) { if (Request.QueryString["folderid"] != "") { m_intFolderId = Convert.ToInt64(Request.QueryString["folderid"]); } } if (Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = int.Parse(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } m_refContentApi.ContentLanguage = ContentLanguage; SearchStyleSheet = "<link rel=\'stylesheet\' type=\'text/css\' href=\'csslib/worksearch.css\'>" + "\r\n"; StyleSheetJS = m_refStyle.GetClientScript(); if (ProductSearch1 != null) { ProductSearch1.CatalogId = m_intFolderId; ProductSearch1.LanguageID = ContentLanguage; ProductSearch1.IsInWorkArea = true; ProductSearch1.DisplayXslt = "Xslt/WA_ProductSearch.xsl"; //ProductSearch1.TemplateProduct = "ProductView.aspx" } if (Page.IsPostBack == false) { Display_ToolBar(); } } catch (Exception ex) { if (ex.Message.ToLower().IndexOf("service is not running") != -1) { Utilities.ShowError("Error: Index service is not running. You cannot search on Products. Restart the service."); } else { Utilities.ShowError(ex.Message); } } }
public void AuthorizeNullQuoteTest() { ContentAPI client = ConstructServiceClient(); Quote authorizeQuote = new Quote(0, DateTime.Now, 0, 0, "", 0m, 0m, 0m, null); QuoteAuthorization quoteAuthorization = client.AuthorizeQuote(authorizeQuote); Assert.IsNull(quoteAuthorization); }
protected void Page_Load(object sender, EventArgs e) { m_refMsg = m_refSiteApi.EkMsgRef; ContentAPI capi = new ContentAPI(); // Register JS JS.RegisterJSInclude(this, JS.ManagedScript.EktronJS); JS.RegisterJSInclude(this, JS.ManagedScript.EktronTreeviewJS); }
public void ListLocalesTest() { ContentAPI client = ConstructServiceClient(); IEnumerable <Locale> locales = client.ListLocales(); Assert.IsNotNull(locales); Assert.AreNotEqual(0, locales.Count()); }
public void AccountInformationTest() { ContentAPI client = ConstructServiceClient(); AccountInformation account = client.GetAccountInformation(); Assert.IsNotNull(account); Assert.AreEqual <String>("*****@*****.**", account.Email); Assert.AreEqual <String>("USD", account.Currency); }
protected void Page_Load(object sender, EventArgs e) { contentAPI = new ContentAPI(); // The action parameter is really only relevent to sharepoint // distribution scenarios. (Community distribution does not // require any special revert functionality because nothing // is committed until the user clicks 'Done'.) string actionParam = Request.QueryString["action"]; bool revertAction = false; if (!String.IsNullOrEmpty(actionParam)) { if (actionParam.ToLower() == "cancel") { revertAction = true; } } DistributionWizardEnumerations.Mode distributionMode = DistributionWizardHelperMethods.GetModeFromQueryString(Request); switch (distributionMode) { case DistributionWizardEnumerations.Mode.CommunityCopy: case DistributionWizardEnumerations.Mode.CommunityRedistribute: case DistributionWizardEnumerations.Mode.CommunityReplace: case DistributionWizardEnumerations.Mode.None: Page.ClientScript.RegisterClientScriptBlock( this.GetType(), "CloseThickboxScript", "<script type=\"text/javascript\" language=\"javascript\">self.parent.ektb_remove();</script>"); break; case DistributionWizardEnumerations.Mode.Sharepoint: case DistributionWizardEnumerations.Mode.SharepointRedistribute: // In Sharepoint distribution scenarios, the file is uploaded // prior to applying metadata/taxonomy and creating the distribution // relationship. Therefore, if the action is canceled after folder selection // we must "undo" the upload -- either delete the copied file (initial distribution) // or revert to an older version (redistribution). if (revertAction) { RollbackSharepointDistribution(distributionMode); } // Add window close script to page. Page.ClientScript.RegisterClientScriptBlock( this.GetType(), "ClosePopupScript", "<script type=\"text/javascript\" language=\"javascript\">window.close();</script>"); break; } // Clear out any leftover session data ClearSessionData(); }
private void Page_Load(System.Object sender, System.EventArgs e) { try { m_refContentApi = new ContentAPI(); if (ContentBlock.EkItem != null) { if (ContentBlock.EkItem.Id > 0) { Page.Title = ContentBlock.EkItem.Title; lblLastModifiedBy.Text = string.Format("{0} {1}", ContentBlock.EkItem.LastEditorFname, ContentBlock.EkItem.LastEditorLname); lblLastModifiedBy.ToolTip = lblLastModifiedBy.Text; lblLastModifiedDate.Text = ContentBlock.EkItem.DateModified.ToString("MMM-dd-yyyy"); lblLastModifiedDate.ToolTip = lblLastModifiedDate.Text; if (((int)ContentBlock.EkItem.ContentType > EkConstants.ManagedAsset_Min && (int)ContentBlock.EkItem.ContentType < EkConstants.ManagedAsset_Max) || ((int)ContentBlock.EkItem.ContentType > EkConstants.Archive_ManagedAsset_Min && (int)ContentBlock.EkItem.ContentType < EkConstants.Archive_ManagedAsset_Max)) { DownloadAssetLink.Text = "<a style=\"text-decoration:none;\" href=\"" + m_refContentApi.SitePath + "assetmanagement/downloadasset.aspx?id=" + ContentBlock.EkItem.AssetInfo.Id + "&LangType=" + ContentBlock.EkItem.Language + "&version=" + ContentBlock.EkItem.AssetInfo.Version + "\"><img border=\"0\" src=\"" + m_refContentApi.ApplicationPath + "images/application/download.gif\" /></a>"; } else { DownloadAssetLink.Visible = false; } ContentList.ContentIds = ContentBlock.EkItem.Id.ToString(); if (!string.IsNullOrEmpty(ContentBlock.EkItem.AssetInfo.FileExtension)) { contentBody.Visible = false; } ContentBlock.Text = ContentBlock.Text.Replace("<p> </p>", ""); contentBody.Attributes.Add("style", "border-top: solid 1px #dddddd; margin-bottom: 30px; padding-top: 10px;"); } else { MessageBoard.Visible = false; SocialBar.Visible = false; ContentDetails.Visible = false; ContentList.Visible = false; DownloadAssetLink.Visible = false; ContentBlock.Text = "The requested content does not exist or has been deleted."; ContentBlock.ToolTip = ContentBlock.Text; contentBody.Attributes.Add("style", "margin-bottom: 30px; padding-top: 10px;"); } } } catch (Exception ex) { throw (new Exception(ex.Message)); } }
protected void Page_Load(object sender, EventArgs e) { contentAPI = new ContentAPI(); messageHelper = contentAPI.EkMsgRef; RegisterStylesheets(); if (ParseCommunityParameters()) { Community_DistributionWizard_DistributionWizard masterPage = (Community_DistributionWizard_DistributionWizard)Page.Master; long originalContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_ORIG_CONTENT_ID]; long destinationContentID = GetDestinationContentID(originalContentID); if (destinationContentID > 0) { // This content is already in a distribution relationship. // Display UI for redistribution mode. masterPage.WizardStepHeader = "Step 1"; masterPage.WizardStepTitle = "This item has a distribution relationship:"; // Display redistribution details try { ltrRedistributionDetails.Text = GetRedistributionDetails(destinationContentID); } catch { DisplayErrorMessage(messageHelper.GetMessage("distribution wizard required parameters")); } divRedistributionOptions.Visible = true; divDistributionOptions.Visible = false; Session[DistributionWizardConstants.SESSION_PARAM_DEST_CONTENT_ID] = destinationContentID; } else { // This content is not yet in a distribution relationship. // Display the UI for distribution mode. masterPage.WizardStepHeader = "Step 1"; masterPage.WizardStepTitle = "Choose one:"; divDistributionOptions.Visible = true; divRedistributionOptions.Visible = false; } } else { DisplayErrorMessage(messageHelper.GetMessage("distribution wizard required parameters")); } }
public void GetTermsAndConditionsTest() { ContentAPI client = ConstructServiceClient(); XDocument terms = client.GetTermsAndConditions(); Assert.IsNotNull(terms); Assert.IsNotNull(terms.Element("html")); Assert.IsNotNull(terms.Element("html").Element("head")); Assert.IsNotNull(terms.Element("html").Element("head")); }
public void AddCreditBalanceTest() { ContentAPI client = ConstructServiceClient(); AddCreditBalance acb = client.AddPrepaidBalance(1.01M, "USD"); Assert.AreEqual(1.01M, acb.Amount); Assert.AreEqual("USD", acb.Currency); Uri paymentURL = new Uri(@"https://developer-sandbox.liondemand.com/account/c6d694b5521b928283066e8cd8d42f/add_credit_balance/1.01/USD"); Assert.AreEqual(paymentURL, acb.PaymentURL); }
protected override void OnInit(EventArgs e) { _ContentApi = new ContentAPI(); _ApplicationPath = _ContentApi.ApplicationPath.TrimEnd(new char[] { '/' }); this.Context.Response.Charset = "utf-8"; this.Context.Response.ContentType = "application/javascript"; //set js server variables this.SetJsServerVariables(); base.OnInit(e); }
private void LoadFromFolder(object sender, EventArgs e) { this.Monitor.Log("Loading delegates", LogLevel.Info); this.modContent = this.modContent ?? new ContentManager(Game1.content.ServiceProvider, this.contentPath); // Get all xnbs that need delegates foreach (string mod in Directory.GetDirectories(Path.Combine(Helper.DirectoryPath, "Content"))) { ContentInjector injector = ContentAPI.GetInjector(this, Path.GetFileName(mod)); injector.RegisterDirectoryAssets(mod); } }
public void ListServicesTest() { ContentAPI client = ConstructServiceClient(); IEnumerable <Service> services = client.ListServices(); Assert.AreEqual(5, services.Count()); Assert.IsTrue(services.FirstOrDefault().Name == "Pseudo Translation"); Assert.IsFalse(services.ToArray()[1].Name == "Translation"); Assert.IsTrue(services.ToArray()[1].Name == "Machine Translation"); Assert.IsTrue(services.FirstOrDefault().ServiceID == 146); Assert.IsTrue(services.ToArray()[1].ServiceID == 144); }
protected void Page_Load(object sender, EventArgs e) { ContentAPI capi = new ContentAPI(); JS.RegisterJSInclude(this, JS.ManagedScript.EktronJS); JS.RegisterJSInclude(this, JS.ManagedScript.EktronTreeviewJS); JS.RegisterJSInclude(this, capi.SitePath + "widgets/MultivariateExperiment/controls/pagetree.js", "PageTreeJS"); Css.RegisterCss(this, capi.SitePath + "widgets/MultivariateExperiment/controls/treeview.css", "PageTreeCSS"); string handlerPath = capi.SitePath + "widgets/MultivariateExperiment/controls/pagetree.ashx"; JS.RegisterJSBlock(this,String.Format("Ektron.PageTree.Init(\"{0}\", \"{1}\", {2});", root.ClientID, handlerPath, _callback), root.ClientID + "JS"); }
public Community_PersonalTags() { m_refStyle = new StyleHelper(); m_mode = ""; m_userId = 0; m_id = 0; m_refUserApi = new UserAPI(); m_refCommonAPI = new CommonApi(); m_refContentApi = new ContentAPI(); m_refMsg = RefCommonAPI.EkMsgRef; Utilities.SetLanguage(m_refCommonAPI); }
private void Page_Load(object sender, System.EventArgs e) { _ContentApi = new ContentAPI(); _MessageHelper = _ContentApi.EkMsgRef; if (EkFunctions.UrlDecode(Request.RawUrl).ToLower().Contains("<script") | EkFunctions.UrlDecode(Request.RawUrl).ToLower().Contains("</script")) { Utilities.ShowError(_MessageHelper.GetMessage("invalid querstring")); return; } this.RegisterWorkareaCssLink(); this.RegisterDialogCssLink(); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronStringJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronXmlJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronSmartFormJS); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekxbrowser.js", "ekxbrowserJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekutil.js", "ekutilJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../RadWindow.js", "RadWindowJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "../ekformfields.js", "ekformfieldsJS"); Ektron.Cms.API.JS.RegisterJSInclude(this, "textfield.js", "textfieldJS"); this.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitializeRadWindow", "InitializeRadWindow();", true); chkPassword.Style.Add(HtmlTextWriterStyle.Display, "none"); this.Title.Text = this.GetMessage("lbl text field"); this.RadTabStrip1.Tabs[0].Text = this.GetMessage("tab general"); this.RadTabStrip1.Tabs[0].ToolTip = this.GetMessage("tab general") + " Tab"; this.RadTabStrip1.Tabs[1].Text = this.GetMessage("tab validation"); this.RadTabStrip1.Tabs[1].ToolTip = this.GetMessage("tab validation") + " Tab"; this.RadTabStrip1.Tabs[2].Text = this.GetMessage("tab data style"); this.RadTabStrip1.Tabs[2].ToolTip = this.GetMessage("tab data style") + " Tab"; this.RadTabStrip1.Tabs[3].Text = this.GetMessage("tab advanced"); this.RadTabStrip1.Tabs[3].ToolTip = this.GetMessage("tab advanced") + " Tab"; this.lblDefVal.InnerHtml = this.GetMessage("lbl default value c"); this.chkRichArea.Text = this.GetMessage("lbl allow rich formatting"); this.chkRichArea.ToolTip = this.GetMessage("lbl allow rich formatting"); this.chkKeepPTag.Text = this.GetMessage("lbl keep single blocking tag"); this.chkKeepPTag.ToolTip = this.GetMessage("lbl keep single blocking tag"); this.chkMultiline.Text = this.GetMessage("lbl allow mult lines"); this.chkMultiline.ToolTip = this.GetMessage("lbl allow mult lines"); this.chkReadOnly.Text = this.GetMessage("lbl cannot be changed"); this.chkReadOnly.ToolTip = this.GetMessage("lbl cannot be changed"); this.chkHidden.Text = this.GetMessage("lbl invisible"); this.chkHidden.ToolTip = this.GetMessage("lbl invisible"); this.lblOptions.InnerHtml = this.GetMessage("generic options"); this.sValue.Text = this.GetMessage("lbl value"); this.sInvalidDefVal.Text = this.GetMessage("lbl default value"); this.sWidth.Text = this.GetMessage("lbl imagetool resize width"); this.sHeight.Text = this.GetMessage("lbl imagetool resize height"); this.sSize.Text = this.GetMessage("lbl size colon"); }
public CouponBase() { _UserApi = new UserAPI(); _CouponApi = new CouponApi(); _ContentApi = new ContentAPI(); _SiteApi = new SiteAPI(); _CurrencyApi = new CurrencyApi(); m_refMsg = m_refContentApi.EkMsgRef; this.IsAdmin = _ContentApi.IsAdmin(); this.IsCommerceAdmin = _UserApi.EkUserRef.IsARoleMember_CommerceAdmin(); this.SitePath = _ContentApi.SitePath.TrimEnd(new char[] { '/' }); this.ApplicationPath = _SiteApi.ApplicationPath.TrimEnd(new char[] { '/' }); }
/// <summary> /// /// </summary> /// <returns></returns> private void CleanupQuoteSetup(ContentAPI client, Quote quote) { // Never fail (future implementation of ListQuotes will help this) try { RejectQuoteStatus result = client.RejectQuote(quote.QuoteID); // Unit test breakpoint line if (result == RejectQuoteStatus.Success) { result = RejectQuoteStatus.Success; } } catch { } }
private void Page_Load(System.Object sender, System.EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; if (m_refContentApi == null) { m_refContentApi = new ContentAPI(); } m_refMsgApi = m_refContentApi.EkMsgRef; if (IsInCallbackMode()) { return; } }
public reports() { //initialize members _ContentApi = new ContentAPI(); _StyleHelper = new StyleHelper(); _HasData = false; _ContentLanguage = -1; _EnableMultilingual = 0; _ContentTypeSelected = Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes.ToString(); _SiteActivityDataSource = new System.Data.DataView(); _IsSubFolderIncluded = false; _ContentType2 = 0; _FilterId = 0; _MessageHelper = _ContentApi.EkMsgRef; }
public DatePicker() { _refContentApi = new ContentAPI(); _refSiteApi = new SiteAPI(); if (_refContentApi.UserId > 0) { _cult = new System.Globalization.CultureInfo(_refContentApi.UserLanguage); } else { _cult = new System.Globalization.CultureInfo(_refContentApi.RequestInformationRef.DefaultContentLanguage); } LabelText = GetMessage("generic date label"); BadDateFormatMessage = GetMessage("msg bad date format"); }
public void CreateAccountConstructorTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "US"; String vatID = "12334455544"; Account account = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); CreateAccountCommonAsserts(account, merchantID, email, firstName, lastName, company, country); }
//[ExpectedException(typeof(OnDemandClientException))] public void CreateAccountIENoVatIDTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "IE"; String vatID = ""; // This request should throw an exception because VAT ID's are required in Ireland (IE) Account account = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); CreateAccountCommonAsserts(account, merchantID, email, firstName, lastName, company, country); }
public void GetFileTranslationUnknownTest() { String assetID = "0"; String languageCode = "en-us"; ContentAPI client = ConstructServiceClient(); try { Byte[] content = client.GetFileTranslation(assetID, languageCode); Assert.Fail("A file with an invalid Asset ID should not have been retrieved."); } catch (OnDemandClientException odce) { Assert.AreEqual <HttpStatusCode>(HttpStatusCode.NotFound, odce.HttpStatusCode); Assert.AreEqual <Int32>(0, odce.ReasonCode); Assert.IsNotNull(odce.SimpleMessage); } }
public void AuthorizationTest() { ContentAPI client = new ContentAPI(keyId: "aZqpaIZkYRfPFrtUWiyq", secretKey: "", endpoint: new Uri("https://developer-sandbox.liondemand.com")); try { XDocument terms = client.GetTermsAndConditions(); Assert.Fail("A request without a secret key should not be sucessful."); } catch (OnDemandClientException odce) { Assert.AreEqual <HttpStatusCode>(HttpStatusCode.Unauthorized, odce.HttpStatusCode); Assert.AreEqual <Int32>(0, odce.ReasonCode); Assert.IsNotNull(odce.SimpleMessage); Assert.IsNotNull(odce.DetailedMessage); throw; } }
public string GetContent(string ContentReference) { var api = new ContentAPI(); return(api.GetContent <GenericContent>(ContentReference)); }
public string CreateContent(string type, string ParentRef, ImageFile asset) { var api = new ContentAPI(); return(api.CreateContent(type, ParentRef, asset)); }
public override void Entry(IModHelper helper) { config = helper.ReadConfig <ModConfig>(); if (!config.ModEnabled) { return; } this.contentPath = Path.Combine(this.Helper.DirectoryPath, "Content"); if (!Directory.Exists(this.contentPath)) { try { this.Monitor.Log($"Creating directory {this.contentPath}"); Directory.CreateDirectory(this.contentPath); } catch (Exception ex) { this.Monitor.Log($"Could not create directory {this.contentPath}! Please create it yourself.", LogLevel.Error); this.Monitor.Log(ex.Message, LogLevel.Error); return; } } this.itemLoader = new ItemLoader(); this.merger = new ContentMerger(); GameEvents.UpdateTick += UpdateTick; LocationEvents.CurrentLocationChanged += CurrentLocationChanged; GraphicsEvents.OnPreRenderEvent += OnPreRenderEvent; GameEvents.LoadContent += LoadFromFolder; ItemCustom custom = new ItemCustom("SCCL.custom"); ControlEvents.KeyPressed += (sender, e) => { switch (e.KeyPressed) { case Microsoft.Xna.Framework.Input.Keys.R: Game1.player.addItemToInventory(new ModObject(custom)); break; case Microsoft.Xna.Framework.Input.Keys.T: itemLoader.Save(); break; case Microsoft.Xna.Framework.Input.Keys.Y: itemLoader.Load(); break; } }; #region Console Commands Helper.ConsoleCommands.Add("SCCLEnable", "Enables a content injector | SCCLEnable <injector>", (cmd, args) => { if (args.Length >= 1) { string name = args[0]; if (ContentAPI.InjectorExists(name)) { ContentAPI.GetInjector(this, name).Enabled = true; Monitor.Log(name + " is enabled", LogLevel.Info); } else { Monitor.Log("No injector with name '" + name + "' exists!", LogLevel.Warn); } } else { Monitor.Log("Injector name was not specified", LogLevel.Warn); } }); Helper.ConsoleCommands.Add("SCCLDisable", "Disables a content injector | SCCLEnable <injector>", (cmd, args) => { if (args.Length >= 1) { string name = args[0]; if (ContentAPI.InjectorExists(name)) { ContentAPI.GetInjector(this, name).Enabled = false; Monitor.Log(name + " is disabled", LogLevel.Info); } else { Monitor.Log("No injector with name '" + name + "' exists!", LogLevel.Warn); } } else { Monitor.Log("Injector name was not specified", LogLevel.Warn); } }); Helper.ConsoleCommands.Add("SCCLList", "Lists all content injectors | SCCLList", (cmd, args) => { this.Monitor.Log("Registered injectors: " + string.Join(", ", ContentAPI.GetAllInjectors()), LogLevel.Info); }); Helper.ConsoleCommands.Add("SCCLReload", "Reloads the config (ModEnabled is ignored) | SCCLReload", (cmd, args) => { this.config = this.Helper.ReadConfig <ModConfig>(); // TODO: remove all previously loaded assets this.LoadFromFolder(this, new EventArgs()); }); #endregion }
public IEnumerable <IDictionary <string, object> > GetChildContent(string parentRef) { var api = new ContentAPI(); return(api.GetChildContent(parentRef)); }
public void GetProjectsTest() { ContentAPI client = ConstructServiceClient(); Project project = client.GetProject(10001); }
public string CreateContent <T>(T item) where T : GenericContent { var api = new ContentAPI(); return(api.CreateContent(item)); }
public string GetContentTypeForExtension(string ext) { var api = new ContentAPI(); return(api.GetContentTypeForExtension(ext)); }