|
//
// Text2Mambo - convert HTML to mambo CMS
// Copyright (C) 2009-2011 John Janssen
// http://www.travelisfun.org
//
// This program is free software; you can redistribute it and/or modify
// it any way you want as long as the above copyright statement is maintained.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.Win32;
using Text2Mambo;
namespace Text2Mambo.Tools
{
/// <summary>
/// Structure to hold an content item, with a list of paragraphs.
/// </summary>
class ContentsItem : Collection<String>
{
public String userId;
public String sectionId;
public String categoryId;
public String userAlias;
public DateTime dateTime;
public String title;
public bool publish;
public bool frontpage;
public bool staticContent;
public bool dateItem;
/// <summary>
/// Default constructor
/// </summary>
public ContentsItem()
{
publish = true;
frontpage = false;
staticContent = false;
dateItem = false;
}
/// <summary>
/// Adding a paragraph to the content item.
/// </summary>
/// <param name="paragraph"></param>
public void AddParagraph(String paragraph)
{
AddParagraph(paragraph, true, false);
}
/// <summary>
/// Adding a paragraph to the content item.
/// </summary>
/// <param name="paragraph"></param>
/// <param name="wrapInParagraph"></param>
public void AddParagraph(String paragraph, bool wrapInParagraph)
{
AddParagraph(paragraph, wrapInParagraph, false);
}
/// <summary>
/// Adding a paragraph to the content item.
/// </summary>
/// <param name="paragraph">The paragraph text.</param>
/// <param name="wrapInParagraph"></param>
/// <param name="addEmpty"></param>
public void AddParagraph(String paragraph, bool wrapInParagraph, bool addEmpty)
{
// Check for zero length paragraph's
if (paragraph.Length == 0 && !addEmpty)
return;
if (paragraph[0] != '<')
{
if (wrapInParagraph)
paragraph = "<p class=MsoNormal>" + paragraph + "</p>";
}
base.Add(paragraph);
}
/// <summary>
/// Returns the number of paragraphs in the content item.
/// </summary>
/// <returns></returns>
public int ParagraphCount()
{
return base.Count;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Started in 1988 programming in Pascal, making a 68000 emulator on a DOS platform. Then from Pascal to Clipper, to C++ and now using C#. I've been programming for all walks of businesses; opticians, opthomologist, carbage collectors, reinforcement steel producers, retail chains, and more.
I'm now travelling through Africa with a home-build expedition truck.