Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     System.Diagnostics.Trace.WriteLine("Page_Load Start", "GroupListModuleControl");
     base.Load(sender, e);
     if (base.CheckAutorisation())
     {
         LabelMsg.Text    = "";
         this.ParentGroup = null;
         if (DataCollectionID == null || DataCollectionID == Guid.Empty)
         {
             LabelMsg.Text = "Kies eerst een datacollectie";
         }
         else
         {
             if (!IsPostBack)
             {
                 Guid         dataId     = Guid.Empty;
                 ShowDataEnum showDataBy = base.getSetting <ShowDataEnum>("ShowDataBy");
                 if (showDataBy == ShowDataEnum.UserSelect)
                 {
                     string dataIdQuery = Request.QueryString["dataid"];
                     Guid.TryParse(dataIdQuery, out dataId);
                 }
                 SelectAndShowData(dataId);
             }
         }
     }
     System.Diagnostics.Trace.WriteLine("Page_Load End", "GroupListModuleControl");
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Diagnostics.Trace.WriteLine("Page_Load Start", "ItemListModuleControl");
            base.Load(sender, e);

            if (base.CheckAutorisation())
            {
                LabelMsg.Text = "";
                if (DataCollectionID == null || DataCollectionID == Guid.Empty)
                {
                    LabelMsg.Text = "Kies eerst een datacollectie";
                }
                else
                {
                    pageSize          = base.getSetting <int>("MaxNumberOfRows");
                    placeHolderPaging = (PlaceHolder)FindControl("PlaceHolderPaging" + ModuleID.ToString("N"));
                    usePaging         = ((pageSize > 0) && (placeHolderPaging != null));

                    if (!IsPostBack)
                    {
                        Guid         dataId     = Guid.Empty;
                        ShowDataEnum showDataBy = base.getSetting <ShowDataEnum>("ShowDataBy");
                        if (showDataBy == ShowDataEnum.UserSelect)
                        {
                            string dataIdQuery = Request.QueryString["dataid"];
                            Guid.TryParse(dataIdQuery, out dataId);
                        }
                        SelectAndShowData(dataId);
                    }
                }
            }
            System.Diagnostics.Trace.WriteLine("Page_Load End", "ItemListModuleControl");
        }
Ejemplo n.º 3
0
        protected override string getWhere(string tableAlias)
        {
            string where = base.getWhere(tableAlias);
            ShowDataEnum showDataBy    = base.getSetting <ShowDataEnum>("ShowDataBy");
            string       selectGroupID = getSetting <string>("SelectGroupID");

            if (reloadedFromFilterModule)
            {
                where += new FilterModule()
                {
                    DataCollection = this.DataCollection
                }.BuildWhere(tableAlias, Parameters);
            }
            else
            {
                if (showDataBy == ShowDataEnum.AllItems)
                {
                    //als vaste groep is gekozen dan deze nemen
                    if (selectGroupID != null && selectGroupID != "")
                    {
                        where += String.Format(" AND {0}.FK_Parent_Group = '{1}'", tableAlias, selectGroupID);
                    }
                    else
                    {
                        //doe niks
                    }
                }
                else if (showDataBy == ShowDataEnum.UserSelect)
                {
                    if (dataType == "I")
                    {
                        //Wordt op item geselecteerd: haal de groep op van dit item
                        string sql    = "SELECT FK_Parent_Group FROM DataItem WHERE ID = '" + dataId.ToString() + "'";
                        object result = DataBase.Get().Execute(sql);
                        Guid.TryParse(result.ToString(), out dataId);
                    }
                    if (dataId == Guid.Empty)
                    {
                        //initiele waarde
                        //als vaste groep is gekozen dan deze nemen
                        if (selectGroupID != null && selectGroupID != "")
                        {
                            where += String.Format(" AND {0}.FK_Parent_Group = '{1}'", tableAlias, selectGroupID);
                        }
                        else
                        {
                            //alle uit root tonen
                            where += String.Format(" AND {0}.FK_Parent_Group is null", tableAlias);
                        }
                    }
                    else
                    {
                        where += String.Format(" AND {0}.FK_Parent_Group = '{1}'", tableAlias, dataId);
                    }
                }
            }
            return(where);
        }
