/// <summary> /// 设置数据项 /// </summary> private void SetSortList() { //查询出当前字段的列表 String jsonFields = WebHelper.GetStringParam(Request, nestable_output.UniqueID, ""); if (!String.IsNullOrEmpty(jsonFields)) { JavaScriptSerializer json = new JavaScriptSerializer(); List <DNNGo_ThemePlugin_Relationships> json_fields = json.Deserialize <List <DNNGo_ThemePlugin_Relationships> >(jsonFields); if (json_fields != null && json_fields.Count > 0) { List <DNNGo_ThemePlugin_Relationships> FieldLists = DNNGo_ThemePlugin_Relationships.FindAllByID(EditTabID, PortalId, FileType); for (int i = 0; i < json_fields.Count; i++) { DNNGo_ThemePlugin_Relationships DBField = FieldLists.Find(r => r.ID == json_fields[i].ID); if (DBField != null && DBField.ID > 0 && DBField.Sort != i) { DBField.Sort = i; DBField.Update(); } } } } }
/// <summary> /// 更新绑定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void cmdUpdate_Click(object sender, EventArgs e) { try { if (Display.ToLower() == "list") { //设置全局选项 SetGlobal(); //更新附加图片集 String AlbumIDs = WebHelper.GetStringParam(Request, hfPictures.UniqueID, ""); DNNGo_ThemePlugin_Relationships.Update(TabItem.TabID, PortalId, AlbumIDs, FileType); mTips.LoadMessage("SavePictureSuccess", EnumTips.Success, this, new String[] { TabItem.TabName }); } else { SetSortList(); mTips.LoadMessage("SortPictureSuccess", EnumTips.Success, this, new String[] { "" }); } Response.Redirect(xUrl("EditTabID", EditTabID.ToString(), Token, "Display=" + Display, "FileType=" + FileType.ToString()), false); } catch (Exception ex) { ProcessModuleLoadException(ex); } }
/// <summary> /// 绑定相册集 /// </summary> private void BindPictures(TabInfo Article) { List <String> SelectList = new List <String>(); if (Article != null && Article.TabID > 0) { //填充相册集的关系 List <DNNGo_ThemePlugin_Relationships> Relationships = DNNGo_ThemePlugin_Relationships.FindAllByID(EditTabID, PortalId, FileType); RepeaterFields.DataSource = Relationships; RepeaterFields.DataBind(); foreach (DNNGo_ThemePlugin_Relationships Albums in Relationships) { SelectList.Add(Albums.FileID.ToString()); } } if (Article != null && Article.TabID > 0 && SelectList.Count > 0) { //绑定所有分类到页面 QueryParam qp = new QueryParam(); int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PortalId, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.ID, Common.GetStringByList(SelectList), SearchType.In)); List <DNNGo_ThemePlugin_Multimedia> lst = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount); //拼接顶级分类的方法 StringBuilder sb = new StringBuilder(); StringBuilder sbIDs = new StringBuilder(); foreach (String FileID in SelectList) { if (lst.Exists(r => r.ID.ToString() == FileID)) { DNNGo_ThemePlugin_Multimedia PictureItem = lst.Find(r => r.ID.ToString() == FileID); sb.AppendFormat("<tr data-value='{0}'>", PictureItem.ID).AppendLine(); sb.AppendFormat("<td>{0}<br/><img src=\"{1}\" style=\"max-width:120px; margin-right:15px;\"/></td>", PictureItem.FileName, GetPhotoExtension(PictureItem.FileExtension, PictureItem.FilePath)).AppendLine(); sb.AppendFormat("<td class=\"center\"><a data-value='{0}' class=\"btn btn-xs btn-bricky tooltips\" href=\"javascript:;\" data-placement=\"top\" data-original-title=\"Delete\"><i class=\"fa fa-times fa fa-white\"></i></a></td>", PictureItem.ID).AppendLine(); sb.Append("</tr>").AppendLine(); sbIDs.AppendFormat("{0},", PictureItem.ID); } } hfPictures.Value = sbIDs.ToString(); liPictures.Text = sb.ToString(); } }
/// <summary> /// 字段绑定事件 /// </summary> protected void RepeaterFields_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DNNGo_ThemePlugin_Relationships FieldItem = e.Item.DataItem as DNNGo_ThemePlugin_Relationships; DNNGo_ThemePlugin_Multimedia PictureItem = DNNGo_ThemePlugin_Multimedia.FindByID(FieldItem.FileID); if (PictureItem != null && PictureItem.ID > 0) { Literal liName = e.Item.FindControl("liName") as Literal; liName.Text = PictureItem.FileName; Image imgPicture = e.Item.FindControl("imgPicture") as Image; imgPicture.ImageUrl = GetPhotoExtension(PictureItem.FileExtension, PictureItem.FilePath); } } }
/// <summary> /// 页面加载需要绑定的方法 /// </summary> public void BindPageLoad() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.AppendFormat("<ul id=\"{0}\" class=\"{1}\">", SkinClientID, CssClass).AppendLine(); DNNGo_ThemePlugin_Menu Item = GetGlobalSettings(); EnumRelationshipsFileType FileType = Token.IndexOf("Breadcrumb", StringComparison.CurrentCultureIgnoreCase) >= 0 ? EnumRelationshipsFileType.Breadcrumb : EnumRelationshipsFileType.Background; Boolean isGlobal = (Token.IndexOf("Breadcrumb", StringComparison.CurrentCultureIgnoreCase) >= 0 ? Item.Globals_Breadcrumb : Item.Globals_Background) == 1; List <String> FileIDs = new List <String>(); List <DNNGo_ThemePlugin_Relationships> Relationships = DNNGo_ThemePlugin_Relationships.FindAllViewByID(PortalSettings.ActiveTab.TabID, PortalSettings.PortalId, (Int32)FileType, isGlobal); foreach (DNNGo_ThemePlugin_Relationships Relationship in Relationships) { FileIDs.Add(Relationship.FileID.ToString()); } if (FileIDs != null && FileIDs.Count > 0) { //绑定所有分类到页面 QueryParam qp = new QueryParam(); int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PortalSettings.PortalId, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.ID, Common.GetStringByList(FileIDs), SearchType.In)); List <DNNGo_ThemePlugin_Multimedia> lst = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount); foreach (String FileID in FileIDs) { if (lst.Exists(r => r.ID.ToString() == FileID)) { DNNGo_ThemePlugin_Multimedia PictureItem = lst.Find(r => r.ID.ToString() == FileID); if (PictureItem != null && PictureItem.ID > 0) { sb.AppendFormat("<li style=\"background-image:url('{0}')\"></li>", GetPhotoPath(PictureItem.FilePath)).AppendLine(); } } } } sb.Append("</ul>").AppendLine(); liHTML.Text = sb.ToString(); }