public async Task Trace_Header() { string traceId = _traceIdFactory.NextId(); ulong spanId = _spanIdFactory.NextId(); var uri = $"/Trace/{nameof(TraceController.Trace)}/{_testId}"; var childSpanName = EntryData.GetMessage(nameof(TraceController.Trace), _testId); using (var server = new TestServer(new WebHostBuilder().UseStartup <TraceTestNoBufferLowQpsApplication>())) using (var client = server.CreateClient()) { var header = TraceHeaderContext.Create(traceId, spanId, shouldTrace: true); client.DefaultRequestHeaders.Add(TraceHeaderContext.TraceHeader, header.ToString()); var response = await client.GetAsync(uri); var trace = _polling.GetTrace(uri, _startTime); TraceEntryVerifiers.AssertParentChildSpan(trace, uri, childSpanName); Assert.Equal(traceId, trace.TraceId); var parentSpan = trace.Spans.First(s => s.Name == uri); Assert.Equal(spanId, parentSpan.ParentSpanId); Assert.True(response.Headers.Contains(TraceHeaderContext.TraceHeader)); var returnedHeader = response.Headers.GetValues(TraceHeaderContext.TraceHeader).Single(); var headerContext = TraceHeaderContext.FromHeader(returnedHeader); Assert.Equal(traceId, headerContext.TraceId); Assert.Equal(spanId, headerContext.SpanId); Assert.True(headerContext.ShouldTrace); } }
public async Task Logging_Trace_FromHeader_MultipleSpans() { string traceId = s_traceIdFactory.NextId(); ulong spanId = s_spanIdFactory.NextId(); string testId = IdGenerator.FromGuid(); var builder = new WebHostBuilder().UseStartup <NoBufferWarningLoggerTestApplication>(); using (var server = new TestServer(builder)) using (var client = server.CreateClient()) { client.DefaultRequestHeaders.Add(TraceHeaderContext.TraceHeader, TraceHeaderContext.Create(traceId, spanId, true).ToString()); await client.GetAsync($"/Main/{nameof(MainController.LogsInDifferentSpans)}/{testId}"); } _fixture.AddValidator(testId, results => { // Span: span-1 // Log: span-1 // Span: span-1-2 // Log: span-1-2 // Span: span-2 // Log: span-2 string projectId = TestEnvironment.GetTestProjectId(); // We have 3 logs. Assert.Equal(3, results.Count); // And the resource name of the trace associated to all of them points to the trace // we specified on the header. Assert.DoesNotContain(results, entry => !entry.Trace.Contains(projectId)); Assert.DoesNotContain(results, entry => !entry.Trace.Contains(traceId)); // Let's get our trace. var trace = s_tracePolling.GetTrace(traceId); Assert.NotNull(trace); // Let's check that all the entries are associated to the correct spans. var logEntry1 = Assert.Single(results, e => e.JsonPayload.Fields["message"].StringValue.EndsWith("log-1")); var logEntry12 = Assert.Single(results, e => e.JsonPayload.Fields["message"].StringValue.EndsWith("log-1-2")); var logEntry2 = Assert.Single(results, e => e.JsonPayload.Fields["message"].StringValue.EndsWith("log-2")); var span1 = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == logEntry1.SpanId); Assert.EndsWith("span-1", span1.Name); var span12 = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == logEntry12.SpanId); Assert.EndsWith("span-1-2", span12.Name); var span2 = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == logEntry2.SpanId); Assert.EndsWith("span-2", span2.Name); // Let's check that the spans are correctly created and descend from the span we specified in the header. // span-1-2 is a child of span-1 Assert.Equal(span12.ParentSpanId, span1.SpanId); // span-1 and span-2 have the same parent Assert.Equal(span1.ParentSpanId, span2.ParentSpanId); // The grandparent of span-1 and span-2 is the span we specified on the header. var parentSpan = Assert.Single(trace.Spans, s => s.SpanId == span1.ParentSpanId); Assert.Equal(spanId, parentSpan.ParentSpanId); }); }
public async Task Logging_Trace_Implicit() { Timestamp startTime = Timestamp.FromDateTime(DateTime.UtcNow); string testId = IdGenerator.FromGuid(); string url = $"/Main/Critical/{testId}"; var builder = new WebHostBuilder().UseStartup <NoBufferWarningLoggerTracesAllTestApplication>(); using (var server = new TestServer(builder)) using (var client = server.CreateClient()) { await client.GetAsync(url); } _fixture.AddValidator(testId, results => { // Let's get our trace. var trace = s_tracePolling.GetTrace(url, startTime); Assert.NotNull(trace); // We only have one log entry. LogEntry entry = Assert.Single(results); // And the resource name of the trace associated to it points to the trace // created during the call. Assert.Contains(TestEnvironment.GetTestProjectId(), entry.Trace); Assert.Contains(trace.TraceId, entry.Trace); // The span associated to our entry needs to be part of that trace. // (We created this span on the middleware to encompass the whole request) var entrySpan = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == entry.SpanId); // And it shouldn't have a span parent. Assert.Equal((ulong)0, entrySpan.ParentSpanId); }); }
public ConvertToGameObject(StreamState stream, EntryData instanceData, SyncObjectInstance syncInstance, SyncObject syncObject) { Stream = stream; InstanceData = instanceData; SyncInstance = syncInstance; SyncObject = syncObject; }
string GetEntryFullPath(EntryData entry) { var downloadFolder = GetSourceProjectFolder(entry.SourceId); var filename = entry.Hash + PlayerFile.SyncModelTypeToExtension(entry.EntryType); return(Path.Combine(downloadFolder, filename)); }
private void cmdNext_Click(object sender, EventArgs e) { if (EntryData.Count == 0) { MessageBox.Show("Nu exista nici o masina in asteptare!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EntryData[0].dateEntry = DateTime.Now; AddEntryToCompleted(EntryData[0]); using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(0); } if (EntryData != null) { EntryData.RemoveAt(0); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; lstTruckOrder.Items.RemoveAt(0); foreach (TruckInfo ti in EntryData) { lstTruckOrder.Items[--ti.nrCrt - 1].SubItems[0].Text = ti.nrCrt.ToString(); } } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData")); }
private void ReplayReport(IHttpRequest request, IHttpResponse response, TFSSourceControlProvider sourceControlProvider, ReplayReportData replayReport) { if (replayReport.Revision == 0) { response.StatusCode = (int)HttpStatusCode.OK; using (var output = new StreamWriter(response.OutputStream)) { output.Write( @"<?xml version=""1.0"" encoding=""utf-8""?> <S:editor-report xmlns:S=""svn:""> <S:target-revision rev=""0""/> </S:editor-report>"); return; } } var data = new UpdateReportData(); data.SrcPath = request.Url.AbsoluteUri; data.Entries = new List <EntryData>(); var item = new EntryData(); string localPath = PathParser.GetLocalPath(request); LogItem log = sourceControlProvider.GetLog(localPath, 0, sourceControlProvider.GetLatestVersion(), Recursion.None, 1); if (log.History.Length == 0) { WriteFileNotFoundResponse(request, response); } item.Rev = (replayReport.Revision - 1).ToString(); data.TargetRevision = (replayReport.Revision).ToString(); data.Entries.Add(item); SetResponseSettings(response, "text/xml; charset=\"utf-8\"", Encoding.UTF8, 200); response.SendChunked = true; using (var output = new StreamWriter(response.OutputStream)) { try { output.Write(@"<?xml version=""1.0"" encoding=""utf-8""?> <S:editor-report xmlns:S=""svn:"">"); int targetRevision; FolderMetaData metadata = GetMetadataForUpdate(request, data, sourceControlProvider, out targetRevision); output.WriteLine("<S:target-revision rev=\"{0}\"/>", targetRevision); OutputEditorReport(sourceControlProvider, metadata, replayReport.Revision, localPath == "/", output); output.Write("</S:editor-report>"); } catch (FileNotFoundException) { WriteFileNotFoundResponse(request, response); } } }
public bool Run(EntryData entry) { Request = new RevealEntryRequest(); Request.param.Entry = entry.MarshalBinary.ToHexString(); return(Run(Request)); }
public async Task Logging_Trace_MultipleSpans() { Timestamp startTime = Timestamp.FromDateTime(DateTime.UtcNow); string testId = IdGenerator.FromGuid(); string spanPrefix; using (var server = GetTestServer <NoBufferWarningLoggerTracesAllTestApplication>()) using (var client = server.CreateClient()) { spanPrefix = await client.GetStringAsync($"/Main/{nameof(MainController.LogsInDifferentSpans)}/{testId}"); } _fixture.AddValidator(testId, results => { // Span: span-1 // Log: span-1 // Span: span-1-2 // Log: span-1-2 // Span: span-2 // Log: span-2 string projectId = TestEnvironment.GetTestProjectId(); // Let's get our trace. var trace = s_tracePolling.GetTrace(spanPrefix, startTime); Assert.NotNull(trace); // We have 3 logs. Assert.Equal(3, results.Count); // And the resource name of the trace associated to all of them points to the trace // created during the call. Assert.All(results, entry => { Assert.Contains(projectId, entry.Trace); Assert.Contains(trace.TraceId, entry.Trace); }); // Let's check that all the entries are associated to the correct spans. var logEntry1 = Assert.Single(results, e => e.JsonPayload.Fields["message"].StringValue.EndsWith("log-1")); var logEntry12 = Assert.Single(results, e => e.JsonPayload.Fields["message"].StringValue.EndsWith("log-1-2")); var logEntry2 = Assert.Single(results, e => e.JsonPayload.Fields["message"].StringValue.EndsWith("log-2")); var span1 = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == logEntry1.SpanId); Assert.EndsWith("span-1", span1.Name); var span12 = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == logEntry12.SpanId); Assert.EndsWith("span-1-2", span12.Name); var span2 = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == logEntry2.SpanId); Assert.EndsWith("span-2", span2.Name); // Let's check that the spans are correctly created. // span-1-2 is a child of span-1 Assert.Equal(span12.ParentSpanId, span1.SpanId); // span-1 and span-2 have the same parent Assert.Equal(span1.ParentSpanId, span2.ParentSpanId); // The parent of span-1 and span-2 exists, it's the span we created on the middleware // to encompass the whole request. Assert.NotEqual((ulong)0, span1.ParentSpanId); }); }
private async Task <List <EntryData> > GetEntryData(string wStr) { var res = new List <EntryData>(); var entryData = new EntryData(); var container_StatusPat = @"COST U LESS, INC\.\n*\*\*.COMMERCIAL INVOICE\*\*\*.*\nContainer :\s(?<ContainerNo>\d{3}-\d{4}-\d{6}).Status : (?<Status>\w*)\n"; var bookingPat = @"Booking #:\n(?<BookingNo>[\w\-]*)"; //get Regex Groups var entryDetailspat = @"(?<ItemNumber>\d{5,})\s(?<ItemDescription>[\w,<,\s,\&,\%]{1,})\s(?<Quantity>\d{1,4})\s(?<CS>\d+)\s(?<Cost>[\d,\,]+\.\d{2})\s(?<ExtCost>[\d,\,]+\.\d{2})\s(?<IF>[\d,\,]+\.\d{2})?\s?(?<ExtCIF>[\d,\,]+\.\d{2})\s(?<OriginCountry>\w{2,})\n(?<ExtItemDescription>[\w,\<,\s,\-\./]{1,})?\n?BRB.+HTS.+(?<TariffCode>\d{10})\s?%?\n?Duty\s?%\s?\:\s(?<DutyPercent>\d{1,3}\.\d{2})\s\%?\s?.+\:\s(?<DutyAmt>\d{1,3}\.\d{2})"; var entryDetailsRegx = new Regex(entryDetailspat, RegexOptions.Compiled); foreach (Match m in entryDetailsRegx.Matches(wStr)) { var ed = new EntryDataDetails(true) { TrackingState = TrackingState.Added }; ed.ItemNumber = m.Groups["ItemNumber"].Value; ed.ItemDescription = m.Groups["ItemDescription"].Value; ed.Cost = Convert.ToDouble(m.Groups["Cost"].Value); ed.LineNumber = m.Index; ed.Quantity = Convert.ToDouble(m.Groups["Quantity"].Value); ed.Units = m.Groups["Unit"].Value; } return(res); }
public bool WriteToChain(string ChainId, EntryData entry, String CallbackURL = null, params Stages[] CallbackStages) { var request = new RestRequest($"v1/chains/{ChainId}/entries", Method.POST); if (!String.IsNullOrEmpty(CallbackURL)) { request.AddJsonBody( new { callback_url = CallbackURL, callback_stages = CallbackStages, external_ids = entry.ExtIDsBase64Strings, content = entry.ContentBase64String }); } else { request.AddJsonBody( new { external_ids = entry.ExtIDsBase64Strings, content = entry.ContentBase64String }); } RestResponse = Harmony.MakeRequest(request); if (RestResponse.StatusCode == System.Net.HttpStatusCode.Accepted) { DataResponse = JsonConvert.DeserializeObject <Response>(RestResponse.Content); return(true); } return(false); }
private void Re_Record_Clicked(object sender, System.EventArgs e) { RecordEntry re = sender as RecordEntry; EntryData ed = re.DataContext as EntryData; _parent.UcViewer.RecordEntryCall(ed.Id); }
public static string Cancel(int idEntry) { EntryData DEntry = new EntryData(); DEntry.IdEntry = idEntry; return(DEntry.Cancel(DEntry)); }
public async Task Logging_ScopeFormatParameter() { string testId = IdGenerator.FromGuid(); using (var server = GetTestServer <NoBufferWarningLoggerTestApplication>()) using (var client = server.CreateClient()) { await client.GetAsync($"/Main/ScopeFormatParameters/{testId}"); } _fixture.AddValidator(testId, results => { var message = EntryData.GetMessage(nameof(MainController.ScopeFormatParameters), testId); var json = results.Single().JsonPayload.Fields; Assert.Equal(message, json["message"].StringValue); var parentScopes = json["parent_scopes"]?.ListValue?.Values; Assert.NotNull(parentScopes); var expectedScope = Value.ForStruct(new Struct { Fields = { { "id", Value.ForString(testId) }, { "{OriginalFormat}", Value.ForString(nameof(MainController.ScopeFormatParameters) + " - {id}") } } }); Assert.Single(parentScopes, expectedScope); }); }
private void WriteEntry(EntryData entryData) { ResourceEntry entry = entryData.Entry; if (entry.IdentifiedByName) { uint stringOffset = (uint)_state.StringPos | 0x80000000; _state.Blob.Write(ref _state.TreePos, stringOffset); _state.Blob.Write(ref _state.StringPos, (ushort)entry.Name.Length); _state.Blob.Write(ref _state.StringPos, entry.Name, Encoding.Unicode); } else { uint entryId = (uint)entry.ID & 0x7fffffff; _state.Blob.Write(ref _state.TreePos, entryId); } if (entryData.Table != null) { uint tableOffset = (uint)entryData.Table.Offset | 0x80000000; _state.Blob.Write(ref _state.TreePos, tableOffset); } else { var dataEntry = (ResourceDataEntry)entry; uint dataDescriptionOffset = (uint)_state.DataDescriptionPos & 0x7fffffff; _state.Blob.Write(ref _state.TreePos, dataDescriptionOffset); WriteDataEntry(dataEntry); } }
public static string Insert(DateTime dateEntry, string receiptType, string serie, string sequent, decimal iva, string status, int idEmployee, int idProvider, DataTable dtDetails) { EntryData DEntry = new EntryData(); DEntry.DateEntry = dateEntry; DEntry.ReceiptType = receiptType; DEntry.Serie = serie; DEntry.Sequent = sequent; DEntry.Iva = iva; DEntry.Status = status; DEntry.IdEmployee = idEmployee; DEntry.IdProvider = idProvider; List <EntryDetailData> entryDetails = new List <EntryDetailData>(); foreach (DataRow row in dtDetails.Rows) { EntryDetailData detail = new EntryDetailData(); detail.IdItem = Convert.ToInt32(row["id_articulo"].ToString()); detail.PriceBuy = Convert.ToDecimal(row["precio_compra"].ToString()); detail.PriceSale = Convert.ToDecimal(row["precio_venta"].ToString()); detail.StockIni = Convert.ToInt32(row["stock_inicial"].ToString()); detail.StockCurrent = Convert.ToInt32(row["stock_inicial"].ToString()); detail.Fecha = Convert.ToDateTime(row["fecha_produccion"].ToString()); entryDetails.Add(detail); } return(DEntry.Insert(DEntry, entryDetails)); }
private void DrawHeader() { _tabIndex = GUILayout.Toolbar(_tabIndex, _headerContents.ToArray()); if (_tabIndex == 0 && _changesMade) { bool save = EditorUtility.DisplayDialog("Bookmark Everything", "You have unsaved changes. Would you like to save them?", "Yes", "No"); if (save) { SaveChanges(); } else { _lastlyAddedCount = -1; _tempLocations.Clear(); _tempLocations.AddRange(EntryData.Clone(_currentSettings.EntryData.ToArray())); _changesMade = false; } } switch (_tabIndex) { case 0: DrawProjectFinder(); break; case 1: DrawSettings(); break; default: break; } }
private int GetClientRevisionFor(List <EntryData> entries, string name) { EntryData bestMatch = entries[0]; foreach (EntryData entry in entries) { if (entry.path == name)// found a best match { bestMatch = entry; break; } if (entry.path == null || name.StartsWith(entry.path, StringComparison.InvariantCultureIgnoreCase) == false) { continue; } // if the current entry is longer than the previous best match, than this // is a better match, because it is more deeply nested, so likely // to be a better parent if (bestMatch.path == null || bestMatch.path.Length < entry.path.Length) { bestMatch = entry; } } return(int.Parse(bestMatch.Rev)); }
private async Task DeleteEntryData(EntryData olded) { using (var ctx = new EntryDataService()) { await ctx.DeleteEntryData(olded.EntryDataId).ConfigureAwait(false); } }
private void cmdRemTruck_Click(object sender, EventArgs e) { if (lstTruckOrder.SelectedItems.Count == 1) { using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(lstTruckOrder.SelectedIndices[0]); if (EntryData != null) { foreach (TruckInfo ti in EntryData.Skip(lstTruckOrder.SelectedIndices[0] + 1)) { lstTruckOrder.Items[--ti.nrCrt].SubItems[0].Text = ti.nrCrt.ToString(); } } } if (EntryData != null) { EntryData.RemoveAt(lstTruckOrder.SelectedIndices[0]); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; } if (lstTruckOrder != null) { lstTruckOrder.Items.Remove(lstTruckOrder.SelectedItems[0]); } if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("EntryData")); } } }
public async Task Logging_Trace_FromHeader_Implicit() { string traceId = s_traceIdFactory.NextId(); ulong spanId = s_spanIdFactory.NextId(); string testId = IdGenerator.FromGuid(); using (var server = GetTestServer <NoBufferWarningLoggerTestApplication>()) using (var client = server.CreateClient()) { client.DefaultRequestHeaders.Add(TraceHeaderContext.TraceHeader, TraceHeaderContext.Create(traceId, spanId, true).ToString()); await client.GetAsync($"/Main/Critical/{testId}"); } _fixture.AddValidator(testId, results => { // We only have one log entry. LogEntry entry = Assert.Single(results); // And the resource name of the trace associated to it points to the trace // we specified on the header. Assert.Contains(TestEnvironment.GetTestProjectId(), entry.Trace); Assert.Contains(traceId, entry.Trace); // Let's get our trace. var trace = s_tracePolling.GetTrace(traceId); Assert.NotNull(trace); // The span associated to our entry needs to be part of that trace. // (We created this span on the middleware to encompass the whole request) var entrySpan = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == entry.SpanId); // And its parent needs to be the span specified in the header Assert.Equal(spanId, entrySpan.ParentSpanId); }); }
async Task <ISyncModel> AcquireEntryAsync(EntryData entry, CancellationToken token) { var fullPath = Path.Combine(ProjectFolder, m_FileOrganization == FileOrganization.OneFolderPerSource ? entry.SourceId : "", entry.Hash + PlayerFile.PersistentKeyToExtension(entry.IdInSource)); return(await PlayerFile.LoadSyncModelAsync(fullPath, entry.IdInSource, token)); }
public async Task Logging_Trace() { Timestamp startTime = Timestamp.FromDateTime(DateTime.UtcNow); string testId = IdGenerator.FromGuid(); string spanPrefix; using (var server = GetTestServer <NoBufferWarningLoggerTracesAllTestApplication>()) using (var client = server.CreateClient()) { spanPrefix = await client.GetStringAsync($"/Main/{nameof(MainController.LogsInOneSpan)}/{testId}"); } _fixture.AddValidator(testId, results => { // Let's get our trace. var trace = s_tracePolling.GetTrace(spanPrefix, startTime); Assert.NotNull(trace); // We only have one log entry. LogEntry entry = Assert.Single(results); // And the resource name of the trace associated to it points to the trace // created during the call. Assert.Contains(TestEnvironment.GetTestProjectId(), entry.Trace); Assert.Contains(trace.TraceId, entry.Trace); // The span associated to our entry needs to be part of that trace. // (We created this span on the action call) var entrySpan = Assert.Single(trace.Spans, s => EntryData.SpanIdToHex(s.SpanId) == entry.SpanId); // And its parent is a span we create on the middleware to encompass the whole request Assert.NotEqual((ulong)0, entrySpan.ParentSpanId); }); }
public async Task Trace_Header( Action <IWebHostBuilder> testServerConfigurator, Action <HttpRequestHeaders, string, ulong?, bool?> traceContextEmitter, Action <HttpResponseMessage, string, ulong?, bool?> assertTraceContext) { string traceId = _traceIdFactory.NextId(); ulong spanId = _spanIdFactory.NextId(); var uri = $"/Trace/{nameof(TraceController.Trace)}/{_testId}"; var childSpanName = EntryData.GetMessage(nameof(TraceController.Trace), _testId); using var server = GetTestServer <TraceTestNoBufferLowQpsApplication>(testServerConfigurator); using var client = server.CreateClient(); traceContextEmitter(client.DefaultRequestHeaders, traceId, spanId, true); var response = await client.GetAsync(uri); var trace = _polling.GetTrace(uri, _startTime); TraceEntryVerifiers.AssertParentChildSpan(trace, uri, childSpanName); Assert.Equal(traceId, trace.TraceId); var parentSpan = trace.Spans.First(s => s.Name == uri); Assert.Equal(spanId, parentSpan.ParentSpanId); assertTraceContext(response, traceId, spanId, true); }
public async Task Logging_FormatParameter() { string testId = IdGenerator.FromGuid(); DateTime startTime = DateTime.UtcNow; var builder = new WebHostBuilder().UseStartup <NoBufferWarningLoggerTestApplication>(); using (var server = new TestServer(builder)) using (var client = server.CreateClient()) { await client.GetAsync($"/Main/FormatParameters/{testId}"); } _fixture.AddValidator(testId, results => { var message = EntryData.GetMessage(nameof(MainController.FormatParameters), testId); var json = results.Single().JsonPayload.Fields; Assert.Equal(message, json["message"].StringValue); var formatParams = json["format_parameters"]?.StructValue?.Fields; Assert.NotNull(formatParams); Assert.Equal(3, formatParams.Count); Assert.Equal(nameof(MainController.FormatParameters), formatParams["message"].StringValue); Assert.Equal(testId, formatParams["id"].StringValue); Assert.Equal("{message} - {id}", formatParams["{OriginalFormat}"].StringValue); }); }
public DialogResult InitDialog(DataHelper dataHelper, EntryData entryData, Mode mode, Context context) { GetSectorPairs(context); this._dataHelper = dataHelper; this._entryData = entryData; this._mode = mode; this.context = context; settings = Settings.GetSettings(context); pnl_Params.Visible = false; spinner_BattleConditionals_Sector.Maximum = settings.MaxSectors; spinner_WorldConditionals_Sector.Maximum = settings.MaxSectors; spinner_Events_Sector.Maximum = settings.MaxSectors; txt_ISO.Text = string.Empty; chk_BattleConditionals.Checked = true; chk_Events.Checked = true; chk_WorldConditionals.Checked = true; btn_Load.Enabled = false; btn_Patch.Enabled = false; if (mode == Mode.Load) { Text = "Load ISO"; btn_Load.Visible = true; btn_Patch.Visible = false; } else if (mode == Mode.Patch) { Text = "Patch ISO"; btn_Load.Visible = false; btn_Patch.Visible = true; } bool isLoad = (_mode == Mode.Load); lbl_BattleConditionals_Size.Visible = isLoad; lbl_WorldConditionals_Size.Visible = isLoad; lbl_Events_Size.Visible = isLoad; spinner_BattleConditionals_Size.Visible = isLoad; spinner_WorldConditionals_Size.Visible = isLoad; spinner_Events_Size.Visible = isLoad; spinner_BattleConditionals_Size.Value = settings.BattleConditionalsSize; spinner_WorldConditionals_Size.Value = settings.WorldConditionalsSize; spinner_Events_Size.Value = settings.TotalEventSize; btn_ISO.Focus(); InitComboBoxes(); SetSectorOffsetDefaults(); return(ShowDialog()); }
/// <summary> /// スティックの連続入力防止用コルーチン /// </summary> /// <param name="data"></param> /// <returns></returns> private IEnumerator ResetKeyFlags(EntryData data) { for (int i = 0; i < RESET_FRAME; ++i) { yield return(null); } data.isInput = false; }
internal virtual void OnReorder(ReorderableList list) { if (_itemSelected) { EntryData.OnComponentChanged(ListChangeType.Reorder, _reorderSelectedIndex, list.index); _itemSelected = false; } }
internal virtual void OnAdd(IList <EntryComponent> list, BetterGenericMenu betterGenericMenu) { InitializeAddButtonGenerucMenu(betterGenericMenu, type => { list.Add(CreateNewComponent(type)); EntryData.OnComponentChanged(ListChangeType.Add, list.Count - 1, -1); }); }
protected override Task <HttpResponseMessage> SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) { string id = request.GetRouteData().Values["id"].ToString(); string message = EntryData.GetMessage(nameof(SendAsync), id); throw new Exception(message); }
public static EntryData ConvertStringFormatToByteFormat(EntryDataStringFormat entryStringFormat) { var entry = new EntryData { ChainId = Strings.DecodeHexIntoBytes(entryStringFormat.ChainId), Content = Strings.DecodeHexIntoBytes(entryStringFormat.Content) }; if (entryStringFormat.ExtIDs == null) return entry; var len = entryStringFormat.ExtIDs.Length; entry.ExtIDs = new byte[len][]; for (var i = 0; i < len; i++) { entry.ExtIDs[i] = Strings.DecodeHexIntoBytes(entryStringFormat.ExtIDs[i]); } return entry; }
private void PopulateCatalogPageData(EntryData entry_data_version, EntryData entry_data) { bool bPackageDisplayXSLT = false; string CurrentXslt = ""; Display_PropertiesTab(entry_data_version); Display_PricingTab(entry_data_version); Display_MetadataTab(entry_data_version); phItemsTab.Visible = false; phItems.Visible = false; //sp_item.Visible = False if ((!(entry_data_version.ProductType == null)) && (bApplyXslt)) { if (entry_data_version.ProductType.PackageDisplayXslt.Length > 0) { bPackageDisplayXSLT = true; } else { if (entry_data_version.ProductType.DefaultXslt.Length > 0) { bPackageDisplayXSLT = false; Collection xsltPhysPath = (Collection)content_data.XmlConfiguration.PhysPathComplete; Collection xsltLogicalPath = (Collection)content_data.XmlConfiguration.LogicalPathComplete; if (xsltPhysPath.Contains("Xslt" + entry_data_version.ProductType.DefaultXslt)) { CurrentXslt = xsltPhysPath["Xslt" + entry_data_version.ProductType.DefaultXslt].ToString(); } else { CurrentXslt = xsltLogicalPath["Xslt" + entry_data_version.ProductType.DefaultXslt].ToString(); } } else { bPackageDisplayXSLT = true; } } if (bPackageDisplayXSLT) { divContentHtml.InnerHtml = m_refContentApi.XSLTransform(entry_data_version.Html, entry_data_version.ProductType.PackageDisplayXslt, false, false, null, false, true); } else { divContentHtml.InnerHtml = m_refContentApi.TransformXSLT(entry_data_version.Html, CurrentXslt); } } else { divContentHtml.InnerHtml = entry_data_version.Html; } tdsummaryhead.InnerHtml = m_refMsg.GetMessage("content summary label"); tdsummarytext.InnerHtml += entry_data_version.Summary; tdcommenthead.InnerHtml = m_refMsg.GetMessage("content HC label"); tdcommenttext.InnerHtml = entry_data_version.Comment; }
private void Page_Load(System.Object sender, System.EventArgs e) { try { if (!(Request.QueryString["LangType"] == null)) { if (Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refContentApi.ContentLanguage = ContentLanguage; } m_refMsg = m_refContentApi.EkMsgRef; if (Request.QueryString["id"] != "") { ContentId = Convert.ToInt64(Request.QueryString["id"]); } if (Request.QueryString["hist_id"] != "") { HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]); } if (!(Page.IsPostBack)) { AppImgPath = m_refContentApi.AppImgPath; AppName = m_refContentApi.AppName; ContentLanguage = m_refContentApi.ContentLanguage; imagePath = m_refContentApi.AppPath + "images/ui/icons/"; content_data = new ContentData(); if (ContentId > 0 && HistoryId > 0) { if (Request.QueryString["xslt"] == "remove") { bApplyXslt = false; } else { bApplyXslt = true; } security_data = m_refContentApi.LoadPermissions(ContentId, "content", ContentAPI.PermissionResultType.Content); m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId); switch (m_contentType) { case EkConstants.CMSContentType_CatalogEntry: Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi(); entry_data = m_refCatalogAPI.GetItem(ContentId); entry_version_data = m_refCatalogAPI.GetItemVersion(ContentId, m_refContentApi.ContentLanguage, HistoryId); PopulateCatalogPageData(entry_version_data, entry_data); Display_EntryHistoryToolBar(entry_data); break; default: content_data = m_refContentApi.GetContentById(ContentId, 0); hist_content_data = m_refContentApi.GetContentByHistoryId(HistoryId); FolderData folder_data; blog_post_data = new BlogPostData(); blog_post_data.Categories = new string[0]; if (!(content_data == null)) { bIsBlog = System.Convert.ToBoolean(m_refContentApi.EkContentRef.GetFolderType(content_data.FolderId) == Ektron.Cms.Common.EkEnumeration.FolderType.Blog); if (bIsBlog) { folder_data = m_refContentApi.GetFolderById(content_data.FolderId); if (hist_content_data.MetaData != null) { for (int i = 0; i <= (hist_content_data.MetaData.Length - 1); i++) { Ektron.Cms.Common.EkEnumeration.BlogPostDataType MetaType = (Ektron.Cms.Common.EkEnumeration.BlogPostDataType)Enum.Parse(typeof(Ektron.Cms.Common.EkEnumeration.BlogPostDataType), hist_content_data.MetaData[i].TypeId.ToString()); if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Categories || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog categories") > -1) { hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("'", "\'"); hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace(""", "\""); hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace(">", ">"); hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("<", "<"); blog_post_data.Categories = Strings.Split((string)(hist_content_data.MetaData[i].Text), ";", -1, 0); } else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Ping || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog pingback") > -1) { blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo((string)(hist_content_data.MetaData[i].Text)); } else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Tags || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog tags") > -1) { blog_post_data.Tags = (string)(hist_content_data.MetaData[i].Text); } else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Trackback || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog trackback") > -1) { blog_post_data.TrackBackURL = (string)(hist_content_data.MetaData[i].Text); } } } if (!(folder_data.XmlConfiguration == null)) { bXmlContent = true; } } hist_content_data.Type = content_data.Type; PopulatePageData(hist_content_data, content_data); } Display_ContentHistoryToolBar(); break; } } else if (ContentId > 0) { m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId); switch (m_contentType) { case EkConstants.CMSContentType_CatalogEntry: Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi(); entry_data = m_refCatalogAPI.GetItem(ContentId); entry_version_data = m_refCatalogAPI.GetItemVersion(ContentId, m_refContentApi.ContentLanguage, HistoryId); PopulateCatalogPageData(entry_version_data, entry_data); Display_EntryHistoryToolBar(entry_data); break; default: content_data = m_refContentApi.GetContentById(ContentId, 0); PopulatePageData(hist_content_data, content_data); Display_ContentHistoryToolBar(); break; } } } else { m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId); content_data = m_refContentApi.GetContentById(ContentId, 0); switch (m_contentType) { case EkConstants.CMSContentType_CatalogEntry: Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi(); HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]); m_refCatalogAPI.Restore(ContentId, HistoryId); break; default: HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]); m_refContentApi.RestoreHistoryContent(HistoryId); break; } CloseOnRestore.Text = "<script type=\"text/javascript\">try { location.href = \'content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + ContentId + "&fldid=" + content_data.FolderId + "\'; } catch(e) {}</script>"; } } catch (Exception ex) { ShowError(ex.Message); } }
private void Display_PropertiesTab(EntryData entry_data_version) { System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "NAME"; colBound.HeaderText = ""; colBound.ItemStyle.CssClass = "label"; PropertiesGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "TITLE"; colBound.HeaderText = ""; PropertiesGrid.Columns.Add(colBound); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("NAME", typeof(string))); dt.Columns.Add(new DataColumn("TITLE", typeof(string))); int i = 0; dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content title label"); dr[1] = entry_data_version.Title; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content id label"); dr[1] = entry_data_version.Id; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content language label"); dr[1] = entry_data_version.LanguageId; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("lbl calatog entry sku") + " #:"; dr[1] = entry_data.Sku; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content status label"); switch (entry_data_version.Status.ToLower()) { case "a": dr[1] = m_refMsg.GetMessage("status:Approved (Published)"); break; case "o": dr[1] = m_refMsg.GetMessage("status:Checked Out"); break; case "i": dr[1] = m_refMsg.GetMessage("status:Checked In"); break; case "p": dr[1] = m_refMsg.GetMessage("status:Approved (PGLD)"); break; case "m": dr[1] = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Deletion") + "</font>"; break; case "s": dr[1] = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Approval") + "</font>"; break; case "t": dr[1] = m_refMsg.GetMessage("status:Waiting Approval"); break; case "d": dr[1] = "Deleted (Pending Start Date)"; break; } dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content LUE label"); dr[1] = entry_data_version.LastEditorFirstName + " " + entry_data_version.LastEditorLastName; //DisplayUserName dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content LED label"); dr[1] = entry_data_version.DateModified; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("generic start date label"); if (entry_data_version.GoLive == DateTime.MinValue || entry_data_version.GoLive == DateTime.MaxValue) { dr[1] = m_refMsg.GetMessage("none specified msg"); } else { dr[1] = entry_data_version.GoLive; } dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("generic end date label"); if (entry_data_version.EndDate == DateTime.MinValue || entry_data_version.EndDate == DateTime.MaxValue) { dr[1] = m_refMsg.GetMessage("none specified msg"); } else { dr[1] = entry_data_version.EndDate; } dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("End Date Action Title"); if (entry_data_version.EndDate == DateTime.MinValue || entry_data_version.EndDate == DateTime.MaxValue) { if (entry_data_version.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_archive_display) { dr[1] = m_refMsg.GetMessage("Archive display descrp"); } else if (entry_data_version.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_refresh) { dr[1] = m_refMsg.GetMessage("Refresh descrp"); } else { dr[1] = m_refMsg.GetMessage("Archive expire descrp"); } } else { dr[1] = m_refMsg.GetMessage("none specified msg"); } dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content DC label"); dr[1] = entry_data_version.DateModified; //DisplayDateCreated dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("content approvals label"); System.Text.StringBuilder approvallist = new System.Text.StringBuilder(); ApprovalData[] approvaldata; approvaldata = m_refContentApi.GetCurrentApprovalInfoByID(ContentId); approvallist.Append(m_refMsg.GetMessage("none specified msg")); if (!(approvaldata == null)) { if (approvaldata.Length > 0) { approvallist.Length = 0; for (i = 0; i <= approvaldata.Length - 1; i++) { if (approvaldata[i].Type == "user") { approvallist.Append("<img src=\"" + imagePath + "user.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user") + "\" title=\"" + m_refMsg.GetMessage("approver is user") + "\">"); } else { approvallist.Append("<img src=\"" + imagePath + "user.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user group") + "\" title=\"" + m_refMsg.GetMessage("approver is user group") + "\">"); } if (approvaldata[i].IsCurrentApprover) { approvallist.Append("<span class=\"important\">"); } else { approvallist.Append("<span>"); } approvallist.Append(approvaldata[i].DisplayUserName + "</span>"); } } } dr[1] = approvallist.ToString(); dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("xml configuration label"); dr[1] = " " + entry_data_version.ProductType.Title; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("generic template label"); dr[1] = ""; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = m_refMsg.GetMessage("generic Path"); dr[1] = m_refContentApi.EkContentRef.GetFolderPath(entry_data_version.FolderId); DataView dv = new DataView(dt); PropertiesGrid.DataSource = dv; PropertiesGrid.DataBind(); }
private void Display_PricingTab(EntryData versionData) { Currency m_refCurrency = new Currency(m_refContentApi.RequestInformationRef); Ektron.Cms.Workarea.workareabase workarearef = new Ektron.Cms.Workarea.workareabase(); List<CurrencyData> activeCurrencyList = m_refCurrency.GetActiveCurrencyList(); List<ExchangeRateData> exchangeRateList = new List<ExchangeRateData>(); if (activeCurrencyList.Count > 1) { ExchangeRateApi exchangeRateApi = new ExchangeRateApi(); Criteria<ExchangeRateProperty> exchangeRateCriteria = new Criteria<ExchangeRateProperty>(); List<long> currencyIDList = new List<long>(); for (int i = 0; i <= (activeCurrencyList.Count - 1); i++) { currencyIDList.Add(activeCurrencyList[i].Id); } exchangeRateCriteria.AddFilter(ExchangeRateProperty.BaseCurrencyId, CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId); exchangeRateCriteria.AddFilter(ExchangeRateProperty.ExchangeCurrencyId, CriteriaFilterOperator.In, currencyIDList.ToArray()); exchangeRateList = exchangeRateApi.GetCurrentList(exchangeRateCriteria); } ltr_pricing.Text = workarearef.CommerceLibrary.GetPricingMarkup(versionData.Pricing, activeCurrencyList, exchangeRateList, entry_data.EntryType, false, workareaCommerce.ModeType.View); }
private void Display_MetadataTab(EntryData versionData) { StringBuilder sbAttrib = new StringBuilder(); StringBuilder sbResult = new StringBuilder(); string strResult; string strAttrResult; string strImage = ""; ProductTypeApi prod_type_API = new ProductTypeApi(); ProductTypeData prod_type_data = null; EnhancedMetadataScript.Text = CustomFields.GetEnhancedMetadataScript().Replace("src=\"java/", "src=\"../java/"); EnhancedMetadataArea.Text = CustomFields.GetEnhancedMetadataArea(); if (prod_type_data == null) { prod_type_data = prod_type_API.GetItem(versionData.ProductType.Id); } if (versionData.Metadata.Count > 0 || prod_type_data.Attributes.Count > 0) { m_refSite = new Ektron.Cms.Site.EkSite(this.m_refContentApi.RequestInformationRef); Hashtable hPerm = m_refSite.GetPermissions(m_iFolder, 0, "folder"); sbResult.Append(Ektron.Cms.CustomFields.WriteFilteredMetadataForView(versionData.Metadata.ToArray(), versionData.FolderId, false).Trim()); if (prod_type_data != null) { sbAttrib.Append(CustomFields.WriteFilteredAttributesForView(versionData.Attributes, prod_type_data.Id, false,prod_type_data.Attributes)); } } if (m_sEditAction == "update") { strImage = versionData.Image; string strThumbnailPath = versionData.ImageThumbnail; if (versionData.ImageThumbnail == "") { strThumbnailPath = m_refContentApi.AppImgPath + "spacer.gif"; } else if (catalog_data.IsDomainFolder == true) { } else { strThumbnailPath = m_refContentApi.SitePath + strThumbnailPath; } sbResult.Append("<fieldset><legend>Image Data:</legend><table><tr><td class=\"label\" align=\"left\">Image:</td><td><span id=\"sitepath\"" + this.m_refContentApi.SitePath + "</span><input type=\"textbox\" size=\"30\" readonly=\"true\" id=\"content_image\" name=\"content_image\" value=\"" + strImage + "\" /></td></tr><tr><td colomnspan=\"2\"><img id=\"content_image_thumb\" src=\"" + strThumbnailPath + "\" /></td></tr></table></fieldset>"); } else { sbResult.Append("<fieldset><legend>Image Data:</legend><table><tr><td class=\"label\" align=\"left\">Image:</td><td><span id=\"sitepath\"" + this.m_refContentApi.SitePath + "</span><input type=\"textbox\" size=\"30\" readonly=\"true\" id=\"content_image\" name=\"content_image\" value=\"" + strImage + "\" /></td></tr><tr><td colomnspan=\"2\"><img id=\"content_image_thumb\" src=\"" + m_refContentApi.AppImgPath + "spacer.gif\" /></td></tr></table></fieldset>"); } strAttrResult = (string) (sbAttrib.ToString().Trim()); strResult = sbResult.ToString().Trim(); strResult = Util_FixPath(strResult); MetaDataValue.Text = strResult; ltr_attrib.Text = strAttrResult; }
private void Display_EntryHistoryToolBar(EntryData entry_data) { System.Text.StringBuilder result = new System.Text.StringBuilder(); divTitleBar.InnerHtml = m_refStyle.GetTitleBar((string) (m_refMsg.GetMessage("view catalog entry history title") + " \"" + entry_data.Title + "\"")); if (HistoryId != -1) { result.Append("<table><tr>"); result.Append(m_refStyle.GetButtonEventsWCaption(imagePath + "back.png", "javascript:history.go(-1);", m_refMsg.GetMessage("btn back"), m_refMsg.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true)); bool primaryCssApplied = false; if (security_data.CanRestore) { restore_id.Value = HistoryId.ToString(); if ((entry_data.Status.ToLower() != "o") && (entry_data.Status.ToLower() != "s") && (entry_data.Status.ToLower() != "p")) { result.Append(m_refStyle.GetButtonEventsWCaption(imagePath + "restore.png", "#", m_refMsg.GetMessage("alt restore button text"), m_refMsg.GetMessage("btn restore"), " onclick=\"javascript:document.forms[0].submit();return false;\" target=\"history_frame\"", StyleHelper.RestoreButtonCssClass, !primaryCssApplied)); primaryCssApplied = true; } result.Append(m_refStyle.GetButtonEventsWCaption(imagePath + "contentViewDifferences.png", "#", "View Content Difference", m_refMsg.GetMessage("btn view diff"), "onclick=\"javascript:PopUpWindow(\'compare.aspx?LangType=" + ContentLanguage + "&id=" + ContentId + "&hist_id=" + HistoryId + "\', \'Compare\', 800, 530, 0, 0);return false;\"", StyleHelper.ViewDifferenceButtonCssClass, !primaryCssApplied)); primaryCssApplied = true; } result.Append(m_refStyle.GetButtonEventsWCaption(imagePath + "history.png", (string) ("history.aspx?action=report&LangType=" + ContentLanguage + "&id=" + Request.QueryString["id"]), m_refMsg.GetMessage("view history report"), m_refMsg.GetMessage("view history report"), "", StyleHelper.HistoryButtonCssClass, !primaryCssApplied)); primaryCssApplied = true; result.Append(StyleHelper.ActionBarDivider); result.Append("<td>" + m_refStyle.GetHelpButton("ViewContentHistory", "") + "</td>"); result.Append("</tr></table>"); divToolBar.InnerHtml = result.ToString(); } else { divToolBar.Style.Add("height", "0"); } result = null; }
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 void Util_GetEntryType() { switch (prod_type_data.EntryClass) { case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct: entry_edit_data = new SubscriptionProductData(); entry_edit_data.EntryType = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct; break; case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle: entry_edit_data = new BundleData(); entry_edit_data.EntryType = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle; break; case Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit: entry_edit_data = new KitData(); entry_edit_data.EntryType = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit; break; default: entry_edit_data = new ProductData(); entry_edit_data.EntryType = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product; break; } }
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 object Process_GetSubscriptionInfo(EntryData entry) { Ektron.Cms.Commerce.Subscriptions.MembershipSubscriptionInfo subscriptionInfo = new Ektron.Cms.Commerce.Subscriptions.MembershipSubscriptionInfo(); long authorGroupId = 0; long memberGroupId = 0; try { if (Request.Form["EktronSusbscriptionCmsGroupMarkedForDelete"] == "false") { authorGroupId = Convert.ToInt64(Request.Form["EktronSusbscriptionCmsGroupId"]); } else { authorGroupId = 0; } memberGroupId = Convert.ToInt64(Request.Form["EktronSusbscriptionMembershipGroupId"]); subscriptionInfo.EntryId = entry.Id; subscriptionInfo.AuthorGroupId = authorGroupId; subscriptionInfo.MemberGroupId = memberGroupId; } catch (Exception) { } return subscriptionInfo; }
protected string Util_GetLinkJS(EntryData entryList) { string sRet = ""; if (bTabUseCase == true) { if ((string)(Request.QueryString["SelectedTab"].ToLower()) == "items") { sRet = "parent.Ektron.Commerce.CatalogEntry.Items.DefaultView.Add.addItem(\'" + entryList.Id + "\', \'" + entryList.Title + "\');"; } } else { switch (m_sPageAction) { case "couponselect": sRet = "parent.addRowToTable(null, " + entryList.Id + ", " + entryList.LanguageId + ", \'" + entryList.Title + "\', " + entryList.EntryType + "); parent.ektb_remove();"; break; case "coupon": sRet = ""; break; case "crosssell": case "upsell": sRet = "parent.addRowToTable(null, " + entryList.Id + ", \'" + entryList.Title + "\'); parent.ektb_remove();"; break; default: sRet = "parent.addRowToTable(null, " + entryList.Id + ", \'" + entryList.Title + "\'); parent.ektb_remove();"; break; } } return sRet; }
public EntryData Process_GetEntryValues(EntryData entry) { entry.Title = Request.Form["content_title"]; entry.Html = (string)contentEditor.Content; entry.Summary = (string)summaryEditor.Content; entry.Image = Process_GetDefaultImage(); // Request.Form("entry_image") entry.Comment = (string)hdnComment.Value; //entry.FolderId = m_iFolder entry.ProductType.Id = Convert.ToInt64(hdn_xmlid.Value); entry.TemplateId = Convert.ToInt64(drp_tempsel.SelectedValue); entry.Sku = (string)txt_sku.Text; entry.QuantityMultiple = EkFunctions.ReadIntegerValue(txt_quantity.Text, 1); // entry.EntryType = Request.Form("hdn_entrytype") entry.TaxClassId = Convert.ToInt64(drp_taxclass.SelectedValue); entry.IsArchived = System.Convert.ToBoolean(chk_avail.Checked); // entry.IsMarkedForDeletion = chk_markdel.Checked entry.IsBuyable = System.Convert.ToBoolean(chk_buyable.Checked); if (!chk_tangible.Checked) { entry.Dimensions.Height = 0; entry.Dimensions.Length = 0; entry.Dimensions.Width = 0; entry.Weight.Amount = 0; } else { if (m_refContentApi.RequestInformationRef.MeasurementSystem == Ektron.Cms.Common.EkEnumeration.MeasurementSystem.English) { entry.Dimensions.Units = LinearUnit.Inches; } else { entry.Dimensions.Units = LinearUnit.Centimeters; } entry.Dimensions.Height = (float)(EkFunctions.ReadDecimalValue(txt_height.Text, 0)); entry.Dimensions.Length = (float)(EkFunctions.ReadDecimalValue(txt_length.Text, 0)); entry.Dimensions.Width = (float)(EkFunctions.ReadDecimalValue(txt_width.Text, 0)); if (m_refContentApi.RequestInformationRef.MeasurementSystem == Ektron.Cms.Common.EkEnumeration.MeasurementSystem.English) { entry.Weight.Units = WeightUnit.Pounds; } else { entry.Weight.Units = WeightUnit.Kilograms; } entry.Weight.Amount = (float)(EkFunctions.ReadDecimalValue(txt_weight.Text, 0)); } entry.Pricing = Process_GetPricing(entry.Pricing); entry.Media = Process_GetMedia(null); entry.Metadata = Process_GetMetaData(); entry.Attributes = Process_GetAttributes(); if (Request.Form["end_date"] != null && Request.Form["end_date"] != "") { entry.EndDate = DateTime.Parse(Strings.Trim(Request.Form["end_date"])); entry.EndDateAction = System.Convert.ToInt32(rblaction.SelectedValue); if (entry.EndDateAction == 2) { entry.IsBuyable = false; chk_buyable.Checked = false; } } else { entry.EndDate = DateTime.MinValue; entry.EndDateAction = 0; } if (Request.Form["go_live"] != null && Request.Form["go_live"] != "") { entry.GoLive = Convert.ToDateTime(Request.Form["go_live"]); } else { entry.GoLive = DateTime.MinValue; } entry.DisableInventoryManagement = System.Convert.ToBoolean(chk_disableInv.Checked); return entry; }
protected string Util_GetLinkJS(EntryData entryList) { string sRet = ""; switch (m_sPageAction) { case "couponselect": sRet = "parent.addRowToTable(null, " + entryList.Id + ", " + entryList.LanguageId + ", \'" + entryList.Title + "\', " + entryList.EntryType + "); parent.ektb_remove();"; break; case "crosssellselect": case "upsellselect": sRet = "parent.addRowToTable(null, " + entryList.Id + ", \'" + entryList.Title + "\'); parent.ektb_remove();"; break; default: sRet = "parent.location.href=\'fulfillment.aspx?action=byproduct&productid=" + entryList.Id + "\'; "; break; } return sRet; }