Example #1
0
        public static Node CreateFromTemplate(Node target, Node template, string name)
        {
            var           newNode = template.MakeTemplatedCopy(target, name);
            VersionNumber version = null;

            //compute new version number according to the versioning
            //and approving settings in the target folder
            var gc = newNode as GenericContent;

            if (gc != null)
            {
                version = SavingAction.ComputeNewVersion(gc.ApprovingMode == ApprovingType.True, gc.VersioningMode);
            }
            else
            {
                //TODO: handle non-GenericContent scenarios
            }

            if (version != null)
            {
                newNode.Version = version;
            }

            newNode.Template = template;

            return(newNode);
        }
Example #2
0
        private static SavingAction CreateForNode(Node node)
        {
            var savingAction = new SavingAction
            {
                Node           = node,
                VersioningMode = VersioningMode.None,
                HasApproving   = false
            };

            return(savingAction);
        }
Example #3
0
        public static bool HasUndoCheckOut(GenericContent node)
        {
            if (HasForceUndoCheckOutRight(node))
            {
                return(false);
            }

            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.UndoCheckOut) == ActionValidationResult.Valid);
        }
Example #4
0
        private static SavingAction CreateForGenericContent(GenericContent genericContent)
        {
            var mode = VersioningMode.None;

            switch (genericContent.VersioningMode)
            {
            case VersioningType.MajorOnly: mode = VersioningMode.Major; break;

            case VersioningType.MajorAndMinor: mode = VersioningMode.Full; break;
            }
            var savingAction = new SavingAction
            {
                Node           = genericContent,
                VersioningMode = mode,
                HasApproving   = genericContent.HasApproving
            };

            return(savingAction);
        }
Example #5
0
        public static bool HasReject(GenericContent node)
        {
            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.Reject) == ActionValidationResult.Valid);
        }
Example #6
0
        public static bool HasCheckIn(Node node)
        {
            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.CheckIn) == ActionValidationResult.Valid);
        }