示例#1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ExportModule implements the IPortable ExportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModuleID">The Id of the module to be exported</param>
        /// <history>
        ///		[cnurse]	11/17/2004	documented
        /// </history>
        /// -----------------------------------------------------------------------------
        public string ExportModule(int ModuleID)
        {
            string strXML = "";

            oRepositoryBusinessController = new Helpers();

            Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
            Entities.Modules.ModuleInfo       objModule  = objModules.GetModule(ModuleID, Null.NullInteger);

            RepositoryObjectCategoriesController RepositoryItemCategoryController = new RepositoryObjectCategoriesController();
            ArrayList RepositoryItemCategories = null;

            RepositoryCommentController CommentController = new RepositoryCommentController();
            ArrayList Comments = null;

            ArrayList RepositoryObjects = GetRepositoryObjects(ModuleID, "", "Name", oRepositoryBusinessController.IS_APPROVED, -1, "", -1);

            if (RepositoryObjects.Count != 0)
            {
                strXML += "<repository>";

                RepositoryInfo objDocument = null;
                foreach (RepositoryInfo objDocument_loopVariable in RepositoryObjects)
                {
                    objDocument = objDocument_loopVariable;
                    strXML     += "<item>";
                    strXML     += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.ItemId.ToString()) + "</itemid>";
                    strXML     += "<moduleid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.ModuleId.ToString()) + "</moduleid>";
                    strXML     += "<createdbyuser>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.CreatedByUser) + "</createdbyuser>";
                    strXML     += "<createddate>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.CreatedDate.ToString()) + "</createddate>";
                    strXML     += "<updatedbyuser>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.UpdatedByUser) + "</updatedbyuser>";
                    strXML     += "<updateddate>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.UpdatedDate.ToString()) + "</updateddate>";
                    strXML     += "<name>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Name) + "</name>";
                    strXML     += "<description>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Description) + "</description>";
                    strXML     += "<author>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Author) + "</author>";
                    strXML     += "<authoremail>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.AuthorEMail) + "</authoremail>";
                    strXML     += "<filesize>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.FileSize) + "</filesize>";
                    strXML     += "<downloads>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Downloads.ToString()) + "</downloads>";
                    strXML     += "<previewimage>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.PreviewImage) + "</previewimage>";
                    strXML     += "<image>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Image) + "</image>";
                    strXML     += "<filename>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.FileName) + "</filename>";
                    strXML     += "<clicks>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Clicks.ToString()) + "</clicks>";
                    strXML     += "<ratingvotes>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.RatingVotes.ToString()) + "</ratingvotes>";
                    strXML     += "<ratingtotal>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.RatingTotal.ToString()) + "</ratingtotal>";
                    strXML     += "<ratingaverage>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.RatingAverage.ToString()) + "</ratingaverage>";
                    strXML     += "<commentcount>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.CommentCount.ToString()) + "</commentcount>";
                    strXML     += "<approved>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Approved.ToString()) + "</approved>";
                    strXML     += "<showemail>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.ShowEMail.ToString()) + "</showemail>";
                    strXML     += "<summary>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Summary) + "</summary>";
                    strXML     += "<securityroles>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.SecurityRoles) + "</securityroles>";

                    Comments = CommentController.GetRepositoryComments(objDocument.ItemId, ModuleID);
                    strXML  += "<comments>";
                    foreach (RepositoryCommentInfo comment in Comments)
                    {
                        strXML += "<comment>";
                        strXML += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.ItemId.ToString()) + "</itemid>";
                        strXML += "<createdbyuser>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.CreatedByUser) + "</createdbyuser>";
                        strXML += "<createddate>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.CreatedDate.ToString()) + "</createddate>";
                        strXML += "<objectid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.ObjectId.ToString()) + "</objectid>";
                        strXML += "<comment>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.Comment) + "</comment>";
                        strXML += "</comment>";
                    }
                    strXML += "</comments>";

                    RepositoryItemCategories = RepositoryItemCategoryController.GetRepositoryObjectCategories(objDocument.ItemId);
                    strXML += "<categories>";
                    foreach (RepositoryObjectCategoriesInfo cat in RepositoryItemCategories)
                    {
                        strXML += "<category>";
                        strXML += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(cat.ItemID.ToString()) + "</itemid>";
                        strXML += "<objectid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(cat.ObjectID.ToString()) + "</objectid>";
                        strXML += "<categoryid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(cat.CategoryID.ToString()) + "</categoryid>";
                        strXML += "</category>";
                    }
                    strXML += "</categories>";

                    strXML += "</item>";
                }

                RepositoryCategoryController CategoryController = new RepositoryCategoryController();
                ArrayList Arr        = CategoryController.GetRepositoryCategories(ModuleID, -1);
                ArrayList categories = new ArrayList();
                oRepositoryBusinessController.AddCategoryToArrayList(ModuleID, -1, Arr, ref categories);

                foreach (RepositoryCategoryInfo objCategory in categories)
                {
                    strXML += "<category>";
                    strXML += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.ItemId.ToString()) + "</itemid>";
                    strXML += "<moduleid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.ModuleId.ToString()) + "</moduleid>";
                    strXML += "<category>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.Category.ToString()) + "</category>";
                    strXML += "<parent>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.Parent.ToString()) + "</parent>";
                    strXML += "<vieworder>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.ViewOrder.ToString()) + "</vieworder>";
                    strXML += "<count>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.Count.ToString()) + "</count>";
                    strXML += "</category>";
                }

                strXML += "</repository>";
            }

            return(strXML);
        }
