Exemple #1
0
        public ActionResult CreateForPresentation(int id, Slide s)
        {
            s.CreationDate     = DateTime.Now;
            s.ModificationDate = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.Slides.AddObject(s);
                db.SaveChanges();

                System.Diagnostics.Debug.Print("slide has id of {0}", s.ID);

                PresentationSlide ps = new PresentationSlide();
                ps.PresentationID = id;
                ps.SlideID        = s.ID;
                int slideCount = db.PresentationSlides.Where(pslide => pslide.PresentationID == id).Count();
                ps.OrderNum = slideCount;
                db.PresentationSlides.AddObject(ps);
                s.PresentationSlides.Add(ps);
                db.SaveChanges();

                return(RedirectToAction("Edit", "Presentation", new { id = id }));
            }

            return(View(s));
        }
Exemple #2
0
        public ActionResult CreateDlgPost(Slide s, int id, string div)
        {
            s.CreatedBy        = CurrentUserID;
            s.CreationDate     = DateTime.Now;
            s.ModifiedBy       = CurrentUserID;
            s.ModificationDate = DateTime.Now;
            s.Content          = ""; // fill with model/template perhaps?

            if (ModelState.IsValid)
            {
                db.Slides.AddObject(s);
                db.SaveChanges();

                PresentationSlide ps = new PresentationSlide();
                ps.OrderNum       = db.PresentationSlides.Where(x => x.PresentationID == id).Count();
                ps.PresentationID = id;
                ps.SlideID        = s.ID;
                db.PresentationSlides.AddObject(ps);
                db.SaveChanges();


                return(JavaScript("closeDialog(); refreshQueuedSlides(" + id + ", " + "'Edit'" + ");"));
            }

            return(PartialView());
        }
Exemple #3
0
        private void OnShapeChanged(int slidePosition, String slideName, int shapePosition, String shapeValue, SlideItemType type, String shapeName)
        {
            PresentationEditorItem page = (PresentationEditorItem)getPresentationEditor().getActivePage();

            if (page == null)
            {
                return;
            }
            bool added = false;
            PresentationSlide presentationSlide = page.EditedObject.getSlide(slidePosition);

            if (presentationSlide == null)
            {
                presentationSlide = new PresentationSlide(slidePosition, slideName);
                added             = true;
            }

            if (added)
            {
                page.EditedObject.AddSlide(presentationSlide);
            }
            else
            {
                page.EditedObject.UpdateSlide(presentationSlide);
            }

            PresentationSlideItem item = presentationSlide.getShape(shapePosition);

            added = false;
            if (item == null)
            {
                item  = new PresentationSlideItem();
                added = true;
            }
            item.index = shapePosition;
            item.value = shapeValue;
            item.type  = type;
            item.name  = shapeName;
            if (added)
            {
                presentationSlide.AddShape(item);
            }
            else
            {
                presentationSlide.UpdateShape(item);
            }

            Change();
        }
Exemple #4
0
        public JsonResult SlideDelete(int id, int slideID)
        {
            PresentationSlide ps = db.PresentationSlides.Include("Slide").Single(p => p.PresentationID == id && p.SlideID == slideID);

            db.PresentationSlides.DeleteObject(ps);

            int cnt = db.PresentationSlides.Where(p => p.SlideID == slideID).Count();

            if (cnt == 0)
            {
                db.Slides.DeleteObject(ps.Slide);
            }
            db.SaveChanges();

            return(this.Json(new { result = true }));
        }
Exemple #5
0
        public JsonResult Slide(int id, string Title)
        {
            var presentation = db.Presentations.Single(p => p.CreatedBy == CurrentUser.ID && p.ID == id);

            if (presentation != null)
            {
                Slide s = new Slide();
                s.Content          = "";
                s.CreatedBy        = CurrentUserID;
                s.CreationDate     = DateTime.Now;
                s.ModificationDate = DateTime.Now;
                s.ModifiedBy       = CurrentUserID;
                s.Title            = Title;
                db.Slides.AddObject(s);
                db.SaveChanges();

                PresentationSlide ps = new PresentationSlide();
                ps.PresentationID = presentation.ID;
                ps.SlideID        = s.ID;
                ps.OrderNum       = db.PresentationSlides.Where(x => x.PresentationID == id).Count() + 1;
                db.PresentationSlides.AddObject(ps);
                db.SaveChanges();

                return(this.Json(new
                {
                    ID = ps.ID,
                    PresentationID = ps.PresentationID,
                    SlideID = ps.SlideID,
                    OrderNum = ps.OrderNum,
                    Slide = new
                    {
                        ID = ps.Slide.ID,
                        HtmlContentString = ps.Slide.HtmlContentHtmlString.ToHtmlString(),
                        Title = ps.Slide.Title,
                        Layout = ps.Slide.Layout,
                        ModificationDate = ps.Slide.ModificationDate.ToString(),
                        ModifiedBy = ps.Slide.ModifiedBy,
                        CreationDate = ps.Slide.CreationDate.ToString(),
                        CreatedBy = ps.Slide.CreatedBy
                    }
                }));
            }

            return(this.Json(new { result = false }));
        }
Exemple #6
0
        private void OnShapeDeleted(int slidePosition, String slideName, int shapePosition, String shapeValue, SlideItemType type, String shapeName)
        {
            PresentationEditorItem page = (PresentationEditorItem)getPresentationEditor().getActivePage();

            if (page == null)
            {
                return;
            }
            PresentationSlide presentationSlide = page.EditedObject.getSlide(slidePosition);

            if (presentationSlide == null)
            {
                return;
            }
            PresentationSlideItem item = presentationSlide.getShape(shapePosition);

            if (item == null)
            {
                return;
            }
            presentationSlide.DeleteShape(item);
            page.EditedObject.UpdateSlide(presentationSlide);
            Change();
        }
Exemple #7
0
 /// <summary>
 /// This method for close or open slide
 /// </summary>
 /// <param name="slide">the selected slide to turn on or off</param>
 /// <param name="isOpen">the state of the slide</param>
 private void Turn_On_Off_Slide(PresentationSlide slide, bool isOpen)
 {
     slide.gameObject.SetActive(isOpen);
 }