protected void Page_Load(object sender, EventArgs e)
        {
            UserDataContext     udc       = UserDataContext.GetUserDataContext();
            DataObjectCommunity myProfile = DataObject.Load <DataObjectCommunity>(UserProfile.Current.ProfileCommunityID);

            QuickParameters quickParameters = new QuickParameters()
            {
                Udc              = udc,
                UserID           = UserProfile.Current.UserId,
                IgnoreCache      = true,
                MembershipParams = new MembershipParams {
                    UserID = UserProfile.Current.UserId
                }
            };
            List <DataObjectCommunity> involvedCommunities = DataObjects.Load <DataObjectCommunity>(quickParameters);

            involvedCommunities.Insert(0, myProfile);
            this.CTYS.DataSource = involvedCommunities;
            this.CTYS.DataBind();

            if (!string.IsNullOrEmpty(CloseWindowJavaScript))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CloseWindowJavaScript", CloseWindowJavaScript, false);
            }
        }
        protected void CTYS_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataObjectCommunity community = (DataObjectCommunity)e.Item.DataItem;

            Literal literal = (Literal)e.Item.FindControl("CTYTITLE");

            if (community.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                literal.Text = GuiLanguage.GetGuiLanguage("ProfileData").GetString("MyProfile");
            }
            else
            {
                literal.Text = community.Title;
            }
            StoredProcedure sp = SPs.HispDataObjectFindInCommunity(dataObject.ObjectID, community.ObjectID.Value, null);

            sp.Execute();
            bool ObjectFound = Convert.ToBoolean(sp.OutputValues[0]);

            literal = (Literal)e.Item.FindControl("CTYSEL");
            if (!ObjectFound)
            {
                literal.Text = "<input type=\"checkbox\" name=\"CTYSEL\" value=\"" + community.ObjectID.Value.ToString() + "\"/>";
            }
            else
            {
                literal.Text = "<input type=\"checkbox\" name=\"CTYSEL\" checked='true' disabled='true' value=\"\" />";
            }
        }
        protected void OnMembershipItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataObjectCommunity item = (DataObjectCommunity)e.Item.DataItem;

            Panel panel = (Panel)e.Item.FindControl("UD");

            RenderCommunity(panel, item);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.WizardSpezial);

            foreach (ListItem item in this.ddlPicV.Items)
            {
                item.Text = language.GetString(string.Format("TextPicUploadSize{0}", item.Value));
            }

            foreach (ListItem item in this.ddlPicVPopup.Items)
            {
                item.Text = language.GetString(string.Format("TextPicUploadPopup{0}", item.Value));
            }


            string paramCtyId = string.Empty;

            if (!string.IsNullOrEmpty(Request.QueryString["CN"]))
            {
                paramCtyId = Request.QueryString["CN"];
                if (!paramCtyId.IsGuid())
                {
                    communityId = DataObjectCommunity.GetCommunityIDByVirtualURL(paramCtyId);
                }
                else
                {
                    communityId = paramCtyId.ToGuid();
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["OID"]))
            {
                objectId = Request.QueryString["OID"].ToGuid();
                if (!communityId.HasValue)
                {
                    DataObject dataObject = DataObject.Load <DataObject>(objectId, null, false);
                    communityId = dataObject.CommunityID.Value;
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["PV"]))
            {
                returnPictureVersion = (PictureVersion)Enum.Parse(typeof(PictureVersion), Request.QueryString["PV"]);
            }

            this.LnkImage.Attributes.Add("onClick", string.Format("radWinOpen('/Pages/Popups/SinglePictureUpload.aspx?OID={0}&TemplateID={1}&ParentRadWin={2}', '{3}', 400, 100, false, null, 'imageWin')", Guid.NewGuid().ToString(), objectId, "galleryWin", language.GetString("TitlePicUpload").StripForScript()));

            LoadPictures();
        }
        protected void OnOverviewItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataObjectCommunity dataObjectUser = (DataObjectCommunity)e.Item.DataItem;
            PlaceHolder         ph             = (PlaceHolder)e.Item.FindControl("PhItem");

            Control ctrl = LoadControl(string.Format("~/UserControls/Templates/{0}", this.OutputTemplate));

            IDataObjectWorker dataObjectWorker = ctrl as IDataObjectWorker;

            if (dataObjectWorker != null)
            {
                dataObjectWorker.DataObject = dataObjectUser;
            }

            ph.Controls.Add(ctrl);
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (DataObject != null && DataObject.ObjectType == Helper.GetObjectTypeNumericID("Page"))
            {
                EnableRoles();
                EnableShowState(DataObject.ShowState);
            }
            else if (DataObject != null && DataObject.ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                EnableManaged();
                EnableShowState(DataObject.ShowState);
                EnableVisibility(DataObject.Status, DataObject.FriendVisibility);
            }
            else if (DataObject != null)
            {
                if (ParentDataObject != null && ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("Community"))
                {
                    bool isMember;
                    bool isOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, ParentDataObject.ObjectID.Value, out isMember);
                    DataObjectCommunity doCommunity = DataObject.Load <DataObjectCommunity>(DataObject.ObjectID, null, true);
                    if (!doCommunity.Managed || isOwner)
                    {
                        EnableShowState(DataObject.ShowState);
                    }
                    else
                    {
                        lblInfo.Text = language.GetString("MessageVisibilityTransmit");
                    }
                }
                else
                {
                    EnableShowState(DataObject.ShowState);
                    EnableVisibility(DataObject.Status, DataObject.FriendVisibility);
                }
            }
            else
            {
                EnableShowState(ObjectShowState.Published);
                EnableVisibility(ObjectStatus.Public, 0);
            }

            pnlView.Visible = visiblilityEnabled || managedEnabled || rolesEnabled || showStateEnabled;
        }
Beispiel #7
0
        public void RenderOverviewPageBreadCrumbs(QuickParameters quickParameters)
        {
            HyperLink userOrCommunityLink = null;

            if (CustomizationSection.CachedInstance.Common.BreadCrumbUserOrCommunityEnabled)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["XUI"]))
                {
                    MembershipUser membershipUser = Membership.GetUser(new Guid(Request.QueryString["XUI"]), false);
                    userOrCommunityLink             = new HyperLink();
                    userOrCommunityLink.Text        = membershipUser.UserName;
                    userOrCommunityLink.NavigateUrl = Helper.GetDetailLink("User", membershipUser.UserName);
                }
                else if (!string.IsNullOrEmpty(Request.QueryString["XCN"]))
                {
                    Guid communityId = new Guid(Request.QueryString["XCN"]);
                    DataObjectCommunity community = DataAccess.Business.DataObject.Load <DataObjectCommunity>(communityId);
                    userOrCommunityLink             = new HyperLink();
                    userOrCommunityLink.Text        = community.Title;
                    userOrCommunityLink.NavigateUrl = Helper.GetDetailLink(community.ObjectType, community.VirtualURL);
                }
            }

            // Set page title
            if (userOrCommunityLink == null)
            {
                this.Page.Master.Page.Title = string.Format(CustomizationSection.CachedInstance.Common.TitleFormat1, SiteConfig.SiteName, Helper.GetObjectName(quickParameters.ObjectType, false));
            }
            else
            {
                this.Page.Master.Page.Title = string.Format(CustomizationSection.CachedInstance.Common.TitleFormat2, SiteConfig.SiteName, userOrCommunityLink.Text, Helper.GetObjectName(quickParameters.ObjectType, false));
            }

            // Set breadcrumbs
            this.BreadCrumpImage = string.Format("/Library/Images/Layout/{0}", Helper.GetObjectIcon(quickParameters.ObjectType));
            this.breadCrumbs.Clear();
            if (userOrCommunityLink != null)
            {
                this.BreadCrumbs.Add(userOrCommunityLink);
            }
            this.BreadCrumbs.Add(new LiteralControl(string.Format("<h1>{0}</h1>", Helper.GetObjectName(quickParameters.ObjectType, false))));
            this.RenderBreadCrumbs();
        }
