private void SetProductType(ProductTypeData productTypeData) { if (productTypeData == null) { throw new ArgumentNullException(nameof(productTypeData)); } ProductType = new ProductType(productTypeData); }
// Save product type public ActionResult Update(string Name) { if (!string.IsNullOrEmpty(Name)) { ProductTypeData.Update(Name); } return(RedirectToAction("Show")); }
public ProductType(ProductTypeData productTypeData) { ProductTypeKey = productTypeData.ProductTypeKey; ProductTypeCategory = productTypeData.ProductTypeCategory; ProductTypeCode = productTypeData.ProductTypeCode; ProductTypeName = productTypeData.ProductTypeName; ProductTypeDesc = productTypeData.ProductTypeDesc; AddedUserID = productTypeData.AuditAddUserId; AddedDateTime = productTypeData.AuditAddDatetime; UpdateUserID = productTypeData.AuditUpdateUserId; UpdateDateTime = productTypeData.AuditUpdateDatetime; }
} // Map function closer public List <SqlParameter> MapParamsForUpsert(ProductTypeData entity) { var sql_params = new List <SqlParameter>(); sql_params.Add(new SqlParameter("@product_type_key", entity.ProductTypeKey)); sql_params.Add(new SqlParameter("@product_type_category", entity.ProductTypeCategory)); sql_params.Add(new SqlParameter("@product_type_code", entity.ProductTypeCode)); sql_params.Add(new SqlParameter("@product_type_name", entity.ProductTypeName)); sql_params.Add(new SqlParameter("@product_type_desc", entity.ProductTypeDesc)); sql_params.Add(GetOutParam()); return(sql_params); }
public ProductType(ProductTypeData productTypeData) { if (productTypeData == null) { throw new ArgumentNullException(nameof(productTypeData)); } ProductTypeId = productTypeData.ProductTypeId; ProductTypeCode = productTypeData.ProductTypeCode; ProductTypeCategory = productTypeData.ProductTypeCategory; ProductTypeName = productTypeData.ProductTypeName; ProductTypeDesc = productTypeData.ProductTypeDesc; }
/// <summary> /// 加载json数组对象 /// </summary> /// <returns></returns> public ActionResult LoadProductTypejson() { int row = int.Parse(Request["rows"].ToString()); int pageindex = int.Parse(Request["page"].ToString()); ProductTypeData ProductTypejson = new ProductTypeData(); int total; ProductTypejson.rows = productTypeBLL.GetProductTypesList(pageindex, row, out total); ProductTypejson.total = total; JavaScriptSerializer json = new JavaScriptSerializer(); string Str = json.Serialize(ProductTypejson);// return(Content(Str, "text/html;charset=UTF-8")); }
public ProductType Map(ProductTypeData product_type_data) { return(new ProductType() { ProductTypeKey = product_type_data.ProductTypeKey, ProductTypeCategory = product_type_data.ProductTypeCategory, ProductTypeCode = product_type_data.ProductTypeCode, ProductTypeName = product_type_data.ProductTypeName, ProductTypeDesc = product_type_data.ProductTypeDesc, AddedUserID = product_type_data.AuditAddUserId, AddedDateTime = product_type_data.AuditAddDatetime, UpdateUserID = product_type_data.AuditUpdateUserId, UpdateDateTime = product_type_data.AuditUpdateDatetime }); }
/// <summary> /// 搜索产品类型 /// </summary> /// <param name="collection"></param> /// <returns></returns> public ActionResult SeachProductTypeInfo(FormCollection collection) { String Name = collection.Get("Name").Trim().ToString();//上下两种方法都可以获取数据 int row = int.Parse(Request["rows"].ToString()); int pageindex = int.Parse(Request["page"].ToString()); ProductTypeData ProductTypejson = new ProductTypeData(); int total; ProductTypejson.rows = productTypeBLL.GetProductTypesBySerach(pageindex, row, out total, Name); ProductTypejson.total = total; JavaScriptSerializer json = new JavaScriptSerializer(); string Str = json.Serialize(ProductTypejson);// return(Content(Str, "text/html;charset=UTF-8")); }
public void ProductTypeModelTest1() { var data = new ProductTypeData { ProductTypeKey = 1, ProductTypeCategory = "TEST", ProductTypeCode = "TEST", ProductTypeName = "TEST", ProductTypeDesc = "TEST", AuditAddUserId = "TEST", AuditAddDatetime = new System.DateTime(2018, 1, 1), AuditUpdateUserId = "TEST", AuditUpdateDatetime = new System.DateTime(2018, 1, 1), }; //var sut = new ProductType(data); //Assert.True(sut.ProductTypeKey == 1); //Assert.True(sut.ProductTypeCategory == "TEST"); //Assert.True(sut.ProductTypeCode == "TEST"); //Assert.True(sut.ProductTypeName == "TEST"); //Assert.True(sut.ProductTypeDesc == "TEST"); }
public static void Main() { var host = CreateHostBuilder(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; var context = services.GetRequiredService <WebAppDBContext>(); AccountData.Initialize(context); AdminData.Initialize(context); FunctionData.Initialize(context); ProductData.Initialize(context); ProductTypeData.Initialize(context); SaleData.Initialize(context); RegionData.Initialize(context); ProvinceData.Initialize(context); WardData.Initialize(context); AuthorData.Initialize(context); } host.Run(); }
public ProductType Map(ProductTypeData ent) { return(new ProductType(ent)); }
protected void Page_Load(object sender, System.EventArgs e) { try { _ImageId = long.Parse(Request.QueryString["imageId"]); _ProductTypeData = _ProductType.GetItem(long.Parse(Request.QueryString["productTypeId"])); LibraryData imageData = _ContentApi.GetLibraryItemByID_UnAuth(_ImageId); FolderData folderData = _ContentApi.GetFolderById(imageData.ParentId); if (folderData.PrivateContent == false) { string uploadImagePath = _ContentApi.GetPathByFolderID(_ProductData.Id); //Dim sPhysicalPath As String = Server.MapPath(sWebPath) string sFileName = imageData.FileName.Substring(System.Convert.ToInt32(imageData.FileName.LastIndexOf("/") + 1), System.Convert.ToInt32((imageData.FileName.Length - 1) - imageData.FileName.LastIndexOf("/"))); string sWebPath = imageData.FileName.Replace(sFileName, string.Empty); sWebPath = sWebPath.Replace("//", "/"); string sPhysicalPath = Server.MapPath(imageData.FileName.Replace(sFileName, "")); //Begins: Generate thumbnails. Generates thumbnails for various pixes sizes. if (_ProductTypeData.DefaultThumbnails.Count > 0) { EkFileIO thumbnailCreator = new EkFileIO(); bool thumbnailResult = false; //Dim sourceFile As String = Server.MapPath(_LibraryConfigData.ImageDirectory) & sFileName string sourceFile = Server.MapPath(imageData.FileName); foreach (ThumbnailDefaultData thumbnail in _ProductTypeData.DefaultThumbnails) { string fileNameNoExtension = sFileName.Replace(System.IO.Path.GetExtension(sFileName), ""); string fileNameExtension = System.IO.Path.GetExtension(sFileName); string thumbnailFile = sPhysicalPath + "\\" + "thumb_" + fileNameNoExtension + thumbnail.Title.Replace("[filename]", "") + fileNameExtension; thumbnailResult = thumbnailCreator.CreateThumbnail(sourceFile, thumbnailFile, thumbnail.Width, thumbnail.Height); //766 load balancing handled by service - no code needed for load balancing _Thumbnails.Add(new ThumbnailData((string) ("thumb_" + fileNameNoExtension + thumbnail.Title.Replace("[filename]", "") + fileNameExtension), (string) (sWebPath.TrimEnd("/".ToCharArray()) + "/"), fileNameNoExtension + thumbnail.Title.Replace("[filename]", "") + fileNameExtension, fileNameNoExtension + thumbnail.Title.Replace("[filename]", "") + fileNameExtension)); } } //Ends : Generate Thumbnails. System.Drawing.Bitmap libraryImage; string libraryPhysicalPath = Server.MapPath(_LibraryConfigData.ImageDirectory); libraryImage = new System.Drawing.Bitmap(Server.MapPath(imageData.FileName)); // Add media image this.litAddMediaJS.Text += "<script type=\"text/javascript\">" + Environment.NewLine; this.litAddMediaJS.Text += " var newImageObj = {" + Environment.NewLine; this.litAddMediaJS.Text += " id: \"" + imageData.Id.ToString() + "\"," + Environment.NewLine; this.litAddMediaJS.Text += " title: \"" + imageData.Title + "\"," + Environment.NewLine; this.litAddMediaJS.Text += " altText: \"" + imageData.Title + "\"," + Environment.NewLine; this.litAddMediaJS.Text += " path: \"" + imageData.FileName.Replace("//", "/") + "\"," + Environment.NewLine; this.litAddMediaJS.Text += " width:" + libraryImage.Width + "," + Environment.NewLine; this.litAddMediaJS.Text += " height:" + libraryImage.Height; int i = 0; if (_Thumbnails.Count > 0) { string sourceFile = sPhysicalPath + sFileName; this.litAddMediaJS.Text += "," + Environment.NewLine; this.litAddMediaJS.Text += " Thumbnails: [" + Environment.NewLine; for (i = 0; i <= _Thumbnails.Count - 1; i++) { this.litAddMediaJS.Text += " {"; this.litAddMediaJS.Text += " title: \"" + _Thumbnails[i].Title + "\"," + Environment.NewLine; this.litAddMediaJS.Text += " imageName: \"" + _Thumbnails[i].ImageName + "\"," + Environment.NewLine; this.litAddMediaJS.Text += " path: \"" + _Thumbnails[i].Path + "\"" + Environment.NewLine; this.litAddMediaJS.Text += " }"; if (i != _Thumbnails.Count - 1) { this.litAddMediaJS.Text += "," + Environment.NewLine; } } this.litAddMediaJS.Text += Environment.NewLine + "] " + Environment.NewLine; } this.litAddMediaJS.Text += "}" + Environment.NewLine; this.litAddMediaJS.Text += "parent.CommerceMediaTabAddLibraryImage(newImageObj);"; this.litAddMediaJS.Text += "</script>"; } else { this.litAddMediaJS.Text += "<script type=\"text/javascript\">" + Environment.NewLine; this.litAddMediaJS.Text += "alert(\'Images in this folder are private and cannot be added to a catalog\');"; this.litAddMediaJS.Text += "</script>"; } } catch (Exception ex) { string reason = ex.Message; } }
public List <SqlParameter> MapParamsForDelete(ProductTypeData entity) { return(MapParamsForDelete(entity.ProductTypeKey)); }
protected void Page_Init(object sender, System.EventArgs e) { _MessageHelper = _ContentApi.EkMsgRef; _ProductType = new ProductType(_ContentApi.RequestInformationRef); Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; if (! Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(_ContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce)) { Utilities.ShowError(_ContentApi.EkMsgRef.GetMessage("feature locked error")); } if (!string.IsNullOrEmpty(Request.QueryString["productTypeId"])) { _Id = Convert.ToInt64(Request.QueryString["productTypeId"]); } lib_settings_data = this._ContentApi.GetLibrarySettings(0); SetLocalizedStrings(); btnUpload.Attributes.Add("onclick", "return checkForEmptyTitleAndAlt(); return checkntoggle(document.getElementById(\'dvHoldMessage\'),document.getElementById(\'dvErrorMessage\'));"); btnUpload.Text = this.GetMessage("upload txt"); _ProductTypeData = _ProductType.GetItem(_Id); }
protected void Display_ViewProductType() { _ProductType = new ProductType(m_refContentApi.RequestInformationRef); _ProductTypeData = _ProductType.GetItem(m_iID, true); _IsUsed = _ProductType.IsProductTypeUsed(m_iID); tr_id.Visible = true; txt_id.Text = _ProductTypeData.Id.ToString(); phAddEdit.Visible = false; phView.Visible = true; phTabAttributes.Visible = true; phTabMediaDefaults.Visible = true; txtTitle.Attributes.Add("onkeypress", "return " + JSLibrary.CheckKeyValueName+ "(event, \'34,13\');"); txtDescription.Attributes.Add("onkeypress", "return " + JSLibrary.CheckKeyValueName+ "(event, \'34,13\');"); XmlConfigData xml_config_data; xml_config_data = m_refContentApi.GetXmlConfiguration(m_iID); PopulatePropertiesGrid(xml_config_data, Convert.ToInt64(_ProductTypeData.EntryClass), _ProductTypeData.SubscriptionProvider); PopulateDisplayGrid(xml_config_data); if (xml_config_data.PackageDisplayXslt.Length > 0) { PopulatePreviewGrid(xml_config_data); phPreview.Visible = true; phTabPreview.Visible = true; } else { phTabPreview.Visible = false; phPreview.Visible = false; } Util_PopulateData(); Util_XSLTLinks(); Util_AddProductTypeItems(_ProductTypeData.EntryClass); Util_SetJs(); Util_SetLabels(); }
protected void Display_AddThumbnail() { phAddThumbnail.Visible = true; _ProductType = new ProductType(m_refContentApi.RequestInformationRef); if (this.m_iID > 0) { _ProductTypeData = _ProductType.GetItem(m_iID, true); } Util_SetJs(); Util_SetLabels(); }
public void Process_EditProductType() { try { _ProductType = new ProductType(m_refContentApi.RequestInformationRef); _ProductTypeData = _ProductType.GetItem(m_iID, true); _ProductTypeData.Title = (string) txtTitle.Text; _ProductTypeData.Description = (string) txtDescription.Text; _ProductTypeData.DefaultXslt = (string) (Request.Form["frm_xsltdefault"].Replace("frm_xsltdefault", "")); _ProductTypeData.Xslt1 = (string) txt_xslt1.Text; _ProductTypeData.Xslt2 = (string) txt_xslt2.Text; _ProductTypeData.Xslt3 = (string) txt_xslt3.Text; _ProductTypeData.PhysicalPath = Server.MapPath(m_refContentApi.XmlPath); _ProductTypeData.Attributes = Process_GetAttributes(); _ProductTypeData.DefaultThumbnails = Process_GetThumbnails(); if (_ProductTypeData.EntryClass == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct) { _ProductTypeData.SubscriptionProvider = Request.Form["drp_SubscriptionProvider"]; } _ProductType.Update(_ProductTypeData); Response.Redirect(_PageName + "?action=viewproducttype&id=" + m_iID, false); } catch (Ektron.Cms.Exceptions.SpecialCharactersException) { trError.Visible = true; litErrorMessage.Text = string.Format(GetMessage("js alert product type title cant include"), EkFunctions.HtmlEncode("<,>")); Display_EditProductType(); } catch (Exception ex) { trError.Visible = true; litErrorMessage.Text = ex.Message.ToString(); Display_EditProductType(); // Utilities.ShowError() } }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce)) { Utilities.ShowError(m_refContentApi.EkMsgRef.GetMessage("feature locked error")); } lib_settings_data = this.m_refContentApi.GetLibrarySettings(iboardid); if (!Page.IsPostBack) { CheckAccess(); productType = productTypeManager.GetItem(m_iID); lblTitle.InnerText = m_refMsg.GetMessage("generic title label"); lblaltTitle.InnerText = m_refMsg.GetMessage("alt text"); lblFullSize.InnerText = m_refMsg.GetMessage("lbl full size"); if (productType.DefaultThumbnails.Count > 0) { ltr_pixel.Text = "<br /><table><tr><td>" + m_refMsg.GetMessage("lbl thumbnail spec") + "</td></tr>"; foreach (ThumbnailDefaultData thumbnail in productType.DefaultThumbnails) { ltr_pixel.Text += "<tr><td> " + thumbnail.Width.ToString() + " x " + thumbnail.Height.ToString() + " px</td></tr>"; } ltr_pixel.Text += "</table>"; } btnUpload.Attributes.Add("onclick", " return checkForEmptyTitleAndAlt(); return IsExtensionValid(); return checkntoggle(document.getElementById(\'dvHoldMessage\'),document.getElementById(\'dvErrorMessage\'));"); btnUpload.Text = m_refMsg.GetMessage("upload txt"); } GenerateJS(); }
protected void btnUpload_Click(object sender, System.EventArgs e) { string parentId = ""; if ((Request.QueryString["catalogid"] != null) && Request.QueryString["catalogid"] != "") { parentId = Request.QueryString["catalogid"]; } CheckAccess(); try { if (!(ul_image.PostedFile == null)) { productType = productTypeManager.GetItem(m_iID); int iFolder = iboardid; //lib_settings_data = Me.m_refContentApi.GetLibrarySettings(iFolder) // file was sent HttpPostedFile myFile = ul_image.PostedFile; string sFileExt = ""; // Get and check size of uploaded file int nFileLen = myFile.ContentLength; //If nFileLen > _board.MaxFileSize Then // Throw New Exception("File is too large. There is a " & _board.MaxFileSize.ToString() & " byte limit.") //End If //get and check name and extension string sFileName = myFile.FileName; string sShortName = ""; if (myFile.FileName.IndexOf("\\") > -1) { string[] aFilename = myFile.FileName.Split('\\'); // take the very last one if (aFilename.Length > 0) { sFileName = aFilename[aFilename.Length - 1]; } } sFileName = sFileName.Replace(" ", "_").Replace("\'", ""); // make safe string[] aFileExt = sFileName.Split('.'); if (aFileExt.Length > 1) { sFileExt = (string)(aFileExt[(aFileExt.Length - 1)].Trim().ToLower()); //use the LAASSTT one. if (sFileExt == "tif" || sFileExt == "bmp") { throw (new Exception("The extension \"" + sFileExt + "\" is not allowed.")); } sShortName = sFileName.Substring(0, System.Convert.ToInt32(sFileName.Length - (sFileExt.Length + 1))); } else { throw (new Exception("The extension \"" + sFileExt + "\" is not allowed.")); } //aFileExt = Split(_board.AcceptedExtensions, ",") if (aFileExt.Length > 0) { bool bGo = false; for (int i = 0; i <= (aFileExt.Length - 1); i++) { if (sFileExt == aFileExt[i].Trim().ToLower()) { bGo = true; break; } } if (bGo == false) { throw (new Exception("The extension \"" + sFileExt + "\" is not allowed.")); } } else { throw (new Exception("The extension \"" + sFileExt + "\" is not allowed.")); } // Allocate a buffer for reading of the file byte[] myData = new byte[nFileLen + 1]; // Read uploaded file from the Stream myFile.InputStream.Read(myData, 0, nFileLen); //check for existence of file. FileInfo CheckFile; int iUnqueNameIdentifier = 0; string uploadImagePath = m_refContentApi.GetPathByFolderID(Convert.ToInt64(parentId)); string sWebPath = lib_settings_data.ImageDirectory + uploadImagePath.Replace(" ", "_").Replace(".", ""); string sPhysicalPath = Server.MapPath(sWebPath); CheckFile = new FileInfo(sPhysicalPath + "\\" + sFileName); if (CheckFile.Exists) { while (CheckFile.Exists) { iUnqueNameIdentifier++; sFileName = sShortName + "(" + iUnqueNameIdentifier + ")." + sFileExt; CheckFile = new FileInfo(sPhysicalPath + sFileName); } } //write WriteToFile(sPhysicalPath + "\\" + sFileName, myData); //----------------- Load Balance ------------------------------------------------------ LoadBalanceData[] loadbalance_data; loadbalance_data = base.m_refContentApi.GetAllLoadBalancePathsExtn(iFolder, "files"); if (!(loadbalance_data == null)) { for (int j = 0; j <= loadbalance_data.Length - 1; j++) { sPhysicalPath = Server.MapPath(loadbalance_data[j].Path); if ((sPhysicalPath.Substring(sPhysicalPath.Length - 1, 1) != "\\")) { sPhysicalPath = sPhysicalPath + "\\"; } WriteToFile(sPhysicalPath + "\\" + sFileName, myData); } } //Begins: Generate thumbnails. Generates thumbnails for various pixes sizes. if (productType.DefaultThumbnails.Count > 0) { foreach (ThumbnailDefaultData thumbnail in productType.DefaultThumbnails) { Utilities.ProcessThumbnail(sPhysicalPath, sFileName, thumbnail.Width, thumbnail.Height, thumbnail.Width); // Utilities.ProcessThumbnail(sPhysicalPath, thumbnail.FileNameFormat.Replace("[filename]", sFileName), thumbnail.Width, thumbnail.Height, thumbnail.Width) } } //Ends : Generate Thumbnails. //upload this file to library. LibraryData librarydata = new LibraryData(); long libraryId = 0; librarydata.FileName = (string)((sWebPath.Replace("/\\", "\\") + "\\" + sFileName).Replace(" ", "_")); librarydata.Type = "images"; if (txtTitle.Value == "") { librarydata.Title = sShortName; } else { librarydata.Title = (string)txtTitle.Value; } librarydata.ParentId = Convert.ToInt64(parentId); libraryId = m_refContentApi.AddLibraryItem(ref librarydata); LibraryData retLibraryData = m_refContentApi.GetLibraryItemByID(libraryId, Convert.ToInt64(parentId)); //Uploading image to libray ends. System.Drawing.Bitmap imageUpload; imageUpload = new System.Drawing.Bitmap(sPhysicalPath + "\\" + sFileName); // Add media image ltrAddMediaJS.Text += "var newImageObj = {"; ltrAddMediaJS.Text += " id: \"" + libraryId.ToString() + "\", " + Environment.NewLine; ltrAddMediaJS.Text += " title: \"" + retLibraryData.Title + "\", " + Environment.NewLine; ltrAddMediaJS.Text += " altText: \"" + altTitle.Value + "\", " + Environment.NewLine; ltrAddMediaJS.Text += " path: \"" + retLibraryData.FileName + "\", " + Environment.NewLine; ltrAddMediaJS.Text += " width:" + imageUpload.Width + "," + Environment.NewLine; ltrAddMediaJS.Text += " height:" + imageUpload.Height + "," + Environment.NewLine; ltrAddMediaJS.Text += " Thumbnails: [" + Environment.NewLine; int iThumbnail = 0; for (iThumbnail = 0; iThumbnail <= productType.DefaultThumbnails.Count - 1; iThumbnail++) { int indexThumbnail = retLibraryData.FileName.LastIndexOf("/"); string thumbnailpath = retLibraryData.FileName.Substring(0, indexThumbnail + 1); ltrAddMediaJS.Text += " {path: \"" + thumbnailpath + "thumb" + productType.DefaultThumbnails[iThumbnail].Width + "_" + sFileName + "\"}," + Environment.NewLine; } ltrAddMediaJS.Text += " ] " + Environment.NewLine; ltrAddMediaJS.Text += " }; " + Environment.NewLine; ltrAddMediaJS.Text += "parent.Ektron.Commerce.MediaTab.Images.addNewImage(newImageObj);"; } else { throw (new Exception("No File")); } } catch (Exception ex) { ltr_error.Text = ex.Message; ltr_bottomjs.Text += " justtoggle(document.getElementById(\'dvErrorMessage\'), true);" + Environment.NewLine; bError = true; } }
private void Display_ViewContent() { m_refMsg = m_refContentApi.EkMsgRef; bool bCanAlias = false; PermissionData security_task_data; StringBuilder sSummaryText; Ektron.Cms.UrlAliasing.UrlAliasManualApi m_aliasname = new Ektron.Cms.UrlAliasing.UrlAliasManualApi(); Ektron.Cms.UrlAliasing.UrlAliasAutoApi m_autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi(); Ektron.Cms.Common.UrlAliasManualData d_alias; System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData> auto_aliaslist = new System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData>(); Ektron.Cms.UrlAliasing.UrlAliasSettingsApi m_urlAliasSettings = new Ektron.Cms.UrlAliasing.UrlAliasSettingsApi(); int i; bool IsStagingServer; IsStagingServer = m_refContentApi.RequestInformationRef.IsStaging; security_task_data = m_refContentApi.LoadPermissions(m_intId, "tasks", ContentAPI.PermissionResultType.Task); security_data = m_refContentApi.LoadPermissions(m_intId, "content", ContentAPI.PermissionResultType.All); security_data.CanAddTask = security_task_data.CanAddTask; security_data.CanDestructTask = security_task_data.CanDestructTask; security_data.CanRedirectTask = security_task_data.CanRedirectTask; security_data.CanDeleteTask = security_task_data.CanDeleteTask; active_subscription_list = m_refContentApi.GetAllActiveSubscriptions(); if ("viewstaged" == m_strPageAction) { ContentStateData objContentState; objContentState = m_refContentApi.GetContentState(m_intId); if ("A" == objContentState.Status) { // Can't view staged m_strPageAction = "view"; } } try { if (m_strPageAction == "view") { content_data = m_refContentApi.GetContentById(m_intId, 0); } else if (m_strPageAction == "viewstaged") { content_data = m_refContentApi.GetContentById(m_intId, ContentAPI.ContentResultType.Staged); } } catch (Exception ex) { Response.Redirect("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message), true); return; } if ((content_data != null) && (Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64 (content_data.Type), Convert.ToBoolean (-1)))) { ContentPaneHeight = "700px"; } //ekrw = m_refContentApi.EkUrlRewriteRef() //ekrw.Load() if (((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) && (content_data != null) && (content_data.AssetData != null) && !(Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension)))) { bCanAlias = true; } blog_post_data = new BlogPostData(); blog_post_data.Categories = (string[])Array.CreateInstance(typeof(string), 0); if (content_data.MetaData != null) { for (i = 0; i <= (content_data.MetaData.Length - 1); i++) { if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog categories") { content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("'", "\'"); content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace(""", "\""); content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace(">", ">"); content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("<", "<"); blog_post_data.Categories = Strings.Split((string)(content_data.MetaData[i].Text), ";", -1, 0); } else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog pingback") { if (!(content_data.MetaData[i].Text.Trim().ToLower() == "no")) { m_bIsBlog = true; } blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo((string)(content_data.MetaData[i].Text)); } else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog tags") { blog_post_data.Tags = (string)(content_data.MetaData[i].Text); } else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog trackback") { blog_post_data.TrackBackURL = (string)(content_data.MetaData[i].Text); } } } //THE FOLLOWING LINES ADDED DUE TO TASK //:BEGIN / PROPOSED BY PAT //TODO: Need to recheck this part of the code e.r. if (content_data == null) { if (ContentLanguage != 0) { if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"])) { Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Strings.Replace(Request.ServerVariables["Query_String"], (string)("LangType=" + ContentLanguage), (string)("LangType=" + m_refContentApi.DefaultContentLanguage), 1, -1, 0)), false); return; } } else { if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"])) { Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Request.ServerVariables["Query_String"] + "&LangType=" + m_refContentApi.DefaultContentLanguage), false); return; } } } //:END if (m_intFolderId == -1) { m_intFolderId = content_data.FolderId; } HoldMomentMsg.Text = m_refMsg.GetMessage("one moment msg"); if ((active_subscription_list == null) || (active_subscription_list.Length == 0)) { phWebAlerts.Visible = false; phWebAlerts2.Visible = false; } content_state_data = m_refContentApi.GetContentState(m_intId); jsFolderId.Text = m_intFolderId.ToString (); jsIsForm.Text = content_data.Type.ToString (); jsBackStr.Text = "back_file=content.aspx"; if (m_strPageAction.Length > 0) { jsBackStr.Text += "&back_action=" + m_strPageAction; } if (Convert.ToString(m_intFolderId).Length > 0) { jsBackStr.Text += "&back_folder_id=" + m_intFolderId; } if (Convert.ToString(m_intId).Length > 0) { jsBackStr.Text += "&back_id=" + m_intId; } if (Convert.ToString((short)ContentLanguage).Length > 0) { jsBackStr.Text += "&back_LangType=" + ContentLanguage; } jsToolId.Text = m_intId.ToString (); jsToolAction.Text = m_strPageAction; jsLangId.Text = m_refContentApi.ContentLanguage.ToString (); if (content_data.Type == 3333) { ViewCatalogToolBar(); } else { ViewToolBar(); } if (bCanAlias && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And folder_data.FolderType <> 1 Don't Show alias tab for Blogs. { string m_strAliasPageName = ""; d_alias = m_aliasname.GetDefaultAlias(content_data.Id); if (d_alias.QueryString != "") { m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension + d_alias.QueryString; //content_data.ManualAlias } else { m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension; //content_data.ManualAlias } if (m_strAliasPageName != "") { if (IsStagingServer && folder_data.DomainStaging != string.Empty) { m_strAliasPageName = (string)("http://" + folder_data.DomainStaging + "/" + m_strAliasPageName); } else if (folder_data.IsDomainFolder) { m_strAliasPageName = (string)("http://" + folder_data.DomainProduction + "/" + m_strAliasPageName); } else { m_strAliasPageName = SitePath + m_strAliasPageName; } m_strAliasPageName = "<a href=\"" + m_strAliasPageName + "\" target=\"_blank\" >" + m_strAliasPageName + "</a>"; } else { m_strAliasPageName = " [Not Defined]"; } tdAliasPageName.InnerHtml = m_strAliasPageName; } else { phAliases.Visible = false; phAliases2.Visible = false; } auto_aliaslist = m_autoaliasApi.GetListForContent(content_data.Id); autoAliasList.InnerHtml = "<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl automatic") + "</div>"; autoAliasList.InnerHtml += "<div class=\"ektronBorder\">"; autoAliasList.InnerHtml += "<table width=\"100%\">"; autoAliasList.InnerHtml += "<tr class=\"title-header\">"; autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("generic type") + "</th>"; autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("lbl alias name") + "</th>"; autoAliasList.InnerHtml += "</tr>"; for (i = 0; i <= auto_aliaslist.Count() - 1; i++) { autoAliasList.InnerHtml += "<tr class=\"row\">"; if (auto_aliaslist[i].AutoAliasType == Ektron.Cms.Common.EkEnumeration.AutoAliasType.Folder) { autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/folder.png\" alt=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\"/ ></td>"; } else { autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/taxonomy.png\" alt=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\"/ ></td>"; } if (IsStagingServer && folder_data.DomainStaging != string.Empty) { autoAliasList.InnerHtml = autoAliasList.InnerHtml + "<td> <a href = \"http://" + folder_data.DomainStaging + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td></tr>"; } else if (folder_data.IsDomainFolder) { autoAliasList.InnerHtml += "<td> <a href = \"http://" + folder_data.DomainProduction + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>"; } else { autoAliasList.InnerHtml += "<td> <a href = \"" + SitePath + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>"; } autoAliasList.InnerHtml += "</tr>"; } autoAliasList.InnerHtml += "</table>"; autoAliasList.InnerHtml += "</div>"; if (content_data == null) { content_data = m_refContentApi.GetContentById(m_intId, 0); } if (content_data.Type == 3333) { m_refCatalog = new CatalogEntry(m_refContentApi.RequestInformationRef); m_refCurrency = new Currency(m_refContentApi.RequestInformationRef); //m_refMedia = MediaData() entry_edit_data = m_refCatalog.GetItemEdit(m_intId, ContentLanguage, false); Ektron.Cms.Commerce.ProductType m_refProductType = new Ektron.Cms.Commerce.ProductType(m_refContentApi.RequestInformationRef); prod_type_data = m_refProductType.GetItem(entry_edit_data.ProductType.Id, true); if (prod_type_data.Attributes.Count == 0) { phAttributes.Visible = false; phAttributes2.Visible = false; } Display_PropertiesTab(content_data); Display_PricingTab(); Display_ItemTab(); Display_MetadataTab(); Display_MediaTab(); } else { ViewContentProperties(content_data); phCommerce.Visible = false; phCommerce2.Visible = false; phItems.Visible = false; } bool bPackageDisplayXSLT = false; string CurrentXslt = ""; int XsltPntr; if ((!(content_data.XmlConfiguration == null)) && (content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Content || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Forms)) { if (!(content_data.XmlConfiguration == null)) { if (content_data.XmlConfiguration.DefaultXslt.Length > 0) { if (content_data.XmlConfiguration.DefaultXslt == "0") { bPackageDisplayXSLT = true; } else { bPackageDisplayXSLT = false; } if (!bPackageDisplayXSLT) { XsltPntr = int.Parse(content_data.XmlConfiguration.DefaultXslt); if (XsltPntr > 0) { Collection tmpXsltColl = (Collection)content_data.XmlConfiguration.PhysPathComplete; if (tmpXsltColl["Xslt" + XsltPntr] != null) { CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]); } else { tmpXsltColl = (Collection)content_data.XmlConfiguration.LogicalPathComplete; CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]); } } } } else { bPackageDisplayXSLT = true; } //End If Ektron.Cms.Xslt.ArgumentList objXsltArgs = new Ektron.Cms.Xslt.ArgumentList(); objXsltArgs.AddParam("mode", string.Empty, "preview"); if (bPackageDisplayXSLT) { divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, content_data.XmlConfiguration.PackageDisplayXslt, false, false, objXsltArgs, true, true); } else { // CurrentXslt is always obtained from the object in the database. divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, CurrentXslt, true, false, objXsltArgs, true, true); } } else { divContentHtml.InnerHtml = content_data.Html; } } else { if (content_data.Type == 104) { media_html.Value = content_data.MediaText; //Get Url from content string tPath = m_refContentApi.RequestInformationRef.AssetPath + m_refContentApi.EkContentRef.GetFolderParentFolderIdRecursive(content_data.FolderId).Replace(",", "/") + "/" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension; string mediaHTML = FixPath(content_data.Html, tPath); int scriptStartPtr = 0; int scriptEndPtr = 0; int len = 0; //Registering the javascript & CSS this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "linkReg", "<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", false); mediaHTML = mediaHTML.Replace("<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", ""); while (1 == 1) { scriptStartPtr = mediaHTML.IndexOf("<script", scriptStartPtr); scriptEndPtr = mediaHTML.IndexOf("</script>", scriptEndPtr); if (scriptStartPtr == -1 || scriptEndPtr == -1) { break; } len = scriptEndPtr - scriptStartPtr + 9; this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), (string)("scriptreg" + scriptEndPtr), mediaHTML.Substring(scriptStartPtr, len), false); mediaHTML = mediaHTML.Replace(mediaHTML.Substring(scriptStartPtr, len), ""); scriptStartPtr = 0; scriptEndPtr = 0; } media_display_html.Value = mediaHTML; divContentHtml.InnerHtml = "<a href=\"#\" onclick=\"document.getElementById(\'" + divContentHtml.ClientID + "\').innerHTML = document.getElementById(\'" + media_display_html.ClientID + "\').value;return false;\" alt=\"" + m_refMsg.GetMessage("alt show media content") + "\" title=\"" + m_refMsg.GetMessage("alt show media content") + "\">" + m_refMsg.GetMessage("lbl show media content") + "<br/><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/filmstrip_ph.jpg\" /></a>"; } else { if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, Convert .ToBoolean (-1))) { string ver = ""; ver = (string)("&version=" + content_data.AssetData.Version); if (IsImage(content_data.AssetData.Version)) { divContentHtml.InnerHtml = "<img src=\"" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\" />"; } else { divContentHtml.InnerHtml = "<div align=\"center\" style=\"padding:15px;\"><a style=\"text-decoration:none;\" href=\"#\" onclick=\"javascript:window.open(\'" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\',\'DownloadAsset\',\'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=1000,height=800\');return false;\"><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/application/download.gif\" />" + m_refMsg.GetMessage("btn download") + " "" + content_data.Title + ""</a></div>"; } } else if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) { Ektron.Cms.API.UrlAliasing.UrlAliasCommon u = new Ektron.Cms.API.UrlAliasing.UrlAliasCommon(); FolderData fd = this.m_refContentApi.GetFolderById(content_data.FolderId); string stralias = u.GetAliasForContent(content_data.Id); if (stralias == string.Empty || fd.IsDomainFolder) { stralias = content_data.Quicklink; } string link = ""; if (content_data.ContType == (int)EkEnumeration.CMSContentType.Content || (content_data.ContType == (int)EkEnumeration.CMSContentType.Archive_Content && content_data.EndDateAction != 1)) { string url = this.m_refContent.RequestInformation.SitePath + stralias; if (url.Contains("?")) { url += "&"; } else { url += "?"; } if ("viewstaged" == m_strPageAction) { url += "view=staged"; } else { url += "view=published"; } url += (string)("&LangType=" + content_data.LanguageId.ToString()); link = "<a href=\"" + url + "\" onclick=\"window.open(this.href);return false;\">Click here to view the page</a><br/><br/>"; } divContentHtml.InnerHtml = link + Ektron.Cms.PageBuilder.PageData.RendertoString(content_data.Html); } else { if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type) { divContentHtml.InnerHtml = content_data.Html.Replace("[srcpath]", m_refContentApi.ApplicationPath + m_refContentApi.AppeWebPath); divContentHtml.InnerHtml = divContentHtml.InnerHtml.Replace("[skinpath]", m_refContentApi.ApplicationPath + "csslib/ContentDesigner/"); } else { divContentHtml.InnerHtml = content_data.Html; } if (m_bIsBlog) { Collection blogData = m_refContentApi.EkContentRef.GetBlogData(content_data.FolderId); if (blogData != null) { if (blogData["enablecomments"].ToString() != string.Empty) { litBlogComment.Text = "<div class=\"ektronTopSpace\"></div><a class=\"button buttonInline greenHover buttonNoIcon\" href=\"" + m_refContentApi.AppPath + "content.aspx?id=" + content_data.FolderId + "&action=ViewContentByCategory&LangType=" + content_data.LanguageId + "&ContType=" + Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments + "&contentid=" + content_data.Id + "&viewin=" + content_data.LanguageId + "\" title=\"" + m_refMsg.GetMessage("alt view comments label") + "\">" + m_refMsg.GetMessage("view comments") + "</a>"; litBlogComment.Visible = true; } } } } } } sSummaryText = new StringBuilder(); if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type) { if (content_data.Teaser != null) { if (content_data.Teaser.IndexOf("<ektdesignpackage_design") > -1) { string strDesign; strDesign = m_refContentApi.XSLTransform(null, null, true, false, null, true); tdsummarytext.InnerHtml = strDesign; } else { tdsummarytext.InnerHtml = content_data.Teaser; } } else { tdsummarytext.InnerHtml = ""; } } else { if (m_bIsBlog) { sSummaryText.AppendLine("<table class=\"ektronGrid\">"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td valign=\"top\" class=\"label\">"); sSummaryText.AppendLine(" " + m_refMsg.GetMessage("generic description") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td valign=\"top\">"); } sSummaryText.AppendLine(content_data.Teaser); if (m_bIsBlog) { sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td valign=\"top\" class=\"label\">"); sSummaryText.AppendLine(" " + m_refMsg.GetMessage("lbl blog cat") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); if (!(blog_post_data.Categories == null)) { arrBlogPostCategories = blog_post_data.Categories; if (arrBlogPostCategories.Length > 0) { Array.Sort(arrBlogPostCategories); } } else { arrBlogPostCategories = null; } if (blog_post_data.Categories.Length > 0) { for (i = 0; i <= (blog_post_data.Categories.Length - 1); i++) { if (blog_post_data.Categories[i].ToString() != "") { sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"blogcategories" + i.ToString() + "\" value=\"" + blog_post_data.Categories[i].ToString() + "\" checked=\"true\" disabled> " + Strings.Replace((string)(blog_post_data.Categories[i].ToString()), "~@~@~", ";", 1, -1, 0) + "<br />"); } } } else { sSummaryText.AppendLine("No categories defined."); } sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\" valign=\"top\">"); sSummaryText.AppendLine(" " + m_refMsg.GetMessage("lbl personal tags") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); if (!(blog_post_data == null)) { sSummaryText.AppendLine(blog_post_data.Tags); } sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\">"); if (!(blog_post_data == null)) { sSummaryText.AppendLine(" <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"" + blog_post_data.TrackBackURLID.ToString() + "\" />"); sSummaryText.AppendLine(" <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"" + EkFunctions.HtmlEncode(blog_post_data.TrackBackURL) + "\" disabled/>"); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\">"); if (blog_post_data.Pingback == true) { sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" checked disabled/>"); } else { sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>"); } } else { sSummaryText.AppendLine(" <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"\" />"); sSummaryText.AppendLine(" <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + ""); sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"\" disabled/>"); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\">" + m_refMsg.GetMessage("lbl blog ae ping") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>"); } sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine("</table>"); } tdsummarytext.InnerHtml = sSummaryText.ToString(); } ViewMetaData(content_data); tdcommenttext.InnerHtml = content_data.Comment; AddTaskTypeDropDown(); ViewTasks(); ViewSubscriptions(); Ektron.Cms.Content.EkContent cref; cref = m_refContentApi.EkContentRef; TaxonomyBaseData[] dat; dat = cref.GetAllFolderTaxonomy(folder_data.Id); if (dat == null || dat.Length == 0) { phCategories.Visible = false; phCategories2.Visible = false; } ViewAssignedTaxonomy(); if ((content_data != null) && ((content_data.Type >= EkConstants.ManagedAsset_Min && content_data.Type <= EkConstants.ManagedAsset_Max && content_data.Type != 104) || (content_data.Type >= EkConstants.Archive_ManagedAsset_Min && content_data.Type <= EkConstants.Archive_ManagedAsset_Max && content_data.Type != 1104) || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)) { showAlert = false; } if ( (Request.QueryString["menuItemType"] != null && Request.QueryString["menuItemType"].ToLower() == "viewproperties") || (Request.QueryString["tab"] != null && Request.QueryString["tab"].ToLower() == "properties") ) { DefaultTab.Value = "dvProperties"; Util_ReloadTree(content_data.Path, content_data.FolderId); } }
public ItemController() { data = new ItemData(); bData = new BrandData(); pData = new ProductTypeData(); }
protected void Display_AddProductType() { _ProductTypeData = new ProductTypeData(); phAddEdit.Visible = true; phTabAttributes.Visible = true; phTabMediaDefaults.Visible = true; trXslt.Visible = false; txtTitle.Attributes.Add("onkeypress", "return " + JSLibrary.CheckKeyValueName+ "(event, \'34,13\');"); txtDescription.Attributes.Add("onkeypress", "return " + JSLibrary.CheckKeyValueName+ "(event, \'34,13\');"); Util_XSLTLinks(); Util_AddProductTypeItems(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product); Util_SetJs(); Util_SetLabels(); drp_SubscriptionProvider.Items.Add(new ListItem("MembershipSubscriptionProvider")); this.drp_type.Attributes.Add("onchange", "if (this.selectedIndex == 3) {toggleSubscriptionRow(this, true);} else {toggleSubscriptionRow(this, false);}"); }
protected override void Page_Load(object sender, System.EventArgs e) { try { base.Page_Load(sender, e); if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce)) { throw (new Exception(GetMessage("feature locked error"))); } Util_ObtainValues(); Util_CheckAccess(); m_refCatalog = new Ektron.Cms.Commerce.CatalogEntry(m_refContentApi.RequestInformationRef); m_refCurrency = new Currency(m_refContentApi.RequestInformationRef); m_refContent = m_refContentApi.EkContentRef; hdn_defaultCurrency.Value = m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId.ToString(); switch (this.m_sEditAction) { case "add": case "addlang": m_iFolder = this.m_iID; if (!Page.IsPostBack) { UserRights = m_refContentApi.LoadPermissions(m_iFolder, "folder", ContentAPI.PermissionResultType.Folder); ContentMetaData[] defaultMeta; Util_CheckFolderType(); if (m_sEditAction == "addlang") { entry_edit_data = m_refCatalog.GetItem(otherLangId, backLangType); if (entry_edit_data.ProductType.Id > 0) { m_refProductType = new ProductType(m_refContentApi.RequestInformationRef); prod_type_data = m_refProductType.GetItem(entry_edit_data.ProductType.Id, true); editorPackage = prod_type_data.PackageXslt; xid = prod_type_data.Id; Util_SetXmlId(xid); hdn_entrytype.Value = entry_edit_data.EntryType.ToString(); } } if (entry_edit_data == null) { Util_GetEntryType(); } defaultMeta = m_refContentApi.GetMetaDataTypes("id"); if ((defaultMeta != null) && defaultMeta.Length > 0) { meta_data.AddRange(defaultMeta); } Display_ContentTab(); Display_SummaryTab(); Display_EntryTab(); Display_PricingTab(); Display_MediaTab(); Display_ItemTab(); Display_MetadataTab(); Display_ScheduleTab(); Display_TaxonomyTab(); Display_CommentTab(); Display_TemplateTab(); if ((_urlAliasSettingApi.IsManualAliasEnabled || _urlAliasSettingApi.IsAutoAliasEnabled) && m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) { Display_AliasTab(); } Util_SetLabels(); } else { Process_Add(); } break; case "update": if (!Page.IsPostBack) { UserRights = m_refContentApi.LoadPermissions(m_iID, "content", ContentAPI.PermissionResultType.Content); if (PullApproval) this.m_refContent.TakeOwnership(m_iID); entry_edit_data = m_refCatalog.GetItemEdit(m_iID, m_refContentApi.RequestInformationRef.ContentLanguage, true); if (entry_edit_data.ProductType.Id > 0) { m_refProductType = new ProductType(m_refContentApi.RequestInformationRef); prod_type_data = m_refProductType.GetItem(entry_edit_data.ProductType.Id, true); editorPackage = prod_type_data.PackageXslt; xid = prod_type_data.Id; Util_SetXmlId(xid); hdn_entrytype.Value = entry_edit_data.EntryType.ToString(); } meta_data = entry_edit_data.Metadata; m_iFolder = entry_edit_data.FolderId; Util_CheckFolderType(); Display_ContentTab(); Display_SummaryTab(); Display_EntryTab(); Display_PricingTab(); Display_MediaTab(); Display_ItemTab(); Display_MetadataTab(); Display_ScheduleTab(); Display_TaxonomyTab(); Display_CommentTab(); Display_TemplateTab(); if ((_urlAliasSettingApi.IsManualAliasEnabled || _urlAliasSettingApi.IsAutoAliasEnabled) && m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) { Display_AliasTab(); } Util_SetLabels(); } else { Process_Edit(); } break; } Util_SetJS(); if (prod_type_data != null) { hdn_productType.Value = prod_type_data.EntryClass.ToString(); } this.RegisterJs(); this.RegisterCss(); if (catalog_data != null) { chk_searchable.Checked = catalog_data.IscontentSearchable; } //-------------------DisplayTabs Based on selected options from Folder properties---------------------------------- if (((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) == (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) && catalog_data.DisplaySettings != 0) { if ((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Summary) == (int)EkEnumeration.FolderTabDisplaySettings.Summary) { divSummary.Visible = true; } else { divSummary.Visible = false; liSummary.Visible = false; } if ((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.MetaData) == (int)EkEnumeration.FolderTabDisplaySettings.MetaData) { divMetadata.Visible = true; } else { if (!metadataRequired) { divMetadata.Visible = false; liMetadata.Visible = false; } } if ((_urlAliasSettingApi.IsManualAliasEnabled || _urlAliasSettingApi.IsAutoAliasEnabled) && m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) { if ((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) == (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) { divAlias.Visible = true; } else { if (!catalog_data.AliasRequired) { divAlias.Visible = false; liAlias.Visible = false; } } } if ((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Schedule) == (int)EkEnumeration.FolderTabDisplaySettings.Schedule) { divSchedule.Visible = true; } else { divSchedule.Visible = false; liSchedule.Visible = false; } if ((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Comment) == (int)EkEnumeration.FolderTabDisplaySettings.Comment) { divComment.Visible = true; } else { divComment.Visible = false; } if ((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Templates) == (int)EkEnumeration.FolderTabDisplaySettings.Templates) { divTemplates.Visible = true; } else { divTemplates.Visible = false; } if ((catalog_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) == (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) { divCategories.Visible = true; } else { if (!catalog_data.IsCategoryRequired) { divCategories.Visible = false; liCategory.Visible = false; } } } //-------------------DisplayTabs Based on selected options from Folder properties End------------------------------ } catch (Exception ex) { Utilities.ShowError(ex.Message); } }
protected void Display_EditProductType() { _ProductType = new ProductType(m_refContentApi.RequestInformationRef); _ProductTypeData = _ProductType.GetItem(m_iID, true); phTabAttributes.Visible = true; phTabMediaDefaults.Visible = true; tr_id.Visible = true; txt_id.Text = _ProductTypeData.Id.ToString(); phAddEdit.Visible = true; txtTitle.Attributes.Add("onkeypress", "return " + JSLibrary.CheckKeyValueName+ "(event, \'34,13\');"); txtDescription.Attributes.Add("onkeypress", "return " + JSLibrary.CheckKeyValueName+ "(event, \'34,13\');"); Util_PopulateData(); drp_type.Enabled = false; if (_ProductTypeData.EntryClass == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct) { drp_SubscriptionProvider.Items.Add(new ListItem("MembershipSubscriptionProvider")); drp_SubscriptionProvider.SelectedIndex = 0; } Util_XSLTLinks(); Util_AddProductTypeItems(_ProductTypeData.EntryClass); Util_SetJs(); Util_SetLabels(); }
protected void Util_ObtainValues() { if (Request.QueryString["back_LangType"] != "") { backLangType = Convert.ToInt64(Request.QueryString["back_LangType"]); } if (Request.QueryString["content_id"] != "") { otherLangId = Convert.ToInt64(Request.QueryString["content_id"]); } if (Request.QueryString["type"] != "") { m_sEditAction = Request.QueryString["type"]; } if (!(Request.QueryString["folder_id"] == null)) // add { m_iFolder = Convert.ToInt64(Request.QueryString["folder_id"]); } if (!(Request.QueryString["back_folder_id"] == null)) // edit { m_iFolder = Convert.ToInt64(Request.QueryString["back_folder_id"]); } if (Request.QueryString["xid"] != "") { xid = Convert.ToInt64(Request.QueryString["xid"]); if (xid > 0) { m_refProductType = new ProductType(m_refContentApi.RequestInformationRef); prod_type_data = m_refProductType.GetItem(xid, true); this.editorPackage = prod_type_data.PackageXslt; hdn_entrytype.Value = prod_type_data.EntryClass.ToString(); } } Util_SetXmlId(xid); m_cPerms = m_refContentApi.LoadPermissions(m_iFolder, "folder", 0); if (Request.QueryString["incontext"] != "") { _inContextEditing = Convert.ToBoolean(Request.QueryString["incontext"]); } //m_mMeasures = New Measurements(m_refContentApi.RequestInformationRef).GetMeasurements() }
public void Process_AddProductType() { try { _ProductType = new ProductType(m_refContentApi.RequestInformationRef); _ProductTypeData = new ProductTypeData(); _ProductTypeData.EntryClass = (EkEnumeration.CatalogEntryType)Enum.Parse(typeof(EkEnumeration.CatalogEntryType),Request.Form[drp_type.UniqueID]); _ProductTypeData.Title = Request.Form[txtTitle.UniqueID]; _ProductTypeData.Description = Request.Form[txtDescription.UniqueID]; _ProductTypeData.EditXslt = ""; _ProductTypeData.SaveXslt = ""; _ProductTypeData.Xslt1 = ""; _ProductTypeData.Xslt2 = ""; _ProductTypeData.Xslt3 = ""; _ProductTypeData.Xslt4 = ""; _ProductTypeData.Xslt5 = ""; _ProductTypeData.XmlSchema = ""; _ProductTypeData.XmlNameSpace = ""; _ProductTypeData.XmlAdvConfig = ""; _ProductTypeData.DefaultXslt = "0"; _ProductTypeData.PhysicalPath = Server.MapPath(m_refContentApi.XmlPath); _ProductTypeData.Attributes = Process_GetAttributes(); _ProductTypeData.DefaultThumbnails = Process_GetThumbnails(); if (_ProductTypeData.EntryClass == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct) { _ProductTypeData.SubscriptionProvider = Request.Form["drp_SubscriptionProvider"]; } _ProductTypeData = _ProductType.Add(_ProductTypeData); Response.Redirect((string) ("../editdesign.aspx?action=EditPackage&type=product&id=" + _ProductTypeData.Id.ToString()), false); } catch (Ektron.Cms.Exceptions.SpecialCharactersException) { trError.Visible = true; litErrorMessage.Text = string.Format(GetMessage("js alert product type title cant include"), EkFunctions.HtmlEncode("<,>")); Display_AddProductType(); } catch (Exception ex) { trError.Visible = true; litErrorMessage.Text = ex.Message.ToString(); Display_AddProductType(); } }
public void Process_Edit() { if (!string.IsNullOrEmpty(Request.Form["hdn_xmlid"]) && Convert.ToInt64(Request.Form["hdn_xmlid"]) > 0) { m_refProductType = new ProductType(m_refContentApi.RequestInformationRef); prod_type_data = m_refProductType.GetItem(Convert.ToInt64(Request.Form["hdn_xmlid"]), true); xid = prod_type_data.Id; Util_SetXmlId(xid); } if (Request.Form["hdn_entrytype"] == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct.ToString()) { Process_EditSubscription(); } else if (Request.Form["hdn_entrytype"] == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle.ToString()) { Process_EditBundle(); } else if (Request.Form["hdn_entrytype"] == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit.ToString()) { Process_EditKit(); } else if ((Request.Form["hdn_entrytype"] == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product.ToString()) || (Request.Form["hdn_entrytype"] == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct.ToString())) { Process_EditProduct(); } }