//[DeploymentItem("facebook.dll")] public void registerTemplateBundleTest() { var parent = _api; var target = parent.feed; string oneLineStoryTemplate = "{*actor*} has been playing."; string shortStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string shortStoryTemplateBody = "short story body"; string fullStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string fullStoryTemplateBody = "full story body"; template_bundle expected; long actual; List <string> oneLineTemplates = new List <string> { oneLineStoryTemplate }; feedTemplate shortStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = shortStoryTemplateBody, TemplateTitle = shortStoryTemplateTitle }; List <feedTemplate> shortStoryTemplates = new List <feedTemplate> { shortStoryTemplate }; feedTemplate fullStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = fullStoryTemplateBody, TemplateTitle = fullStoryTemplateTitle }; actual = target.registerTemplateBundle(oneLineTemplates, shortStoryTemplates, fullStoryTemplate); expected = target.getRegisteredTemplateBundleByID(actual); Assert.AreEqual(expected.template_bundle_id, actual); }
private long RegisterNewBundle() { string oneLineStoryTemplate = "{*actor*} has been playing."; string shortStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string shortStoryTemplateBody = "short story body"; string fullStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string fullStoryTemplateBody = "full story body"; List <string> oneLineTemplates = new List <string> { oneLineStoryTemplate }; feedTemplate shortStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = shortStoryTemplateBody, TemplateTitle = shortStoryTemplateTitle }; List <feedTemplate> shortStoryTemplates = new List <feedTemplate> { shortStoryTemplate }; feedTemplate fullStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = fullStoryTemplateBody, TemplateTitle = fullStoryTemplateTitle }; return(_apiWeb.Feed.RegisterTemplateBundle(oneLineTemplates, shortStoryTemplates, fullStoryTemplate)); }
private void ContinuePublishUserActionTest() { string oneLineStoryTemplate = "{*actor*} has been playing at {*host*}'s house."; string shortStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string shortStoryTemplateBody = "short story body from {*host*}'s house"; string fullStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string fullStoryTemplateBody = "full story body from {*host*}'s house."; List <string> oneLineTemplates = new List <string> { oneLineStoryTemplate }; feedTemplate shortStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = shortStoryTemplateBody, TemplateTitle = shortStoryTemplateTitle }; List <feedTemplate> shortStoryTemplates = new List <feedTemplate> { shortStoryTemplate }; feedTemplate fullStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = fullStoryTemplateBody, TemplateTitle = fullStoryTemplateTitle }; _api.Feed.RegisterTemplateBundleAsync(oneLineTemplates, shortStoryTemplates, fullStoryTemplate, OnRegisterForPublishUserActionCompleted, null); }
private void ConstructTestTemplates(out List <string> oneLineTemplates, out List <feedTemplate> shortStoryTemplates, out feedTemplate fullStoryTemplate) { string oneLineStoryTemplate = "{*actor*} has been playing."; string shortStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string shortStoryTemplateBody = "short story body"; string fullStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string fullStoryTemplateBody = "full story body"; oneLineTemplates = new List <string> { oneLineStoryTemplate }; feedTemplate shortStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = shortStoryTemplateBody, TemplateTitle = shortStoryTemplateTitle }; shortStoryTemplates = new List <feedTemplate> { shortStoryTemplate }; fullStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = fullStoryTemplateBody, TemplateTitle = fullStoryTemplateTitle }; }
public void publishUserActionTest() { string oneLineStoryTemplate = "{*actor*} has been playing at {*host*}'s house."; string shortStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string shortStoryTemplateBody = "short story body from {*host*}'s house"; string fullStoryTemplateTitle = "{*actor*} has been <a href='http://www.facebook.com/apps/application.php?id=xxx>Playing Poker!</a>"; string fullStoryTemplateBody = "full story body from {*host*}'s house."; List <string> oneLineTemplates = new List <string> { oneLineStoryTemplate }; feedTemplate shortStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = shortStoryTemplateBody, TemplateTitle = shortStoryTemplateTitle }; List <feedTemplate> shortStoryTemplates = new List <feedTemplate> { shortStoryTemplate }; feedTemplate fullStoryTemplate = new feedTemplate { PreferredLayout = "1", TemplateBody = fullStoryTemplateBody, TemplateTitle = fullStoryTemplateTitle }; var templateBundleId = _api.Feed.RegisterTemplateBundle(oneLineTemplates, shortStoryTemplates, fullStoryTemplate); List <long> friendTargets = new List <long> { Constants.FBSamples_friend1, Constants.FBSamples_friend2 }; Dictionary <string, string> body_data = new Dictionary <string, string> { { "host", "Run" } }; var actual = _api.Feed.PublishUserAction(templateBundleId, body_data, friendTargets, null, Feed.PublishedStorySize.Short); Assert.IsTrue(actual); // TODO: find a way to deactivate the template bundle just created, since calls to feed.deactivateTemplateBundleById don't seem to // work. The error returned says that only the owner of a desktop app can deactivate template bundles, but this user should be the // owner of this app. Currently, we have to periodically go in to the Registered Templates Console and deactivate a bunch of templates // so that we don't go over our limit. }
protected void Page_Load(object sender, EventArgs e) { var t1 = WebConfigurationManager.AppSettings["TemplateID1"]; var t2 = WebConfigurationManager.AppSettings["TemplateID2"]; var dict = new Dictionary <string, string> { { "application_name", "Smiley.NET" }, { "callback_url", callback }, { "tab_default_name", "Smile.NET" }, { "profile_tab_url", "mysmiles.aspx" }, { "publish_action", "Smile at!" }, { "publish_url", callback + "handlers/otherPublishHandler.aspx" }, { "publish_self_action", "Smile!" }, { "publish_self_url", callback + "handlers/publishHandler.aspx" }, { "info_changed_url", callback + "handlers/infoHandler.aspx" }, { "wide_mode", "1" } }; this.Api.Admin.SetAppProperties(dict); var one_line_story = new List <string> { "{*actor*} is feeling {*mood*} today" }; var short_story = new List <feedTemplate>(); var short_story_template = new feedTemplate { TemplateTitle = "{*actor*} is feeling so {*mood*} today", TemplateBody = "{*actor*} just wanted to let you know that he is so {*mood*} today", PreferredLayout = "1" }; short_story.Add(short_story_template); var full_story = new feedTemplate { TemplateTitle = "{*actor*} is feeling very {*mood*} today", TemplateBody = "<div style=\"padding: 10px;width : 200px;height : 200px;margin: auto;text-align: center;border: black 1px;cursor: pointer;border: black solid 2px;background: orange;color: black;text-decoration: none;\"><div style=\"font-size: 60pt;font-weight: bold;padding: 40px;\">{*emote*}</div><div style=\"font-size: 20px; font-weight:bold;\">{*mood*}</div></div>" }; if (string.IsNullOrEmpty(t1)) { long bundle1id = this.Api.Feed.RegisterTemplateBundle(one_line_story, short_story, full_story); this.template1.Text = "Bundle 1 is empty = " + bundle1id; } else { this.template1.Text = "Bundle 1 is " + t1; } one_line_story = new List <string> { "{*actor*} just wanted to {*emote*} at {*target*} today" }; short_story = new List <feedTemplate>(); short_story_template = new feedTemplate { TemplateTitle = "{*actor*} just wanted to {*emote*} at {*target*} today", TemplateBody = "Always a great day to {*emoteaction*}", PreferredLayout = "1" }; short_story.Add(short_story_template); full_story = new feedTemplate { TemplateTitle = "{*actor*} just wanted to {*emote*} at {*target*} today", TemplateBody = "Always a great day to {*emoteaction*}" }; if (string.IsNullOrEmpty(t2)) { long bundle2id = this.Api.Feed.RegisterTemplateBundle(one_line_story, short_story, full_story); this.template2.Text = "Bundle 2 is empty = " + bundle2id; } else { this.template2.Text = "Bundle 2 is " + t2; } var options = new List <info_item>(); options.Add(new info_item { label = "Happy", image = callback + "images/smile0.jpg", sublabel = "", description = "The original and still undefeated.", link = "http://apps.facebook.com/" + suffix + "/smile.aspx?smile=1" }); options.Add(new info_item { label = "Indifferent", image = callback + "images/smile1.jpg", sublabel = "", description = "meh....", link = "http://apps.facebook.com/" + suffix + "/smile.aspx?smile=2" }); options.Add(new info_item { label = "Sad", image = callback + "images/smile2.jpg", sublabel = "", description = "Oh my god! you killed my dog!", link = "http://apps.facebook.com/" + suffix + "/smile.aspx?smile=3" }); options.Add(new info_item { label = "Cool", image = callback + "images/smile3.jpg", sublabel = "", description = "Yeah. whatever", link = "http://apps.facebook.com/" + suffix + "/smile.aspx?smile=4" }); this.Api.Profile.SetInfoOptions("My Smiles", options); }