Ejemplo n.º 4
0
        //private BaseCollection<DataItem> getItems()
        //{
        //    Guid dataId = Guid.Empty;
        //    string dataIdQuery = Request.QueryString["dataid"];
        //    Guid.TryParse(dataIdQuery, out dataId);

        //    return getItems(dataId);
        //}

        private BaseCollection <DataItem> getItems(Guid dataId, string extraWhere = "")
        {
            if (DataCollectionID == null)
            {
                return(new BaseCollection <DataItem>());
            }
            where = base.getWhere(extraWhere);
            ShowDataEnum showDataBy = base.getSetting <ShowDataEnum>("ShowDataBy");
            //als vaste groep is gekozen dan deze nemen
            string selectGroupID = getSetting <string>("SelectGroupID");

            if (selectGroupID != null && selectGroupID != "")
            {
                dataId = new Guid(selectGroupID);
            }

            if (showDataBy == ShowDataEnum.AllItems)
            {
                //doe niks
            }
            else if (showDataBy == ShowDataEnum.UserSelect && extraWhere == "")
            {
                if (dataId == Guid.Empty)
                {
                    //als geen user select: alle items uit root
                    where += " AND FK_Parent_Group is null";
                }
                else
                {
                    //dataid kan naar item verwijzen
                    DataItem item = BaseObject.GetById <DataItem>(dataId);
                    //dan group van item laden
                    if (item != null && item.ParentGroup != null)
                    {
                        dataId = item.ParentGroup.ID;
                    }
                    where += String.Format(" AND FK_Parent_Group = '{0}'", dataId);
                }
            }

            string sort              = getSort();
            int    maxNumberOfRows   = getSetting <int>("MaxNumberOfRows");
            int    showFromRowNumber = getSetting <int>("ShowFromRowNumber");

            BaseCollection <DataItem> items;

            if (maxNumberOfRows > 0 || showFromRowNumber > 1)
            {
                items = BaseCollection <DataItem> .Get(where, sort, 0, maxNumberOfRows, showFromRowNumber);
            }
            else
            {
                items = BaseCollection <DataItem> .Get(where, sort, 0, 0, 0);
            }

            return(items);
        }
Ejemplo n.º 5
0
        //private BaseCollection<DataGroup> getGroups()
        //{
        //    return getGroups(Guid.Empty);
        //}

        private BaseCollection <DataGroup> getGroups(Guid dataId)
        {
            if (DataCollectionID == null)
            {
                return(new BaseCollection <DataGroup>());
            }
            string where = base.getWhere();
            ShowDataEnum showDataBy    = base.getSetting <ShowDataEnum>("ShowDataBy");
            string       selectGroupID = getSetting <string>("SelectGroupID");


            if (showDataBy == ShowDataEnum.MainGroups)
            {
                where += " AND FK_Parent_Group is null";
            }
            else if (showDataBy == ShowDataEnum.UserSelect)
            {
                //als vaste groep is gekozen dan deze nemen
                if (selectGroupID != null && selectGroupID != "")
                {
                    where += " AND FK_Parent_Group = '" + selectGroupID + "'";
                }
                else if (dataId == Guid.Empty)
                {
                    where += " AND FK_Parent_Group is null";
                }
                else
                {
                    where += String.Format(" AND FK_Parent_Group = '{0}'", dataId);
                }
            }

            string sort              = getSort();
            int    maxNumberOfRows   = getSetting <int>("MaxNumberOfRows");
            int    showFromRowNumber = getSetting <int>("ShowFromRowNumber");

            BaseCollection <DataGroup> groups;

            if (maxNumberOfRows > 0 || showFromRowNumber > 1)
            {
                groups = BaseCollection <DataGroup> .Get(where, sort, 0, maxNumberOfRows, showFromRowNumber);
            }
            else
            {
                groups = BaseCollection <DataGroup> .Get(where, sort, 0, 0, 0);
            }

            return(groups);
        }