Beispiel #8
0
        public override bool ShowObject(string settingsXml)
        {
            DataObjectCommunity community = new DataObjectCommunity(UserDataContext.GetUserDataContext());

            community.ObjectID = CommunityID.ToString();
            community.Load();
            if (community.ObjectType == ObjectType.ProfileCommunity)
            {
                DataObjectUser user = new DataObjectUser(UserDataContext.GetUserDataContext());
                user.ObjectID = community.UserID;
                user.Load();

                string image = user.GetImage(PictureVersion.S);
                if (string.IsNullOrEmpty(image))
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + Constants.DEFIMG_USER;
                }
                else
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + image;
                }
            }
            else
            {
                string image = community.GetImage(PictureVersion.S);
                if (string.IsNullOrEmpty(image))
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + Constants.DEFIMG_COMMUNITY;
                }
                else
                {
                    IMAGE.ImageUrl = SiteContext.MediaDomainName + image;
                }
            }
            return(true);
        }
        private void RenderCommunity(Panel pnl, DataObjectCommunity item)
        {
            PlaceHolder ph = new PlaceHolder();

            ph.Controls.Add(new LiteralControl("<div class=\"membership\">"));
            ph.Controls.Add(new LiteralControl("<div class=\"\">"));
            ph.Controls.Add(new LiteralControl("<div class=\"\">"));
            ph.Controls.Add(new LiteralControl(string.Format("<img src='{0}{1}' title='{2}' class='CSB_img105' />", _4screen.CSB.Common.SiteConfig.MediaDomainName, item.GetImage(PictureVersion.XS), item.Title)));
            ph.Controls.Add(new LiteralControl("</div>"));
            ph.Controls.Add(new LiteralControl("</div>"));

            // set community/Profillink
            string CommTitle = item.Title.CropString(14);

            ph.Controls.Add(new LiteralControl(string.Format(@"<div class=""""><a class="""" href=""/Default.aspx?CN={0}"" title=""Gehe zu Community: {2}"">{1}</a></div>", item.CommunityID, CommTitle, item.Title)));

            string strTmp = item.Nickname;

            if (strTmp.Length > 9)
            {
                strTmp = strTmp.Substring(0, 7) + "..";
            }

            if (Guid.Equals(UserProfile.Current.UserId, item.UserID.Value))
            {
                ph.Controls.Add(new LiteralControl(string.Format(@"<div class="""" title=""{2}: {1}"">{3}: {0}</div>", strTmp, item.Nickname, language.GetString("LableCratedBy"), language.GetString("LableFrom"))));
            }
            else
            {
                ph.Controls.Add(new LiteralControl(string.Format(@"<div class="""">von: <a class="""" href=""{0}{1}"" title=""{3}: {1}"">{2}</a></div>", Constants.Links["NICE_LINK_TO_USER_DETAIL"].Url, item.Nickname, strTmp, language.GetString("LableCratedBy"))));
            }
            ph.Controls.Add(new LiteralControl(@"<div class="""">"));
            ph.Controls.Add(new LiteralControl(string.Format(@"<a id=""SpnInf_{0}"" href=""javascript:void(0)"" class="""">{1}</a>", item.ObjectID, language.GetString("LableInfo"))));
            ph.Controls.Add(new LiteralControl("<br/>"));

            Telerik.Web.UI.RadToolTip tooltip = new Telerik.Web.UI.RadToolTip();
            tooltip.TargetControlID     = string.Format(@"SpnInf_{0}", item.ObjectID);
            tooltip.IsClientID          = true;
            tooltip.EnableEmbeddedSkins = false;
            tooltip.ShowEvent           = Telerik.Web.UI.ToolTipShowEvent.OnClick;
            tooltip.Position            = Telerik.Web.UI.ToolTipPosition.TopRight;
            tooltip.RelativeTo          = Telerik.Web.UI.ToolTipRelativeDisplay.Element;
            tooltip.HideEvent           = Telerik.Web.UI.ToolTipHideEvent.LeaveToolTip;
            ObjectDetailsSmall objectDetailsSmall = this.LoadControl("~/UserControls/ObjectDetailsSmall.ascx") as ObjectDetailsSmall;

            objectDetailsSmall.DataObject = item;
            Literal literal = new Literal();

            literal.Text = objectDetailsSmall.GetContent();
            tooltip.Controls.Add(literal);
            ph.Controls.Add(tooltip);

            //Löschen
            if (item.UserID.Value != UserProfile.Current.UserId)
            {
                LinkButton btnRem = new LinkButton();
                btnRem.Text            = language.GetString("CommandMembershipRelease");
                btnRem.CssClass        = "";
                btnRem.CommandArgument = item.CommunityID.Value.ToString();
                btnRem.Click          += new EventHandler(btnRem_Click);
                ph.Controls.Add(btnRem);
                ph.Controls.Add(new LiteralControl("<br/>"));
            }
            else
            {
                ph.Controls.Add(new LiteralControl(@"<span class="""">&nbsp;</span><br/>"));
            }

            ph.Controls.Add(new LiteralControl(string.Format(@"</div>")));
            ph.Controls.Add(new LiteralControl(@"</div>"));
            pnl.Controls.Add(ph);
        }
Beispiel #10
0
        private void RenderCommunity(Panel pnl, Message item)
        {
            try
            {
                XmlDocument xmlData = new XmlDocument();
                xmlData.LoadXml(item.XMLData);
                XmlNode             xmlnCommunity  = xmlData.SelectSingleNode("//root/communityid");
                string              strCommId      = xmlnCommunity.InnerText;
                DataObjectCommunity qo             = DataObject.Load <DataObjectCommunity>(strCommId.ToNullableGuid(), ObjectShowState.Published, false);
                PlaceHolder         phObjectOutput = new PlaceHolder();
                phObjectOutput.Controls.Add(new LiteralControl("<div class=\"invitation\">"));
                phObjectOutput.Controls.Add(new LiteralControl("<div class=\"\">"));
                phObjectOutput.Controls.Add(new LiteralControl("<div class=\"\">"));
                phObjectOutput.Controls.Add(new LiteralControl(string.Format(@"<img src='{0}{1}' title='{2}' class='' />", _4screen.CSB.Common.SiteConfig.MediaDomainName, qo.GetImage(PictureVersion.XS), qo.Title)));
                phObjectOutput.Controls.Add(new LiteralControl("</div>"));
                phObjectOutput.Controls.Add(new LiteralControl("</div>"));
                Community comm = new Community(qo.CommunityID.Value);

                string CommTitle = "";
                if (comm != null && comm.ProfileOrCommunity != null && !string.IsNullOrEmpty(comm.ProfileOrCommunity.Title))
                {
                    // set community/Profillink
                    CommTitle = comm.ProfileOrCommunity.Title;
                    if (comm.ProfileOrCommunity.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
                    {
                        CommTitle = GuiLanguage.GetGuiLanguage("SiteObjects").GetString("ProfileCommunity");
                    }
                    CommTitle = CommTitle.CropString(14);
                }
                phObjectOutput.Controls.Add(new LiteralControl(string.Format(@"<div class="""">{0}</div>", CommTitle)));



                string strTmp = qo.Nickname;
                if (strTmp.Length > 9)
                {
                    strTmp = strTmp.Substring(0, 7) + "..";
                }

                if (Guid.Equals(UserProfile.Current.UserId, qo.UserID.Value))
                {
                    phObjectOutput.Controls.Add(new LiteralControl(string.Format(@"<div class="""" title=""{1}: {2}"">von: {0}</div>", strTmp, language.GetString("LableCratedBy"), qo.Nickname)));
                }
                else
                {
                    phObjectOutput.Controls.Add(new LiteralControl(string.Format(@"<div class="""">von: <a class="""" href=""{0}{2}"" title=""{1}: {2}"">{3}</a></div>", Constants.Links["NICE_LINK_TO_USER_DETAIL"].Url, language.GetString("LableCratedBy"), qo.Nickname, strTmp)));
                }

                // set title
                string PlainTextDescription = qo.Title;
                if (PlainTextDescription.Length == 0)
                {
                    PlainTextDescription = language.GetString("LableNoTitle");
                }
                else
                {  //To make the text readable, replace BRs with " "
                    PlainTextDescription = Regex.Replace(PlainTextDescription, "<BR />", " ", RegexOptions.IgnoreCase);
                    //Now convert to plain text
                    PlainTextDescription = PlainTextDescription.StripHTMLTags();
                }
                string PlainTextCropped = PlainTextDescription.CropString(30);
                phObjectOutput.Controls.Add(new LiteralControl(string.Format(@"<div class="""" title=""{0}: {1}"">{2}</div>", language.GetString("LableTitle"), PlainTextDescription, PlainTextCropped)));

                phObjectOutput.Controls.Add(new LiteralControl(@"<div class="""">"));

                LinkButton btnJoinComm = new LinkButton();
                btnJoinComm.Text            = languageShared.GetString("CommandAcciding");
                btnJoinComm.CssClass        = "";
                btnJoinComm.CommandArgument = qo.ObjectID.Value.ToString() + "§" + item.MsgID + "§" + item.FromUserID.ToString();
                btnJoinComm.Click          += new EventHandler(btnJoinComm_Click);
                phObjectOutput.Controls.Add(btnJoinComm);
                phObjectOutput.Controls.Add(new LiteralControl("<br/>"));

                LinkButton btnRejectComm = new LinkButton();
                btnRejectComm.Text            = languageShared.GetString("CommandReject");
                btnRejectComm.CssClass        = "";
                btnRejectComm.CommandArgument = qo.ObjectID.Value.ToString() + "§" + item.MsgID + "§" + item.FromUserID.ToString();
                btnRejectComm.Click          += new EventHandler(btnRejectComm_Click);
                phObjectOutput.Controls.Add(btnRejectComm);
                phObjectOutput.Controls.Add(new LiteralControl("<br/>"));

                phObjectOutput.Controls.Add(new LiteralControl(string.Format(@"</div>")));
                phObjectOutput.Controls.Add(new LiteralControl(string.Format(@"<p class="""">&nbsp;</p>")));
                phObjectOutput.Controls.Add(new LiteralControl(@"</div>"));


                pnl.Controls.Add(phObjectOutput);
            }
            catch (Exception ex)
            {
                pnl.Controls.Add(new LiteralControl(string.Format("{0}<br/>{1}", ex.Message, ex.StackTrace)));
            }
        }
Beispiel #11
0
        private bool DoEncoding(_4screen.CSB.DataAccess.Business.ConvertQueue convertQueue, _4screen.CSB.DataAccess.Business.DataObjectVideo dov)
        {
            blnIsEncoding = true;
            bool     blnIsOK                         = true;
            string   strCheckMessage                 = string.Empty;
            string   strStatisticFileExtension       = string.Empty;
            string   strNewGUIDFilename              = string.Empty;
            string   strNewGUIDFilenameWithoutExt    = string.Empty;
            string   strTargetOutPath                = string.Empty;
            string   strSourcePathFile               = string.Empty;
            string   strConverterLocalSourcePathFile = string.Empty;
            string   strOriginalLocation             = string.Empty;
            int      intStatisticFileSizeByte        = -1;
            DateTime dtmStart                        = DateTime.Now;
            int      intSizeBite                     = -1;

            #region DO SOME FILE MANIPULATIONS AND SET THE RIGHT PATH

            // check if the source folder and file exists
            if (blnIsOK)
            {
                try
                {
                    //The ConverterRootPathUpload in Web.Config may differ from the one in the app.config
                    //Im WebConfig  =  key="ConverterRootPathUpload" value="\\csbmedia\csbooster\Upload"
                    //Im AppConfig  =   key="ConverterRootPathUpload" value="Z:\Upload"
                    //Sample Upload Path = \\csbmedia\csbooster\Upload\ec572c72-e3fc-4486-82ec-0b2fe0a6d60b\V\20c81a3eb0bc43ac8016f84383893908PA084165.MOV
                    //Convert to = Z:\Upload\ec572c72-e3fc-4486-82ec-0b2fe0a6d60b\V\20c81a3eb0bc43ac8016f84383893908PA084165.MOV
                    string strPartialPath = dov.OriginalLocation.Substring(dov.OriginalLocation.IndexOf(dov.UserID));

                    strSourcePathFile   = Path.Combine(strConverterRootPathUpload, strPartialPath);
                    intSnapshotAfterSec = Convert.ToInt32(convertQueue.VideoPreviewPictureTimepointSec);

                    if (blnIsOK)
                    {
                        if (!vbio.FileExists(strSourcePathFile))
                        {
                            strCheckMessage = string.Format("Uploaded file doesn't exist.<br/>Can't find uploaded media '{0}'", strSourcePathFile);
                            blnIsOK         = false;
                            WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 2, "Check if source folder and file exists (Step 2 / 15)", _4screen.CSB.Common.MonitoringLogState.Aborted, strCheckMessage);
                        }
                        else
                        {
                            WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 2, "Check if source folder and file exists (Step 2 / 15)", _4screen.CSB.Common.MonitoringLogState.OK, "");
                        }
                    }
                }
                catch (Exception ex)
                {
                    blnIsOK         = false;
                    strCheckMessage = string.Format("Base error occurred<br/>DataObjectVideo.ObjectID = {{{0}}}<br/>System.Exception Message: {1}", dov.ObjectID, ex.Message);
                    WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 2, "Check if source folder and file exists (Step 2 / 15)", _4screen.CSB.Common.MonitoringLogState.Aborted, strCheckMessage);
                }
            }

            // rename source file to a GUID file
            if (blnIsOK)
            {
                try
                {
                    FileInfo fi = new FileInfo(strSourcePathFile);
                    strStatisticFileExtension       = fi.Extension;
                    strNewGUIDFilename              = dov.ObjectID + fi.Extension;
                    strConverterLocalSourcePathFile = Path.Combine(strLocalPathSource, strNewGUIDFilename);

                    strTargetOutPath = strSourcePathFile.Replace(strConverterRootPathUpload, strConverterRootPathMedia).Replace(fi.Name, "");
                    if (!Directory.Exists(strTargetOutPath))
                    {
                        Directory.CreateDirectory(strTargetOutPath);
                    }

                    try
                    {
                        // copy the file to a GUID File
                        vbio.CopyFile(strSourcePathFile, strConverterLocalSourcePathFile, true);
                        WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 3, "copy source file to a GUID file (Step 3 / 15)", _4screen.CSB.Common.MonitoringLogState.OK, "");
                    }
                    catch (Exception ex)
                    {
                        blnIsOK         = false;
                        strCheckMessage = string.Format("Error: Can't copy original media to a new GUID file<br/>DataObjectVideo.ObjectID = {{{0}}}<br/>System.Exception Message: {1}", dov.ObjectID, ex.Message);
                        WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 3, "copy source file to a GUID file (Step 3 / 15)", _4screen.CSB.Common.MonitoringLogState.Aborted, strCheckMessage);
                    }

                    if (blnIsOK)
                    {
                        try
                        {
                            // move original to the archive
                            string strTmpArchivePath = strTargetOutPath + @"A\"; //-->X:\CSBooster\Media\ec572c72-e3fc-4486-82ec-0b2fe0a6d60b\V\A
                            if (!Directory.Exists(strTmpArchivePath))
                            {
                                Directory.CreateDirectory(strTmpArchivePath);
                            }

                            strOriginalLocation = strSourcePathFile;    // set the original location to the upload dir; needed if move would crash
                            vbio.MoveFile(strSourcePathFile, Path.Combine(strTmpArchivePath, strNewGUIDFilename), true);
                            strOriginalLocation = Path.Combine(strTmpArchivePath, strNewGUIDFilename);

                            WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 4, "move source to archive (Step 4 / 15)", _4screen.CSB.Common.MonitoringLogState.OK, "");
                        }
                        catch (Exception ex)
                        {
                            strCheckMessage = string.Format("Error: Can't move original media to the archive folder<br/>DataObjectVideo.ObjectID = {{{0}}}<br/>System.Exception Message: {1}", dov.ObjectID, ex.Message);
                            WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 4, "move source to archive (Step 4 / 15)", _4screen.CSB.Common.MonitoringLogState.OKWithWarning, strCheckMessage);
                        }
                    }

                    fi = null;
                }
                catch (Exception ex)
                {
                    blnIsOK         = false;
                    strCheckMessage = string.Format("Base error in copy media to a GUID file<br/>DataObjectVideo.ObjectID = {{{0}}}<br/>System.Exception Message: {1}", dov.ObjectID, ex.Message);
                    WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 3, "copy source file to a GUID file (Step 3 / 15)", _4screen.CSB.Common.MonitoringLogState.Aborted, strCheckMessage);
                }
            }
            #endregion DO SOME FILE MANIPULATIONS AND SET THE RIGHT PATH


            #region DO THE ENCODING
            if (blnIsOK)
            {
                if (!strConverterLocalSourcePathFile.EndsWith(".flv"))
                {
                    ConvertVideo(strConverterLocalSourcePathFile, strLocalPathTarget, dov.ObjectID);
                }
                else
                {
                    try
                    {
                        System.IO.File.Copy(strConverterLocalSourcePathFile, System.IO.Path.Combine(strLocalPathTarget, dov.ObjectID + ".flv"));
                    }
                    catch (Exception ex)
                    {
                        WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 9, "couldn't copy to " + strLocalPathTarget, _4screen.CSB.Common.MonitoringLogState.AbortedMissionCritical, ex.Message);
                        blnIsOK = false;
                    }
                }

                // check if movie FLV exists
                // if yes, convert has succeed (99%)
                // generate thumbnails if FLV file exists
                if (vbio.FileExists(System.IO.Path.Combine(strLocalPathTarget, dov.ObjectID + ".flv")))
                {
                    WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 6, "video converted (Step 6 / 14)", _4screen.CSB.Common.MonitoringLogState.OK, "");

                    // do the preview snapshots
                    GenerateSnapshot(dov.ObjectID, dov.UserID);

                    // move the files from local convert server to the media server
                    try
                    {
                        //Check if The video Should be send to Amazone or moved to the Mediaserver
                        if (!useAmazoneS3)
                        {
                            if (!Directory.Exists(strTargetOutPath + @"FLV\"))
                            {
                                Directory.CreateDirectory(strTargetOutPath + @"FLV\");
                            }
                            vbio.MoveFile(System.IO.Path.Combine(strLocalPathTarget, dov.ObjectID + ".flv"), System.IO.Path.Combine(strTargetOutPath + @"FLV\", dov.ObjectID + ".flv"), true);
                        }
                        else
                        {
                            intSizeBite = (int)UploadToAmazone(System.IO.Path.Combine(strLocalPathTarget, dov.ObjectID + ".flv"), dov.ObjectID, dov.UserID);
                            if (intSizeBite == -1)
                            {
                                blnIsOK = false;
                            }
                            vbio.DeleteFile(System.IO.Path.Combine(strLocalPathTarget, dov.ObjectID + ".flv"));
                        }

                        WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 9, "move converted video to the media path (Step 9 / 14)", _4screen.CSB.Common.MonitoringLogState.OK, "");
                    }
                    catch (Exception ex)
                    {
                        blnIsOK = false;
                        WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 9, "move converted video to the media path (Step 9 / 14)", _4screen.CSB.Common.MonitoringLogState.AbortedMissionCritical, ex.Message);
                    }
                }
                else
                {
                    blnIsOK         = false;
                    strCheckMessage = string.Format("CRITICAL ERROR: converted FLV movie does not exist! Please check this: " + System.IO.Path.Combine(strTargetOutPath, dov.ObjectID + ".flv"));
                    WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 6, "video converted (Step 6 / 14)", _4screen.CSB.Common.MonitoringLogState.AbortedMissionCritical, strCheckMessage);
                }

                // finale check for running convert processes
                try
                {
                    Process[] localByName = Process.GetProcessesByName("convert");
                    for (int i = 0; i < localByName.Length; i++)
                    {
                        localByName[i].Kill();
                    }
                }
                catch
                { }

                blnIsEncoding = false;

                // Get File Size statistics
                try
                {
                    FileInfo fiUpload = new FileInfo(strSourcePathFile);
                    intStatisticFileSizeByte = (int)fiUpload.Length;
                    fiUpload = null;
                }
                catch
                { }
            }
            #endregion DO THE ENCODING

            #region WRITE To THE DATABASE
            // Update Queue Item
            int intConvertTryCount = convertQueue.TryingCount;
            intConvertTryCount++;

            try
            {
                if (blnIsOK)
                {
                    // succeded
                    TimeSpan ts = (TimeSpan)(DateTime.Now - dtmStart);
                    int      intStatisticWorkTimeSec = (int)ts.TotalSeconds;

                    convertQueue.TryingCount            = intConvertTryCount;
                    convertQueue.ConvertMessage         = strCheckMessage;
                    convertQueue.Status                 = _4screen.CSB.Common.MediaConvertedState.Convertet;
                    convertQueue.LastTimeStamp          = DateTime.Now;
                    convertQueue.StatisticFileExtension = strStatisticFileExtension;
                    convertQueue.StatisticFileSizeByte  = intStatisticFileSizeByte;
                    convertQueue.StatisticWorkTimeSec   = intStatisticWorkTimeSec;
                    convertQueue.Update();

                    try
                    {
                        // delete the source file in the upload folder
                        File.Delete(strSourcePathFile);
                        // delete temporary convert source file
                        File.Delete(strConverterLocalSourcePathFile);
                    }
                    catch
                    { }
                }
                else
                {
                    // aborted
                    convertQueue.TryingCount = intConvertTryCount;
                    if (intConvertTryCount >= maxRetries)
                    {
                        convertQueue.Status = _4screen.CSB.Common.MediaConvertedState.ConvertError;
                    }
                    else
                    {
                        convertQueue.Status = _4screen.CSB.Common.MediaConvertedState.NotConvertet;
                        convertQueue.LookID = "";
                    }

                    convertQueue.ConvertMessage         = strCheckMessage;
                    convertQueue.LastTimeStamp          = DateTime.Now;
                    convertQueue.StatisticFileExtension = strStatisticFileExtension;
                    convertQueue.StatisticFileSizeByte  = intStatisticFileSizeByte;
                    convertQueue.StatisticWorkTimeSec   = -1;
                    convertQueue.Update();
                }

                WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 12, "update convert queue in database (Step 12 / 14)", _4screen.CSB.Common.MonitoringLogState.OK, "");
            }
            catch
            {
                //Error: update convert queue crashed
                strCheckMessage = string.Format("ConvertQueue final update crashed! Please check the convert queue in the database");
                WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 12, "update convert queue in database (Step 12 / 14)", _4screen.CSB.Common.MonitoringLogState.OKWithWarning, strCheckMessage);
            }

            // Update Object Item
            try
            {
                if (blnIsOK)
                {
                    // succeded
                    string strHTTPPathOutput       = string.Empty;
                    string strHTTPImageOutput      = string.Empty;
                    string strHTTPImageLargeOutput = string.Empty;
                    string strTmpOutPathAndFile    = strTargetOutPath + @"FLV\" + dov.ObjectID + ".flv";

                    //File Size
                    try
                    {
                        FileInfo fiUpload = new FileInfo(strTmpOutPathAndFile);
                        intSizeBite = (int)fiUpload.Length;
                        fiUpload    = null;
                    }
                    catch
                    { }

                    if (strTmpOutPathAndFile.StartsWith(strConverterRootPathMedia))
                    {
                        strHTTPPathOutput = strTmpOutPathAndFile.Substring(strConverterRootPathMedia.Length).Replace("\\", "/");
                    }

                    dov.SetImageType(_4screen.CSB.Common.PictureVersion.L, _4screen.CSB.Common.PictureFormat.Jpg);
                    dov.SetImageType(_4screen.CSB.Common.PictureVersion.S, _4screen.CSB.Common.PictureFormat.Jpg);
                    dov.SetImageType(_4screen.CSB.Common.PictureVersion.XS, _4screen.CSB.Common.PictureFormat.Jpg);
                    dov.Image            = dov.ObjectID;
                    dov.ConvertMessage   = string.Empty;
                    dov.DurationSecond   = -1; // TODO kann mit dieser Engine nicht ausgelesen werden
                    dov.Location         = strHTTPPathOutput;
                    dov.OriginalLocation = strOriginalLocation;
                    dov.SizeByte         = intSizeBite;
                    //Depending on the Community Settings set the default Showstate to this object
                    DataObject doCont = new DataObject(udc);
                    doCont.ObjectID = dov.CommunityID;
                    doCont.Load(null, true);
                    if (doCont.State != _4screen.CSB.Common.ObjectState.Added)
                    {
                        if (doCont.ObjectType == _4screen.CSB.Common.ObjectType.Community)
                        {
                            if (!string.IsNullOrEmpty(doCont.GetXMLValue("Managed")) && doCont.GetXMLValue("Managed") == "1")
                            {
                                if (DataObjectCommunity.IsUserOwner(dov.CommunityID, dov.UserID))
                                {
                                    dov.ShowState = _4screen.CSB.Common.ObjectShowState.Published;
                                }
                                else
                                {
                                    dov.ShowState = _4screen.CSB.Common.ObjectShowState.Draft;
                                }
                            }
                            else
                            {
                                dov.ShowState = _4screen.CSB.Common.ObjectShowState.Published;
                            }
                        }
                        else
                        {
                            dov.ShowState = _4screen.CSB.Common.ObjectShowState.Published;
                        }
                    }
                    dov.UpdateBackground();
                }
                else
                {
                    dov.ShowState        = ObjectShowState.ConversionFailed;
                    dov.ConvertMessage   = strCheckMessage;
                    dov.DurationSecond   = -1;
                    dov.Location         = "";
                    dov.OriginalLocation = strOriginalLocation;
                    dov.SizeByte         = -1;
                    dov.Image            = "";
                    dov.UpdateBackground();
                }

                WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 13, "update object item in database (Step 13 / 14)", _4screen.CSB.Common.MonitoringLogState.OK, "");
            }
            catch
            {
                //Error: update convert queue crashed
                strCheckMessage = string.Format("Object item final database update crashed! Please check the Object item in the database");
                WriteMonitoringLog(strTransactionID, dov.ObjectID, BaseActions.VideoConvert, 13, "update object item in database (Step 13 / 14)", _4screen.CSB.Common.MonitoringLogState.OKWithWarning, strCheckMessage);
            }

            #endregion WRITE TO DATABASE

            if (strCheckMessage.Length > 0)
            {
                eventLog.WriteEntry(strCheckMessage, EventLogEntryType.Error);
            }

            if (blnIsOK)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Load values from data object
            if (ObjectID.HasValue)
            {
                dataObject = DataObject.Load <DataObject>(ObjectID, null, true);

                this.Copyright.SelectedValue = dataObject.Copyright.ToString();
                if (dataObject.Geo_Lat != double.MinValue && dataObject.Geo_Long != double.MinValue)
                {
                    this.TxtGeoLat.Text  = dataObject.Geo_Lat.ToString();
                    this.TxtGeoLong.Text = dataObject.Geo_Long.ToString();
                }
                this.HFZip.Value     = dataObject.Zip;
                this.HFCity.Value    = dataObject.City;
                this.HFStreet.Value  = dataObject.Street;
                this.HFCountry.Value = dataObject.CountryCode;
            }

            // Overwrite values with query string
            if (!string.IsNullOrEmpty(Request.QueryString["CR"]))
            {
                this.Copyright.SelectedValue = Request.QueryString["CR"];
            }

            string[] geoLatLong = Request.QueryString["GC"] == null ? null : Request.QueryString["GC"].Split(',');
            if (geoLatLong != null && geoLatLong.Length == 2)
            {
                this.TxtGeoLat.Text  = geoLatLong[0];
                this.TxtGeoLong.Text = geoLatLong[1];
            }
            if (!string.IsNullOrEmpty(Request.QueryString["ZP"]))
            {
                this.HFZip.Value = Server.UrlDecode(Request.QueryString["ZP"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CI"]))
            {
                this.HFCity.Value = Server.UrlDecode(Request.QueryString["CI"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["RE"]))
            {
                this.HFStreet.Value = Server.UrlDecode(Request.QueryString["RE"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CO"]))
            {
                this.HFCountry.Value = Server.UrlDecode(Request.QueryString["CO"]);
            }

            // Load view control
            if (!string.IsNullOrEmpty(Helper.GetObjectType(ObjectType).ViewHandlerCtrl))
            {
                string viewHandlerControl = Helper.GetObjectType(ObjectType).ViewHandlerCtrl;
                objectViewHandler                  = (IViewHandler)this.LoadControl(viewHandlerControl);
                objectViewHandler.DataObject       = dataObject;
                objectViewHandler.ParentDataObject = CommunityID.HasValue ? DataObject.Load <DataObject>(CommunityID, null, true) : null;
                this.PhView.Controls.Add((Control)objectViewHandler);
            }

            // Load tag control
            if (!string.IsNullOrEmpty(Helper.GetObjectType(ObjectType).TagHandlerCtrl))
            {
                string tagHandlerControl = !string.IsNullOrEmpty(OverrideTagHandlerControl) ? OverrideTagHandlerControl : Helper.GetObjectType(ObjectType).TagHandlerCtrl;
                objectTagHandler = (ITagHandler)this.LoadControl(tagHandlerControl);
                if (dataObject != null)
                {
                    objectTagHandler.SetTags(dataObject.TagList);
                }
                this.PhTagging.Controls.Add((Control)objectTagHandler);
            }

            // Load community control
            if (ObjectType == Helper.GetObjectTypeNumericID("Community") && ObjectID.HasValue && !CommunityID.HasValue)
            {
                DataObjectCommunity communtiy = DataObject.Load <DataObjectCommunity>(ObjectID, null, true);
                foreach (Telerik.Web.UI.RadComboBoxItem item in this.RCBCtyGroups.Items)
                {
                    item.Text = language.GetString(string.Format("LableForumRights{0}", item.Value));
                }
                foreach (Telerik.Web.UI.RadComboBoxItem item in this.RCBCtyUpload.Items)
                {
                    item.Text = language.GetString(string.Format("LableForumRights{0}", item.Value));
                }
                this.PnlCtyGroups.Visible       = true;
                this.RCBCtyGroups.SelectedValue = ((int)communtiy.CreateGroupUser).ToString();
                this.PnlCtyUpload.Visible       = true;
                this.RCBCtyUpload.SelectedValue = ((int)communtiy.UploadUsers).ToString();
            }

            // Load geotagging
            if (CustomizationSection.CachedInstance.Modules["Geotagging"].Enabled && Helper.GetObjectType(ObjectType).IsGeoTaggable)
            {
                PnlGeoTagging.Visible = true;
                this.LnkOpenMap.Attributes.Add("onClick", string.Format("OpenGeoTagWindow('{0}', '{1}');", this.ClientID, languageShared.GetString("TitleMap").StripForScript()));
            }
        }
Beispiel #13
0
        public override bool SaveStep(ref NameValueCollection queryString)
        {
            ObjectStatus objectStatus     = ObjectStatus.Public;
            bool         managed          = false;
            string       selectedRoles    = null;
            FriendType   friendVisibility = 0;

            if (objectViewHandler != null)
            {
                friendVisibility = objectViewHandler.GetFriendType();
                objectStatus     = objectViewHandler.GetObjectStatus();
                selectedRoles    = objectViewHandler.GetRoles();
                managed          = objectViewHandler.IsManaged();
            }

            ObjectShowState objectShowState = ObjectShowState.Published;

            if (dataObject == null || (dataObject.ObjectType != Helper.GetObjectTypeNumericID("ProfileCommunity") && dataObject.ObjectType != Helper.GetObjectTypeNumericID("Page") && dataObject.ObjectType != Helper.GetObjectTypeNumericID("Community")))
            {
                objectShowState = managed ? ObjectShowState.Draft : ObjectShowState.Published;
            }

            string tagWords = string.Empty;

            if (objectTagHandler != null)
            {
                tagWords = objectTagHandler.GetTags();
            }
            else if (dataObject != null)
            {
                tagWords = dataObject.TagList;
            }

            if (ObjectID.HasValue && dataObject != null && dataObject.State != ObjectState.Added)
            {
                dataObject.TagList          = tagWords;
                dataObject.Status           = objectStatus;
                dataObject.ShowState        = objectShowState;
                dataObject.Copyright        = int.Parse(this.Copyright.SelectedValue);
                dataObject.FriendVisibility = friendVisibility;
                if (!string.IsNullOrEmpty(selectedRoles))
                {
                    var roles = dataObject.RoleRight.Keys.ToArray <string>();
                    foreach (string role in roles)
                    {
                        dataObject.RoleRight[role] = false;
                    }
                    string[] selRoles = selectedRoles.Split(Constants.TAG_DELIMITER);
                    for (int i = 0; i < selRoles.Length; i++)
                    {
                        dataObject.RoleRight[selRoles[i]] = true;
                    }
                }
                double geoLat;
                if (double.TryParse(this.TxtGeoLat.Text, out geoLat))
                {
                    dataObject.Geo_Lat = geoLat;
                }
                double geoLong;
                if (double.TryParse(this.TxtGeoLong.Text, out geoLong))
                {
                    dataObject.Geo_Long = geoLong;
                }
                dataObject.Zip         = this.HFZip.Value.StripForScript();
                dataObject.City        = this.HFCity.Value.StripForScript();
                dataObject.Street      = this.HFStreet.Value.StripForScript();
                dataObject.CountryCode = this.HFCountry.Value.StripForScript();
                dataObject.Update(UserDataContext.GetUserDataContext());

                /*DataObjectList<DataObject> relatedObjects = DataObjects.Load<DataObject>(new QuickParameters { Udc = UserDataContext.GetUserDataContext(), QuerySourceType = QuerySourceType.MyContent, IgnoreCache = true, DisablePaging = true, RelationParams = new RelationParams { ParentObjectID = dataObject.ObjectID, ExcludeSystemObjects = true } });
                 * foreach (DataObject relatedObject in relatedObjects)
                 * {
                 *  relatedObject.Status = dataObject.Status;
                 *  relatedObject.ShowState = dataObject.ShowState;
                 *  relatedObject.Copyright = dataObject.Copyright;
                 *  relatedObject.FriendVisibility = dataObject.FriendVisibility;
                 *  foreach (KeyValuePair<string, bool> roleRight in dataObject.RoleRight)
                 *  {
                 *      relatedObject.RoleRight[roleRight.Key] = roleRight.Value;
                 *  }
                 *  relatedObject.Update(UserDataContext.GetUserDataContext());
                 * }*/

                if (ObjectType == Helper.GetObjectTypeNumericID("Community") && ObjectID.HasValue && !CommunityID.HasValue)
                {
                    CommunityUsersType  communityUsersType   = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RCBCtyGroups.SelectedValue);
                    CommunityUsersType  communityUploadUsers = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RCBCtyUpload.SelectedValue);
                    DataObjectCommunity communtiy            = DataObject.Load <DataObjectCommunity>(ObjectID, null, true);
                    communtiy.CreateGroupUser = communityUsersType;
                    communtiy.UploadUsers     = communityUploadUsers;
                    communtiy.Managed         = managed;
                    communtiy.Update(UserDataContext.GetUserDataContext());
                }
                return(true);
            }
            else
            {
                // If there isn't an upload session and no object id, we habe to create one
                if (string.IsNullOrEmpty(Request.QueryString["UploadSession"]) && !ObjectID.HasValue)
                {
                    queryString.Add("OID", Guid.NewGuid().ToString());
                }

                queryString.Add("TG", Server.UrlEncode(tagWords));
                queryString.Add("OS", ((int)objectStatus).ToString());
                queryString.Add("SS", ((int)objectShowState).ToString());
                queryString.Add("FT", ((int)friendVisibility).ToString());
                queryString.Add("CR", this.Copyright.SelectedValue);
                if (!string.IsNullOrEmpty(selectedRoles))
                {
                    queryString.Add("SR", string.Format("{0}", Server.UrlEncode(selectedRoles)));
                }
                if (!string.IsNullOrEmpty(this.TxtGeoLat.Text) && !string.IsNullOrEmpty(this.TxtGeoLong.Text))
                {
                    queryString.Add("GC", string.Format("{0},{1}", this.TxtGeoLat.Text, this.TxtGeoLong.Text));
                }
                else
                {
                    queryString.Add("GC", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFZip.Value))
                {
                    queryString.Add("ZP", string.Format("{0}", Server.UrlEncode(this.HFZip.Value)));
                }
                else
                {
                    queryString.Add("ZP", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFCity.Value))
                {
                    queryString.Add("CI", string.Format("{0}", Server.UrlEncode(this.HFCity.Value)));
                }
                else
                {
                    queryString.Add("CI", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFStreet.Value))
                {
                    queryString.Add("RE", string.Format("{0}", Server.UrlEncode(this.HFStreet.Value)));
                }
                else
                {
                    queryString.Add("RE", string.Empty);
                }
                if (!string.IsNullOrEmpty(this.HFCountry.Value))
                {
                    queryString.Add("CO", string.Format("{0}", Server.UrlEncode(this.HFCountry.Value)));
                }
                else
                {
                    queryString.Add("CO", string.Empty);
                }
                return(true);
            }
        }
        protected override void OnInit(EventArgs e)
        {
            _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.Notification);

            Pages.Popups.UserControls.Notification notification = this.LoadControl("/Pages/Popups/UserControls/Notification.ascx") as Pages.Popups.UserControls.Notification;
            notification.ID = "NOT";

            if (!string.IsNullOrEmpty(Request.QueryString["OID"]))
            {
                notification.ObjectID = Request.QueryString["OID"].ToGuid();
            }
            if (!string.IsNullOrEmpty(Request.QueryString["UI"]))
            {
                notification.ObjectID = Request.QueryString["UI"].ToGuid();
                notification.UserID   = Request.QueryString["UI"].ToGuid();
            }
            string paramCtyId = string.Empty;

            if (!string.IsNullOrEmpty(Request.QueryString["CN"]))
            {
                paramCtyId = Request.QueryString["CN"];

                if (!paramCtyId.IsGuid())
                {
                    notification.ObjectID = notification.CommunityID = DataObjectCommunity.GetCommunityIDByVirtualURL(paramCtyId);
                }
                else
                {
                    notification.ObjectID = notification.CommunityID = paramCtyId.ToGuid();
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OT"]))
            {
                notification.ObjectType = Helper.GetObjectTypeNumericID(Request.QueryString["OT"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OTS"]))
            {
                string[] objectTypesArray = Request.QueryString["OTS"].Split(',');
                int[]    objectTypes      = new int[objectTypesArray.Length];
                for (int i = 0; i < objectTypesArray.Length; i++)
                {
                    objectTypes[i] = Helper.GetObjectTypeNumericID(objectTypesArray[i]);
                }
                notification.ObjectTypes = objectTypes;
            }

            List <TagWord> tagWords = new List <TagWord>();

            if (!string.IsNullOrEmpty(Request.QueryString["TGL1"]))
            {
                string[] tagWordIDs = QuickParameters.GetDelimitedTagIds(Request.QueryString["TGL1"], ',').Split('|');
                foreach (string tagWordID in tagWordIDs)
                {
                    tagWords.Add(new TagWord()
                    {
                        TagID = tagWordID, GroupID = 1
                    });
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["TGL2"]))
            {
                string[] tagWordIDs = QuickParameters.GetDelimitedTagIds(Request.QueryString["TGL2"], ',').Split('|');
                foreach (string tagWordID in tagWordIDs)
                {
                    tagWords.Add(new TagWord()
                    {
                        TagID = tagWordID, GroupID = 2
                    });
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["TGL3"]))
            {
                string[] tagWordIDs = QuickParameters.GetDelimitedTagIds(Request.QueryString["TGL3"], ',').Split('|');
                foreach (string tagWordID in tagWordIDs)
                {
                    tagWords.Add(new TagWord()
                    {
                        TagID = tagWordID, GroupID = 3
                    });
                }
            }
            notification.TagWords = tagWords;

            ph.Controls.Add(notification);
            base.OnInit(e);
        }
Beispiel #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.OnInit(e);

            udc = UserDataContext.GetUserDataContext();
            currDatatObjectCommunity = DataObject.Load <DataObjectCommunity>(ObjectID, null, true);

            if (currDatatObjectCommunity.State == ObjectState.Added)
            {
                currDatatObjectCommunity             = new DataObjectCommunity(udc);
                currDatatObjectCommunity.ObjectID    = ObjectID;
                currDatatObjectCommunity.CommunityID = ObjectID;
                currDatatObjectCommunity.Title       = GuiLanguage.GetGuiLanguage("Shared").GetString("LabelUnnamed");
                currDatatObjectCommunity.Status      = ObjectStatus.Public;
                currDatatObjectCommunity.ShowState   = ObjectShowState.InProgress;
                if (CommunityID.HasValue)
                {
                    //It's a Group (SubCommunity)
                    currDatatObjectCommunity.ParentObjectID   = CommunityID;
                    currDatatObjectCommunity.ParentObjectType = Helper.GetObjectTypeNumericID("Community");
                }
                currDatatObjectCommunity.Insert(udc);
                currDatatObjectCommunity = DataObject.Load <DataObjectCommunity>(ObjectID, null, true);

                HitblCommunityCty objCommunity = new HitblCommunityCty();
                objCommunity.CtyId           = currDatatObjectCommunity.ObjectID.Value;
                objCommunity.CtyInsertedDate = currDatatObjectCommunity.Inserted;
                objCommunity.CtyVirtualUrl   = Guid.NewGuid().ToString();
                objCommunity.UsrIdInserted   = currDatatObjectCommunity.UserID;
                objCommunity.CtyIsProfile    = false;
                objCommunity.CtyStatus       = (int)CommunityStatus.Initializing;
                objCommunity.CtyLayout       = _4screen.CSB.Common.CustomizationSection.CachedInstance.DefaultLayouts.Community;
                objCommunity.CtyTheme        = Constants.DEFAULT_THEME;
                objCommunity.CtyUpdatedDate  = currDatatObjectCommunity.Inserted;
                objCommunity.UsrIdUpdated    = currDatatObjectCommunity.UserID;
                objCommunity.Save();
            }

            currComm = HitblCommunityCty.FetchByID(ObjectID);
            if (currComm.CtyStatus != (int)CommunityStatus.Initializing)
            {
                //its an edit inserted!
                txtCommName.ReadOnly = true;
            }
            else
            {
                currDatatObjectCommunity.Title = string.Empty;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["TG"]))
            {
                currDatatObjectCommunity.TagList = Server.UrlDecode(Request.QueryString["TG"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OS"]))
            {
                currDatatObjectCommunity.Status = (ObjectStatus)int.Parse(Request.QueryString["OS"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["SS"]))
            {
                currDatatObjectCommunity.ShowState = (ObjectShowState)int.Parse(Request.QueryString["SS"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CR"]))
            {
                currDatatObjectCommunity.Copyright = int.Parse(Request.QueryString["CR"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["GC"]))
            {
                string[] geoLatLong = Request.QueryString["GC"].Split(',');
                double   geoLat, geoLong = double.MinValue;
                if (geoLatLong.Length == 2)
                {
                    if (double.TryParse(geoLatLong[0], out geoLat) && double.TryParse(geoLatLong[1], out geoLong))
                    {
                        currDatatObjectCommunity.Geo_Lat  = geoLat;
                        currDatatObjectCommunity.Geo_Long = geoLong;
                    }
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["ZP"]))
            {
                currDatatObjectCommunity.Zip = Server.UrlDecode(Request.QueryString["ZP"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CI"]))
            {
                currDatatObjectCommunity.City = Server.UrlDecode(Request.QueryString["CI"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["RE"]))
            {
                currDatatObjectCommunity.Street = Server.UrlDecode(Request.QueryString["RE"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CO"]))
            {
                currDatatObjectCommunity.CountryCode = Server.UrlDecode(Request.QueryString["CO"]);
            }

            FillEditForm();
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            featuredValues = DataAccessConfiguration.LoadObjectFeaturedValues();

            Img.ImageUrl = _4screen.CSB.Common.SiteConfig.MediaDomainName + DataObject.GetImage(PictureVersion.S);
            Img.ID       = null;

            LnkDet1.NavigateUrl = Helper.GetDetailLink(DataObject.ObjectType, DataObject.ObjectID.ToString());
            LnkDet1.ID          = null;

            LnkDet2.NavigateUrl = LnkDet1.NavigateUrl;
            LnkDet2.Text        = DataObject.Title.StripHTMLTags();
            LnkDet2.ID          = null;

            LnkAuthor.NavigateUrl = Helper.GetDetailLink(Helper.GetObjectTypeNumericID("User"), DataObject.Nickname);
            LnkAuthor.Text        = DataObject.Nickname;
            LnkAuthor.ID          = null;

            DataObject profileOrCommunity = DataObject.Load <DataObject>(DataObject.CommunityID.Value);
            string     communityCssClass  = string.Empty;
            string     communityTooltip   = string.Empty;

            if (profileOrCommunity.State != ObjectState.Added)
            {
                string communityName = string.Empty;
                string communityUrl  = string.Empty;
                if (profileOrCommunity.ObjectType == Helper.GetObjectTypeNumericID("Community"))
                {
                    DataObjectCommunity community = DataObject.Load <DataObjectCommunity>(DataObject.CommunityID.Value);
                    communityName = profileOrCommunity.Title.CropString(14);
                    communityUrl  = string.Format("{0}", Helper.GetDetailLink(Helper.GetObjectTypeNumericID("Community"), community.VirtualURL));
                    if (!community.Managed)
                    {
                        communityCssClass = "cty";
                        communityTooltip  = languageSiteObjects.GetString("Community");
                    }
                    else
                    {
                        communityCssClass = "mcty";
                        communityTooltip  = language.GetString("TooltipManagedCommunity");
                    }
                }
                else if (profileOrCommunity.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
                {
                    communityName     = profileOrCommunity.Nickname.CropString(14);
                    communityUrl      = string.Format("{0}", Helper.GetDetailLink(Helper.GetObjectTypeNumericID("User"), profileOrCommunity.Nickname));
                    communityCssClass = "prof";
                    communityTooltip  = languageSiteObjects.GetString("ProfileCommunity");
                }
                else
                {
                    communityName     = profileOrCommunity.Title.CropString(14);
                    communityUrl      = string.Format("{0}", Helper.GetDetailLink(profileOrCommunity.ObjectType, profileOrCommunity.ObjectID.ToString()));
                    communityCssClass = "cty";
                    communityTooltip  = Helper.GetObjectName(profileOrCommunity.ObjectType, true);
                }
                LnkCty.NavigateUrl = communityUrl;
                LnkCty.Text        = communityName;
                LnkCty.ID          = null;
            }
            else
            {
                communityCssClass = "errcty";
                communityTooltip  = language.GetString("TooltipCommunityError");
            }
            PnlLoc.CssClass = communityCssClass;
            PnlLoc.ID       = null;
            PnlLoc.ToolTip  = communityTooltip;

            // Info icons
            PhInfo.Controls.Add(new LiteralControl(string.Format("<span class=\"icon {0}\" title=\"{1}\"></span>", DataObject.Status.ToString().ToLower(), language.GetString(string.Format("LableCommunity{0}", DataObject.Status)))));

            if (CustomizationSection.CachedInstance.MyContent.FeaturedEditEnabled)
            {
                PhInfo.Controls.Add(new LiteralControl(string.Format("<span class=\"icon featured\" title=\"{0}\">{1}</span>", featuredValues[DataObject.Featured], DataObject.Featured)));
            }

            switch (DataObject.ShowState)
            {
            case ObjectShowState.Published:
                PhInfo.Controls.Add(new LiteralControl(string.Format("<span class=\"icon published\" title=\"{0}\"></span>", languageShared.GetString("TextShowStatePublished"))));
                break;

            case ObjectShowState.Draft:
                PhInfo.Controls.Add(new LiteralControl(string.Format("<span class=\"icon draft\" title=\"{0}\"></span>", languageShared.GetString("TextShowStateDraft"))));
                break;

            case ObjectShowState.InProgress:
                PhInfo.Controls.Add(new LiteralControl(string.Format("<span class=\"icon working\" title=\"{0}\"></span>", languageShared.GetString("TextShowStateInProgress"))));
                break;

            case ObjectShowState.ConversionFailed:
                PhInfo.Controls.Add(new LiteralControl(string.Format("<span class=\"icon failed\" title=\"{0}\"></span>", languageShared.GetString("TextShowStateConversionFailed"))));
                break;
            }

            if (DataObject.Geo_Lat != double.MinValue)
            {
                PhInfo.Controls.Add(new LiteralControl(string.Format("<span class=\"icon geo\" title=\"{0} {1}\"></span>", Helper.GetObjectName(DataObject.ObjectType, true), language.GetString("TextObjectHasGEO"))));
            }

            // Function icons

            // Funktioniert nicht richtig (ist sprach abhängig) PT fragen
            //functions.Controls.Add(GetInfoTooltip(DataObject));
            //LiteralControl infoLink = new LiteralControl();
            //infoLink.Text = string.Format("<a id=\"ITTT_{0}\" class=\"icon popup\" href=\"javascript:void(0)\"></a>", DataObject.ObjectID);
            //functions.Controls.Add(infoLink);

            if (CustomizationSection.CachedInstance.MyContent.FeaturedEditEnabled && SecuritySection.CachedInstance.CurrentUserHasAccess("DataObjectFeaturedEdit"))
            {
                PhFunc.Controls.Add(GetEditTooltip(DataObject));
                LiteralControl editLink = new LiteralControl();
                editLink.Text = string.Format("<a id=\"ETTT_{0}\" class=\"icon popup2\" href=\"javascript:void(0)\"></a>", DataObject.ObjectID);
                PhFunc.Controls.Add(editLink);
            }

            PhFunc.Controls.Add(new LiteralControl(string.Format("<a class=\"icon edit\" href=\"{0}\" title=\"{1} {2}\"></a>", GetEditUrl(DataObject), Helper.GetObjectName(DataObject.ObjectType, true), language.GetString("TextObjectEdit"))));

            if (DataObject.ShowState == ObjectShowState.Draft || DataObject.ShowState == ObjectShowState.Published)
            {
                bool isOwner  = false;
                bool isMember = false;
                if (UserProfile.Current.UserId != Guid.Empty)
                {
                    isOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, DataObject.CommunityID.Value, out isMember);
                }

                if (DataObject.ShowState == ObjectShowState.Draft && (isOwner || SecuritySection.CachedInstance.CurrentUserHasAccess("DataObjectShowStateEdit")))
                {
                    LinkButton publishButton = new LinkButton();
                    publishButton.CssClass        = "icon publish";
                    publishButton.ToolTip         = language.GetString("TooltipShowStateDraftToPublish");
                    publishButton.CommandArgument = DataObject.ObjectID.ToString();
                    publishButton.Click          += new EventHandler(OnPublishButtonClick);
                    PhFunc.Controls.Add(publishButton);
                }
                else if (DataObject.ShowState == ObjectShowState.Published && (isOwner || SecuritySection.CachedInstance.CurrentUserHasAccess("DataObjectShowStateEdit") || DataObject.UserID == UserProfile.Current.UserId))
                {
                    LinkButton withdrawButton = new LinkButton();
                    withdrawButton.CssClass        = "icon withdraw";
                    withdrawButton.ToolTip         = language.GetString("TooltipShowStatePublishToDraft");
                    withdrawButton.CommandArgument = DataObject.ObjectID.ToString();
                    withdrawButton.Click          += new EventHandler(OnWithdrawButtonClick);
                    PhFunc.Controls.Add(withdrawButton);
                }
            }

            if (DataObject.ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                PhFunc.Controls.Add(new LiteralControl(string.Format("<a class=\"icon members\" href=\"Javascript:radWinOpen('/Pages/popups/CommunityMemberOwner.aspx?CN={0}', '{1}', 450, 440, false, null)\" title=\"{2}\"></a>", DataObject.CommunityID, language.GetString("TitleMemberEdit").StripForScript(), language.GetString("TitleMemberEdit"))));
                PhFunc.Controls.Add(new LiteralControl(string.Format("<a class=\"icon msg\" href=\"Javascript:radWinOpen('/Pages/popups/MessageSend.aspx?MsgType=msg&RecType=member&ObjType=Community&ObjId={0}', '{1}', 510, 430, false, null)\" title=\"{2}\"></a>", DataObject.CommunityID, language.GetString("TitleMessageToAllMembers").StripForScript(), language.GetString("TitleMessageToAllMembers"))));
            }

            PhFunc.Controls.Add(new LiteralControl(string.Format("<a class=\"icon delete\" onclick=\"{0}\" href=\"javascript:void(0)\" title=\"{1} {2}\"></a>", GetDeleteUrl(DataObject), Helper.GetObjectName(DataObject.ObjectType, true), language.GetString("TextObjectDelete"))));
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            wizardId = Request.QueryString["WizardID"];
            if (wizardId == "UserRegistration")
            {
                closedUserGroup = Helper.IsClosedUserGroup();
            }

            PnlWiz.CssClass = SiteConfig.UsePopupWindows ? "wizardPopup" : "wizardWidget";
            PnlWiz.ID       = null;

            if (!string.IsNullOrEmpty(Request.QueryString["XCN"]))
            {
                communityId = !Request.QueryString["XCN"].IsGuid() ? DataObjectCommunity.GetCommunityIDByVirtualURL(Request.QueryString["XCN"]) : Request.QueryString["XCN"].ToGuid();
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OID"]))
            {
                objectId = Request.QueryString["OID"].ToGuid();
            }
            if (!string.IsNullOrEmpty(Request.QueryString["Step"]))
            {
                stepNumber = int.Parse(Request.QueryString["Step"]);
            }

            wizard = WizardSection.CachedInstance.Wizards[wizardId];

            if (wizard.AccessMode == AccessMode.Update)
            {
                _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.WizardEdit);
            }
            else
            if (string.IsNullOrEmpty(Request.QueryString["Flash"]))
            {
                _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.WizardInsert);
            }

            wizardSteps = wizard.Steps.LINQEnumarable.ToList();

            if (wizardSteps.Count > 0 && stepNumber < wizardSteps.Count &&
                ((wizard.NeedsAuthentication && Request.IsAuthenticated) || !wizard.NeedsAuthentication))
            {
                CommunityUsersType communityUploadUsers = CommunityUsersType.Members;
                bool isOwner  = false;
                bool isMember = false;
                if (communityId.HasValue)
                {
                    Guid currentUserId = !string.IsNullOrEmpty(Request.QueryString["UI"]) ? Request.QueryString["UI"].ToGuid() : UserProfile.Current.UserId;

                    DataObjectCommunity community = DataObject.Load <DataObjectCommunity>(communityId, null, true);
                    if (community.State != ObjectState.Added)
                    {
                        communityUploadUsers = community.UploadUsers;
                    }

                    isOwner = DataAccess.Business.Community.GetIsUserOwner(currentUserId, communityId.Value, out isMember);
                    if (communityUploadUsers == CommunityUsersType.Members && isMember)
                    {
                        communityAccessGranted = true;
                    }
                    else if (communityUploadUsers == CommunityUsersType.Owners && isOwner)
                    {
                        communityAccessGranted = true;
                    }
                    else
                    {
                        communityAccessGranted = false;
                    }
                }

                RenderTabs();
                RenderContent();
            }
        }
Beispiel #18
0
        private void UpdateDataObject(DataObjectVideo video, VideoInfo videoInfo, Size largePreview, string format, VideoVersion videoVersion)
        {
            video.SetImageType(_4screen.CSB.Common.PictureVersion.L, _4screen.CSB.Common.PictureFormat.Jpg);
            video.SetImageType(_4screen.CSB.Common.PictureVersion.M, _4screen.CSB.Common.PictureFormat.Jpg);
            video.SetImageType(_4screen.CSB.Common.PictureVersion.S, _4screen.CSB.Common.PictureFormat.Jpg);
            video.SetImageType(_4screen.CSB.Common.PictureVersion.XS, _4screen.CSB.Common.PictureFormat.Jpg);
            video.Image = video.ObjectID.ToString();
            Size videoSize = (videoInfo.Width > 0 && videoInfo.Height > 0) ? new Size(videoInfo.Width, videoInfo.Height) : largePreview;

            video.Width          = videoSize.Width;
            video.Height         = videoSize.Height;
            video.AspectRatio    = (decimal)videoSize.Width / (decimal)videoSize.Height;
            video.ConvertMessage = string.Format("Video Encoding dauerte {0} Sekunden", (DateTime.Now - conversionStart).TotalSeconds);
            video.DurationSecond = (int)videoInfo.Duration_Sec;
            if (archiveUpload)
            {
                string videoFileExtenison = video.OriginalLocation.Substring(video.OriginalLocation.LastIndexOf('.') + 1).ToLower();
                switch (videoFileExtenison)
                {
                case "wmv":
                    video.OriginalFormat = VideoFormat.Wmv;
                    break;

                case "mpg":
                    video.OriginalFormat = VideoFormat.Mpg;
                    break;

                case "mp4":
                    video.OriginalFormat = VideoFormat.Mp4;
                    break;

                case "mov":
                    video.OriginalFormat = VideoFormat.Mov;
                    break;

                case "m4v":
                    video.OriginalFormat = VideoFormat.M4v;
                    break;

                case "flv":
                    video.OriginalFormat = VideoFormat.Flv;
                    break;

                case "avi":
                    video.OriginalFormat = VideoFormat.Avi;
                    break;

                case "3gp":
                    video.OriginalFormat = VideoFormat._3gp;
                    break;

                default:
                    video.OriginalFormat = VideoFormat.Unknow;
                    break;
                }
                video.OriginalLocation = string.Format(@"\{0}\{1}\a\{2}.{3}", video.UserID, Helper.GetMediaFolder(Helper.GetObjectType("Video").NumericId), video.ObjectID, videoFileExtenison);
            }
            else
            {
                video.OriginalLocation = string.Empty;
            }
            FileInfo encodedVideoFileInfo = new FileInfo(string.Format(@"{0}\{3}{1}.{2}", temporaryConversionFolder, video.ObjectID, format, videoVersion));

            video.SizeByte = (int)encodedVideoFileInfo.Length;

            DataObject profileOrCommunity = DataObject.Load <DataObject>(adminUdc, video.CommunityID, null, true);

            if (profileOrCommunity.State != _4screen.CSB.Common.ObjectState.Added)
            {
                if (profileOrCommunity.ObjectType == Helper.GetObjectType("Community").NumericId)
                {
                    DataObjectCommunity community = DataObject.Load <DataObjectCommunity>(adminUdc, video.CommunityID, null, true);
                    if (community.Managed)
                    {
                        video.ShowState = DataObjectCommunity.IsUserOwner(video.CommunityID.Value, video.UserID.Value) ? _4screen.CSB.Common.ObjectShowState.Published : _4screen.CSB.Common.ObjectShowState.Draft;
                    }
                    else
                    {
                        video.ShowState = _4screen.CSB.Common.ObjectShowState.Published;
                    }
                }
                else
                {
                    video.ShowState = _4screen.CSB.Common.ObjectShowState.Published;
                }
            }
            video.UpdateBackground();
        }
Beispiel #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                DataObjectCommunity community = DataObject.Load <DataObjectCommunity>(ObjectID.Value, null, true);
                string anchorContent          = string.Empty;
                if (SiteConfig.UsePopupWindows)
                {
                    anchorContent = string.Format("href=\"javascript:void(0)\" onClick=\"RedirectParentPage('/{0}');GetRadWindow().Close();\"", community.VirtualURL);
                }
                else
                {
                    anchorContent = string.Format("href=\"/{0}\"", community.VirtualURL);
                }
                this.LitMsg.Text = string.Format(language.GetString("MessageCreateCommunitySuccess"), anchorContent, community.Title);
            }
            else if (ObjectType == Helper.GetObjectTypeNumericID("Page"))
            {
                DataObjectPage cmsPage       = DataObject.Load <DataObjectPage>(ObjectID.Value, null, true);
                string         anchorContent = string.Empty;
                if (SiteConfig.UsePopupWindows)
                {
                    anchorContent = string.Format("href=\"javascript:void(0)\" onClick=\"RedirectParentPage('/{0}');GetRadWindow().Close();\"", cmsPage.VirtualURL);
                }
                else
                {
                    anchorContent = string.Format("href=\"/{0}\"", cmsPage.VirtualURL);
                }
                this.LitMsg.Text = string.Format(language.GetString("MessageCreatePageSuccess"), anchorContent, cmsPage.Title);
            }
            else if (ObjectType == Helper.GetObjectTypeNumericID("User"))
            {
                this.LitMsg.Text = GuiLanguage.GetGuiLanguage("UserControls.WebUI.Base").GetString("MessageRegistrationSucceded");
            }
            else
            {
                DataObject community = DataObject.Load <DataObject>(CommunityID.Value, null, true);

                string message           = string.Empty;
                string goToCommunity     = string.Empty;
                string goToCommunityText = string.Empty;
                if (community.ObjectType == Helper.GetObjectTypeNumericID("Community"))
                {
                    message           = string.Format(language.GetString("MessageUploadCommunity"), Helper.GetObjectName(ObjectType, false), community.Title);
                    goToCommunity     = string.Format("{0}", Helper.GetDetailLink(Helper.GetObjectTypeNumericID("Community"), community.ObjectID.ToString()));
                    goToCommunityText = string.Format(language.GetString("MessageGoTo"), community.Title);
                }
                else if (community.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
                {
                    message           = string.Format(language.GetString("MessageUploadProfile"), Helper.GetObjectName(ObjectType, false), community.Title);
                    goToCommunity     = string.Format("{0}", Helper.GetDetailLink(Helper.GetObjectTypeNumericID("User"), community.Nickname));
                    goToCommunityText = string.Format(language.GetString("MessageGoToProfile"));
                }
                string goToMyContent     = string.Format("{0}&T={1}&I=true", Helper.GetDashboardLink(Common.Dashboard.ManageContent), ObjectType);
                string goToMyContentText = string.Format(language.GetString("MessageGoToMyContent"), Helper.GetObjectName(ObjectType, false));
                string goToReturnUrl     = string.Empty;
                if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
                {
                    goToReturnUrl = System.Text.ASCIIEncoding.ASCII.GetString(System.Convert.FromBase64String(Request.QueryString["ReturnUrl"]));
                }

                StringBuilder sb = new StringBuilder();
                sb.Append("<ul>");
                if (SiteConfig.UsePopupWindows)
                {
                    sb.AppendFormat("<li><a href=\"javascript:void(0)\" onClick=\"RedirectParentPage('{0}');GetRadWindow().Close();\">{1}</a></li>", goToCommunity, goToCommunityText);
                    sb.AppendFormat("<li><a href=\"javascript:void(0)\" onClick=\"RedirectParentPage('{0}');GetRadWindow().Close();\">{1}</a></li>", goToMyContent, goToMyContentText);
                    if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
                    {
                        sb.AppendFormat("<li><a href=\"javascript:void(0)\" onClick=\"RedirectParentPage('{0}');GetRadWindow().Close();\">{1}</a></li>", goToReturnUrl, language.GetString("MessageGoBack"));
                    }
                }
                else
                {
                    sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", goToCommunity, goToCommunityText);
                    sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", goToMyContent, goToMyContentText);
                    if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
                    {
                        sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", goToReturnUrl, language.GetString("MessageGoBack"));
                    }
                }
                sb.Append("</ul>");

                this.LitMsg.Text  = message;
                this.LitMsg2.Text = sb.ToString();

                Guid?uploadSession = Request.QueryString["UploadSession"].ToNullableGuid();
                if (uploadSession.HasValue)
                {
                    DataObjectList <DataObject> dataObjectsByUploadSession = DataObjects.Load <DataObject>(new QuickParameters {
                        Udc = UserDataContext.GetUserDataContext(UserProfile.Current.UserName), ObjectType = ObjectType, SortBy = QuickSort.InsertedDate, Direction = QuickSortDirection.Asc, GroupID = uploadSession, DisablePaging = true, IgnoreCache = true, QuerySourceType = QuerySourceType.MyContent
                    });
                    if (dataObjectsByUploadSession.Count > 0)
                    {
                        for (int i = 0; i < dataObjectsByUploadSession.Count; i++)
                        {
                            UserActivities.Insert(UserDataContext.GetUserDataContext(), UserActivityWhat.HasUploadetOneObject, dataObjectsByUploadSession[i].CommunityID.Value, dataObjectsByUploadSession[i].ObjectID.Value, false);
                        }
                    }
                }
                else if (ObjectID.HasValue)
                {
                    UserActivities.Insert(UserDataContext.GetUserDataContext(), UserActivityWhat.HasUploadetOneObject, CommunityID.Value, ObjectID.Value, false);
                }
            }
        }
        public override bool ShowObject(string settingsXml)
        {
            Guid?communityId = null;

            try
            {
                if (this.WidgetHost.ParentObjectType == Helper.GetObjectTypeNumericID("Community"))
                {
                    communityId = this.WidgetHost.ParentCommunityID;
                }
                else if (this.WidgetHost.ParentObjectType == Helper.GetObjectTypeNumericID("Page"))
                {
                    if (WidgetHost.ParentPageType == PageType.Detail && !string.IsNullOrEmpty(Request.QueryString["OID"]))
                    {
                        DataObject detail = DataObject.Load <DataObject>(Request.QueryString["OID"].ToGuid());
                        communityId = detail.CommunityID;
                    }
                    else if (WidgetHost.ParentPageType == PageType.Overview && !string.IsNullOrEmpty(Request.QueryString["XCN"]))
                    {
                        communityId = Request.QueryString["XCN"].ToGuid();
                    }
                }
            }
            catch
            {
                return(false);
            }

            string template = string.Empty;

            if (WidgetHost.OutputTemplate != null)
            {
                if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl))
                {
                    template = WidgetHost.OutputTemplate.OutputTemplateControl;
                }
            }


            if (communityId.HasValue && !string.IsNullOrEmpty(template))
            {
                DataObjectCommunity community = DataObject.Load <DataObjectCommunity>(communityId);
                if (community.State != ObjectState.Added)
                {
                    Control control = LoadControl("~/UserControls/Templates/" + template);
                    control.ID = "USI";

                    IDataObjectWorker dataObjectWorker = control as IDataObjectWorker;
                    if (dataObjectWorker != null)
                    {
                        dataObjectWorker.DataObject = community;
                    }
                    else
                    {
                        return(false);
                    }
                    Ph.Controls.Add(control);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #21
0
        protected void OnRepObjItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataObject quickObject = (DataObject)e.Item.DataItem;

                Control itemOutput = e.Item;

                Panel pnlItem = (Panel)e.Item.FindControl("pnlItem");

                ImageZoom IZ1 = (ImageZoom)itemOutput.FindControl("IZ1");

                IZ1.ImageUrl    = SiteConfig.MediaDomainName + quickObject.GetImage(PictureVersion.XS);
                IZ1.BigImageUrl = SiteConfig.MediaDomainName + quickObject.GetImage(PictureVersion.L);
                IZ1.Description = quickObject.Title;
                IZ1.StyleFolder = "/library/OboutControls/ImageZoom/styles/simple";

                string DetailLink = Helper.GetDetailLink(quickObject.ObjectType, quickObject.ObjectID.Value.ToString());

                Literal litItemPicker = (Literal)itemOutput.FindControl("litItemPicker");
                if (CurrentSelected.ToLower() == DetailLink.ToLower())
                {
                    pnlItem.CssClass   = "CSB_admin_cnt_item CSB_admin_cnt_item_selected CSB_admin_cnt_item_row";
                    litItemPicker.Text = "<a href=\"javascript:void(0)\" class=\"picked\"></a>";
                }
                else
                {
                    litItemPicker.Text = string.Format("<a href=\"javascript:void(0)\" class=\"notpicked\" onclick=\"javascript:document.getElementById('{0}').value='{1}'\"></a>", UrlTextBoxId, DetailLink);
                }

                HyperLink link2 = (HyperLink)itemOutput.FindControl("LnkDet2");
                link2.NavigateUrl = DetailLink;
                link2.Text        = quickObject.Title.StripHTMLTags();
                link2.Target      = "_blank";
                link2.ID          = null;

                HyperLink authorLink = (HyperLink)itemOutput.FindControl("LnkAuthor");
                authorLink.NavigateUrl = Helper.GetDetailLink("User", quickObject.Nickname);
                authorLink.Text        = quickObject.Nickname;
                authorLink.Target      = "_blank";
                authorLink.ID          = null;

                DataObject dataObject        = DataObject.Load <DataObject>(quickObject.CommunityID, null, false);
                string     communityCssClass = string.Empty;
                string     communityTooltip  = string.Empty;
                if (dataObject.State != ObjectState.Added)
                {
                    string communityName = string.Empty;
                    string communityUrl  = string.Empty;
                    if (dataObject.ObjectType == Helper.GetObjectTypeNumericID("Community"))
                    {
                        DataObjectCommunity community = DataObject.Load <DataObjectCommunity>(quickObject.CommunityID, null, false);
                        communityName = community.Title;
                        communityUrl  = string.Format("{0}", Helper.GetDetailLink("Community", community.VirtualURL));
                        if (!community.Managed)
                        {
                            communityCssClass = "cty";
                            communityTooltip  = language.GetString("TootltipCommunity");
                        }
                        else
                        {
                            communityCssClass = "mcty";
                            communityTooltip  = language.GetString("TootltipCommunityManaged");
                        }
                    }
                    else
                    {
                        communityName     = language.GetString("LableProfile");
                        communityUrl      = string.Format("{0}", Helper.GetDetailLink("User", dataObject.Nickname));
                        communityCssClass = "prof";
                        communityTooltip  = language.GetString("TooltipProfile");
                    }
                    HyperLink communityLink = (HyperLink)itemOutput.FindControl("LnkCty");
                    communityLink.NavigateUrl = communityUrl;
                    communityLink.Text        = communityName;
                    communityLink.Target      = "_blank";
                    communityLink.ID          = null;
                }
                else
                {
                    communityCssClass = "errcty";
                    communityTooltip  = language.GetString("TooltipCommunityError");
                }
                Panel storagePanel = (Panel)itemOutput.FindControl("PnlLoc");
                storagePanel.CssClass = communityCssClass;
                storagePanel.ID       = null;
                storagePanel.ToolTip  = communityTooltip;
                HyperLink lnkMyCnt = (HyperLink)itemOutput.FindControl("lnkMyCnt");
                lnkMyCnt.Target      = "_blank";
                lnkMyCnt.NavigateUrl = string.Format("/Pages/Admin/MyContent.aspx?T={0}&W={1}&C=&I=false", Helper.GetObjectType(quickObject.ObjectType).Id, quickObject.ObjectID.Value.ToString());
                lnkMyCnt.Text        = language.GetString("CommandGoToMyContent");
            }
        }