本文整理汇总了C#中Template.SetProse方法的典型用法代码示例。如果您正苦于以下问题:C# Template.SetProse方法的具体用法?C# Template.SetProse怎么用?C# Template.SetProse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template.SetProse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTemplate
/// <summary>
/// Creates an isolated template class for the module to render
/// inside.
/// </summary>
public new void CreateTemplate()
{
template = new Template(core.Http.TemplatePath, "1301.html");
template.Parse("U_ACCOUNT", core.Hyperlink.AppendSid(Owner.AccountUriStub, true));
if (assembly != null)
{
template.AddPageAssembly(assembly);
template.SetProse(core.Prose);
}
List<string[]> breadCrumbParts = new List<string[]>();
breadCrumbParts.Add(new string[] { "forum", core.Prose.GetString("FORUM") });
breadCrumbParts.Add(new string[] { "mcp", core.Prose.GetString("MODERATOR_CONTROL_PANEL") });
Owner.ParseBreadCrumbs(core.Template, "BREADCRUMBS", breadCrumbParts);
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
bool isAjax = false;
long itemId;
long itemTypeId;
ItemKey itemKey = null;
IShareableItem item = null;
if (Request["ajax"] == "true")
{
isAjax = true;
}
if (!core.Session.IsLoggedIn)
{
core.Response.ShowMessage("notLoggedIn", "Not Logged In", "Sign in to share this item.");
}
string mode = Request.QueryString["mode"];
if (mode == "post")
{
template.SetTemplate("pane.share.post.html");
try
{
itemId = long.Parse((string)core.Http.Query["item"]);
itemTypeId = long.Parse((string)core.Http.Query["type"]);
itemKey = new ItemKey(itemId, itemTypeId);
item = (IShareableItem)NumberedItem.Reflect(core, itemKey);
TextBox messageTextBox = new TextBox("share-message");
PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "share-permissions", core.Session.LoggedInMember.ItemKey);
template.Parse("S_SHARE_MESSAGE", messageTextBox);
template.Parse("S_SHARE_PERMISSIONS", permissionSelectBox);
template.Parse("S_SHARED_URI", item.Info.ShareUri);
core.Display.ParseBbcode(template, "S_SHARED_STRING", core.Functions.Tldr("[share=\"[iurl=\"" + item.Uri + "\"]" + item.Owner.DisplayName + "[/iurl]\"]" + item.ShareString + "[/share]"), item.Owner);
}
catch
{
core.Response.SendRawText("errorFetchingItem", "");
return;
}
core.Response.SendRawText("sharingForm", template.ToString());
return;
}
// Save the Share
try
{
itemId = long.Parse((string)core.Http.Form["item"]);
itemTypeId = long.Parse((string)core.Http.Form["type"]);
}
catch
{
core.Response.SendRawText("errorFetchingItem", "");
return;
}
itemKey = new ItemKey(itemId, itemTypeId);
item = (IShareableItem)NumberedItem.Reflect(core, itemKey);
if (item is IPermissibleItem)
{
IPermissibleItem pitem = (IPermissibleItem)item;
if (!pitem.Access.IsPublic())
{
core.Response.ShowMessage("cannotShare", "Cannot Share", "You can only share public items.");
return;
}
}
string message = (string)core.Http.Form["share-message"] + "\n\n" + core.Functions.Tldr("[share=\"[iurl=\"" + item.Uri + "\"]" + item.Owner.DisplayName + "[/iurl]\"]" + item.ShareString + "[/share]");
StatusMessage newStatus = StatusMessage.Create(core, core.Session.LoggedInMember, message);
AccessControlLists acl = new AccessControlLists(core, newStatus);
acl.SaveNewItemPermissions("share-permissions");
core.Search.Index(newStatus);
ApplicationEntry ae = core.GetApplication("Profile");
ae.PublishToFeed(core, core.Session.LoggedInMember, newStatus, Functions.SingleLine(core.Bbcode.Flatten(newStatus.Message)));
Share.ShareItem(core, itemKey);
if (Request.Form["ajax"] == "true")
{
Template template = new Template("pane.statusmessage.html");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
VariableCollection statusMessageVariableCollection = template.CreateChild("status_messages");
core.Display.ParseBbcode(statusMessageVariableCollection, "STATUS_MESSAGE", core.Bbcode.FromStatusCode(newStatus.Message), core.Session.LoggedInMember, true, string.Empty, string.Empty);
statusMessageVariableCollection.Parse("STATUS_UPDATED", core.Tz.DateTimeToString(newStatus.GetTime(core.Tz)));
//.........这里部分代码省略.........
示例3: ShowMore
public static void ShowMore(Core core, TPage page, User owner)
{
if (core == null)
{
throw new NullCoreException();
}
Template template = new Template("pane.feeditem.html");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
bool moreContent = false;
long lastId = 0;
List<Action> feedActions = CombinedFeed.GetItems(core, owner, page.TopLevelPageNumber, 20, page.TopLevelPageOffset, out moreContent);
foreach (Action feedAction in feedActions)
{
VariableCollection feedItemVariableCollection = template.CreateChild("feed_days_list.feed_item");
core.Display.ParseBbcode(feedItemVariableCollection, "TITLE", feedAction.FormattedTitle);
core.Display.ParseBbcode(feedItemVariableCollection, "TEXT", feedAction.Body, core.PrimitiveCache[feedAction.OwnerId], true, string.Empty, string.Empty);
feedItemVariableCollection.Parse("USER_DISPLAY_NAME", feedAction.Owner.DisplayName);
feedItemVariableCollection.Parse("ID", feedAction.ActionItemKey.Id);
feedItemVariableCollection.Parse("TYPE_ID", feedAction.ActionItemKey.TypeId);
if (feedAction.ActionItemKey.GetType(core).Likeable)
{
feedItemVariableCollection.Parse("LIKEABLE", "TRUE");
if (feedAction.Info.Likes > 0)
{
feedItemVariableCollection.Parse("LIKES", string.Format(" {0:d}", feedAction.Info.Likes));
feedItemVariableCollection.Parse("DISLIKES", string.Format(" {0:d}", feedAction.Info.Dislikes));
}
}
if (feedAction.ActionItemKey.GetType(core).Commentable)
{
feedItemVariableCollection.Parse("COMMENTABLE", "TRUE");
if (feedAction.Info.Comments > 0)
{
feedItemVariableCollection.Parse("COMMENTS", string.Format(" ({0:d})", feedAction.Info.Comments));
}
}
//Access access = new Access(core, feedAction.ActionItemKey, true);
if (feedAction.PermissiveParent.Access.IsPublic())
{
feedItemVariableCollection.Parse("IS_PUBLIC", "TRUE");
if (feedAction.ActionItemKey.GetType(core).Shareable)
{
feedItemVariableCollection.Parse("SHAREABLE", "TRUE");
//feedItemVariableCollection.Parse("U_SHARE", feedAction.ShareUri);
if (feedAction.Info.SharedTimes > 0)
{
feedItemVariableCollection.Parse("SHARES", string.Format(" {0:d}", feedAction.Info.SharedTimes));
}
}
}
if (feedAction.Owner is User)
{
feedItemVariableCollection.Parse("USER_TILE", ((User)feedAction.Owner).Tile);
feedItemVariableCollection.Parse("USER_ICON", ((User)feedAction.Owner).Icon);
}
lastId = feedAction.Id;
}
string loadMoreUri = core.Hyperlink.BuildHomeUri() + "?p=" + (core.TopLevelPageNumber + 1) + "&o=" + lastId;
core.Response.SendRawText(moreContent ? loadMoreUri : "noMoreContent", template.ToString());
}
示例4: CreateTemplate
/// <summary>
/// Creates an isolated template class for the module to render
/// inside.
/// </summary>
private new void CreateTemplate()
{
string formSubmitUri = string.Empty;
template = new Template(core.Http.TemplatePath, "1301.html");
if (Owner != null)
{
formSubmitUri = core.Hyperlink.AppendSid(Owner.UriStub + "forum/mcp", true);
template.Parse("U_MCP", core.Hyperlink.AppendSid(Owner.UriStub + "forum/mcp/", true));
template.Parse("S_MCP", core.Hyperlink.AppendSid(Owner.UriStub + "forum/mcp/", true));
}
template.AddPageAssembly(Assembly.GetCallingAssembly());
template.SetProse(core.Prose);
Form = new Form("control-panel", formSubmitUri);
Form.SetValues(core.Http.Form);
if (core.Http.Form["save"] != null)
{
Form.IsFormSubmission = true;
}
core.Template.Parse("IS_CONTENT", "FALSE");
List<string[]> breadCrumbParts = new List<string[]>();
breadCrumbParts.Add(new string[] { "forum", core.Prose.GetString("FORUM") });
breadCrumbParts.Add(new string[] { "mcp", core.Prose.GetString("MODERATOR_CONTROL_PANEL") });
Owner.ParseBreadCrumbs(core.Template, "BREADCRUMBS", breadCrumbParts);
}
示例5: PostContent
void PostContent(HookEventArgs e)
{
VariableCollection styleSheetVariableCollection = core.Template.CreateChild("javascript_list");
styleSheetVariableCollection.Parse("URI", @"/scripts/load-image.min.js");
styleSheetVariableCollection = core.Template.CreateChild("javascript_list");
styleSheetVariableCollection.Parse("URI", @"/scripts/canvas-to-blob.min.js");
styleSheetVariableCollection = core.Template.CreateChild("javascript_list");
styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.iframe-transport.js");
styleSheetVariableCollection = core.Template.CreateChild("javascript_list");
styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.fileupload.js");
styleSheetVariableCollection = core.Template.CreateChild("javascript_list");
styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.fileupload-process.js");
styleSheetVariableCollection = core.Template.CreateChild("javascript_list");
styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.fileupload-image.js");
if (e.core.IsMobile)
{
return;
}
Template template = new Template(Assembly.GetExecutingAssembly(), "postphoto");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
string formSubmitUri = core.Hyperlink.AppendSid(e.Owner.AccountUriStub, true);
template.Parse("U_ACCOUNT", formSubmitUri);
template.Parse("S_ACCOUNT", formSubmitUri);
template.Parse("USER_DISPLAY_NAME", e.Owner.DisplayName);
CheckBox publishToFeedCheckBox = new CheckBox("publish-feed");
publishToFeedCheckBox.IsChecked = true;
CheckBox highQualityCheckBox = new CheckBox("high-quality");
highQualityCheckBox.IsChecked = false;
core.Display.ParseLicensingBox(template, "S_GALLERY_LICENSE", 0);
template.Parse("S_PUBLISH_FEED", publishToFeedCheckBox);
template.Parse("S_HIGH_QUALITY", highQualityCheckBox);
core.Display.ParseClassification(template, "S_PHOTO_CLASSIFICATION", Classifications.Everyone);
PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", e.Owner.ItemKey);
HiddenField aclModeField = new HiddenField("aclmode");
aclModeField.Value = "simple";
template.Parse("S_PERMISSIONS", permissionSelectBox);
template.Parse("S_ACLMODE", aclModeField);
//GallerySettings settings = new GallerySettings(core, e.Owner);
Gallery rootGallery = new Gallery(core, e.Owner);
List<Gallery> galleries = rootGallery.GetGalleries();
SelectBox galleriesSelectBox = new SelectBox("gallery-id");
foreach (Gallery gallery in galleries)
{
galleriesSelectBox.Add(new SelectBoxItem(gallery.Id.ToString(), gallery.GalleryTitle));
}
template.Parse("S_GALLERIES", galleriesSelectBox);
/* Title TextBox */
TextBox galleryTitleTextBox = new TextBox("gallery-title");
galleryTitleTextBox.MaxLength = 127;
template.Parse("S_GALLERY_TITLE", galleryTitleTextBox);
CheckBoxArray shareCheckBoxArray = new CheckBoxArray("share-radio");
shareCheckBoxArray.Layout = Layout.Horizontal;
CheckBox twitterSyndicateCheckBox = null;
CheckBox tumblrSyndicateCheckBox = null;
CheckBox facebookSyndicateCheckBox = null;
if (e.Owner is User)
{
User user = (User)e.Owner;
if (user.UserInfo.TwitterAuthenticated)
{
twitterSyndicateCheckBox = new CheckBox("photo-share-twitter");
twitterSyndicateCheckBox.Caption = "Twitter";
twitterSyndicateCheckBox.Icon = "https://g.twimg.com/twitter-bird-16x16.png";
twitterSyndicateCheckBox.IsChecked = user.UserInfo.TwitterSyndicate;
twitterSyndicateCheckBox.Width.Length = 0;
shareCheckBoxArray.Add(twitterSyndicateCheckBox);
}
if (user.UserInfo.TumblrAuthenticated)
{
tumblrSyndicateCheckBox = new CheckBox("photo-share-tumblr");
tumblrSyndicateCheckBox.Caption = "Tumblr";
tumblrSyndicateCheckBox.Icon = "https://platform.tumblr.com/v1/share_4.png";
tumblrSyndicateCheckBox.IsChecked = user.UserInfo.TumblrSyndicate;
tumblrSyndicateCheckBox.Width.Length = 0;
shareCheckBoxArray.Add(tumblrSyndicateCheckBox);
//.........这里部分代码省略.........
示例6: ShowGroupGallery
/// <summary>
/// Hook showing gallery items on a group profile.
/// </summary>
/// <param name="e">Hook event arguments</param>
public void ShowGroupGallery(HookEventArgs e)
{
UserGroup thisGroup = (UserGroup)e.Owner;
if (!(!thisGroup.IsGroupMember(e.core.LoggedInMemberItemKey) && thisGroup.GroupType == "CLOSED"))
{
Template template = new Template(Assembly.GetExecutingAssembly(), "viewprofilegallery");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
// show recent photographs in the gallery
Gallery gallery = new Gallery(e.core, thisGroup);
List<GalleryItem> galleryItems = gallery.GetItems(e.core, 1, 6, 0);
template.Parse("PHOTOS", thisGroup.GalleryItems.ToString());
foreach (GalleryItem galleryItem in galleryItems)
{
VariableCollection galleryVariableCollection = template.CreateChild("photo_list");
galleryVariableCollection.Parse("TITLE", galleryItem.ItemTitle);
galleryVariableCollection.Parse("PHOTO_URI", galleryItem.Uri);
galleryVariableCollection.Parse("THUMBNAIL", galleryItem.ThumbnailUri);
}
template.Parse("U_GROUP_GALLERY", Gallery.BuildGalleryUri(core, thisGroup));
e.core.AddMainPanel(template);
}
}
示例7: GetPostTemplate
public Template GetPostTemplate(Core core, Primitive owner)
{
Template template = new Template(Assembly.GetExecutingAssembly(), "postblog");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
string formSubmitUri = core.Hyperlink.AppendSid(owner.AccountUriStub, true);
template.Parse("U_ACCOUNT", formSubmitUri);
template.Parse("S_ACCOUNT", formSubmitUri);
template.Parse("USER_DISPLAY_NAME", owner.DisplayName);
Blog blog = null;
try
{
blog = new Blog(core, (User)owner);
}
catch (InvalidBlogException)
{
if (owner.ItemKey.Equals(core.LoggedInMemberItemKey))
{
blog = Blog.Create(core);
}
else
{
return null;
}
}
/* Title TextBox */
TextBox titleTextBox = new TextBox("title");
titleTextBox.MaxLength = 127;
/* Post TextBox */
TextBox postTextBox = new TextBox("post");
postTextBox.IsFormatted = true;
postTextBox.Lines = 15;
/* Tags TextBox */
TagSelectBox tagsTextBox = new TagSelectBox(core, "tags");
//tagsTextBox.MaxLength = 127;
CheckBox publishToFeedCheckBox = new CheckBox("publish-feed");
publishToFeedCheckBox.IsChecked = true;
PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", blog.ItemKey);
HiddenField aclModeField = new HiddenField("aclmode");
aclModeField.Value = "simple";
template.Parse("S_PERMISSIONS", permissionSelectBox);
template.Parse("S_ACLMODE", aclModeField);
DateTime postTime = DateTime.Now;
SelectBox postYearsSelectBox = new SelectBox("post-year");
for (int i = DateTime.Now.AddYears(-7).Year; i <= DateTime.Now.Year; i++)
{
postYearsSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString()));
}
postYearsSelectBox.SelectedKey = postTime.Year.ToString();
SelectBox postMonthsSelectBox = new SelectBox("post-month");
for (int i = 1; i < 13; i++)
{
postMonthsSelectBox.Add(new SelectBoxItem(i.ToString(), core.Functions.IntToMonth(i)));
}
postMonthsSelectBox.SelectedKey = postTime.Month.ToString();
SelectBox postDaysSelectBox = new SelectBox("post-day");
for (int i = 1; i < 32; i++)
{
postDaysSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString()));
}
postDaysSelectBox.SelectedKey = postTime.Day.ToString();
template.Parse("S_POST_YEAR", postYearsSelectBox);
template.Parse("S_POST_MONTH", postMonthsSelectBox);
template.Parse("S_POST_DAY", postDaysSelectBox);
template.Parse("S_POST_HOUR", postTime.Hour.ToString());
template.Parse("S_POST_MINUTE", postTime.Minute.ToString());
SelectBox licensesSelectBox = new SelectBox("license");
System.Data.Common.DbDataReader licensesReader = core.Db.ReaderQuery(ContentLicense.GetSelectQueryStub(core, typeof(ContentLicense)));
licensesSelectBox.Add(new SelectBoxItem("0", "Default License"));
while(licensesReader.Read())
{
ContentLicense li = new ContentLicense(core, licensesReader);
licensesSelectBox.Add(new SelectBoxItem(li.Id.ToString(), li.Title));
}
licensesReader.Close();
licensesReader.Dispose();
SelectBox categoriesSelectBox = new SelectBox("category");
SelectQuery query = Category.GetSelectQueryStub(core, typeof(Category));
//.........这里部分代码省略.........
示例8: CreateTemplate
/// <summary>
/// Creates an isolated template class for the module to render
/// inside.
/// </summary>
private void CreateTemplate()
{
string formSubmitUri = string.Empty;
template = new Template(core.Http.TemplatePath, "1301.html");
template.Medium = core.Template.Medium;
if (Owner != null)
{
formSubmitUri = core.Hyperlink.AppendSid(Owner.AccountUriStub, true);
template.Parse("U_ACCOUNT", formSubmitUri);
template.Parse("S_ACCOUNT", formSubmitUri);
}
template.AddPageAssembly(Assembly.GetCallingAssembly());
template.SetProse(core.Prose);
Form = new Form("control-panel", formSubmitUri);
Form.SetValues(core.Http.Form);
if (core.Http.Form["save"] != null)
{
Form.IsFormSubmission = true;
}
core.Template.Parse("IS_CONTENT", "FALSE");
template.Parse("SITE_TITLE", core.Settings.SiteTitle);
}
示例9: RenderPreview
public Template RenderPreview()
{
Template template = new Template("search_result.user.html");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
template.Parse("USER_DISPLAY_NAME", DisplayName);
template.Parse("ICON", Icon);
template.Parse("TILE", Tile);
template.Parse("U_PROFILE", Uri);
template.Parse("JOIN_DATE", core.Tz.DateTimeToString(UserInfo.GetRegistrationDate(core.Tz)));
template.Parse("USER_AGE", Profile.AgeString);
template.Parse("USER_COUNTRY", Profile.Country);
if (core.Session.IsLoggedIn)
{
List<long> friendIds = core.Session.LoggedInMember.GetFriendIds();
if (!friendIds.Contains(Id))
{
template.Parse("U_ADD_FRIEND", core.Hyperlink.BuildAddFriendUri(Id, true));
}
}
return template;
}
示例10: ShowMore
public static void ShowMore(Core core, ShowUPageEventArgs e)
{
if (core == null)
{
throw new NullCoreException();
}
if (!e.Page.Owner.Access.Can("VIEW"))
{
core.Functions.Generate403();
return;
}
Template template = new Template("pane.statusmessage.html");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
bool moreContent = false;
long lastId = 0;
List<StatusMessage> items = StatusFeed.GetItems(core, (User)e.Page.Owner, e.Page.TopLevelPageNumber, 20, e.Page.TopLevelPageOffset, out moreContent);
foreach (StatusMessage item in items)
{
VariableCollection statusMessageVariableCollection = template.CreateChild("status_messages");
core.Display.ParseBbcode(statusMessageVariableCollection, "STATUS_MESSAGE", core.Bbcode.FromStatusCode(item.Message), e.Page.Owner, true, string.Empty, string.Empty);
statusMessageVariableCollection.Parse("STATUS_UPDATED", core.Tz.DateTimeToString(item.GetTime(core.Tz)));
statusMessageVariableCollection.Parse("ID", item.Id.ToString());
statusMessageVariableCollection.Parse("TYPE_ID", item.ItemKey.TypeId.ToString());
statusMessageVariableCollection.Parse("USERNAME", item.Poster.DisplayName);
statusMessageVariableCollection.Parse("USER_ID", item.Poster.Id);
statusMessageVariableCollection.Parse("U_PROFILE", item.Poster.ProfileUri);
statusMessageVariableCollection.Parse("U_QUOTE", string.Empty /*core.Hyperlink.BuildCommentQuoteUri(item.Id)*/);
statusMessageVariableCollection.Parse("U_REPORT", string.Empty /*core.Hyperlink.BuildCommentReportUri(item.Id)*/);
statusMessageVariableCollection.Parse("U_DELETE", string.Empty /*core.Hyperlink.BuildCommentDeleteUri(item.Id)*/);
statusMessageVariableCollection.Parse("U_PERMISSIONS", item.Access.AclUri);
statusMessageVariableCollection.Parse("USER_TILE", item.Poster.Tile);
statusMessageVariableCollection.Parse("USER_ICON", item.Poster.Icon);
statusMessageVariableCollection.Parse("URI", item.Uri);
if (core.Session.IsLoggedIn)
{
if (item.Owner.Id == core.Session.LoggedInMember.Id)
{
statusMessageVariableCollection.Parse("IS_OWNER", "TRUE");
}
}
if (item.Info.Likes > 0)
{
statusMessageVariableCollection.Parse("LIKES", string.Format(" {0:d}", item.Info.Likes));
statusMessageVariableCollection.Parse("DISLIKES", string.Format(" {0:d}", item.Info.Dislikes));
}
if (item.Info.Comments > 0)
{
statusMessageVariableCollection.Parse("COMMENTS", string.Format(" ({0:d})", item.Info.Comments));
}
if (item.Access.IsPublic())
{
statusMessageVariableCollection.Parse("IS_PUBLIC", "TRUE");
if (item.ItemKey.GetType(core).Shareable)
{
statusMessageVariableCollection.Parse("SHAREABLE", "TRUE");
statusMessageVariableCollection.Parse("U_SHARE", item.ShareUri);
if (item.Info.SharedTimes > 0)
{
statusMessageVariableCollection.Parse("SHARES", string.Format(" {0:d}", item.Info.SharedTimes));
}
}
}
lastId = item.Id;
}
string loadMoreUri = core.Hyperlink.BuildStatusUri((User)e.Page.Owner) + "?p=" + (core.TopLevelPageNumber + 1) + "&o=" + lastId;
core.Response.SendRawText(moreContent ? loadMoreUri : "noMoreContent", template.ToString());
}
示例11: core_FootHooks
void core_FootHooks(HookEventArgs e)
{
if (e.PageType == AppPrimitives.Musician)
{
Template template = new Template(Assembly.GetExecutingAssembly(), "music_footer");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
if (e.Owner.Type == "MUSIC")
{
if (((Musician)e.Owner).IsMusicianMember(core.Session.LoggedInMember.ItemKey))
{
template.Parse("U_MUSICIAN_ACCOUNT", core.Hyperlink.AppendSid(e.Owner.AccountUriStub));
}
}
e.core.AddFootPanel(template);
}
}
示例12: ShowToday
void ShowToday(HookEventArgs e)
{
Template template = new Template(Assembly.GetExecutingAssembly(), "todayupcommingevents");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
long startTime = e.core.Tz.GetUnixTimeStamp(new DateTime(e.core.Tz.Now.Year, e.core.Tz.Now.Month, e.core.Tz.Now.Day, 0, 0, 0));
long endTime = startTime + 60 * 60 * 24 * 7; // skip ahead one week into the future
Calendar cal = null;
try
{
cal = new Calendar(core, core.Session.LoggedInMember);
}
catch (InvalidCalendarException)
{
cal = Calendar.Create(core, core.Session.LoggedInMember);
}
List<Event> events = cal.GetEvents(core, e.core.Session.LoggedInMember, startTime, endTime);
template.Parse("U_NEW_EVENT", core.Hyperlink.AppendSid(string.Format("{0}calendar/new-event",
e.core.Session.LoggedInMember.AccountUriStub)));
template.Parse("U_CALENDAR", core.Hyperlink.AppendSid(string.Format("{0}calendar",
e.core.Session.LoggedInMember.UriStub)));
VariableCollection appointmentDaysVariableCollection = null;
DateTime lastDay = e.core.Tz.Now;
if (events.Count > 0)
{
template.Parse("HAS_EVENTS", "TRUE");
}
foreach(Event calendarEvent in events)
{
DateTime eventDay = calendarEvent.GetStartTime(e.core.Tz);
DateTime eventEnd = calendarEvent.GetEndTime(e.core.Tz);
if (appointmentDaysVariableCollection == null || lastDay.Day != eventDay.Day)
{
lastDay = eventDay;
appointmentDaysVariableCollection = template.CreateChild("appointment_days_list");
appointmentDaysVariableCollection.Parse("DAY", core.Tz.DateTimeToDateString(eventDay));
}
VariableCollection appointmentVariableCollection = appointmentDaysVariableCollection.CreateChild("appointments_list");
appointmentVariableCollection.Parse("TIME", eventDay.ToShortTimeString() + " - " + eventEnd.ToShortTimeString());
appointmentVariableCollection.Parse("SUBJECT", calendarEvent.Subject);
appointmentVariableCollection.Parse("LOCATION", calendarEvent.Location);
appointmentVariableCollection.Parse("URI", Event.BuildEventUri(core, calendarEvent));
}
e.core.AddMainPanel(template);
//
// Tasks panel
//
template = new Template(Assembly.GetExecutingAssembly(), "todaytaskspanel");
template.SetProse(core.Prose);
List<Task> tasks = cal.GetTasks(core, e.core.Session.LoggedInMember, startTime, endTime, true);
VariableCollection taskDaysVariableCollection = null;
lastDay = e.core.Tz.Now;
if (tasks.Count > 0)
{
template.Parse("HAS_TASKS", "TRUE");
}
template.Parse("U_TASKS", Task.BuildTasksUri(e.core, e.core.Session.LoggedInMember));
foreach (Task calendarTask in tasks)
{
DateTime taskDue = calendarTask.GetDueTime(e.core.Tz);
if (taskDaysVariableCollection == null || lastDay.Day != taskDue.Day)
{
lastDay = taskDue;
taskDaysVariableCollection = template.CreateChild("task_days");
taskDaysVariableCollection.Parse("DAY", taskDue.DayOfWeek.ToString());
}
VariableCollection taskVariableCollection = taskDaysVariableCollection.CreateChild("task_list");
taskVariableCollection.Parse("DATE", taskDue.ToShortDateString() + " (" + taskDue.ToShortTimeString() + ")");
taskVariableCollection.Parse("TOPIC", calendarTask.Topic);
taskVariableCollection.Parse("ID", calendarTask.Id.ToString());
taskVariableCollection.Parse("URI", Task.BuildTaskUri(core, calendarTask));
taskVariableCollection.Parse("U_MARK_COMPLETE", Task.BuildTaskMarkCompleteUri(core, calendarTask));
if (calendarTask.Status == TaskStatus.Overdue)
{
taskVariableCollection.Parse("OVERDUE", "TRUE");
taskVariableCollection.Parse("CLASS", "overdue-task");
//.........这里部分代码省略.........
示例13: ShowMiniCalendar
void ShowMiniCalendar(HookEventArgs e)
{
Template template = new Template(Assembly.GetExecutingAssembly(), "todaymonthpanel");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
template.Parse("URI", Calendar.BuildMonthUri(e.core, e.core.Session.LoggedInMember, e.core.Tz.Now.Year, e.core.Tz.Now.Month));
Calendar.DisplayMiniCalendar(e.core, template, e.core.Session.LoggedInMember, e.core.Tz.Now.Year, e.core.Tz.Now.Month);
e.core.AddSidePanel(template);
}
示例14: RenderPreview
public Template RenderPreview()
{
Template template = new Template(Assembly.GetExecutingAssembly(), "search_result_galleryitem");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
VariableCollection statusMessageVariableCollection = template.CreateChild("status_messages");
//statusMessageVariableCollection.Parse("STATUS_MESSAGE", item.Message);
core.Display.ParseBbcode(statusMessageVariableCollection, "STATUS_MESSAGE", core.Bbcode.FromStatusCode(GetActionBody(new List<ItemKey>())), owner, true, string.Empty, string.Empty);
statusMessageVariableCollection.Parse("STATUS_UPDATED", core.Tz.DateTimeToString(GetCreatedDate(core.Tz)));
statusMessageVariableCollection.Parse("ID", Id.ToString());
statusMessageVariableCollection.Parse("TYPE_ID", ItemKey.TypeId.ToString());
statusMessageVariableCollection.Parse("USERNAME", Owner.DisplayName);
statusMessageVariableCollection.Parse("USER_ID", Owner.Id);
statusMessageVariableCollection.Parse("U_PROFILE", Owner.Uri); // TODO: ProfileUri for primitive
statusMessageVariableCollection.Parse("U_PERMISSIONS", Parent.Access.AclUri);
statusMessageVariableCollection.Parse("USER_TILE", Owner.Tile);
statusMessageVariableCollection.Parse("USER_ICON", Owner.Icon);
statusMessageVariableCollection.Parse("URI", Uri);
if (core.Session.IsLoggedIn)
{
if (Owner is User && Owner.Id == core.Session.LoggedInMember.Id)
{
statusMessageVariableCollection.Parse("IS_OWNER", "TRUE");
}
}
if (Info.Likes > 0)
{
statusMessageVariableCollection.Parse("LIKES", string.Format(" {0:d}", Info.Likes));
statusMessageVariableCollection.Parse("DISLIKES", string.Format(" {0:d}", Info.Dislikes));
}
if (Info.Comments > 0)
{
statusMessageVariableCollection.Parse("COMMENTS", string.Format(" ({0:d})", Info.Comments));
}
return template;
}
示例15: ShowMemberGroups
public void ShowMemberGroups(HookEventArgs e)
{
User profileOwner = (User)e.Owner;
Template template = new Template(Assembly.GetExecutingAssembly(), "viewprofilegroups");
template.Medium = core.Template.Medium;
template.SetProse(core.Prose);
List<UserGroup> groups = UserGroup.GetUserGroups(e.core, profileOwner, 1, 4);
if (groups.Count > 0)
{
template.Parse("HAS_GROUPS", "TRUE");
}
foreach(UserGroup group in groups)
{
VariableCollection groupVariableCollection = template.CreateChild("groups_list");
groupVariableCollection.Parse("TITLE", group.DisplayName);
groupVariableCollection.Parse("U_GROUP", group.Uri);
groupVariableCollection.Parse("ICON", group.Icon);
groupVariableCollection.Parse("TILE", group.Tile);
groupVariableCollection.Parse("SQUARE", group.Square);
}
e.core.AddSidePanel(template);
}