Exemple #1
0
        public ActionResult CreateContentElement(String[] inputDescription, int[] inputType, String[] inputUrl, int[] inputOrder, int contentid)
        {
            if (inputDescription == null || inputType == null || inputUrl == null || inputOrder == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ContentGroup cG = db.ContentGroups.Find(contentid);

            // Content auslesen und erstelen
            for (int i = 0; i < inputDescription.Length; i++)
            {
                ContentElement cE = new ContentElement();
                cE.Description = inputDescription[i];
                cE.TypeID      = inputType[i];
                cE.Url         = inputUrl[i];
                cE.Order       = inputOrder[i];
                cE.ContentID   = contentid;

                cG.ContentElements.Add(cE);
            }
            db.SaveChanges();
            int courseID = cG.CourseID;

            return(RedirectToAction("Course", new { courseID }));
        }
 public ContentItem(Guid musicProviderId, ContentArea location, ContentGroup group, double orderWeight)
 {
     MusicProviderId = musicProviderId;
     Location        = location;
     Group           = group;
     OrderWeight     = orderWeight;
 }
Exemple #3
0
        static void configGroup()
        {
            var g = new ContentGroup {
                FriendlyName = "米菲新闻", Name = "news", UserID = 1
            };

            ContentGroupService.Create(g);

            g = new ContentGroup {
                FriendlyName = "首页轮播", Name = "slide", UserID = 1
            };
            ContentGroupService.Create(g);
            g = new ContentGroup {
                FriendlyName = "产品展示", Name = "product", UserID = 1
            };
            ContentGroupService.Create(g);
            g = new ContentGroup {
                FriendlyName = "产品商城", Name = "shop", UserID = 1
            };
            ContentGroupService.Create(g);
            g = new ContentGroup {
                FriendlyName = "商学院", Name = "school", UserID = 1
            };
            ContentGroupService.Create(g);
        }
Exemple #4
0
        internal static ContentGroup UpdateGroup(ContentGroup group)
        {
            var dal    = MapperFacade.ContentGroupMapper.GetDalObject(group);
            var newDal = DefaultRepository.SimpleUpdate(dal);

            return(MapperFacade.ContentGroupMapper.GetBizObject(newDal));
        }
Exemple #5
0
 public void SetFocus(ContentGroup focusContentGroup, int focusRowId, int focusColumnId)
 {
     if (rolloverEffects && uiElement != null)
     {
         uiElement.SimulateRollOut();
     }
     contentGroup = focusContentGroup;
     rowId        = focusRowId;
     columnId     = focusColumnId;
     uiElement    = contentGroup.uiElements[focusRowId][focusColumnId];
     if (rolloverEffects)
     {
         uiElement.SimulateRollOver();
     }
     if (_evidenceSprite != null)
     {
         // Set evidence sprite
         Vector3 evidencePos = uiElement.bounds.center;
         evidencePos.z -= 1;
         _evidenceSprite.transform.position = evidencePos;
         Vector2 size = uiElement.bounds.size;
         size.x += evidenceBorder * 2;
         size.y += evidenceBorder * 2;
         _evidenceSprite.dimensions = size;
         _evidenceSprite.gameObject.SetActive(true);
         if (_evidenceTween != null)
         {
             _evidenceTween.Restart();
         }
     }
 }
Exemple #6
0
        /// <summary>
        /// Refreshes the current groups. Useful in case of layout changes withing the same group.
        /// </summary>
        public static void Refresh()
        {
            List <ContentGroup> currGroups = new List <ContentGroup>(_ContentGroups);
            string       currFocusName     = _FocusManager.uiElement.name;
            ContentGroup currFocusGroup    = _FocusManager.contentGroup;

            DeactivateAll();
            for (int i = 0; i < currGroups.Count; ++i)
            {
                ContentGroup cGroup = currGroups[i];
                if (i == 0)
                {
                    if (currFocusGroup == cGroup)
                    {
                        Activate(cGroup.parent, currFocusName);
                    }
                    else
                    {
                        Activate(cGroup.parent);
                    }
                }
                else
                {
                    if (currFocusGroup == cGroup)
                    {
                        AddGroup(cGroup.parent, currFocusName);
                    }
                    else
                    {
                        AddGroup(cGroup.parent);
                    }
                }
            }
        }
Exemple #7
0
        public async Task <ActionResult <ListResult> > Add([FromBody] AddRequest request)
        {
            if (await _contentGroupRepository.IsExistsAsync(request.SiteId, request.GroupName))
            {
                return(this.Error("保存失败,已存在相同名称的内容组!"));
            }

            var groupInfo = new ContentGroup
            {
                SiteId      = request.SiteId,
                GroupName   = request.GroupName,
                Description = request.Description
            };

            await _contentGroupRepository.InsertAsync(groupInfo);

            await _authManager.AddSiteLogAsync(request.SiteId, "新增内容组", $"内容组:{groupInfo.GroupName}");

            var groups = await _contentGroupRepository.GetContentGroupsAsync(request.SiteId);

            var groupNames = groups.Select(x => x.GroupName);

            return(new ListResult
            {
                GroupNames = groupNames,
                Groups = groups
            });
        }
Exemple #8
0
        private static void ConvertListIndexToEntityIds(ContentGroup contentGroup, ItemIdentifier reqItem,
                                                        string contentTypeStaticName)
        {
            var part = contentGroup[reqItem.Group.Part];

            reqItem.ContentTypeName = contentTypeStaticName;
            if (!reqItem.Group.Add &&               // not in add-mode
                part.Count > reqItem.Group.Index && // has as many items as desired
                part[reqItem.Group.Index] != null)  // and the slot has something
            {
                reqItem.EntityId = part[reqItem.Group.Index].EntityId;
            }

            // tell the UI that it should not actually use this data yet, keep it locked
            if (!reqItem.Group.Part.ToLower().Contains(AppConstants.PresentationLower))
            {
                return;
            }

            reqItem.Group.SlotCanBeEmpty = true;     // all presentations can always be locked

            if (reqItem.EntityId != 0)
            {
                return;
            }

            reqItem.Group.SlotIsEmpty = true;     // if it is blank, then lock this one to begin with

            reqItem.DuplicateEntity =
                reqItem.Group.Part.ToLower() == AppConstants.PresentationLower
                        ? contentGroup.Template.PresentationDemoEntity?.EntityId
                        : contentGroup.Template.ListPresentationDemoEntity?.EntityId;
        }
Exemple #9
0
 public static void Create(ContentGroup model)
 {
     using (var conn = Database.GetConn())
     {
         conn.Insert(model);
     }
 }
Exemple #10
0
        private static void ConvertListIndexToEntityIds(ItemIdentifier identifier, ContentGroup contentGroup)
        {
            var part = contentGroup[identifier.Group.Part];

            if (!identifier.Group.Add &&               // not in add-mode
                part.Count > identifier.Group.Index && // has as many items as desired
                part[identifier.Group.Index] != null)  // and the slot has something
            {
                identifier.EntityId = part[identifier.Group.Index].EntityId;
            }

            // tell the UI that it should not actually use this data yet, keep it locked
            if (!identifier.Group.Part.ToLower().Contains(AppConstants.PresentationLower))
            {
                return;
            }

            // the following steps are only for presentation items
            identifier.Group.SlotCanBeEmpty = true; // all presentations can always be locked

            if (identifier.EntityId != 0)
            {
                return;
            }

            identifier.Group.SlotIsEmpty = true; // if it is blank, then lock this one to begin with

            identifier.DuplicateEntity =
                identifier.Group.Part.ToLower() == AppConstants.PresentationLower
                    ? contentGroup.Template.PresentationDemoEntity?.EntityId
                    : contentGroup.Template.ListPresentationDemoEntity?.EntityId;
        }
Exemple #11
0
    private void OnPlayerGesture(long userid, string gesture)
    {
        if (userid == PlayerManager.Instance.GetPrimaryPlay().UserID)
        {
            switch (gesture)
            {
            case "右挥手":
                ContentGroup.DOLocalMoveX(-1100, 0.5f).Ease(TweenType.EaselnOutBack).OnComplete(() =>
                {
                    for (int i = 0; i < ContentRawImage.Count; i++)
                    {
                        ContentRawImage[i].enabled = false;
                    }
                    ContentGroup.localPosition = Vector3.zero;
                    SetContent(1);
                });
                break;

            case "左挥手":
                ContentGroup.DOLocalMoveX(1100, 0.5f).Ease(TweenType.EaselnOutBack).OnComplete(() =>
                {
                    for (int i = 0; i < ContentRawImage.Count; i++)
                    {
                        ContentRawImage[i].enabled = false;
                    }
                    ContentGroup.localPosition = Vector3.zero;
                    SetContent(-1);
                });
                break;
            }
        }
    }
        public async Task <ActionResult <GetResult> > Add([FromBody] ChannelGroup request)
        {
            if (!await _authManager.HasSitePermissionsAsync(request.SiteId,
                                                            Types.SitePermissions.SettingsContentGroup))
            {
                return(Unauthorized());
            }

            if (await _contentGroupRepository.IsExistsAsync(request.SiteId, request.GroupName))
            {
                return(this.Error("保存失败,已存在相同名称的内容组!"));
            }

            var groupInfo = new ContentGroup
            {
                SiteId      = request.SiteId,
                GroupName   = request.GroupName,
                Description = request.Description
            };

            await _contentGroupRepository.InsertAsync(groupInfo);

            await _authManager.AddSiteLogAsync(request.SiteId, "新增内容组", $"内容组:{groupInfo.GroupName}");

            var groups = await _contentGroupRepository.GetContentGroupsAsync(request.SiteId);

            return(new GetResult
            {
                Groups = groups
            });
        }
Exemple #13
0
        /// <summary>
        /// Use this to add a content group to the Help Panel
        /// </summary>
        public ContentGroup AddContentGroup(string title, string description = null)
        {
            ContentGroup result = new ContentGroup(title, description);

            _ContentGroups.Add(result);
            return(result);
        }
Exemple #14
0
        public HelpPanel(NodeProcess nodeProcess)
        {
            _process = nodeProcess;

            // Write down help content
            // GENERAL
            ContentGroup cGroup = AddContentGroup("General");

            cGroup.AppendDefinition("Open/Close [b]Help Panel[/b]").AddKey("F1");
            cGroup.AppendDefinition("Pan area").AddKey("MMB → Drag");
            cGroup.AppendDefinition("Zoom in/out (if allowed)").AddKey("CTRL+Scrollwheel");
            cGroup.AppendDefinition("Show extra UI buttons").AddKey("ALT");
            cGroup.AppendDefinition("Background context menu").AddKey("RMB");
            // SELECTION
            cGroup = AddContentGroup("Selection");
            cGroup.AppendDefinition("Select all nodes").AddKey("CTRL+A");
            cGroup.AppendDefinition("Draw selection rect").AddKey("LMB → Drag").AddKeyTarget("on background");
            cGroup.AppendDefinition("Draw selection rect (add)").AddKey("SHIFT+LMB → Drag").AddKeyTarget("on background");
            cGroup.AppendDefinition("Add/Remove node from selection").AddKey("SHIFT+LMB").AddKeyTarget("on node");
            cGroup.AppendDefinition("Add node plus all forward connected nodes to selection").AddKey("SHIFT+ALT+LMB").AddKeyTarget("on node");
            // NODE MANIPULATION
            cGroup = AddContentGroup("Nodes Manipulation");
            cGroup.AppendDefinition("Delete selected nodes").AddKey("DELETE").AddKey("BACKSPACE");
            cGroup.AppendDefinition("Copy selected nodes").AddKey("CTRL+C");
            cGroup.AppendDefinition("Cut selected nodes").AddKey("CTRL+X");
            cGroup.AppendDefinition("Paste nodes").AddKey("CTRL+V");
            cGroup.AppendDefinition("Move selected nodes by 1 pixel").AddKey("ARROWS");
            cGroup.AppendDefinition("Move selected nodes by 10 pixel").AddKey("SHIFT+ARROWS");
            cGroup.AppendDefinition("Disable snapping while dragging nodes").AddKey("ALT");
            cGroup.AppendDefinition("Drag new connection from node (if allowed)").AddKey("CTRL+LMB → Drag");
            cGroup.AppendDefinition("Clone selected nodes and drag them").AddKey("SHIFT+CTRL+LMB → Drag");
            cGroup.AppendDefinition("Node context menu").AddKey("RMB");
        }
Exemple #15
0
        // Returns eventual group above this one (but within this group's X bounds), or NULL if there is none
        static ContentGroup GetAdjacentGroup(this ContentGroup contentGroup, Direction direction)
        {
            if (_ContentGroups.Count <= 1)
            {
                return(null);
            }

            ContentGroup adjacentGroup = null;

            foreach (ContentGroup cGroup in _ContentGroups)
            {
                if (cGroup == contentGroup)
                {
                    continue;
                }
                switch (direction)
                {
                case Direction.Up:
                    if (cGroup.IsAboveOf(contentGroup))
                    {
                        if (adjacentGroup == null || cGroup.bounds.min.y < adjacentGroup.bounds.min.y)
                        {
                            adjacentGroup = cGroup;
                        }
                    }
                    break;

                case Direction.Down:
                    if (cGroup.IsBelowOf(contentGroup))
                    {
                        if (adjacentGroup == null || cGroup.bounds.max.y > adjacentGroup.bounds.max.y)
                        {
                            adjacentGroup = cGroup;
                        }
                    }
                    break;

                case Direction.Left:
                    if (cGroup.IsLeftOf(contentGroup))
                    {
                        if (adjacentGroup == null || cGroup.bounds.max.x > adjacentGroup.bounds.max.x)
                        {
                            adjacentGroup = cGroup;
                        }
                    }
                    break;

                case Direction.Right:
                    if (cGroup.IsRightOf(contentGroup))
                    {
                        if (adjacentGroup == null || cGroup.bounds.min.x < adjacentGroup.bounds.min.x)
                        {
                            adjacentGroup = cGroup;
                        }
                    }
                    break;
                }
            }
            return(adjacentGroup);
        }
        public ContentGroup CreateContentGroup(Director director, List <Actor> actors)
        {
            if (director == null)
            {
                return(null);
            }

            lock (groupLock)
            {
                uint[] initialMembers = null;

                if (actors != null)
                {
                    initialMembers = new uint[actors.Count];
                    for (int i = 0; i < actors.Count; i++)
                    {
                        initialMembers[i] = actors[i].actorId;
                    }
                }

                groupIndexId = groupIndexId | 0x3000000000000000;

                ContentGroup contentGroup = new ContentGroup(groupIndexId, director, initialMembers);
                mContentGroups.Add(groupIndexId, contentGroup);
                groupIndexId++;
                if (initialMembers != null && initialMembers.Length != 0)
                {
                    contentGroup.SendAll();
                }

                return(contentGroup);
            }
        }
Exemple #17
0
        public async Task InsertAsync(ContentGroup group)
        {
            group.Taxis = await GetMaxTaxisAsync(group.SiteId) + 1;

            await _repository.InsertAsync(group, Q
                                          .CachingRemove(GetCacheKey(group.SiteId))
                                          );
        }
Exemple #18
0
        internal ShapeLayer(ILottieDrawable lottieDrawable, Layer layerModel) : base(lottieDrawable, layerModel)
        {
            // Naming this __container allows it to be ignored in KeyPath matching.
            ShapeGroup shapeGroup = new ShapeGroup("__container", layerModel.Shapes, false);

            _contentGroup = new ContentGroup(lottieDrawable, this, shapeGroup);
            _contentGroup.SetContents(new List <IContent>(), new List <IContent>());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ContentGroup contentGroup = db.ContentGroups.Find(id);

            db.ContentGroups.Remove(contentGroup);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #20
0
        private ContentGroup ParseGroup(XmlElement element)
        {
            var group = new ContentGroup();

            group.SetCommonProperty(element);

            return(group);
        }
Exemple #21
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ContentGroup contentGroup = await db.ContentGroups.FindAsync(id);

            db.ContentGroups.Remove(contentGroup);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemple #22
0
        public static ContentGroup UpdateGroup(ContentGroup item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            return(ContentRepository.UpdateGroup(item));
        }
Exemple #23
0
        private static void ConvertToContentGroup(ref List <NodeElementWrapper> nodeContents, SimpleNodeElement nodeElement)
        {
            Debug.Assert(nodeElement.Element is PSMClass);
            int index = nodeContents.IndexOf(nodeElement);

            nodeContents.RemoveAt(index);
            ContentGroup cg = ((PSMClass)nodeElement.Element).GetNodeAsContentGroup();

            nodeContents.Insert(index, cg);
        }
        public ActionResult DeleteConfirmed(Guid id)
        {
            ContentGroup contentGroup = db.ContentGroups.Find(id);

            contentGroup.IsDeleted    = true;
            contentGroup.DeletionDate = DateTime.Now;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// Adds ContentGroup
        /// </summary>
        /// <param name="g">Content group to add</param>
        void AddGroup(ContentGroup g)
        {
            TreeNode n = AddItem(g.Name);

            n.Expand();

            foreach (ContentInfo i in g.Contents)
            {
                AddItem(i.Name, i, n);
            }
        }
Exemple #26
0
 public ActionResult Edit([Bind(Include = "Id,Order,Header,CourseId,ContentId")] ContentGroup contentGroup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contentGroup).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseId = new SelectList(db.Courses, "Id", "Title", contentGroup.CourseId);
     return(View(contentGroup));
 }
        /// <summary>
        /// Deletes the given model.
        /// </summary>
        /// <param name="model">The model</param>
        public async Task DeleteAsync(ContentGroup model)
        {
            // Call hooks & delete
            App.Hooks.OnBeforeDelete(model);
            await _repo.DeleteAsync(model.Id).ConfigureAwait(false);

            App.Hooks.OnAfterDelete(model);

            // Clear cache
            _cache?.Remove(CacheKey);
        }
Exemple #28
0
        public async Task <ActionResult> DeleteContentGroupConfirmed(int id)
        {
            ContentGroup contentGroup = await db.ContentGroups.FindAsync(id);

            int temp = contentGroup.CourseID;

            db.ContentGroups.Remove(contentGroup);
            await db.SaveChangesAsync();

            return(RedirectToAction("ContentGroup", new { id = temp }));
        }
 public void DeleteContentGroup(ulong groupId)
 {
     lock (groupLock)
     {
         if (mContentGroups.ContainsKey(groupId) && mContentGroups[groupId] is ContentGroup)
         {
             ContentGroup group = (ContentGroup)mContentGroups[groupId];
             mContentGroups.Remove(groupId);
         }
     }
 }
Exemple #30
0
        public ActionResult AddContentElements(int id)
        {
            ContentGroup cg = db.ContentGroups.Find(id);

            List <ContentElement> sortedContentElements = cg.ContentElements.OrderBy(order => order.Order).ToList();

            //Adrian
            ViewBag.CGid = id;
            //adrian
            return(View(sortedContentElements));
        }
 public bool IsAboveOf(ContentGroup cGroup)
 {
     return bounds.min.y > cGroup.bounds.min.y && IntersectsX(cGroup.bounds);
 }
 public bool IsBelowOf(ContentGroup cGroup)
 {
     return bounds.max.y < cGroup.bounds.max.y && IntersectsX(cGroup.bounds);
 }
 public bool IsRightOf(ContentGroup cGroup)
 {
     return bounds.min.x > cGroup.bounds.min.x && IntersectsY(cGroup.bounds);
 }
 public bool IsLeftOf(ContentGroup cGroup)
 {
     return bounds.max.x < cGroup.bounds.max.x && IntersectsY(cGroup.bounds);
 }
 public void SetFocus(ContentGroup focusContentGroup, int focusRowId, int focusColumnId)
 {
     if (rolloverEffects && uiElement != null) uiElement.SimulateRollOut();
     contentGroup = focusContentGroup;
     rowId = focusRowId;
     columnId = focusColumnId;
     uiElement = contentGroup.uiElements[focusRowId][focusColumnId];
     if (rolloverEffects) uiElement.SimulateRollOver();
     if (_evidenceSprite != null) {
         // Set evidence sprite
         Vector3 evidencePos = uiElement.bounds.center;
         evidencePos.z -= 1;
         _evidenceSprite.transform.position = evidencePos;
         Vector2 size = uiElement.bounds.size;
         size.x += evidenceBorder * 2;
         size.y += evidenceBorder * 2;
         _evidenceSprite.dimensions = size;
         _evidenceSprite.gameObject.SetActive(true);
         if (_evidenceTween != null) _evidenceTween.Restart();
     }
 }
 public void Clear()
 {
     if (_evidenceSprite != null) {
         _evidenceSprite.gameObject.SetActive(false);
         if (_evidenceTween != null) _evidenceTween.Pause();
     }
     if (rolloverEffects && uiElement != null) uiElement.SimulateRollOut();
     rowId = columnId = -1;
     contentGroup = null;
     uiElement = null;
 }
 //----------------------------------------------------
 public DataSet getAllContentGroups()
 {
     ContentGroup content = new ContentGroup();
     return content.getAllContentGroups(SiteId);
 }