public SiteUserGroup[] GetUserGroups(string sort, int pageNumber, int pageSize, string searchString) { BaseService.CheckLoginAndLicense(); string where = String.Format("FK_Site = '{0}'", SessionObject.CurrentSite.ID); if (searchString != null && searchString != "") { where += String.Format(" AND (Name like '%{0}%')", searchString); } //List<TreeGridItem> returnValue = new List<TreeGridItem>(); //BitAutorisationService.AutorisationClient client = new BitAutorisationService.AutorisationClient(); //BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient(); //UserGroup[] usergroups = client.GetUserGroups(SessionObject.CurrentBitplateUser, onlyCurrentSite, sort, pageNumber, pageSize, searchString); //foreach (UserGroup usergroup in usergroups) //{ // TreeGridItem item = TreeGridItem.NewGroup<UserGroup>(usergroup); // item.Field1 = usergroup.Site.Name; // returnValue.Add(item); //} Guid environmentId = Guid.Empty; //todo string connectionString = getConnectionString(environmentId); return(BaseCollection <SiteUserGroup> .Get(where, sort, pageNumber, pageSize, connectionString : connectionString).ToArray()); }
public string SaveModuleContent(string id, string content, string languageCode, string pageid, string newsletterid) { BaseService.CheckLoginAndLicense(); BaseModule module = BaseModule.GetById <BaseModule>(new Guid(id)); module = module.ConvertToType(); module.Content = content; module.Save(); module.LanguageCode = languageCode; CmsPage page = null; if (pageid != null && pageid != "") { page = BaseObject.GetById <CmsPage>(Guid.Parse(pageid)); } else if (newsletterid != null && newsletterid != "") { page = BaseObject.GetById <Newsletter>(Guid.Parse(newsletterid)); } return(module.Publish2(page)); }
public BaseModule GetModule(string id) { BaseService.CheckLoginAndLicense(); id = id.Replace("bitModule", ""); id = id.Replace("bitEditor", ""); BaseModule mod = BaseModule.GetById <BaseModule>(new Guid(id)); if (mod.HasBitplateAutorisation()) { if (!mod.IsAutorized(SessionObject.CurrentBitplateUser)) { throw new Exception("U heeft geen rechten voor deze module"); } } mod = mod.ConvertToType(); //if (mod.SelectGroup != null && mod.SelectGroup != "") //{ // DataGroup dataGroup = BaseObject.GetById<DataGroup>(Guid.Parse(mod.SelectGroup)); // if (dataGroup != null) // { // mod.SelectGroupPath = dataGroup.DataCollection.Name + "/" + dataGroup.GetCompletePath(); //FindDataGroupBasePath(Guid.Parse(mod.SelectGroup)); // } //} return(mod); }
public List <TreeGridItem> GetDataCollections(string sort, string searchString) { BaseService.CheckLoginAndLicense(); string where = String.Format("FK_Site='{0}'", SessionObject.CurrentSite.ID); if (searchString != null && searchString != "") { where += String.Format("AND Name like '%{0}%'", searchString); } List <TreeGridItem> returnList = new List <TreeGridItem>(); BaseCollection <DataCollection> collections = BaseCollection <DataCollection> .Get(where, sort); foreach (DataCollection collection in collections) { TreeGridItem item = TreeGridItem.NewItem <DataCollection>(collection); item.Icon = ""; //TODO laten afhangen van type item.Type = collection.TypeString; item.Status = collection.ChangeStatusString; item.LanguageCode = collection.LanguageCode; item.HasAutorisation = collection.HasAutorisation; if (searchString != null && searchString != "") { item.Name = item.Name.Replace(searchString, "<span class='highlight'>" + searchString + "</span>"); //item.Title = item.Title.Replace(searchString, "<span class='highlight'>" + searchString + "</span>"); } returnList.Add(item); } return(returnList); }
public static List <CmsScript> LoadScripts() { BaseService.CheckLoginAndLicense(); string target = "page"; string id = ""; string targetscript = "BITTEMPLATES"; List <CmsScript> Scripts = new List <CmsScript>(); if (HttpContext.Current.Request.QueryString["target"] != null) { target = HttpContext.Current.Request.QueryString["target"]; } if (target == "page") { targetscript = "BITPAGES"; } if (HttpContext.Current.Request.QueryString["id"] != null) { id = HttpContext.Current.Request.QueryString["id"]; } BaseCollection <CmsScript> scripts = ScriptService.GetScripts("ScriptType, Name", "", null); string html = ""; foreach (CmsScript script in scripts) { html += String.Format(@"<a href=""javascript:{0}.addScript('{1}', '{2}');"">{2}</a><br/>", targetscript, script.ID, script.CompleteName); } Scripts.AddRange(scripts); return(Scripts); }
public void DeleteDataLookupValue(string id) { BaseService.CheckLoginAndLicense(); DataLookupValue lookupValue = BaseObject.GetById <DataLookupValue>(new Guid(id)); lookupValue.Delete(); }
public DataItem GetItem(string id, string groupid, string datacollectionid) { BaseService.CheckLoginAndLicense(); DataItem item = null; if (id == null) { item = new DataItem(); item.Site = SessionObject.CurrentSite; item.DataCollection = new DataCollection(); item.DataCollection.ID = new Guid(datacollectionid); if (groupid != null && groupid != "") { item.ParentGroup = new DataGroup(); item.ParentGroup.ID = new Guid(groupid); item.OrderNumber = item.ParentGroup.GetMaxItemOrderNumber() + 1; } else { item.OrderNumber = item.DataCollection.GetMaxItemOrderNumber() + 1; } this.SetDefaultItemValues(item); } else { item = BaseObject.GetById <DataItem>(new Guid(id)); } return(item); }
public void CopyMenuItem(string itemId, string newName) { BaseService.CheckLoginAndLicense(); CmsMenuItem item = BaseObject.GetById <CmsMenuItem>(new Guid(itemId)); item.Copy(newName); }
public BaseCollection <CmsMenu> GetMenus(string sort) { BaseService.CheckLoginAndLicense(); string where = String.Format("FK_Site='{0}'", SessionObject.CurrentSite.ID); //List<TreeGridItem> returnList = new List<TreeGridItem>(); BaseCollection <CmsMenu> menus = BaseCollection <CmsMenu> .Get(where, sort); return(menus); //foreach (CmsMenu menu in menus) //{ // TreeGridItem item = TreeGridItem.NewItem<CmsMenu>(menu); // item.Icon = ""; //TODO laten afhangen van type // item.Type = menu.TypeString; // item.Status = menu.ChangeStatusString; // item.LanguageCode = menu.LanguageCode; // item.HasAutorisation = menu.HasAutorisation; // if (searchString != null && searchString != "") // { // item.Name = item.Name.Replace(searchString, "<span class='highlight'>" + searchString + "</span>"); // //item.Title = item.Title.Replace(searchString, "<span class='highlight'>" + searchString + "</span>"); // } // returnList.Add(item); //} //return returnList; }
public void DeleteMenuItem(string id) { BaseService.CheckLoginAndLicense(); CmsMenuItem item = BaseObject.GetById <CmsMenuItem>(new Guid(id)); item.Delete(); }
public void CopyMenu(string menuId, string newName) { BaseService.CheckLoginAndLicense(); CmsMenu menu = BaseObject.GetById <CmsMenu>(new Guid(menuId)); menu.Copy(newName); }
public CmsMenuItem GetMenuItem(string id, string parentId, string menuId) { BaseService.CheckLoginAndLicense(); CmsMenuItem item = null; if (id == null) { item = new CmsMenuItem(); item.Site = SessionObject.CurrentSite; item.Menu = new CmsMenu(); item.Menu.ID = new Guid(menuId); if (parentId != null && parentId != "") { item.ParentMenuItem = new CmsMenuItem(); item.ParentMenuItem.ID = new Guid(parentId); item.OrderingNumber = item.ParentMenuItem.GetMaxItemOrderNumber() + 1; } else { item.OrderingNumber = item.Menu.GetMaxItemOrderNumber() + 1; } } else { item = BaseObject.GetById <CmsMenuItem>(new Guid(id)); } return(item); }
public BaseCollection <CmsMenuItem> GetMenuItems(string menuId, string parentId, string parentPath, string sort) { BaseService.CheckLoginAndLicense(); if ((parentId == null || parentId == "") && (parentPath != null && parentPath != "")) { //haal folder id op vanuit path //path wordt gebruikt als er vanuit de breadcrumb wordt genavigeerd string where = String.Format("CompletePath = '{0}'", parentPath); CmsMenuItem item = BaseObject.GetFirst <CmsMenuItem>(where); parentId = item.ID.ToString(); } //if (sort == "" || sort == null) //{ // sort = "OrderingNumber"; //} string whereItems = String.Format("FK_Menu = '{0}' AND FK_Parent_MenuItem='{1}'", menuId, parentId); if (parentId == null || parentId == "" || parentId == Guid.Empty.ToString()) { whereItems = String.Format("FK_Menu = '{0}' AND FK_Parent_MenuItem Is Null", menuId); } BaseCollection <CmsMenuItem> itemslist = BaseCollection <CmsMenuItem> .Get(whereItems, "OrderingNumber"); return(itemslist); }
public CmsMenu SaveMenu(CmsMenu obj) { BaseService.CheckLoginAndLicense(); obj.Site = SessionObject.CurrentSite; obj.Save(); return(obj); }
public DataField SaveDataField(DataField obj) { BaseService.CheckLoginAndLicense(); obj.Site = SessionObject.CurrentSite; obj.Save(); return(obj); }
public List <TreeGridItem> GetUsers(string sort, int pageNumber, int pageSize, string searchString) { BaseService.CheckLoginAndLicense(); List <TreeGridItem> returnValue = new List <TreeGridItem>(); string where = String.Format(@" EXISTS(SELECT * FROM SiteUserGroup g INNER JOIN SiteUserGroupPerUser ug ON ug.FK_UserGroup = g.ID WHERE g.FK_Site='{0}' AND ug.FK_User = SiteUser.ID)", SessionObject.CurrentSite.ID); Guid environmentId = Guid.Empty; //todo string connectionString = getConnectionString(environmentId); BaseCollection <SiteUser> users = BaseCollection <SiteUser> .Get(where, sort, pageNumber, pageSize, connectionString : connectionString); foreach (SiteUser user in users) { TreeGridItem item = TreeGridItem.NewItem <SiteUser>(user); item.Name = user.CompleteName; foreach (SiteUserGroup group in user.UserGroups) { item.Field1 += group.CompleteName + ", "; } if (item.Field1 != null && item.Field1 != "") { item.Field1 = item.Field1.Substring(0, item.Field1.Length - 2); } returnValue.Add(item); } return(returnValue); }
public void DeleteDataField(string id) { BaseService.CheckLoginAndLicense(); DataField field = BaseObject.GetById <DataField>(new Guid(id)); field.Delete(); }
public CmsTemplate GetTemplateIncludeHeader(string id) { BaseService.CheckLoginAndLicense(); CmsTemplate template = CmsTemplate.New(); if (id != null) { template = BaseObject.GetById <CmsTemplate>(new Guid(id)); if (template.HasAutorisation) { //BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient(); //BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(template.ID); //template.AutorizedBitplateUserGroups = usergroups; //BitplateUser[] users = client.GetUsersByObjectPermission(template.ID); //template.AutorizedBitplateUsers = users; if (!template.IsAutorized(SessionObject.CurrentBitplateUser)) { throw new Exception("U heeft geen rechten voor deze template"); } } } else { template.Site = SessionObject.CurrentSite; } string tmpHead = ""; foreach (CmsScript script in template.Scripts) { tmpHead += script.GetTag() + "\n\r"; } template.Content = template.Content.Replace("[HEAD]", tmpHead).Replace("[SCRIPTS]", ""); return(template); }
public DataCollection SaveDataCollection(DataCollection obj) { BaseService.CheckLoginAndLicense(); obj.Site = SessionObject.CurrentSite; obj.Save(); return(obj); }
public CmsTemplate GetTemplate(string id, int type) { BaseService.CheckLoginAndLicense(); CmsTemplate template = CmsTemplate.New(); //TODO: NewsletterTemplate service. 0 = PageTemplate & 1 = NewsletterTemplate if (type == 1) { //template.Content = template.Content.Replace("[HEAD]", ""); } if (id != null) { template = BaseObject.GetById <CmsTemplate>(new Guid(id)); if (template.HasAutorisation) { //BitAutorisationService.AutorisationClient client = BitMetaServerServicesHelper.GetClient(); //BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(template.ID); //template.AutorizedBitplateUserGroups = usergroups; //BitplateUser[] users = client.GetUsersByObjectPermission(template.ID); //template.AutorizedBitplateUsers = users; if (!template.IsAutorized(SessionObject.CurrentBitplateUser)) { throw new Exception("U heeft geen rechten voor deze template"); } } } else { template.Site = SessionObject.CurrentSite; } return(template); }
public DataGroup GetGroup(string id, string parentgroupid, string datacollectionid) { BaseService.CheckLoginAndLicense(); DataGroup group = null; if (id == null) { group = new DataGroup(); group.Site = SessionObject.CurrentSite; group.DataCollection = new DataCollection(); group.DataCollection.ID = new Guid(datacollectionid); if (parentgroupid != null && parentgroupid != "") { group.ParentGroup = new DataGroup(); group.ParentGroup.ID = new Guid(parentgroupid); group.OrderNumber = group.ParentGroup.GetMaxGroupOrderNumber() + 1; } else { group.OrderNumber = group.DataCollection.GetMaxGroupOrderNumber() + 1; } } else { group = BaseObject.GetById <DataGroup>(new Guid(id)); } return(group); }
public CmsTemplate SaveTemplate(CmsTemplate obj) { if (obj.Name.Trim() == "") { throw new Exception("Geen template naam ingevoerd."); } BaseService.CheckLoginAndLicense(); obj.Site = SessionObject.CurrentSite; obj.Save(); //lijst van ObjectPermissions wordt hier alleen als drager gebruikt. //in de licentieserver wordt deze lijst weer gesplitst en in 2 tabellen gezet //BaseCollection<ObjectPermission> objPermissions = obj.GetObjectPermissions4LicenseServer(); //if (objPermissions.Count > 0) //{ // BitAutorisationService.AutorisationClient client = BitMetaServerServicesHelper.GetClient(); // client.SaveObjectPermissions(objPermissions); //} //update pages //Waarom dit ook alweer???? @HJ //foreach (CmsPage page in obj.GetPages()) //{ // page.Save(); //} return(obj); }
public void SaveOrderingNummerItem_old(string type, string id, string parentid, int orderingnumber) { BaseService.CheckLoginAndLicense(); int newOrderingNumber = orderingnumber; BaseDataObject dataObj; type = type.ToLower(); if (type == "item") { dataObj = BaseObject.GetById <DataItem>(new Guid(id)); } else { dataObj = BaseObject.GetById <DataGroup>(new Guid(id)); } string oldParentID = "treeRoot"; if (dataObj.ParentGroup != null) { oldParentID = dataObj.ParentGroup.ID.ToString(); } //oude plek in de groep: int oldOrderingNumber = dataObj.OrderNumber; //dataObj.DataCollection.MoveItemsAndGroups(dataObj, oldParentID, parentid, oldOrderingNumber, newOrderingNumber); }
public List <TreeGridItem> GetTemplatesLite(string sort, string searchString, int templateType) { BaseService.CheckLoginAndLicense(); //IsNewsletterTemplate string where = String.Format("FK_Site='{0}' AND IsNewsletterTemplate={1}", SessionObject.CurrentSite.ID, templateType.ToString()); if (searchString != null && searchString != "") { where += String.Format(" AND Name like '%{0}%'", searchString); } List <TreeGridItem> returnList = new List <TreeGridItem>(); BaseCollection <CmsTemplate> templates = BaseCollection <CmsTemplate> .Get(where, sort); foreach (CmsTemplate template in templates) { TreeGridItem item = TreeGridItem.NewPublishableItem <CmsTemplate>(template); item.Icon = template.Screenshot + "?" + DateTime.Now.Ticks; item.LanguageCode = template.LanguageCode; if (searchString != null && searchString != "") { item.Name = item.Name.Replace(searchString, "<span class='highlight'>" + searchString + "</span>"); //item.Title = item.Title.Replace(searchString, "<span class='highlight'>" + searchString + "</span>"); } returnList.Add(item); } return(returnList); }
public static BaseCollection <CmsScript> GetScripts(string sort, string searchString, int?scriptMode) { BaseService.CheckLoginAndLicense(); string where; if (scriptMode == null) { where = String.Format("FK_Site='{0}'", new object[] { SessionObject.CurrentSite.ID }); } else { where = String.Format("FK_Site='{0}' AND ScriptType={1}", new object[] { SessionObject.CurrentSite.ID, scriptMode }); } if (searchString != null && searchString != "") { where += String.Format(" AND Name like '%{0}%'", searchString); } if (sort == "") { sort = "Name ASC"; } BaseCollection <CmsScript> list = BaseCollection <CmsScript> .Get(where, sort); return(list); }
public void CopyDataCollection(string datacollectionId, string newName) { BaseService.CheckLoginAndLicense(); DataCollection collection = BaseObject.GetById <DataCollection>(new Guid(datacollectionId)); collection.Copy(newName); }
public void DeleteModule(string id) { BaseService.CheckLoginAndLicense(); BaseModule module = GetModule(id); module.Delete(); //CmsPage page = module.Page; //if (page != null) //{ // //verwijderen drilldown modules // string where = String.Format("FK_Page='{0}'", module.Page.ID); // BaseCollection<BaseModule> modulesOnThisPage = BaseCollection<BaseModule>.Get(where); // //foreach (BaseModule mod in modulesOnThisPage) // //{ // // if (mod.DrillDownType == NavigationTypeEnum.ShowDetailsInModules) // // { // // string modArray = mod.DrillDownModules.ToString().Replace(module.ID + ",", ""); // // mod.DrillDownModules = modArray.Split(new char[] { ',' }); // // } // //} // //Remove page from caching. // //BitCaching.RemoveItemFromCache(page.ID.ToString()); //} ////SetUnpublishedItem(module); //module.Delete(); //PublishDependentPages(module); }
public void CopyItem(string itemId, string newName) { BaseService.CheckLoginAndLicense(); DataItem item = BaseObject.GetById <DataItem>(new Guid(itemId)); item.Copy(newName, null, null, true); }
public List <ListItem> GetSelectAndSortFieldsByDataCollectionID(string datacollectionid, string moduleType) { BaseService.CheckLoginAndLicense(); string type = "item"; if (moduleType == "GroupListModule") { type = "group"; } string whereIn = (int)FieldTypeEnum.Text + ", "; whereIn += (int)FieldTypeEnum.DateTime + ", "; whereIn += (int)FieldTypeEnum.Currency + ", "; whereIn += (int)FieldTypeEnum.Numeric + ", "; whereIn += (int)FieldTypeEnum.YesNo + ", "; whereIn += (int)FieldTypeEnum.DropDown; string where = String.Format("FK_DataCollection = '{0}' AND Type='{1}' AND FieldType IN({2})", datacollectionid, type, whereIn); BaseCollection <DataField> fields = BaseCollection <DataField> .Get(where); List <ListItem> returnItems = new List <ListItem>(); foreach (DataField fld in fields) { returnItems.Add(new ListItem(fld.Name, fld.MappingColumn)); } if (returnItems.Count > 0) { returnItems.Add(new ListItem("Aanmaak datum", "CreateDate")); returnItems.Add(new ListItem("Laatst gewijzigd", "ModifiedDate")); } //return fields; return(returnItems); }
public static string SaveModuleContent(string id, string content) { BaseService.CheckLoginAndLicense(); id = id.Replace("bitModule", ""); id = id.Replace("bitEditor", ""); BaseModule module = BaseModule.GetById <BaseModule>(new Guid(id)); module = module.ConvertToType(); //module.LoadPropsFromXmlFile(); content = content.Replace("?mode=edit", ""); //BUG WORKAROUND. BUG ZIT MOGELIJK NOG IN DE EDITOR. module.Content = content; module.Save(); module.Publish(); //Experimenteel caching reset //if (module.Page != null) //{ // BitCaching.RemoveItemFromCache(module.Page.ID.ToString()); //} if (module.Type == "HtmlModule") { PublishModule(module); } return(new ModuleService().GetUserControlContent(module)); }