public Workarea_MenuActions() { m_CommonApi = new CommonApi(); m_ContentApi = new ContentAPI(); m_EkContent = m_ContentApi.EkContentRef; m_refMsg = m_ContentApi.EkMsgRef; }
protected void Page_Init(object sender, EventArgs e) { Page.ClientScript.GetPostBackEventReference(this, string.Empty); CommonApi commonApi = new CommonApi(); m_refMsg = commonApi.EkMsgRef; string sitepath = commonApi.SitePath; Package ruleEditorUI = new Package() { Components = new List<Ektron.Cms.Framework.UI.Component> { // JS Packages.Ektron.StringObject, Packages.Ektron.JSON, JavaScript.Create(Path.Combine(this.TemplateSourceDirectory, @"js\RuleEditor.js").Replace(@"\", "/")), JavaScript.Create(Path.Combine(this.TemplateSourceDirectory, @"js\ektron.autogrow.js").Replace(@"\", "/")), JavaScript.Create(Path.Combine(this.TemplateSourceDirectory, @"js\ektron.jeditable.js").Replace(@"\", "/")), JavaScript.Create(Path.Combine(this.TemplateSourceDirectory, @"js\ektron.dropdown.js").Replace(@"\", "/")), // Css Packages.jQuery.jQueryUI.ThemeRoller, Ektron.Cms.Framework.UI.Css.Create(Path.Combine(this.TemplateSourceDirectory, @"css\RuleEditor.css").Replace(@"\", "/")) } }; ruleEditorUI.Register(this); JavaScript.RegisterJavaScriptBlock(this, string.Format("Ektron.RuleEditor.init('{0}', '{1}');", UniqueID, container.ClientID), false); }
protected void Page_Init(object sender, EventArgs e) { _host = Ektron.Cms.Widget.WidgetHost.GetHost(this); _host.Title = "Google Conversion"; _host.Maximize += new MaximizeDelegate(delegate() { Visible = true; }); _host.Minimize += new MinimizeDelegate(delegate() { Visible = false; }); _host.Edit += new EditDelegate(EditEvent); if ((Page as PageBuilder).Status != Mode.Editing && _ConversionScript != "") { Page.Controls.Add(new LiteralControl(_ConversionScript)); litViewText.Visible = false; } else { litViewText.Visible = true; } string sitepath = new CommonApi().SitePath; imgConversion.ImageUrl = sitepath + "widgets/GoogleConversion/images/trackingthumb.gif"; imgConversion.CssClass = "google-thumbnail"; ScriptManager.RegisterClientScriptInclude(this, this.GetType(), "GoogleConversion1", sitepath + "widgets/GoogleConversion/js/googleconversion.js"); Css.RegisterCss(this, sitepath + "widgets/GoogleConversion/css/googleconversion.css", "googleconversioncss"); ScriptManager.RegisterOnSubmitStatement(this.Page, this.GetType(), "googleconversion", String.Format("Ektron.Widget.GoogleConversion.EscapeHTML('{0}');", tbConversionScript.ClientID)); ViewSet.SetActiveView(View); }
protected void Page_Init(object sender, EventArgs e) { string sitepath = new CommonApi().SitePath; JS.RegisterJSInclude(this, JS.ManagedScript.EktronJS); JS.RegisterJSInclude(this, JS.ManagedScript.EktronModalJS); Css.RegisterCss(this, Css.ManagedStyleSheet.EktronModalCss); _host = Ektron.Cms.Widget.WidgetHost.GetHost(this); _host.Title = "Hello World Widget"; _host.Edit += new EditDelegate(EditEvent); _host.Maximize += new MaximizeDelegate(delegate() { Visible = true; }); _host.Minimize += new MinimizeDelegate(delegate() { Visible = false; }); _host.Create += new CreateDelegate(delegate() { EditEvent(""); }); PreRender += new EventHandler(delegate(object PreRenderSender, EventArgs Evt) { SetOutput(); }); string myPath = string.Empty; if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ek_helpDomainPrefix"])) { string helpDomain = ConfigurationManager.AppSettings["ek_helpDomainPrefix"]; if ((helpDomain.IndexOf("[ek_cmsversion]") > 1)) { myPath = helpDomain.Replace("[ek_cmsversion]", new CommonApi().RequestInformationRef.Version); } else { myPath = ConfigurationManager.AppSettings["ek_helpDomainPrefix"]; } } else { myPath = sitepath + "Workarea/help"; } _host.HelpFile = myPath + "/Widget Chapter/Hello World/Creating the Hello World Widget.htm"; ViewSet.SetActiveView(View); }
/// <summary> /// Constructor /// </summary> public Sync() { _presenter = new SyncRelationshipsPresenter(this); _commonApi = new CommonApi(); _siteApi = new SiteAPI(); _styleHelper = new StyleHelper(); }
public EmailHelper() { CommonApi objCommonApi = new CommonApi(); gtMessEmail = objCommonApi.EkMsgRef; AppImgPath = objCommonApi.AppImgPath; AppPath = objCommonApi.AppPath; }
public SyncHistory() { _presenter = new SyncHistoryPresenter(this); _commonApi = new CommonApi(); _siteApi = new SiteAPI(); _styleHelper = new StyleHelper(); }
void EditEvent(string settings) { string sitepath = new CommonApi().SitePath; ScriptManager.RegisterClientScriptInclude(this, this.GetType(), "widgetjavascript", sitepath + "widgets/widgets.js"); ScriptManager.RegisterOnSubmitStatement(this.Page, this.GetType(), "gadgetescapehtml", "GadgetEscapeHTML('" + TextTextBox.ClientID + "');"); TextTextBox.Text = TextData; ViewSet.SetActiveView(Edit); }
protected void Page_Init(object sender, EventArgs e) { string sitepath = new CommonApi().SitePath; _host = Ektron.Cms.Widget.WidgetHost.GetHost(this); _host.Title = "ContentReview Widget"; _host.Edit += new EditDelegate(EditEvent); _host.Maximize += new MaximizeDelegate(delegate() { Visible = true; }); _host.Minimize += new MinimizeDelegate(delegate() { Visible = false; }); _host.Create += new CreateDelegate(delegate() { EditEvent(""); }); this.PreRender += new EventHandler(delegate(object PreRenderSender, EventArgs PreRenderE) { SetOutput(); }); ViewSet.SetActiveView(View); }
public bool SendMessage(string msgSubject, string msgText) { bool returnValue; bool result = true; CommonApi refCommonAPI = new CommonApi(); PrivateMessage objPM = new PrivateMessage(refCommonAPI.RequestInformationRef); UserData[] aUsers; string[] userIds = null; int idx = 0; try { if (! (Request.Form["ektouserid" + m_uniqueId] == null)) { userIds = Request.Form["ektouserid" + m_uniqueId].Split(",".ToCharArray()); } if ((userIds == null) || (userIds.Length == 0) || ("" == userIds[0])) { // no recipients selected! result = false; } else { aUsers = (UserData[])Array.CreateInstance(typeof(Ektron.Cms.UserData), userIds.Length); if (0 == msgSubject.Length) { msgSubject = m_refMsg.GetMessage("lbl no subject"); } objPM.Subject = msgSubject; objPM.Message = msgText; objPM.FromUserID = refCommonAPI.RequestInformationRef.UserId; for (idx = 0; idx <= userIds.Length - 1; idx++) { aUsers[idx] = new Ektron.Cms.UserData(); aUsers[idx].Id = Convert.ToInt64((userIds[idx].Trim())); } objPM.Send(aUsers); } } catch (Exception) { result = false; } finally { returnValue = result; refCommonAPI = null; objPM = null; } return returnValue; }
private Dictionary <string, string> QueryServerForJson(string query) { using (var server = CreateBloomServer()) { var commonApi = new CommonApi(null, null); commonApi.RegisterWithApiHandler(server.ApiHandler); var transaction = new PretendRequestInfo(BloomServer.ServerUrlWithBloomPrefixEndingInSlash + query); server.MakeReply(transaction); Debug.WriteLine(transaction.ReplyContents); var jss = new System.Web.Script.Serialization.JavaScriptSerializer(); return(jss.Deserialize <Dictionary <string, string> >(transaction.ReplyContents)); } }
public ResLiveVideoResponse LiveVideo(string mediaServerId, string deviceid, string cameraid, bool tcp = false) { ResponseStruct rs; var ret = CommonApi.LiveVideo(mediaServerId, deviceid, cameraid, out rs, tcp); if (rs.Code != ErrorNumber.None) { throw new HttpResponseException(JsonHelper.ToJson(rs)); } return(ret); }
/// <summary> /// 设置与用户聊天窗口中的输入中状态 /// </summary> /// <param name="appId"></param> /// <param name="userOpenId">用户OpenId</param> /// <param name="isTyping">是否是输入中</param> /// <returns></returns> public async Task <ResultReturn> SetTypingState(string appId, string userOpenId, bool isTyping) { var data = await CommonApi.Post(appId, "/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN", new JObject() { ["touser"] = userOpenId, ["command"] = isTyping?"Typing":"CancelTyping" } ); return(data); }
public async Task <GetWechatMenuForEditOutput> GetMenuForEdit(string appId) { await _wechatAppConfigManager.RegisterWechatApp(appId); var result = CommonApi.GetMenu(appId); return(new GetWechatMenuForEditOutput() { menu = result.menu, conditionalmenu = result.conditionalmenu, MenuTypeList = WechatMenuTypeList }); }
public async Task DeleteMenuConditional(string appId, string menuConditionalId) { await _wechatAppConfigManager.RegisterWechatApp(appId); try { var result = CommonApi.DeleteMenuConditional(appId, menuConditionalId); } catch (UserFriendlyException e) { throw e; } }
public void GetTokenFailTest() { try { var result = CommonApi.GetToken("appid", "secret"); Assert.Fail();//上一步就应该已经抛出异常 } catch (ErrorJsonResultException ex) { //实际返回的信息(错误信息) Assert.AreEqual(ex.JsonResult.errcode, ReturnCode.合法的APPID); } }
public void GetUserInfoTest() { try { GetTokenTest(); var result = CommonApi.GetUserInfo(tokenResult.access_token, "olPjZjsXuQPJoV0HlruZkNzKc91E"); Assert.IsNotNull(result); } catch (Exception ex) { //如果不参加内测,只是“服务号”,这类接口仍然不能使用,会抛出异常:错误代码:45009:api freq out of limit } }
public Community_PersonalTags() { m_refStyle = new StyleHelper(); m_mode = ""; m_userId = 0; m_id = 0; m_refUserApi = new UserAPI(); m_refCommonAPI = new CommonApi(); m_refContentApi = new ContentAPI(); m_refMsg = RefCommonAPI.EkMsgRef; Utilities.SetLanguage(m_refCommonAPI); }
public void GetUserInfoTest() { try { var accessToken = AccessTokenContainer.GetAccessToken(_appId); var result = CommonApi.GetUserInfo(accessToken, _testOpenId); Assert.IsNotNull(result); } catch (Exception ex) { //如果不参加内测,只是“服务号”,这类接口仍然不能使用,会抛出异常:错误代码:45009:api freq out of limit } }
public ActionResult CreateMenu(string token, GetMenuResultFull resultFull, MenuMatchRule menuMatchRule) { var useAddCondidionalApi = menuMatchRule != null && !menuMatchRule.CheckAllNull(); var apiName = string.Format("使用接口:{0}。", (useAddCondidionalApi ? "个性化菜单接口" : "普通自定义菜单接口")); try { if (token.IsNullOrEmpty()) { throw new WeixinException("Token不能为空!"); } //重新整理按钮信息 WxJsonResult result = null; IButtonGroupBase buttonGroup = null; if (useAddCondidionalApi) { //个性化接口 buttonGroup = CommonApi.GetMenuFromJsonResult(resultFull, new ConditionalButtonGroup()).menu; var addConditionalButtonGroup = buttonGroup as ConditionalButtonGroup; addConditionalButtonGroup.matchrule = menuMatchRule; result = CommonApi.CreateMenuConditional(token, addConditionalButtonGroup); apiName += string.Format("menuid:{0}。", (result as CreateMenuConditionalResult).menuid); } else { //普通接口 buttonGroup = CommonApi.GetMenuFromJsonResult(resultFull, new ButtonGroup()).menu; result = CommonApi.CreateMenu(token, buttonGroup); } var json = new { Success = result.errmsg == "ok", Message = "菜单更新成功。" + apiName }; return(Json(json, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() })); } catch (Exception ex) { var json = new { Success = false, Message = string.Format("更新失败:{0}。{1}", ex.Message, apiName) }; return(Json(json, new JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() })); } }
protected void Page_Load(object sender, System.EventArgs e) { //30257- This document should never be cached. When content status changes //the page is refreshed to show change in status. This change does //not appear when page is cached. Response.Cache.SetCacheability(HttpCacheability.NoCache); long contentid = 0; //long folderid = 0; int ContentLanguage = -1; CommonApi AppUI = new CommonApi(); Ektron.Cms.ContentAPI content_api = new Ektron.Cms.ContentAPI(); if (! (Request.QueryString["id"] == null)) { contentid = Convert.ToInt64(Request.QueryString["id"]); if ((!(Request.QueryString["LangType"] == null)) && (int.TryParse(Request.QueryString["LangType"], out ContentLanguage)) && (ContentLanguage > 0)) { if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { ContentLanguage = AppUI.DefaultContentLanguage; } AppUI.ContentLanguage = ContentLanguage; content_api.ContentLanguage = ContentLanguage; } else { ContentLanguage = AppUI.DefaultContentLanguage; } content_edit_data = content_api.GetContentForEditing(contentid); if (! (Request.QueryString["executeActiveX"] == null) && Request.QueryString["executeActiveX"] == "true" ) { string strfilename; AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService(); Ektron.ASM.AssetConfig.AssetData assetData = assetmanagementService.GetAssetData(content_edit_data.AssetData.Id); strfilename = (string) (GetFolderPath(content_edit_data.FolderId) + assetData.Handle); string sJS = ""; if (Page.Request.UserAgent.ToLower().Contains("firefox")) { sJS = "editDocumentWithProgIDNoUI('" + getFilePath(content_edit_data.FolderId) + assetData.Handle + "', '', 'SharePoint.OpenDocuments', '0', '" + getSiteAddress() + "', '0');"; string backURL = content_api.AppPath + Page.Request.QueryString["back_callerpage"] + "?" + Page.Request.QueryString["back_origurl"]; sJS += "window.location.href='" + this.Request.UrlReferrer + "'"; }else { sJS = "editInMSOffice(\'" + strfilename + "\');"; } Page.ClientScript.RegisterStartupScript(typeof(Page), "ShowInOffice", sJS.ToString(), true); } } }
public ActionResult MenuManager() { AccessTokenContainer.Register("wx4df7108464fb86f1", "46515264f29685ba478ea93d44919ed5"); var accessToken = AccessTokenContainer.GetAccessToken(AppId); var aa = UserTagApi.Get(accessToken); ButtonGroup bg = new ButtonGroup(); //单击 bg.button.Add(new SingleClickButton() { name = "单击测试", key = "OneClick", type = ButtonType.click.ToString(),//默认已经设为此类型,这里只作为演示 }); //二级菜单 var subButton = new SubButton() { name = "二级菜单" }; subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Text", name = "返回文本" }); subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_News", name = "返回图文" }); subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Music", name = "返回音乐" }); subButton.sub_button.Add(new SingleViewButton() { url = "http://weixin.senparc.com", name = "Url跳转" }); bg.button.Add(subButton); var result = CommonApi.CreateMenu(accessToken, bg); return(View()); }
public static string CreateMenu() { var accessToken = AccessTokenContainer.TryGetAccessToken(appid, secret); ButtonGroup bg = new ButtonGroup(); //单击 bg.button.Add(new SingleViewButton() { url = "http://www.mingshukeji.com.cn/SharePing", name = "小米小店" }); //二级菜单 var subButton = new SubButton() { name = "抢券中心" }; subButton.sub_button.Add(new SingleViewButton() { url = "http://www.mingshukeji.com.cn/SharePing", name = "推荐福利" }); subButton.sub_button.Add(new SingleViewButton() { url = "http://www.mingshukeji.com.cn/SharePing/FindCoupon", name = "搜索福利" }); bg.button.Add(subButton); //二级菜单 var subButton2 = new SubButton() { name = "服务中心" }; subButton2.sub_button.Add(new SingleViewButton() { url = "https://www.mingshukeji.com.cn/Home/AboutCompany", name = "关于我们" }); subButton2.sub_button.Add(new SingleViewButton() { url = "https://shop.mi.com", name = "管理小店" }); bg.button.Add(subButton2); var result = CommonApi.CreateMenu(accessToken, bg); return("菜单创建成功"); }
/// <summary> /// 获取指定ticket的二维码图片数据流 /// </summary> /// <param name="appId"></param> /// <param name="ticket"></param> /// <returns></returns> public async Task <ResultReturn <IReadOnlyList <byte> > > DownloadQrCode(string appId, string ticket) { try { var stream = await CommonApi.GetRaw(appId, $"http://{_option.CurrentValue.MPApiHost}/cgi-bin/showqrcode?ticket={WebUtility.UrlEncode(ticket) }"); return(new SuccessResultReturn <IReadOnlyList <byte> >(stream.data)); } catch (WebException e) { return(new FailResultReturn <IReadOnlyList <byte> >(e)); } }
public ActionResult NotAttention(long id) { BonusModel bonusModel = new BonusModel(_bonusService.Get(id)); //string str = AccessTokenContainer.TryGetToken(_siteSetting.WeixinAppId, _siteSetting.WeixinAppSecret, false); string str = CommonApi.GetToken(_siteSetting.WeixinAppId, _siteSetting.WeixinAppSecret).access_token; // SceneHelper sceneHelper = new SceneHelper(); int num = sceneHelper.SetModel(new SceneModel(QR_SCENE_Type.Bonus, bonusModel), 600); //string str1 = QrCodeApi.Create(str, 86400, num, 10000).ticket; string str1 = Senparc.Weixin.MP.AdvancedAPIs.QrCodeApi.Create(str, 86400, num, QrCode_ActionName.QR_SCENE).ticket; ViewBag.ticket = str1; return(View("~/Areas/Mobile/Templates/Default/Views/Bonus/NotAttention.cshtml", bonusModel)); }
// 创建菜单 private void BuildMenu() { var x5Meuns = new ButtonGroup(); var indexPage = new SingleViewButton { name = "起步科技", type = ButtonType.view.ToString(), url = "http://www.justep.com" }; x5Meuns.button.Add(indexPage); var demoPage = new SingleViewButton { name = "外卖", type = ButtonType.view.ToString(), url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + ConfigHelper.AppConfig["appId"] + "&redirect_uri=http%3A%2F%2Fwx.justep.com%2Ftakeout%2Findex.html&" + "response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect" }; x5Meuns.button.Add(demoPage); var takeout = new SingleViewButton { name = "外卖案例", type = ButtonType.view.ToString(), url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + ConfigHelper.AppConfig["appId"] + "&redirect_uri=http%3A%2F%2Fwx.justep.com%2Fx5%2FUI2%2Ftakeout%2Findex.w&" + "response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect" }; Console.WriteLine(takeout.url); x5Meuns.button.Add(takeout); try { CommonApi.DeleteMenu(AccessToken); CommonApi.CreateMenu(AccessToken, x5Meuns); } catch (Exception e) { Console.WriteLine(e.Message); throw; } }
protected void Page_Init(object sender, EventArgs e) { string sitepath = new CommonApi().SitePath; Css.RegisterCss(this, sitepath + "widgets/MessageBoard/css/messageBoard.css", "wmbCSS"); _host = Ektron.Cms.Widget.WidgetHost.GetHost(this); _host.Title = "MessageBoard Widget"; _host.Edit += new EditDelegate(EditEvent); _host.Maximize += new MaximizeDelegate(delegate() { Visible = true; }); _host.Minimize += new MinimizeDelegate(delegate() { Visible = false; }); _host.Create += new CreateDelegate(delegate() { EditEvent(""); }); Load += new EventHandler(delegate(object PreRenderSender, EventArgs Evt) { if(ViewSet.GetActiveView() != Edit) SetOutput(); }); ViewSet.SetActiveView(View); }
public static WeixinUserInfoResult GetUserInfo(string OpenID) { try { GetToken(); var result = CommonApi.GetUserInfo(tokenResult.access_token, OpenID); return(result); } catch (Exception ex) { //如果不参加内测,只是“服务号”,这类接口仍然不能使用,会抛出异常:错误代码:45009:api freq out of limit throw new Exception(ex + "///" + "获取用户信息出错,可能无权限。"); } }
public void CreateMenuTest() { return;//已经通过测试 var accessToken = AccessTokenContainer.GetToken(_corpId); ButtonGroup bg = new ButtonGroup(); //单击 bg.button.Add(new SingleClickButton() { name = "单击测试", key = "OneClick", type = ButtonType.click.ToString(),//默认已经设为此类型,这里只作为演示 }); //二级菜单 var subButton = new SubButton() { name = "二级菜单" }; subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Text", name = "返回文本" }); subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_News", name = "返回图文" }); subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Music", name = "返回音乐" }); subButton.sub_button.Add(new SingleViewButton() { url = "http://weixin.senparc.com", name = "Url跳转" }); bg.button.Add(subButton); var result = CommonApi.CreateMenu(accessToken, _agentId, bg); Assert.IsNotNull(result); Assert.AreEqual("ok", result.errmsg); }
public void FetchAnnouncements(List <string[]> announcementData) { int length; CommonApi cmna = new CommonApi(); string userid = cmna.GetUserID(); Common cmn = new Common(); string env = cmn.GetEnvFromUrl(); string baseurl = cmna.GetServices2Url(); string apiendpoint = baseurl + "/internalapi/v1.0/member/" + userid + "/allnotifications"; Console.WriteLine(apiendpoint); ApiKeywords.InitializeRequest(apiendpoint); ApiKeywords.SetMethod("GET"); string jsonresponse = ApiKeywords.SendRequest(); string[] parentObjPath = { "Notification" }; string[] subObjPath = { "Description" }; List <string[]> description = ApiKeywords.GetResponse(jsonresponse, parentObjPath, subObjPath); Console.WriteLine("Announcements Result: " + description.Count); if (description.Count() != 0 && announcementData.Count() != 0) { if (announcementData.Count() < description.Count()) { length = announcementData.Count(); } else { length = description.Count(); } Console.WriteLine("Length: " + length); for (int i = 0; i < length; i++) { for (int j = 0; j < description.ElementAt(0).Count(); j++) { Console.WriteLine("Description: " + description.ElementAt(i)[j]); string elementname = "Announcement " + (i + 1); string expectedtext = announcementData.ElementAt(i)[3]; string actualtext = description.ElementAt(i)[j]; Console.WriteLine(elementname + "\tExpectedText : " + expectedtext + "\tActualText : " + actualtext); softAssertions.Add(elementname, expectedtext, actualtext, "contains"); } } } else { softAssertions.Add("Total tiles Doesn't match", announcementData.Count(), description.Count(), "equals"); } }
public void dd() { //125.105.97.120 AccessTokenContainer.Register(AppId, AppSecret); // var accesstoken = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetToken(AppId, AppSecret); var accesstoken = AccessTokenContainer.TryGetAccessToken(AppId, AppSecret); //21_aBoVaAUgaWbzmZkclQJSRVN2HkBLJCny12kOxwumMMavDaKUWMecnYNz6Vwmol1pgvYkaOzF7zmpFh3puXhhIx3JpjrMQUWw24O-1lFul60G2wjCUmP1e4QcfKAVJYdAHAZNC // var accesstoken1 = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetToken(AppId, AppSecret); ButtonGroup bg = new ButtonGroup(); //单击 bg.button.Add(new SingleClickButton() { name = "单击测试", key = "OneClick" //type = ButtonType.click.ToString(),//默认已经设为此类型,这里只作为演示 }); //二级菜单 var subButton = new SubButton() { name = "二级菜单" }; subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Text", name = "返回文本" }); subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_News", name = "返回图文" }); subButton.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Music", name = "返回音乐" }); subButton.sub_button.Add(new SingleViewButton() { url = "http://weixin.senparc.com", name = "Url跳转" }); bg.button.Add(subButton); var result = CommonApi.CreateMenu(accesstoken, bg); var results = CommonApi.GetMenu(accesstoken); }
public void GetUserInfoTest() { return;//已经通过,但需要连接远程测试,太耗时,常规测试时暂时忽略。 try { var result = CommonApi.GetUserInfo("token", "olPjZjsXuQPJoV0HlruZkNzKc91E"); Assert.Fail();//上一步就应该已经抛出异常 } catch (ErrorJsonResultException ex) { //实际返回的信息(错误信息) Assert.AreEqual(ex.JsonResult.errcode, ReturnCode.验证失败); } }
public ActionResult CustomMenus() { if (!string.IsNullOrEmpty(_wxAccount.AppId) && !string.IsNullOrEmpty(_wxAccount.Secret)) { var accessToken = AccessTokenContainer.TryGetAccessToken(_wxAccount.AppId, _wxAccount.Secret); var result = CommonApi.GetMenu(accessToken); if (result != null) { return(View(result)); } } return(View()); }
public void UploadMediaFileTest() { try { var file = "..\\..\\..\\..\\Senparc.Weixin.MP.Sample\\Senparc.Weixin.MP.Sample\\Images\\qrcode.jpg"; var result = CommonApi.UploadMediaFile("token", UploadMediaFileType.image, file); Assert.Fail();//上一步就应该已经抛出异常 } catch (ErrorJsonResultException ex) { //实际返回的信息(错误信息) Assert.AreEqual(ex.JsonResult.errcode, ReturnCode.验证失败); } }
public ActionResult SaveMenu(FormCollection fc) { Guid id = Guid.Parse(fc["accountid"].ToString()); string menustr = fc["menustr"].ToString(); JavaScriptSerializer js = new JavaScriptSerializer(); var jsonResult = js.Deserialize <GetMenuResultFull>(menustr); ButtonGroup bg = new ButtonGroup(); GetMenuResult aasaas = CommonApi.GetMenuFromJsonResult(jsonResult, bg); OfficialAccount_BLL bll = new OfficialAccount_BLL(); OfficialAccount oa = bll.Get(a => a.AccountID == id); string accessToken = AccessTokenContainer.TryGetAccessToken(oa.AppID, oa.AppSecret); Senparc.Weixin.Entities.WxJsonResult rrr = CommonApi.CreateMenu(accessToken, aasaas.menu); return(Json(rrr.errcode.ToString(), JsonRequestBehavior.AllowGet)); }
/// <summary> /// 根据OpenId获取用户信息 /// </summary> /// <param name="openId"></param> /// <returns></returns> public static WeixinUserInfoResult GetWechatUserInfo(string openId) { var type = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType; try { var user = CommonApi.GetUserInfo(WeChatAppId, openId); return(user); } catch (Exception) { Log4NetHelper.WriteInfo(type, "没取到code"); throw; } }
protected void Page_Init(object sender, EventArgs e) { //string sitepath = new CommonApi().SitePath; sitePath = new CommonApi().SitePath; appPath = new CommonApi().AppPath; _host = Ektron.Cms.Widget.WidgetHost.GetHost(this); _host.Title = "Face Book Fan List"; _host.Edit += new EditDelegate(EditEvent); _host.Maximize += new MaximizeDelegate(delegate() { Visible = true; }); _host.Minimize += new MinimizeDelegate(delegate() { Visible = false; }); _host.Create += new CreateDelegate(delegate() { EditEvent(""); }); ScriptManager.RegisterClientScriptInclude(this, this.GetType(), "FaceBookFanListWidgetInit", sitePath + "widgets/FacebookFanList/featureloader.js"); PreRender += new EventHandler(delegate(object PreRenderSender, EventArgs Evt) { SetOutput(); }); ViewSet.SetActiveView(View); }
public ActionResult WeixinMenu() { var accesstoken = AccessTokenContainer.TryGetToken(AppId, AppSecret); var menu = CommonApi.GetMenu(accesstoken); if (menu != null) { ViewBag.MenuList = menu.menu; } else { ViewBag.MenuList = null; } return(View()); }
public void InitializeJourneyRequest(string tailurl) { Common cmn = new Common(); string env = cmn.GetEnvFromUrl(); string baseurl = "https://" + env + "services2.onlifehealth.com"; string apiurl; CommonApi capi = new CommonApi(); capi.getActorid(GlobalVariables.username); string actorid = GlobalVariables.actorid; apiurl = baseurl + "/internalapi/v1.0/member/" + actorid + tailurl; Console.WriteLine(apiurl); ApiKeywords.InitializeRequest(apiurl); }
public JsonResult ApplyWithDrawSubmit(string nickname, decimal amount, string pwd) { if (ServiceHelper.Create <IMemberCapitalService>().GetMemberInfoByPayPwd(base.CurrentUser.Id, pwd) == null) { throw new HimallException("支付密码不对,请重新输入!"); } CapitalInfo capitalInfo = ServiceHelper.Create <IMemberCapitalService>().GetCapitalInfo(base.CurrentUser.Id); decimal num = amount; decimal? balance = capitalInfo.Balance; if ((num <= balance.GetValueOrDefault() ? false : balance.HasValue)) { throw new HimallException("提现金额不能超出可用金额!"); } string cookie = WebHelper.GetCookie("Himall-User_OpenId"); string empty = string.Empty; if (string.IsNullOrWhiteSpace(cookie)) { throw new HimallException("数据异常,OpenId不能为空!"); } cookie = SecureHelper.AESDecrypt(cookie, "Mobile"); SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); if (!string.IsNullOrWhiteSpace(siteSettings.WeixinAppId) && !string.IsNullOrWhiteSpace(siteSettings.WeixinAppSecret)) { //string str = AccessTokenContainer.TryGetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret, false); string str = CommonApi.GetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret).access_token; // WeixinUserInfoResult userInfo = CommonApi.GetUserInfo(str, cookie); if (userInfo != null) { empty = userInfo.nickname; } } ApplyWithDrawInfo applyWithDrawInfo = new ApplyWithDrawInfo() { ApplyAmount = amount, ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm, ApplyTime = DateTime.Now, MemId = base.CurrentUser.Id, OpenId = cookie, NickName = empty }; ServiceHelper.Create <IMemberCapitalService>().AddWithDrawApply(applyWithDrawInfo); return(Json(new { success = true })); }
public void TC_ValidateCourseAndProgressCheckInIncentiveHistory() { Common config = new Common(); isenabled = config.GetConfig("IncentiveEnabled").ElementAt(0)[1].ToLower(); if (isenabled.Equals("false")) { Assert.Ignore("Incentives not enabled for client"); } string category = "I Completed The Weight Course"; List <string[]> incentivehistorydata = CSVReaderDataTable.GetCSVData("IncentiveHistoryData", pageName, category, GlobalVariables.clientname.ToLower()); Page_EligibleActivities peligible = new Page_EligibleActivities(softassertions); is_soft_assert = true; CommonApi cma = new CommonApi(); String token = cma.GetToken(); peligible.InitializeIncentiveHistoryRequest(); peligible.SetHeader(token); peligible.SetMethod(); peligible.SendRequest(); if (incentivehistorydata.Count > 0) { peligible.VerifyHistoryData(incentivehistorydata, category); softassertions.AssertAll(); } else { Assert.Ignore("Incentives for Course is not available for Client"); } category = "I Completed The Weight Progress Check-In"; incentivehistorydata = CSVReaderDataTable.GetCSVData("IncentiveHistoryData", pageName, category, GlobalVariables.clientname.ToLower()); if (incentivehistorydata.Count > 0) { peligible.VerifyHistoryData(incentivehistorydata, category); softassertions.AssertAll(); } else { Assert.Ignore("Incentives for Progress Check-in is not available for Client"); } }
/// <summary> /// 获取所有菜单,包括个性化菜单和通用菜单 /// </summary> /// <param name="appId"></param> /// <returns></returns> public async Task <ResultReturn <GetAllMenus_Result> > GetAllMenus(string appId) { var data = await CommonApi.Get(appId, "/cgi-bin/menu/get?access_token=ACCESS_TOKEN"); if (data.IsSuccess) { var result = new GetAllMenus_Result(); var commonMenusJson = data.ReturnData.GetJObject("menu"); var commonMenuButtonsJson = commonMenusJson.GetJObjectArray("button"); var commonButtons = commonMenuButtonsJson.Select(x => x.ToObject <MPMenuBase>()).ToArrayEx(); result.CommonMenus = commonButtons; result.CommonMenuId = commonMenusJson.GetString("menuid"); if (data.ReturnData.ContainsKey("conditionalmenu")) { var conditionalMenusJson = data.ReturnData.GetJObjectArray("conditionalmenu"); if (conditionalMenusJson.HasData()) { var conditionalMenus = new List <GetAllMenus_Result.PersonalizedMenu>(); foreach (var item in conditionalMenusJson) { var buttonsJson = item.GetJObjectArray("button"); var rulsJson = item.GetJObject("matchrule"); var tmp = new GetAllMenus_Result.PersonalizedMenu(); tmp.MenuId = item.GetString("menuid"); tmp.Menus = buttonsJson.Select(x => x.ToObject <MPMenuBase>()).ToList(); tmp.Rule = rulsJson.ToObject <PersonalizedMenuRule>(); conditionalMenus.Add(tmp); } result.PersonalizedMenus = conditionalMenus; } } return(new SuccessResultReturn <GetAllMenus_Result>(result)); } else { return(data.Cast <GetAllMenus_Result>(default));
/// <summary> /// 处理文字请求 /// </summary> /// <returns></returns> public override IResponseMessageBase OnTextRequest(RequestMessageText requestMessage) { LogHelper.WriteLog(LogEnum.WeChatSend, "requestMessage.Content:" + requestMessage.Content); if (requestMessage.Content.Contains("客服")) { var _responseMessage = this.CreateResponseMessage <ResponseMessageTransfer_Customer_Service>(); return(_responseMessage); } var responseMessageContent = BaseConfig.DefaultInfo; var model = new BLL.AutoReplys().GetAutoReplyList(requestMessage.Content).Tables[0].ToEntity <Model.AutoReply>(); if (model != null) { if (model.ReplyType == AutoReplyTypeEnum.Text.GetHashCode()) { responseMessageContent = model.ReplyIdList; } } try { var access_token = CommonApi.GetToken(BaseConfig.AppId, BaseConfig.AppSecret); if (access_token.errcode == Senparc.Weixin.ReturnCode.请求成功) { string urlFormat = string.Format("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}", access_token.access_token); var info = new { touser = "******", msgtype = "text", text = new { content = "公众号新消息:" + requestMessage.Content } }; Utils.HttpPostRequest(urlFormat, info.ToJson()); } } catch (Exception err) { LogHelper.WriteLog(LogEnum.Error, " 客服接口异常:" + err.Message); } var responseMessage = this.CreateResponseMessage <ResponseMessageText>(); responseMessage.Content = responseMessageContent; return(responseMessage); }
/// <summary> /// 初始化用户的默认菜单 /// </summary> private static void InitMenus() { var buttonGroup = new ButtonGroup(); #region 第一个菜单 var timeGalleryBtn = new SubButton("时光轴"); var pepeWebBtn = new SingleViewButton { name = "裴裴时光轴", url = "http://fengrui358.vicp.cc/TimeGallery" }; timeGalleryBtn.sub_button.Add(pepeWebBtn); buttonGroup.button.Add(timeGalleryBtn); #endregion #region 第二个菜单 var aboutBtn = new SubButton("关于"); var uploadBtn = new SingleViewButton { name = "上传", url = "http://fengrui358.vicp.cc/TimeGallery/Gallery/OAuth2ForBaseUpload" }; var uploadUserBtn = new SingleViewButton { name = "用户信息上传", url = "http://fengrui358.vicp.cc/TimeGallery/Gallery/OAuth2ForUserInfoUpload" }; aboutBtn.sub_button.Add(uploadBtn); aboutBtn.sub_button.Add(uploadUserBtn); buttonGroup.button.Add(aboutBtn); #endregion var result = CommonApi.CreateMenu(AppId, buttonGroup); if (result == null || result.errcode != 0) { throw new Exception("初始化微信默认菜单出错!"); } }
private void Page_Load(System.Object sender, System.EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; CommonApi m_refApi = new CommonApi(); if (m_refApi.TreeModel == 1) { m_bAjaxTree = true; } m_refApi = null; //set javascript strings this.SetJavascriptStrings(); }
protected void Page_Load(object sender, EventArgs e) { //This document should never be cached. When content status changes //the page is refreshed to show change in status. This change does //not appear when page is cached. Response.Cache.SetCacheability(HttpCacheability.NoCache); CommonApi myCommonApi = new CommonApi(); if (myCommonApi.IsLoggedIn == true) { this.ProcessMenuRequest(); } else { this.RejectMenuRequest(); } }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce)) { Utilities.ShowError(m_refContentApi.EkMsgRef.GetMessage("feature locked error")); } CommonApi api = new CommonApi(); if (!Utilities.ValidateUserLogin()) { return; } Util_CheckAccess(); AppPath = api.AppPath; m_strWfImgPath = AppPath + "workflowimage.aspx?type=preview&id="; Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronModalCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronFixedPositionToolbarCss); // Register necessary JS files Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronXmlJS); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronModalJS); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronCookieJS); Ektron.Cms.API.JS.RegisterJS(this, api.AppPath + "java/jfunct.js", "EktronJFunctJS"); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronStringJS); Ektron.Cms.API.JS.RegisterJS(this, Ektron.Cms.API.JS.ManagedScript.EktronScrollToJS); Ektron.Cms.API.JS.RegisterJS(this, api.AppPath + "java/toolbar_roll.js", "EktronToolbarRollJS"); lnkWorkflow.Text = "<img style=\"cursor:pointer\" alt=\'click here to preview the selected workflow\' src=\'" + api.AppPath + "Images/ui/icons/preview.png\' onclick=\"setImageUrl(\'" + m_strWfImgPath + "\');$ektron(\'#wfImgModal\').modalShow(); return false;\"/>"; workflowTitle.Text = GetMessage("lbl view workflow"); if (!Page.IsPostBack) { Util_BindData(); Util_SetLabels(); } else { Process_Save(); Util_SetLabels(); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { long contentid = 0; long folderid = 0; CommonApi AppUI = new CommonApi(); m_refMsg = content_api.EkMsgRef; Utilities.ValidateUserLogin(); if (content_api.RequestInformationRef.IsMembershipUser == 1 || content_api.RequestInformationRef.UserId == 0) { Response.Redirect(content_api.ApplicationPath + "reterror.aspx?info=" + Server.UrlEncode(m_refMsg.GetMessage("msg login cms user")), false); return; } RegisterResources(); if ((!(Request.QueryString["contentId"] == null)) && (long.TryParse(Request.QueryString["contentId"], out contentid)) && (contentid > 0)) { hdnContentId.Value = contentid.ToString(); if ((!(Request.QueryString["LangType"] == null)) && (int.TryParse(Request.QueryString["LangType"], out ContentLanguage)) && (ContentLanguage > 0)) { if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { ContentLanguage = AppUI.DefaultContentLanguage; } AppUI.ContentLanguage = ContentLanguage; content_api.ContentLanguage = ContentLanguage; } else { ContentLanguage = AppUI.DefaultContentLanguage; } hdnLangType.Value = ContentLanguage.ToString(); if ((!(Request.QueryString["folderId"] == null)) && (long.TryParse(Request.QueryString["folderId"], out folderid)) && (folderid > 0)) { hdnFolderId.Value = folderid.ToString(); } ViewToolBar(); } } }
private void Page_Load(System.Object sender, System.EventArgs e) { CommonApi m_refAPI = new CommonApi(); try { if (m_refAPI.GetCookieValue("site_preview") == "1") { m_refAPI.SetCookieValue("site_preview", "0"); } else { m_refAPI.SetCookieValue("site_preview", "1"); } } catch (Exception) { } finally { m_refAPI = null; } }
/// <summary> /// Constructor /// </summary> public Workarea_customproperties() { _siteApi = new SiteAPI(); _commonApi = new CommonApi(); _customPropertyApi = new CustomProperty(); _customPropertyCore = new CustomPropertyBL(); _styleHelper = new StyleHelper(); _pageAction = string.Empty; _propertyId = 0; _language = -1; _pageType = string.Empty; _translate = false; _originalLanguage = 0; _currentPage = 1; _messageHelper = _commonApi.EkMsgRef; _enableMultiLanguage = _commonApi.EnableMultilingual; _appImgPath = _commonApi.AppImgPath; _imageIconPath = _commonApi.AppPath + RelativeIconPath; _commonApi.ContentLanguage = _language; }
public static TaxonomyData createTaxonomyTree(long TaxonomyId) { TaxonomyRequest taxonomyRequest = new TaxonomyRequest(); Ektron.Cms.API.Content.Taxonomy tax1 = new Taxonomy(); // Ektron.Cms.TaxonomyData taxData = new TaxonomyData(); try { taxonomyRequest.TaxonomyId = TaxonomyId; // taxonomyRequest.Page = Page; taxonomyRequest.TaxonomyLanguage = 1033; // taxonomyRequest.PageSize = contentApi.RequestInformationRef.PagingSize; taxonomyRequest.Depth = -1; taxonomyRequest.ReadCount = true; taxonomyRequest.TaxonomyType = 0; //0 = content; 1 = user; 2 = group; taxonomyRequest.IncludeItems = false; // taxonomyRequest.SortOrder = "last_edit_date"; // taxonomyRequest.SortDirection = "desc"; taxData = tax1.LoadTaxonomy(ref taxonomyRequest); TaxonomyBaseData[] taxonomyDataArray = new CommonApi().EkContentRef.ReadAllSubCategories(taxonomyRequest); } catch (Exception) { } return taxData; }
private void SetUpRating() { SetContentID(); common = new Ektron.Cms.CommonApi(); }
public NewContent() { _ContentApi = new ContentAPI(); _CommonApi = new CommonApi(); }
protected void Page_Load(object sender, EventArgs e) { MsgHelper = new EkMessageHelper(m_refContentApi.RequestInformationRef); StyleHelper m_refStyle = new StyleHelper(); CommonApi m_refApi = new CommonApi(); ApplicationAPI AppUI = new ApplicationAPI(); sitePath = AppUI.SitePath; AppPath = AppUI.AppPath; AxMenuData menuData = new AxMenuData(); string ErrorString =""; MenuId = Convert.ToInt64(Request.QueryString["nid"]); FolderId = Convert.ToInt64(Request.QueryString["folderid"]); if (Request.QueryString["LangType"] == "-1") { ContentLanguage = AppUI.DefaultContentLanguage; AppUI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); AppUI.ContentLanguage = ContentLanguage; } else { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); if (ContentLanguage == 0) { ContentLanguage = AppUI.DefaultContentLanguage; AppUI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); AppUI.ContentLanguage = ContentLanguage; } } Hashtable cPerms = AppUI.EkSiteRef.GetPermissions(FolderId, 0, "folder"); if (!(IsCollectionMenuRoleMember() || (cPerms.Contains("Collections") && Convert.ToBoolean(cPerms["Collections"])))) ErrorString = MsgHelper.GetMessage("com: user does not have permission"); if (ErrorString == "") { if (m_refApi.TreeModel == 1) gtLinks = AppUI.EkContentRef.GetMenuByID(MenuId, 0,false); else gtLinks = AppUI.EkContentRef.GetMenuByID(MenuId, 0, true); menuData = AppUI.EkContentRef.GetMenuDataByID(MenuId); if (!string.IsNullOrEmpty(menuData.AssociatedFolderIdList)) { AssociatedFolderIdListString = menuData.AssociatedFolderIdList; AssociatedFolderTitleListString = GetTitlesFromFolderIds(menuData.AssociatedFolderIdList); } if (!string.IsNullOrEmpty(menuData.AssociatedTemplates)) AssociatedTemplatesString = menuData.AssociatedTemplates; } litTitle.Text = m_refStyle.GetTitleBar(MsgHelper.GetMessage("edit menu title")); litHelp.Text = StyleHelper.ActionBarDivider + "<td>" + m_refStyle.GetHelpButton("editmenu", "") + "</td>"; if (Request.QueryString["back"] != "") litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", Request.QueryString["back"], MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "", StyleHelper.CancelButtonCssClass, true); else if (Request.QueryString["iframe"] == "true") litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", "#", MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "onclick=\"parent.CancelIframe();\"", StyleHelper.CancelButtonCssClass, true); else { if (m_refApi.TreeModel == 1) litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/back.png", "menutree.aspx?nid=" + MenuId + "&folderid=" + FolderId, MsgHelper.GetMessage("alt back button text"), MsgHelper.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true); else litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/back.png", "collections.aspx?action=ViewMenu&nid=" + MenuId + "&folderid=" + FolderId, MsgHelper.GetMessage("alt back button text"), MsgHelper.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true); } litButtons.Text += m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/save.png", "#", "Save Menu", MsgHelper.GetMessage("btn save"), "onclick=\"return SubmitForm(\'menu\', \'VerifyMenuForm()\');\"", StyleHelper.SaveButtonCssClass, true); LanguageName = gtLinks["ContentLanguage"].ToString(); }
private void Page_Load(System.Object sender, System.EventArgs e) { string action = "view"; string inFolder = ""; int k = 0; string[] id = null; string folderList = ""; string folderId = ""; long rootFolder = 0; string userNames = "None"; string groupNames = "None"; string userIdList = ""; string groupIdList = ""; string[] userId = null; string[] groupId = null; string userList = ""; Ektron.Cms.UserAPI userAPI = new Ektron.Cms.UserAPI(); int i = 0; bool doesExcludeAll = false; bool isSubmit = true; CommonApi commonApi = new CommonApi(); bool continueSub = false; if ((_ContentApi.EkContentRef).IsAllowed(0, 0, "users", "IsLoggedIn", 0) == false) { Response.Redirect("login.aspx?fromLnkPg=1", false); return; } if (_ContentApi.RequestInformationRef.IsMembershipUser == 1 || _ContentApi.RequestInformationRef.UserId == 0) { Response.Redirect("reterror.aspx?info=Please login as cms user", false); return; } //set language _ContentLanguage = string.IsNullOrEmpty(Request.QueryString["LangType"]) ? Convert.ToInt32(_ContentApi.GetCookieValue("LastValidLanguageID")) : Convert.ToInt32(Request.QueryString["LangType"]); _ContentApi.SetCookieValue("LastValidLanguageID", _ContentLanguage.ToString()); _ContentApi.ContentLanguage = System.Convert.ToInt32(_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED ? Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES : _ContentLanguage); _EnableMultilingual = _ContentApi.EnableMultilingual; //set filter _FilterType = (string)((string.IsNullOrEmpty(Request.QueryString["filterType"])) ? string.Empty : (AntiXss.HtmlEncode(Request.QueryString["filtertype"]))); if (!string.IsNullOrEmpty(Request.QueryString["filterid"]) ) { folderId = Request.QueryString["filterid"]; if (!folderId.Contains(",")) { if (Request.QueryString["filterid"] != null) { _FilterId = long.Parse(Request.QueryString["filterid"]); } } if (_FilterType == "path") { id = folderId.Split(','); for (k = 0; k <= id.Length - 1; k++) { if (!string.IsNullOrEmpty(_FolderName)) { if (_FolderName.Length > 0) { _FolderName = _FolderName + ","; } } _FolderName = _FolderName + _ContentApi.GetFolderById(long.Parse(id[k])).Name; _FilterId = long.Parse(id[k]); // Set limit for listing folder-names: if ((k >= 0) && (k < (id.Length - 1))) { _FolderName += ", ..."; break; } } //FldrName = m_refContentApi.GetFolderById(FilterId).Name & """" _FolderName += "\""; inFolder = " In Folder \""; } } //set page action - throw if contains ampersand _PageAction = (string)((string.IsNullOrEmpty(Request.QueryString["action"])) ? string.Empty : (EkFunctions.HtmlEncode(Convert.ToString(Request.QueryString["action"])).ToLower().Trim())); if (_PageAction.Contains("&")) { Utilities.ShowError(_MessageHelper.GetMessage("invalid querstring")); return; } _PageAction = AntiXss.HtmlEncode(_PageAction); //get querystrings _AppImgPath = _ContentApi.AppImgPath; _Interval = (string)((string.IsNullOrEmpty(Request.QueryString["interval"])) ? string.Empty : (AntiXss.HtmlEncode(Request.QueryString["interval"]))); _OrderBy = (string)((string.IsNullOrEmpty(Request.QueryString["orderby"])) ? string.Empty : (AntiXss.HtmlEncode(Request.QueryString["orderby"]))); if (!string.IsNullOrEmpty(Request.QueryString["rootfolder"])) { rootFolder = long.Parse(Request.QueryString["rootfolder"]); } if (!string.IsNullOrEmpty(Request.QueryString["subfldInclude"])) { _IsSubFolderIncluded = bool.Parse(Request.QueryString["subfldInclude"]); } if ((Request.QueryString["rptFolder"] == null) || (Request.QueryString["rptFolder"] == "")) { _Folder = " Content Folder "; } else if (!(Request.QueryString["filterType"] == null) && Request.QueryString["filterType"] != "") { id = (EkFunctions.HtmlEncode(Request.QueryString["filterid"])).Split(','); for (k = 0; k <= id.Length - 1; k++) { if (_Folder.Length > 0) { _Folder = _Folder + ","; } _Folder = _Folder + _ContentApi.GetFolderById(long.Parse(id[k])).Name; } } else { _Folder = EkFunctions.HtmlEncode(Request.QueryString["rptFolder"]); } if (Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "") { if (Information.IsNumeric(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { _ContentType = Convert.ToInt32(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]); _ContentTypeSelected = Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam].ToString(); _ContentApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, _ContentTypeSelected); } } else if (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "") { if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { _ContentTypeSelected = (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]).ToString(); } } switch (_PageAction) { case "checkinall": Process_CheckInAll(); break; case "submitall": Process_SubmitAll(); break; case "viewallreporttypes": Display_ReportTypes(); break; case "viewasynchlogfile": Display_AsynchLogFile(); break; case "contentreviews": Display_ContentReviews(); break; case "contentflags": Display_ContentFlags(); break; case "viewsearchphrasereport": SearchPhraseReport(); break; case "viewpreapproval": Display_Preapproval(); break; case "viewcheckedout": continueSub = true; _ReportType = "checkedout"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports checked out title") + inFolder + _FolderName); break; case "viewcheckedin": //look at last line in page_load for loading of viewcheckedin control continueSub = true; _ReportType = "checkedin"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports checked in title") + inFolder + _FolderName); break; case "viewsubmitted": continueSub = true; _ReportType = "submitted"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports submitted title") + inFolder + _FolderName); break; case "viewnewcontent": continueSub = true; _ReportType = "newcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports new title") + inFolder + _FolderName); break; case "viewpending": continueSub = true; _ReportType = "pendingcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports pending title") + inFolder + _FolderName); break; case "viewrefreshreport": continueSub = true; _ReportType = "refreshdcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports refresh title") + inFolder + _FolderName); break; case "viewexpired": continueSub = true; _ReportType = "expiredcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports expired title") + inFolder + _FolderName); break; case "viewtoexpire": continueSub = true; _ReportType = "expireToContent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("lbl cont expire") + " " + _Interval + " " + _MessageHelper.GetMessage("lbl sync monthly days") + inFolder + _FolderName); break; case "siteupdateactivity": continueSub = true; _ReportType = "updateactivityContent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports site activity title") + inFolder + _FolderName); break; default: continueSub = true; _ReportType = ""; _HasData = false; _TitleBarMsg = ""; break; } //set js vars litPageAction.Text = _PageAction; litOrderBy.Text = _OrderBy; litFilterType.Text = _FilterType; litFilterId.Text = _FilterId.ToString(); litInterval.Text = _Interval; if (continueSub == true) { int j; Collection pagedata = null; Collection cUser = null; long[] arUserIds; string sExclUserId = ""; int idx = 0; //Dim sitedata As ContentData() if ((_PageAction == "viewcheckedout") || (_PageAction == "viewnewcontent")) { lblAction.Text = "var actionString = \"reports.aspx?action=CheckinAll&PreviousAction=" + _PageAction + "&filtertype=" + _FilterType + "&filterid=" + _FilterId + "&orderby=" + _OrderBy + "\";"; lblAction.Text += "if (WarnAllCheckin()) { DisplayHoldMsg_Local(true); document.forms.selections.action = actionString; document.forms.selections.submit(); }"; } if (_PageAction == "viewcheckedin") { lblAction.Text += "var actionString = \"reports.aspx?action=SubmitAll&PreviousAction=" + _PageAction + "&filtertype=" + _FilterType + "&filterid=" + _FilterId + "&orderby=" + _OrderBy + "\";"; lblAction.Text += "if (WarnAllSubmit()) { DisplayHoldMsg_Local(true); document.forms.selections.action = actionString; document.forms.selections.submit(); }"; } rptTitle.Value = _TitleBarMsg; top.Visible = false; if (_PageAction == "viewtoexpire") { selInterval.Visible = true; txtInterval.Visible = true; if (0 != _Interval.Length) { txtInterval.Value = _Interval; } selInterval.Items.Clear(); selInterval.Items.Add(new ListItem("Select Interval", "")); selInterval.Items.Add(new ListItem("10", "10")); selInterval.Items.Add(new ListItem("20", "20")); selInterval.Items.Add(new ListItem("30", "30")); selInterval.Items.Add(new ListItem("40", "40")); selInterval.Items.Add(new ListItem("50", "50")); selInterval.Items.Add(new ListItem("60", "60")); selInterval.Items.Add(new ListItem("70", "70")); selInterval.Items.Add(new ListItem("80", "80")); selInterval.Items.Add(new ListItem("90", "90")); if (0 != _Interval.Length) { for (j = 1; j <= 9; j++) { if (_Interval == selInterval.Items[j].Value) { selInterval.Items[j].Selected = true; break; } } } else { selInterval.Items[0].Selected = true; } lblDays.Text = _MessageHelper.GetMessage("lbl sync monthly days"); lblDays.Visible = true; top.Visible = true; IncludeContentToExpireJS(); } else if (_PageAction == "siteupdateactivity") { System.Text.StringBuilder result = new System.Text.StringBuilder(); EditScheduleHtml.Text = ""; if (!(Request.QueryString["ex_users"] == null)) { if (Request.QueryString["ex_users"] != "") { userIdList = EkFunctions.HtmlEncode(Request.QueryString["ex_users"]); } } if (!(Request.QueryString["ex_groups"] == null)) { if (Request.QueryString["ex_groups"] != "") { groupIdList = EkFunctions.HtmlEncode(Request.QueryString["ex_groups"]); } } if (Request.QueryString["btnSubmit"] == null) { isSubmit = false; editSchedule.Visible = true; lblDays.Visible = true; tr_startDate.Visible = true; tr_endDate.Visible = true; lblStartDate.Text = _MessageHelper.GetMessage("generic start date label"); lblEndDate.Text = _MessageHelper.GetMessage("generic end date label"); } else { // User wants Site Activity report isSubmit = true; if (!(Request.Form["excludeAllUsers"] == null)) { doesExcludeAll = Convert.ToBoolean(Request.Form["excludeAllUsers"]); } if (!(Request.Form["start_date"] == null)) { _StartDate = Request.Form["start_date"]; } else if (!(Request.QueryString["startdate"] == null)) { _StartDate = EkFunctions.HtmlEncode(Request.QueryString["startdate"]); _StartDate = _StartDate.Replace("\'", ""); } if (!(Request.Form["end_date"] == null)) { _EndDate = Request.Form["end_date"]; if (!Information.IsDate(_EndDate)) { _EndDate = ""; } } else if (!(Request.QueryString["enddate"] == null)) { _EndDate = EkFunctions.HtmlEncode(Request.QueryString["enddate"]); _EndDate = _EndDate.Replace("\'", ""); if (!Information.IsDate(_EndDate)) { _EndDate = ""; } } } DisplayDateFields(); //EditScheduleHtml.Text = EditScheduleHtml.Text & MakeIFrameArea() result.Append("<input id=\"fId\" type=\"hidden\" name=\"fId\" "); if (Request.QueryString["filterid"] == null) { result.Append("value=\"\">" + "\r\n"); } else { result.Append("value=\"" + EkFunctions.HtmlEncode(Request.QueryString["filterid"]) + "\"/>" + "\r\n"); } result.Append("<input id=\"rptType\" type=\"hidden\" name=\"rptType\"/>" + "\r\n"); result.Append("<input id=\"rptFolderList\" type=\"hidden\" name=\"rptFolderList\"/>" + "\r\n"); result.Append("<input id=\"rootFolder\" type=\"hidden\" name=\"rootFolder\" value=\"" + rootFolder + "\"/>" + "\r\n"); result.Append("<input id=\"rptLink\" type=\"hidden\" name=\"rptLink\"/>" + "\r\n"); result.Append("<input id=\"ContType\" type=\"hidden\" name=\"ContType\" value=\"" + _ContentType + "\"/>" + "\r\n"); result.Append("<input id=\"subfldInclude\" type=\"hidden\" name=\"subfldInclude\" value=\"" + _IsSubFolderIncluded + "\"/>" + "\r\n"); result.Append("<input id=\"LangType\" type=\"hidden\" name=\"LangType\" value=\"" + _ContentLanguage + "\"/>" + "\r\n"); result.Append("<input id=\"excludeUserIds\" type=\"hidden\" name=\"excludeUserIds\" value=\"" + userIdList + "\"/>" + "\r\n"); result.Append("<input id=\"excludeUserGroups\" type=\"hidden\" name=\"excludeUserGroups\" value=\"" + groupIdList + "\"/>" + "\r\n"); result.Append("<input id=\"excludeAllUsers\" type=\"hidden\" name=\"excludeAllUsers\" value=\"" + doesExcludeAll + "\"/>" + "\r\n"); //select folder result.Append("<table id=\"EditText\" width=\"100%\" class=\"ektronGrid\">"); result.Append("<tr><td id=\"lblSelFolder\" class=\"label\">" + _MessageHelper.GetMessage("lbl select folder") + "</td>"); result.Append("<td id=\"selectedFolderList\"><a title=\"" + _MessageHelper.GetMessage("lbl select folder") + "\" href=\"#\" id=\"hselFolder\" onclick=\"LoadFolderChildPage(\'" + _PageAction + "\',\'" + _ContentLanguage + "\');return true;\">"); if ((Request.QueryString["filterid"] == null) || ("" == Request.QueryString["filterid"])) { //result.Append(m_refMsg.GetMessage("lbl Root Folder")) result.Append("\\"); } else { id = (EkFunctions.HtmlEncode(Request.QueryString["filterid"])).Split(','); for (k = 0; k <= id.Length - 1; k++) { if (folderList.Length > 0) { folderList = folderList + ","; } folderList = folderList + _ContentApi.GetFolderById(long.Parse(id[k])).Name; } result.Append(folderList); } result.Append("</a></td></tr>" + "\r\n"); string sShow = "display:none"; if (_IsSubFolderIncluded) { sShow = "display:block"; } result.Append("<tr><td id=\"subfldIncludetxt\" colspan=\"2\" style=\"" + sShow + "\">"); result.Append(_MessageHelper.GetMessage("lbl subfolder included")); result.Append("</td></tr>" + "\r\n"); //report type _ReportDisplay = EkFunctions.HtmlEncode(Request.QueryString["report_display"]); result.Append("<tr><td class=\"label\">" + _MessageHelper.GetMessage("lbl report type") + "</td><td><select id=\"selDisplay\" name=\"selDisplay\">"); result.Append("<option id=\"ev\" value=\"ev\""); if ("ev" == _ReportDisplay) { result.Append(" SELECTED"); } result.Append(">" + _MessageHelper.GetMessage("lbl executive view") + "</option>"); result.Append("<option id=\"dv\" value=\"dv\""); if ("dv" == _ReportDisplay) { result.Append(" selected=\'selected\'"); } result.Append(">" + _MessageHelper.GetMessage("lbl detail view") + "</option>"); result.Append("<option id=\"cv\" value=\"cv\""); if ("cv" == _ReportDisplay) { result.Append(" selected=\'selected\'"); } result.Append(">" + _MessageHelper.GetMessage("lbl combined view") + "</option></select></td></tr>" + "\r\n"); //exclude user result.Append("<tr><td id=\"lblSelUser\" class=\"label\">" + _MessageHelper.GetMessage("lbl exclude users") + "</td>" + "\r\n"); result.Append("<td>"); result.Append("<div id=\"excludeUserList\">"); if (userIdList.Length > 0 || groupIdList.Length > 0) { if (userIdList.Length > 0) { userNames = ""; userId = userIdList.Split(",".ToCharArray()); for (i = 0; i <= userId.Length - 1; i++) { if (userNames.Length > 0) { userNames = userNames + ","; } userNames = userNames + userAPI.UserObject(int.Parse(userId[i])).Username; } if (userNames.Length == 0) { userNames = "None"; } } if (groupIdList.Length > 0) { groupNames = ""; groupId = groupIdList.Split(",".ToCharArray()); for (i = 0; i <= groupId.Length - 1; i++) { if (groupNames.Length > 0) { groupNames = groupNames + ","; } groupNames = groupNames + _ContentApi.EkUserRef.GetActiveUserGroupbyID(Convert.ToInt64(groupId[i])).GroupName; if (groupNames.Length == 0) { groupNames = "None"; } } } userList = "User (" + userNames.Replace(",", ", ") + ")<br />User Group (" + groupNames.Replace(",", ", ") + ")"; result.Append(userList); } result.Append("</div>"); result.Append("<ul class=\'buttonWrapper buttonWrapperLeft\'><li><a title=\"" + _MessageHelper.GetMessage("lbl Select User or Group") + "\" class=\"button buttonInlineBlock greenHover buttonCheckAll\" href=\"javascript://\" id=\"selExclUser\" onclick=\"LoadUserListChildPage(\'" + _PageAction + "_siteRpt\');return true;\">"); result.Append(_MessageHelper.GetMessage("lbl Select User or Group")); result.Append("</a></li></ul></td></tr>" + "\r\n"); //generate report button result.Append("<tr><td class=\'label\'> </td><td><ul class=\'buttonWrapper buttonWrapperLeft\'><li><a class=\"button buttonInlineBlock greenHover buttonGetResult\" id=\"btnResult\" onclick=\"ReportSiteUpdateActivity()\" title=\"" + _MessageHelper.GetMessage("btn get result") + "\">" + _MessageHelper.GetMessage("btn get result") + "</a></li></ul></td></tr>" + "\r\n"); result.Append("</table>"); EditScheduleHtml.Text = EditScheduleHtml.Text + result.ToString(); IncludeSiteUpdateActivityJS(); } _AssetInfoData = _ContentApi.GetAssetSupertypes(); if (Ektron.Cms.Common.EkConstants.CMSContentType_Content == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Content == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Forms == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Library == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_NonImageLibrary == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_PDF == Convert.ToInt32(_ContentTypeSelected)) { _ContentType2 = int.Parse(_ContentTypeSelected); } else if (Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= Convert.ToInt32(_ContentTypeSelected) && Convert.ToInt32(_ContentTypeSelected) <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max) { if (DoesAssetSupertypeExist(_AssetInfoData, int.Parse(_ContentTypeSelected))) { _ContentType2 = int.Parse(_ContentTypeSelected); } } if (_HasData) { if (("viewrefreshreport" == _PageAction | "refreshdcontent" == _PageAction | "viewpending" == _PageAction | "viewcheckedin" == _PageAction) && !_ContentApi.EkContentRef.IsAllowed(_ContentApi.RequestInformationRef.UserId, 0, "users", "IsAdmin")) { _FilterType = "User"; _FilterId = _ContentApi.RequestInformationRef.UserId; } cUser = new Collection(); pagedata = new Collection(); pagedata.Add(_ReportType, "StateWanted", null, null); pagedata.Add(_FilterType, "FilterType", null, null); pagedata.Add(_FilterId, "FilterID", null, null); pagedata.Add(_OrderBy, "OrderBy", null, null); pagedata.Add(_Interval, "Interval", null, null); if (_ContentType2 > 0) { pagedata.Add(_ContentType2, "ContentType", null, null); } if (_PageAction == "viewtoexpire") { _ReportData = _ContentApi.GetExpireContent(pagedata); } else if ("siteupdateactivity" == _PageAction) { pagedata.Add(_StartDate, "StartDate", null, null); pagedata.Add(_EndDate, "EndDate", null, null); pagedata.Add(_IsSubFolderIncluded, "SubFolders", null, null); pagedata.Add(folderId, "FolderId", null, null); pagedata.Add(rootFolder, "RootFolder", null, null); if (groupIdList.Length > 0) { string[] temp = groupIdList.Split(",".ToCharArray()); long[] arrIdList = new long[temp.Length - 1 + 1]; int index; for (index = 0; index <= temp.Length - 1; index++) { arrIdList[index] = Convert.ToInt64(temp[index]); } arUserIds = _ContentApi.EkUserRef.GetAllUsersIdsByGroup(arrIdList, "userid"); if (arUserIds.Length > 0) { for (idx = 0; idx <= arUserIds.Length - 1; idx++) { if (sExclUserId.Length > 0) { sExclUserId = sExclUserId + ","; } sExclUserId = sExclUserId + arUserIds[idx].ToString(); //("UserID") } } } if (userIdList.Length > 0) { if (sExclUserId.Length > 0) { sExclUserId = sExclUserId + ","; } sExclUserId = sExclUserId + userIdList; } if (0 == sExclUserId.Length) { sExclUserId = "EktNone"; } pagedata.Add(sExclUserId, "ExUserIds", null, null); pagedata.Add(doesExcludeAll, "ExAllUsers", null, null); } else { //_ReportData = _ContentApi.GetContentReport(pagedata) _PageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize; _PageInfo.CurrentPage = System.Convert.ToInt32(this.uxPaging.SelectedPage + 1); try { _ReportData = _ContentApi.GetContentReport(pagedata, _PageInfo); } catch { Response.Redirect("reports.aspx?action=ViewPending"); } if (_ReportData != null && _PageInfo.TotalPages > 1) { this.uxPaging.Visible = true; this.uxPaging.TotalPages = _PageInfo.TotalPages; this.uxPaging.CurrentPageIndex = _PageInfo.CurrentPage - 1; } else { this.uxPaging.Visible = false; } } } reportstoolbar m_reportsToolBar; System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); DataTable dt = new DataTable(); DataRow dr; bool bIsChart = false; m_reportsToolBar = (reportstoolbar)(LoadControl("controls/reports/reportstoolbar.ascx")); ToolBarHolder.Controls.Add(m_reportsToolBar); m_reportsToolBar.AppImgPath = _AppImgPath; if (_ReportType.ToLower() == "updateactivitycontent") { m_reportsToolBar.Data = ""; } else { m_reportsToolBar.Data = _ReportData; } m_reportsToolBar.PageAction = _PageAction; m_reportsToolBar.FilterType = _FilterType; m_reportsToolBar.TitleBarMsg = _TitleBarMsg; m_reportsToolBar.MultilingualEnabled = _EnableMultilingual; m_reportsToolBar.ContentLang = _ContentApi.ContentLanguage; m_reportsToolBar.HasData = isSubmit; //DATA DISPLAY // Grid is different for the activity report if (_ReportType.ToLower() != "updateactivitycontent") { chart.Visible = false; lblTbl.Visible = false; colBound.DataField = "TITLE"; if ((_PageAction == "viewcheckedout") || (_PageAction == "viewcheckedin")){ colBound.HeaderText = "<input type=\"checkbox\" name=\"all\" onclick=\"javascript:checkAll(this);\"> "; } colBound.HeaderText += _MessageHelper.GetMessage("generic Title"); colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.HeaderStyle.CssClass = "title-header"; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "ID"; colBound.HeaderText = _MessageHelper.GetMessage("generic ID"); colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "LASTEDITOR"; colBound.HeaderText = _MessageHelper.GetMessage("generic Last Editor"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; dgReport.Columns.Add(colBound); string msg = ""; if (_PageAction == "viewpending") { msg = _MessageHelper.GetMessage("generic Go Live"); } else if (_PageAction == "viewexpired") { msg = _MessageHelper.GetMessage("generic End Date"); } else if (_PageAction == "viewtoexpire") { msg = _MessageHelper.GetMessage("generic End Date"); } else { msg = _MessageHelper.GetMessage("generic Date Modified"); } colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "DATE"; colBound.HeaderText = msg; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "PATH"; colBound.HeaderText = _MessageHelper.GetMessage("generic Path"); colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); dgReport.BorderColor = System.Drawing.Color.White; string cLinkArray = ""; string fLinkArray = ""; string lLinkArray = ""; dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(long))); dt.Columns.Add(new DataColumn("LASTEDITOR", typeof(string))); dt.Columns.Add(new DataColumn("DATE", typeof(string))); dt.Columns.Add(new DataColumn("PATH", typeof(string))); if (_PageAction == "viewcheckedout") { action = "ViewStaged"; } if (!(_ReportData == null)) { editSchedule.Visible = false; dgReport.Visible = true; for (i = 0; i <= _ReportData.Length - 1; i++) { if ((_PageAction == "viewcheckedout") || (_PageAction == "viewcheckedin")) { top.Visible = true; } dr = dt.NewRow(); if ((_PageAction == "viewcheckedout") || (_PageAction == "viewcheckedin")) { dr[0] += "<input type=\"checkbox\" name=\"frm_check" + i + "\" onclick=\"document.forms.selections[\'frm_hidden" + i + "\'].value=(this.checked ?" + _ReportData[i].Id + " : 0);\"> "; } else { dr[0] += "<input type=\"hidden\" name=\"frm_check" + i + "\" onclick=\"document.forms.selections[\'frm_hidden" + i + "\'].value=(this.checked ?" + _ReportData[i].Id + ": 0);\"> "; } if (_ReportData[i].ContType == 1) { if (_ReportData[i].SubType == EkEnumeration.CMSContentSubtype.WebEvent) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/calendarViewDay.png" + "></img> "; } else { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/contentHtml.png" + "></img> "; } } else if (_ReportData[i].ContType == 2) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/contentForm.png" + "></img> "; } else if (_ReportData[i].ContType == 3) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/contentHTML.png" + "></img> "; } else if (_ReportData[i].ContType == 1111) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/asteriskOrange.png" + "></img> "; } else if (_ReportData[i].ContType == 3333) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/brick.png" + "></img> "; } else { dr[0] += " <img id=\"img\" src=" + _ReportData[i].AssetData.Icon + "></img> "; } dr[0] += "<input type=\"hidden\" cid=\"" + _ReportData[i].Id + "\" fid=\"" + _ReportData[i].FolderId + "\" name=\"frm_hidden" + i + "\" value=\"0\"> "; if (_ReportData[i].ContType != 2) { dr[0] += "<a href=\"content.aspx?action=" + action + "&LangType=" + _ReportData[i].LanguageId + "&id=" + _ReportData[i].Id + "&callerpage=" + "reports.aspx" + "&origurl=" + EkFunctions.UrlEncode((string)("action=" + _PageAction + "&filtertype=" + _FilterType + "&filterid=" + _FilterId + "&orderby=" + _OrderBy + "&interval=" + _Interval)) + "\" title=\'" + _MessageHelper.GetMessage("generic View") + " \"" + Strings.Replace(_ReportData[i].Title, "\'", "`", 1, -1, 0) + "\"" + "\'>" + _ReportData[i].Title + "</a>"; } else { //Link to cmsforms.aspx dr[0] += "<a href=\"cmsform.aspx?action=ViewForm" + "&LangType=" + _ReportData[i].LanguageId + "&form_id=" + _ReportData[i].Id + "&folder_id=" + _ReportData[i].FolderId + "\" title=\'" + _MessageHelper.GetMessage("generic view") + " \"" + Strings.Replace(_ReportData[i].Title, "\'", "`", 1, -1, 0) + "\"" + "\'>" + _ReportData[i].Title + "</a>"; } dr[1] = _ReportData[i].Id; dr[2] = "<a href=\"reports.aspx?action=" + _PageAction + "&interval=" + _Interval + "&filtertype=USER&filterId=" + _ReportData[i].UserId + "&orderby=" + _OrderBy + "\" title=\"" + _MessageHelper.GetMessage("click to filter msg") + "\">" + _ReportData[i].EditorLastName + ", " + _ReportData[i].EditorFirstName + "</a>"; string _lnk = MakeLink(_ReportData[i]); if (_lnk != "") { dr[2] = _lnk; } else { dr[2] = "<a href=\"reports.aspx?action=" + _PageAction + "&interval=" + _Interval + "&filtertype=USER&filterId=" + _ReportData[i].UserId + "&orderby=" + _OrderBy + "\" title=\"" + _MessageHelper.GetMessage("click to filter msg") + "\">" + _ReportData[i].EditorLastName + ", " + _ReportData[i].EditorFirstName + "</a>"; } if (_PageAction == "viewpending") { dr[3] = _ReportData[i].DisplayGoLive; } else if ((_PageAction == "viewexpired") || (_PageAction == "viewtoexpire")) { dr[3] = _ReportData[i].DisplayEndDate; } else { dr[3] = _ReportData[i].DisplayLastEditDate; } if (_PageAction == "ViewToExpire") { dr[4] = _ReportData[i].Path; } else { dr[4] = "<a href=\"reports.aspx?action=" + _PageAction + "&interval=" + _Interval + "&filtertype=path&filterId=" + _ReportData[i].FolderId + "&orderby=" + _OrderBy + "\" title=\"" + _MessageHelper.GetMessage("click to filter msg") + "\">" + _ReportData[i].Path + "</a>"; } cLinkArray = cLinkArray + "," + _ReportData[i].Id; fLinkArray = fLinkArray + "," + _ReportData[i].FolderId; lLinkArray = System.Convert.ToString(lLinkArray + "," + _ReportData[i].LanguageId); dt.Rows.Add(dr); } if (cLinkArray.Length > 0) { cLinkArray = Strings.Right(cLinkArray, Strings.Len(cLinkArray) - 1); fLinkArray = Strings.Right(fLinkArray, Strings.Len(fLinkArray) - 1); lLinkArray = Strings.Right(lLinkArray, Strings.Len(lLinkArray) - 1); } litCollectionList.Text = cLinkArray; litFolderList.Text = fLinkArray; litLanguageList.Text = lLinkArray; _DataView = new DataView(dt); dgReport.DataSource = _DataView; dgReport.DataBind(); } else { //Currently there is no data to report. Show such message if (EditScheduleHtml.Text.IndexOf("Currently there is no data") == -1) { System.Text.StringBuilder result = new System.Text.StringBuilder(); result.Append("<table>"); result.Append("<tr><td>").Append(_MessageHelper.GetMessage("msg no data report")).Append("</td></tr>"); result.Append("</table>"); EditScheduleHtml.Text = EditScheduleHtml.Text + result.ToString(); } editSchedule.Visible = true; dgReport.Visible = false; } } else { // If it is not a chart and report for site activity if ((Request.QueryString["btnSubmit"] == "1") && !bIsChart) { chart.Visible = false; lblTbl.Visible = false; _SiteData = _ContentApi.GetSiteActivityReportv2_0(pagedata); if (!(_SiteData == null)) { ShowSiteActivity(); if (!(Request.QueryString["reporttype"] == null) && "export" == Request.QueryString["reporttype"]) { Process_Export(); } } } } } EmailHelper ehelp = new EmailHelper(); EmailArea.Text = ehelp.MakeEmailArea(); switch (this._PageAction.ToLower()) { case "viewcheckedin": Display_CheckedIn(); break; case "viewcheckedout": Display_CheckedOut(); break; case "viewnewcontent": Display_NewContent(); break; } }
public ViewCheckedOut() { _ContentApi = new ContentAPI(); _CommonApi = new CommonApi(); }
public SearchHelper() { _RefAPI = new CommonApi(); _MessageHelper = _RefAPI.EkMsgRef; }
void EditEvent(string settings) { try { string sitepath = new CommonApi().SitePath; string webserviceURL = sitepath + "widgets/listsummary/LSHandler.ashx"; JS.RegisterJSInclude(this, JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronJQueryClueTipJS); JS.RegisterJSInclude(this, JS.ManagedScript.EktronScrollToJS); JS.RegisterJSInclude(this, sitepath + "widgets/ListSummary/behavior.js", "ListSummaryWidgetBehaviorJS"); JS.RegisterJSBlock(this, "Ektron.PFWidgets.ListSummary.webserviceURL = \"" + webserviceURL + "\"; Ektron.PFWidgets.ListSummary.setupAll(); ", "EktronPFWidgetsLSInit"); Css.RegisterCss(this, sitepath + "widgets/listsummary/LSStyle.css", "LSWidgetCSS"); folderid.Text = FolderId.ToString(); pagesize.Text = PageSize.ToString(); TeaserCheckBox.Checked = Teaser; IncludeIconsCheckBox.Checked = IncludeIcons; EnablePagingCheckBox.Checked = EnablePaging; RecursiveCheckBox.Checked = Recursive; OrderKeyDropDownList.SelectedValue = OrderKey; ContentTypeDropDownList.SelectedValue = ContentType; DirectionSelectDropDownList.SelectedValue = Direction; AddTextTextBox.Text = AddText; SelTaxonomyIDTextBox.Text = SelTaxonomyID.ToString(); DisplaySelectedContentCheckBox.Checked = DisplaySelectedContent; ViewSet.SetActiveView(Edit); } catch (Exception e) { errorLb.Text = e.Message + e.Data + e.StackTrace + e.Source + e.ToString(); ViewSet.SetActiveView(View); } }
protected void Page_Load(object sender, EventArgs e) { MsgHelper = new EkMessageHelper(m_refContentApi.RequestInformationRef); StyleHelper m_refStyle = new StyleHelper(); CommonApi m_refApi = new CommonApi(); ApplicationAPI AppUI = new ApplicationAPI(); if (Request.QueryString["LangType"] == "-1") { ContentLanguage = AppUI.DefaultContentLanguage; AppUI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); AppUI.ContentLanguage = ContentLanguage; } else { AppUI.ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); ContentLanguage = AppUI.ContentLanguage; } if (!string.IsNullOrEmpty(Request.QueryString["noworkarea"]) && Request.QueryString["noworkarea"] == "1") { noWorkAreaString = "&noworkarea=1"; } long mpID = Convert.ToInt64(Request.QueryString["parentid"]); long maID = Convert.ToInt64(Request.QueryString["ancestorid"]); string AncestorIDParam = ""; string ParentIDParam = ""; Collection gtNavs = new Collection(); if (string.IsNullOrEmpty(Request.QueryString["ancestorid"])) AncestorIDParam = "&ancestorid=" + Request.QueryString["ancestorid"]; if (string.IsNullOrEmpty(Request.QueryString["parentid"])) ParentIDParam = "&parentid=" + Request.QueryString["parentid"]; FolderId = Convert.ToInt64(Request.QueryString["folderid"]); MenuId = Convert.ToInt64(Request.QueryString["nId"]); string ItemType = Request.Form["ItemType"]; if (mpID != 0) { gtNavs = AppUI.EkContentRef.GetMenuByID(mpID, 0, false); if (gtNavs.Count > 0) { if (gtNavs.Contains("EnableReplication")) enableQDOparam = "&qdo=1"; } } switch (ItemType) { case "content": Response.Redirect("collections.aspx?action=AddLink&addto=Menu&folderid=" + FolderId + "&nid=" + MenuId + "&LangType=" + ContentLanguage + "&iframe=" + Request.QueryString["iframe"] + AncestorIDParam + ParentIDParam + "&back=" + Server.UrlEncode(Request.QueryString["back"]) + enableQDOparam + noWorkAreaString); break; case "newcontent": Response.Redirect("collectiontree.aspx?action=AddLink&addto=menu&noworkarea=1&nid=" + MenuId + "&folderid=" + FolderId + "&LangType=" + ContentLanguage); break; case "submenu": string enableReplicationFlag = ""; if ((gtNavs.Count > 0) && (gtNavs.Contains("EnableReplication"))) enableReplicationFlag = gtNavs["EnableReplication"].ToString(); string strPath = "collections.aspx?action=AddSubMenu&folderid=" + FolderId + "&nId=" + MenuId + "&parentid=" + mpID + "&ancestorid=" + maID + "&LangType=" + ContentLanguage + "&iframe=" + Request.QueryString["iframe"] + "&back=" + Server.UrlEncode(Request.QueryString["back"]) + "&QD=" + enableReplicationFlag + noWorkAreaString; Response.Redirect(strPath); break; case "library": divLibrary.Visible = true; Collection gtFolderInfo = AppUI.EkContentRef.GetFolderInfoWithPath(FolderId); FolderPath = gtFolderInfo["Path"].ToString(); if (FolderPath.Substring(FolderPath.Length - 1, 1) == "\\") FolderPath = FolderPath.Remove(FolderPath.Length - 1, 1); FolderPath = FolderPath.Replace(@"\", @"\\"); divLibrary.Visible = true; litTitle.Text = m_refStyle.GetTitleBar(MsgHelper.GetMessage("Add Menu Item Title")); litHelp.Text = StyleHelper.ActionBarDivider + "<td>" + m_refStyle.GetHelpButton("pAddMenuItem", "") + "</td>"; if (!string.IsNullOrEmpty(Request.QueryString["back"])) litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", Request.QueryString["back"], MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "", StyleHelper.CancelButtonCssClass, true); else if (Request.QueryString["iframe"] == "true") litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", "#", MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "onclick=\"parent.CancelIframe();\"", StyleHelper.CancelButtonCssClass, true); else litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", "#", MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "onclick=\"top.close();\"", StyleHelper.CancelButtonCssClass, true); litButtons.Text += m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/save.png", "#", MsgHelper.GetMessage("alt Save Menu Item"), MsgHelper.GetMessage("btn save"), "onclick=\"return SubmitForm(\'AddMenuItem\', \'VerifyLibraryAssest()\');\"", StyleHelper.SaveButtonCssClass, true); break; default: divOther.Visible = true; litHelp1.Text = StyleHelper.ActionBarDivider + "<td>" + m_refStyle.GetHelpButton("pAddMenuItem", "") + "</td>"; litTitle1.Text = m_refStyle.GetTitleBar(MsgHelper.GetMessage("Add Menu Item Title")); if (!string.IsNullOrEmpty(Request.QueryString["back"])) litButtons1.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", Request.QueryString["back"], MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "", StyleHelper.CancelButtonCssClass, true); else if (Request.QueryString["iframe"] == "true") litButtons1.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", "#", MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "onclick=\"parent.CancelIframe();\"", StyleHelper.CancelButtonCssClass, true); else litButtons1.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", "#", MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "onclick=\"top.close();\"", StyleHelper.CancelButtonCssClass, true); litButtons1.Text += m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/save.png", "#", MsgHelper.GetMessage("alt Save Menu Item"), MsgHelper.GetMessage("btn save"), "onclick=\"return SubmitForm(\'AddMenuItem\', \'VerifyAddMenuItem()\');\"", StyleHelper.SaveButtonCssClass, true); break; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if (!IsPostBack) { litLoadingMessage.Text = GetMessage("generic loading"); // TODO should be label w/o viewstate } AnalyticsSecurity.Guard(RequestInformationRef); InitializeDatePickers(); ObtainValues(); //if ("localhost" == RequestInformationRef.HostUrl) //{ // ltr_error.Text = GetMessage("err hostname could not be parsed"); // errGAMsg.Visible = true; //} // abort if error: // TODO: Tie datepicker into ASP.NET Validation? if (errGAMsg.Visible) return; btnRefresh.AlternateText = GetMessage("generic refresh"); btnRefresh.Attributes.Add("title", btnRefresh.AlternateText); CommonApi api = new CommonApi(); btnRefresh.ImageUrl = api.AppImgPath + "refresh.png"; SiteSelect.ProviderName = ProviderSelect.ProviderName; if (!string.IsNullOrEmpty(ProviderSelect.ProviderName)) { _segmentPersistenceId = dataManager.GetSegmentFilterCookieName(ProviderSelect.ProviderName); } } catch (Exception ex) { ltr_error.Text = ex.Message; errGAMsg.Visible = true; ComparisonTimeLineChart.Visible = false; SelectorFilterRow.Visible = false; CaptionRow.Visible = false; SummaryRow.Visible = false; } }