Ejemplo n.º 6
0
        protected override string getWhere(string tableAlias)
        {
            string where = base.getWhere(tableAlias);
            ShowDataEnum showDataBy    = base.getSetting <ShowDataEnum>("ShowDataBy");
            string       selectGroupID = getSetting <string>("SelectGroupID");

            if (showDataBy == ShowDataEnum.AllGroups)
            {
                //als vaste groep is gekozen dan deze nemen
                //if (selectGroupID != null && selectGroupID != "")
                //{
                //    where += String.Format(" AND {0}.FK_Parent_Group = '{1}'", tableAlias, selectGroupID);
                //}
                //else {
                ////doe niks
                //}
            }
            else if (showDataBy == ShowDataEnum.MainGroups)
            {
                where += String.Format(" AND {0}.FK_Parent_Group is null", tableAlias);
            }
            else if (showDataBy == ShowDataEnum.UserSelect || showDataBy == ShowDataEnum.UserSelectNoDefaultData)
            {
                if (dataId == Guid.Empty)
                {
                    //initiele waarde
                    //als vaste groep is gekozen dan deze nemen
                    if (selectGroupID != null && selectGroupID != "")
                    {
                        where += String.Format(" AND {0}.FK_Parent_Group = '{1}'", tableAlias, selectGroupID);
                    }
                    else
                    {
                        //alle uit root tonen
                        where += String.Format(" AND {0}.FK_Parent_Group is null", tableAlias);
                    }
                }
                else
                {
                    where += String.Format(" AND {0}.FK_Parent_Group = '{1}'", tableAlias, dataId);
                }
            }
            return(where);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Diagnostics.Trace.WriteLine("Page_Load Start", "GoogleMapsModuleControl");
            base.Load(sender, e);
            if (base.CheckAutorisation())
            {
                LabelMsg.Text    = "";
                this.ParentGroup = null;
                if (DataCollectionID == null || DataCollectionID == Guid.Empty)
                {
                    LabelMsg.Text = "Kies eerst een datacollectie";
                }
                else
                {
                    if (!IsPostBack)
                    {
                        Guid         dataId     = Guid.Empty;
                        ShowDataEnum showDataBy = base.getSetting <ShowDataEnum>("ShowDataBy");
                        if (showDataBy == ShowDataEnum.UserSelect)
                        {
                            string dataIdQuery = Request.QueryString["dataid"];
                            Guid.TryParse(dataIdQuery, out dataId);
                        }
                        SelectAndShowData(dataId);


                        GPoint initPoint = GoogleGeocoder.GetLatLng(base.getSetting <string>("InitialAddress") + "," + base.getSetting <string>("InitialAddress"), SessionObject.CurrentSite.GoogleMapsKey);

                        string  infoBalloonFormat  = "";
                        string  sideBarRowFormat   = "";
                        Literal literalInfoBalloon = (Literal)FindControl("LiteralInfoBalloon" + ModuleID.ToString("N"));
                        if (literalInfoBalloon != null)
                        {
                            infoBalloonFormat = literalInfoBalloon.Text;
                            infoBalloonFormat = infoBalloonFormat.Replace("\r", "").Replace("\n", "").Replace("\t", "");
                            infoBalloonFormat = infoBalloonFormat.Replace("'", "&quot;");
                        }

                        Literal literalSideBar = (Literal)FindControl("LiteralSideBar" + ModuleID.ToString("N"));
                        if (literalSideBar != null)
                        {
                            sideBarRowFormat = literalSideBar.Text;
                            sideBarRowFormat = sideBarRowFormat.Replace("\r", "").Replace("\n", "").Replace("\t", "");
                            sideBarRowFormat = sideBarRowFormat.Replace("'", "&quot;");
                        }

                        string navigationUrl = Request.Url.LocalPath;

                        ModuleNavigationActionLite navigationAction = GetNavigationActionByTagName("{DrillDownLink}");
                        if (navigationAction != null)
                        {
                            navigationUrl = navigationAction.NavigationUrl;
                            if (navigationAction.NavigationType == NavigationTypeEnum.ShowDetailsInModules)
                            {
                                //blijven op dezelfde pagina
                                navigationUrl = Request.Url.LocalPath;
                            }
                        }
                        LabelMsg.Text = String.Format(@"
<script type=""text/javascript"">
    BITGOOGLEMAP.key = '{0}';
    
    BITGOOGLEMAP.initLatitude = {1};
    BITGOOGLEMAP.initLongitude = {2};
    BITGOOGLEMAP.initZoom = {3};
    BITGOOGLEMAP.datacollectionID = '{4}';
    BITGOOGLEMAP.infoBalloonFormat = '{5}';
    BITGOOGLEMAP.sideBarRowFormat = '{6}';
    BITGOOGLEMAP.navigationUrl = '{7}'
    //BITGOOGLEMAP.mapType = '{0}';
</script>", SessionObject.CurrentSite.GoogleMapsKey, initPoint.Lat.ToString().Replace(",", "."), initPoint.Long.ToString().Replace(",", "."), base.getSetting <string>("InitialZoom"), this.DataCollectionID, infoBalloonFormat, sideBarRowFormat, navigationUrl);
                    }
                }
            }
            System.Diagnostics.Trace.WriteLine("Page_Load End", "GoogleMapsModuleControl");
        }
Ejemplo n.º 8
0
        //public string ConvertHeaderFooterTags(string html)
        //{
        //    //{Parent.Naam}
        //    string header = Regex.Match(html, "<HeaderTemplate>(.*?)</HeaderTemplate>", RegexOptions.Singleline).ToString();
        //    html = ConvertHtml(html, header);
        //    string footer = Regex.Match(html, "<FooterTemplate>(.*?)</FooterTemplate>", RegexOptions.Singleline).ToString();
        //    html = ConvertHtml(html, footer);
        //    return html;
        //}

        //public string ConvertHtml(string html, string source)
        //{
        //    if (source != null)
        //    {
        //        string convertedHeader = source;
        //        MatchCollection tags = Regex.Matches(source, "{Parent(.*?)}");
        //        foreach (Match tagMatch in tags)
        //        {
        //            string field = tagMatch.ToString().Replace("{Parent.", "").Replace("}", "");
        //            Tag tag = this._tags.Where(c => c.Name == "{Parent." + field + "}").FirstOrDefault();
        //            if (tag != null)
        //            {
        //                string mappingColumn = tag.ReplaceValue.Replace("<%#DataBinder.Eval(Container.DataItem,\"", "").Replace("\")%>", "");
        //                convertedHeader = convertedHeader.Replace(tagMatch.ToString(), "<%# " + mappingColumn + " %>");
        //            }
        //        }
        //        html = html.Replace(source, convertedHeader);
        //    }
        //    return html;
        //}

        public override string Publish2(CmsPage page)
        {
            string html = "";

            try
            {
                if (DataCollection != null)
                {
                    PrepairTemplate(DataCollection.DataGroupFields, DataCollection.DataGroupFields);
                }
                html = base.Publish2(page);
                if (DataCollection == null)
                {
                    return(html);
                }


                ModuleNavigationAction navigationActionDrillDown = this.GetNavigationActionByTagName("{DrillDownLink}");
                if (navigationActionDrillDown != null)
                {
                    drillDownUrl  = navigationActionDrillDown.GetNavigationUrl();
                    drillDownLink = navigationActionDrillDown.CreateNavigationHyperlink("G");
                }

                if (html.Contains("{DrillUpLink}"))
                {
                    ModuleNavigationAction navigationActionDrillUp = this.GetNavigationActionByTagName("{DrillUpLink}");
                    if (navigationActionDrillUp != null)
                    {
                        drillUpUrl  = navigationActionDrillUp.GetNavigationUrl();
                        drillUpLink = navigationActionDrillUp.CreateNavigationHyperlink("G");
                    }
                }
                //getDrillDownUrlAndLink(out drillDownUrl, out drillDownLink);
                ShowDataEnum          showdataBy  = getSetting <ShowDataEnum>("ShowDataBy");
                System.Data.DataTable groupsTable = new System.Data.DataTable();
                if (showdataBy == ShowDataEnum.UserSelectNoDefaultData)
                {
                    if (this.dataId != Guid.Empty && this.dataId != null)
                    {
                        groupsTable = getDataTable("DataGroup", "G", DataCollection.DataGroupFields);
                    }
                }
                else
                {
                    groupsTable = getDataTable("DataGroup", "G", DataCollection.DataGroupFields);
                }

                string rowTemplate = base.GetSubTemplate("{List}");
                string rowsHtml    = "";
                foreach (System.Data.DataRow dataRow in groupsTable.Rows)
                {
                    string rowHtml             = rowTemplate;
                    string rewriteUrlDrillDown = CreateRewriteUrl(page, drillDownUrl, "G", new Guid(dataRow["ID"].ToString()), dataRow["CompletePath"].ToString(), dataRow["Title"].ToString());
                    rowHtml = rowHtml.Replace("{DrillDownLink}", drillDownLink);
                    rowHtml = rowHtml.Replace("{/DrillDownLink}", "</a>");
                    rowHtml = rowHtml.Replace("{DrillDownUrl}", rewriteUrlDrillDown);
                    foreach (System.Data.DataColumn column in dataRow.Table.Columns)
                    {
                        rowHtml = ReplaceTag(rowHtml, dataRow, column);
                        //rowHtml = rowHtml.Replace("{" + column.ColumnName + "}", dataRow[column.ColumnName].ToString());
                        if (rowHtml.Contains("{FileList1}"))
                        {
                            rowHtml = fillExtraFilesSubTemplate(rowHtml, "", dataRow["ID"].ToString());
                        }
                        if (html.Contains("{ImageList1}"))
                        {
                            rowHtml = fillExtraImagesSubTemplate(rowHtml, "", dataRow["ID"].ToString());
                        }
                    }

                    rowsHtml += rowHtml;
                }
                html = html.Replace("<!--{List}-->" + rowTemplate + "<!--{/List}-->", rowsHtml);
                html = html.Replace("{List}" + rowTemplate + "{/List}", rowsHtml);

                //parent-tags kunnen ook buiten de list-template staan. dus buiten {List} en {/List}
                //dan ook deze tags vervangen, ook als er geen rows zouden zijn. (parent kan er nog wel zijn)
                if (html.Contains("{Parent") || html.Contains("{DrillUp"))
                {
                    //dataId = dataId == Guid.Empty ? Guid.Parse(getSetting<string>("SelectGroupID")) : dataId;
                    System.Data.DataRow parentGroupRow = base.getDataParentGroupRow(dataId);
                    html = ReplaceDrillUpTag(page, html, parentGroupRow["FK_Parent_Group"].ToString());
                    foreach (System.Data.DataColumn column in parentGroupRow.Table.Columns)
                    {
                        html = html.Replace("{" + column.ColumnName + "}", parentGroupRow[column.ColumnName].ToString());
                    }
                }

                bool hideWhenNoData = getSetting <bool>("HideWhenNoData");
                if (hideWhenNoData && groupsTable.Rows.Count == 0)
                {
                    html = getModuleStartDiv() + getModuleEndDiv();
                }
            }
            catch (Exception ex)
            {
                html = base.HandlePublishError(ex);
            }
            return(html);
        }