Exemple #1
0
        protected override string ParserSkinTags(string skinKey, string skin)
        {
            IList<ReplaceTag> tags = ReplaceTagManager.GetInstance().GetReplaceTags(skinKey, skin);

            if (tags.Count == 0) return skin;

            StringBuilder sb = new StringBuilder(skin);

            ITagValueProvider wpProvider = new WebPartValueProvider(this);

            ITagValueProvider listValueProvider = null;

            foreach (ReplaceTag tag in tags)
            {
                if (tag.ValueProvider == "webpart")
                    sb.Replace(tag.TagValue, wpProvider.GetValue(tag));
                else if (tag.ValueProvider == "splist")
                {
                    if (listValueProvider == null)
                        listValueProvider = new SPListValueProvider(this.GetCurrentSPList());

                    sb.Replace(tag.TagValue, listValueProvider.GetValue(tag));
                }
            }

            return sb.ToString();
        }
Exemple #2
0
        /// <summary>
        /// ����Ƥ��ģ������html
        /// </summary>
        /// <param name="skin"></param>
        /// <returns></returns>       
        private string GetContentHtml(string skin)
        {
            StringBuilder html = new StringBuilder();

            try
            {

                SPList list = base.GetCurrentSPList();

                if (list == null)
                {
                    return "";
                }

                string skinKey = GetBodySkinKey();

                SPListItemCollection items = null;

                SPView view = base.CurrentView ;

                SPQuery q = new SPQuery(view);

                if (this._QueryConditionProvider != null)
                {
                    q.Query = this._QueryConditionProvider.QueryCondition.Query;
                }

                if (RowLimit > 0)
                    q.RowLimit = (uint)this.RowLimit;

                q.ViewFields = "";

                if (!String.IsNullOrEmpty(_RootFolder))
                {
                    SPFolder folder = base.Web.GetFolder(_RootFolder);
                    if (folder != null)
                        q.Folder = folder;
                }
                else
                {

                    string rootFolder = Page.Request.QueryString["RootFolder"];

                    if (rootFolder != null && rootFolder != "")
                    {
                        SPFolder folder = base.Web.GetFolder(rootFolder);
                        if (folder != null)
                            q.Folder = folder;
                    }

                }

                items = list.GetItems(q);

                int rowNumber = 0;

                IList<ReplaceTag> tags = ReplaceTagManager.GetInstance().GetReplaceTags(skinKey, skin);

                ITagValueProvider listValueProvider = new SPListValueProvider(list);
                ITagValueProvider wpValueProvider = new WebPartValueProvider(this);

                foreach (SPListItem item in items)
                {
                    StringBuilder sb = new StringBuilder(skin);

                    rowNumber++;

                    string v;

                    ITagValueProvider fieldValueProvider = new SPListItemValueProvider(item, rowNumber);

                    foreach (ReplaceTag tag in tags)
                    {
                        if (tag.ValueProvider == "spfield")
                            sb.Replace(tag.TagValue, fieldValueProvider.GetValue(tag));
                        else if (tag.ValueProvider == "splist")
                            sb.Replace(tag.TagValue, listValueProvider.GetValue(tag));
                        else if (tag.ValueProvider == "webpart")
                            sb.Replace(tag.TagValue, wpValueProvider.GetValue(tag));
                    }

                    html.Append(sb.ToString());
                }

                return html.ToString();
            }
            catch (Exception ex)
            {
                base.RegisterError(ex);

                return "" ;
            }
        }