コード例 #1
0
        public int create(templateCarrier carrier, string username, string password)
        {
            Authenticate(username, password);

            if (carrier.Id != 0)
            {
                throw new Exception("ID may not be specified when creating");
            }
            if (carrier == null)
            {
                throw new Exception("No carrier specified");
            }

            // Get the user
            umbraco.BusinessLogic.User user = GetUser(username, password);

            // Create template
            cms.businesslogic.template.Template template = cms.businesslogic.template.Template.MakeNew(carrier.Name, user);

            template.MasterTemplate = carrier.MastertemplateId;
            template.Alias          = carrier.Alias;
            template.Text           = carrier.Name;
            template.Design         = carrier.Design;
            template.Save();
            clearCachedTemplate(template);
            return(template.Id);
        }
コード例 #2
0
        public void update(templateCarrier carrier, string username, string password)
        {
            if (carrier.Id == 0)
            {
                throw new Exception("ID must be specifed when updating");
            }
            if (carrier == null)
            {
                throw new Exception("No carrier specified");
            }

            cms.businesslogic.template.Template template;
            try
            {
                template = new cms.businesslogic.template.Template(carrier.Id);
            }
            catch (Exception)
            {
                throw new Exception("Template with ID " + carrier.Id + " not found");
            }

            template.MasterTemplate = carrier.MastertemplateId;
            template.Alias          = carrier.Alias;
            template.Text           = carrier.Name;
            template.Design         = carrier.Design;
            template.Save();


            clearCachedTemplate(template);
        }
コード例 #3
0
        private static string SaveTemplate(string templateName, string templateAlias, string templateContents, int templateID, int masterTemplateID)
        {
            var tp     = new cms.businesslogic.template.Template(templateID);
            var retVal = "false";

            tp.Text           = templateName;
            tp.Alias          = templateAlias;
            tp.MasterTemplate = masterTemplateID;
            tp.Design         = templateContents;

            tp.Save();

            retVal = "true";

            return(retVal);
        }
コード例 #4
0
 public bool UpdateTemplate(int Id, int Master, string Design, string Login, string Password)
 {
     if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login))
     {
         try
         {
             var t = new cms.businesslogic.template.Template(Id)
             {
                 MasterTemplate = Master,
                 Design         = Design
             };
             //ensure events are raised
             t.Save();
             return(true);
         }
         catch (ArgumentException)
         {
             return(false);
         }
     }
     return(false);
 }
コード例 #5
0
		public bool UpdateTemplate(int Id, int Master, string Design, string Login, string Password)
		{
            if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) 
			{
                try
                {
                    var t = new cms.businesslogic.template.Template(Id)
                        {
                            MasterTemplate = Master,
                            Design = Design
                        };
                    //ensure events are raised
                    t.Save();
                    return true;
                }
                catch (ArgumentException)
                {
                    return false;
                }			    
			}
		    return false;
		}
コード例 #6
0
ファイル: templateService.cs プロジェクト: elrute/Triphulcas
        public void update(templateCarrier carrier, string username, string password)
        {
            if (carrier.Id == 0) throw new Exception("ID must be specifed when updating");
            if (carrier == null) throw new Exception("No carrier specified");

            cms.businesslogic.template.Template template;
            try
            {
                template = new cms.businesslogic.template.Template(carrier.Id);
            }
            catch (Exception)
            {
                throw new Exception("Template with ID " + carrier.Id + " not found");
            }

            template.MasterTemplate = carrier.MastertemplateId;
            template.Alias = carrier.Alias;
            template.Text = carrier.Name;
            template.Design = carrier.Design;
            template.Save();


            clearCachedTemplate(template);
        }
コード例 #7
0
        private static string SaveTemplate(string templateName, string templateAlias, string templateContents, int templateID, int masterTemplateID)
        {
            var tp = new cms.businesslogic.template.Template(templateID);
            var retVal = "false";

	        tp.Text = templateName;
	        tp.Alias = templateAlias;
	        tp.MasterTemplate = masterTemplateID;
	        tp.Design = templateContents;

            tp.Save();

	        retVal = "true";

	        return retVal;
        }