示例#2
0
        public string GetImageMarkUp(MediaInfo Media, Entities.Modules.ModuleInfo ModuleConfig)
        {
            string strTagId       = string.Concat(IMAGE_ID_PREFIX, Media.ModuleID.ToString());
            string strAnchorId    = string.Concat(ANCHOR_ID_PREFIX, strTagId);
            string strDivId       = string.Concat(DIV_ID_PREFIX, strTagId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig));

            //
            // BUILD:
            // <div id="" class="">
            // <img id="" class="" src="" alt="" title="" />
            // </div>
            // <div id="" class="">
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build open anchor tag
            if (!(string.IsNullOrEmpty(Media.NavigateUrl)))
            {
                sb.AppendFormat(OPEN_TAG_FORMAT, ANCHOR_TAG);
                sb.AppendFormat(ID_ATTRIBUTE, strAnchorId);

                if (Regex.IsMatch(Media.NavigateUrl, NUMERIC_MATCH_PATTERN))
                {
                    Media.NavigateUrl = Globals.NavigateURL(int.Parse(Media.NavigateUrl, NumberStyles.Integer));
                }

                if (Media.TrackClicks)
                {
                    // need to parse the local URL to get the human-friendly one
                    sb.AppendFormat(HREF_ATTRIBUTE, FormatURL(Media.NavigateUrl, Media.TrackClicks, ModuleConfig.TabID, ModuleConfig.ModuleID));
                }
                else
                {
                    // this must be a URL already
                    sb.AppendFormat(HREF_ATTRIBUTE, FormatURL(Media.NavigateUrl));
                }

                if (Media.NewWindow)
                {
                    sb.AppendFormat(TARGET_ATTRIBUTE, BLANK_ATTRIBUTE);
                }

                sb.Append(CLOSE_BRACKET);
            }
            //

            // begin building the image tag
            sb.AppendFormat(OPEN_TAG_FORMAT, IMAGE_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strTagId);
            sb.AppendFormat(CLASS_ATTRIBUTE, MEDIA_IMAGE_CLASS);
            sb.AppendFormat(SRC_ATTRIBUTE, Media.WebFriendlyUrl);

            if (!(string.IsNullOrEmpty(Media.Alt)))
            {
                sb.AppendFormat(ALT_ATTRIBUTE, Media.Alt);
                sb.AppendFormat(TITLE_ATTRIBUTE, Media.Alt);
            }
            else
            {
                // for XHTML compliance
                sb.AppendFormat(ALT_ATTRIBUTE, string.Empty);
            }

            if (Media.Width > Null.NullInteger & Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(STYLE_ATTRIBUTE, Media.Width.ToString(), Media.Height.ToString());
            }

            sb.Append(SELF_CLOSE_BRACKET);
            //

            // build close anchor
            if (!(string.IsNullOrEmpty(Media.NavigateUrl)))
            {
                sb.AppendFormat(CLOSE_TAG_FORMAT, ANCHOR_TAG);
            }
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            // add the description, if necessary
            if (!string.IsNullOrEmpty(Media.MediaMessage))
            {
                var strDescriptionId = string.Concat(strDivId, DESCRIPTION);

                // build open div for description
                sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
                sb.AppendFormat(ID_ATTRIBUTE, strDescriptionId);
                sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), DNNCLEAR);
                sb.Append(CLOSE_BRACKET);
                //

                // add the desciption
                sb.Append(HttpUtility.HtmlDecode(Media.MediaMessage));
                //

                // build the close div
                sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
                //
            }

            return(sb.ToString());
        }