Beispiel #1
0
    protected void ButtonNewRoute_Click(object sender, EventArgs e)
    {
        Guid   guid = Guid.NewGuid();
        string url  = PathFunctions.GetUrlFromPath(PathFunctions.EditRoutePage, false).Replace("'", "\\'") + "?Route=" + guid.ToString();

        Response.Redirect(url);
    }
Beispiel #2
0
    public void GenerateMarkers()
    {
        Response.Write("<script type=\"text/javascript\">\r\n");
        Response.Write("function addMarkers(){\r\n");
        foreach (Route r in Routes)
        {
            string url = r.GetRouteUrl(editMode);

            string gpxFile = PathFunctions.GetGpxPathFromRouteName(r.Name);

            GpxParser parser = Helper.GetGpxParser(gpxFile);
            if (parser == null)
            {
                continue;
            }

            //TrackPoint p = parser.Tracks[0].Segments[0].Points[0];
            GenericPoint p           = parser.MediumPoint;
            string       color       = r.Draft ? "red" : "blue";
            string       title       = r.Title.Replace("'", "\\'") + (r.Draft ? " (bozza)" : "");
            string       name        = r.Name;
            string       description = string.Format("<iframe scrolling=\"no\" frameborder=\"no\" src=\"/RouteData.aspx?name={0}\"/>", r.Name);
            string       icon        = r.Draft ? "/Images/draft_marker.png" : "";
            string       imageFolder = PathFunctions.GetImagePathFromGpx(gpxFile);
            string       imageFile   = Path.Combine(imageFolder, string.IsNullOrEmpty(r.Image) ? "" : r.Image);
            if (!File.Exists(imageFile))
            {
                string[] files = Directory.GetFiles(imageFolder, "*.jpg");
                if (files.Length > 0)
                {
                    imageFile = files[0];
                }
                else
                {
                    imageFile = "";
                }
            }
            string thumbFile = imageFile.Length == 0 ? "" : PathFunctions.GetThumbFile(imageFile);
            string photo     = thumbFile.Length == 0 ? "" : PathFunctions.GetUrlFromPath(thumbFile, false).Replace("'", "\\'");
            Response.Write(string.Format(
                               "GV_Draw_Marker({{ lat: {0}, lon: {1}, name: '{2}', desc: '{3}', color: '{4}', icon: '{5}', photo: '{6}', url: '{7}', route_name:'{8}', draw_track: true }});\r\n",
                               p.lat.ToString(System.Globalization.CultureInfo.InvariantCulture),
                               p.lon.ToString(System.Globalization.CultureInfo.InvariantCulture),
                               title,
                               description,
                               color,
                               icon,
                               photo,
                               url,
                               name));
        }


        Response.Write("}\r\n");
        Response.Write("</script>\r\n");
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            return;
        }

        if (string.IsNullOrEmpty(RouteName))
        {
            RouteName = Path.GetFileName(Page.MapPath("."));
        }
        string    gpxFullPath = PathFunctions.GetGpxPathFromRouteName(RouteName);
        GpxParser parser      = Helper.GetGpxParser(gpxFullPath);

        if (parser == null)
        {
            return;
        }

        MapLink.NavigateUrl = string.Format("~/Routes/Map.aspx?Route={0}", RouteName);
        ProfileImage.Src    = Helper.GenerateProfileFile(gpxFullPath);

        int countryCode = 0;

        countryCode = parser.CountryCode;
        string zipPath = parser.ZippedFile;

        HyperLinkToGps.NavigateUrl = PathFunctions.GetUrlFromPath(zipPath, true);

        if (countryCode != 0)
        {
            MeteoFrame.Attributes["src"] = string.Format("http://www.ilmeteo.it/script/meteo.php?id=free&citta={0}", countryCode);
        }
        else
        {
            MeteoFrame.Visible = false;
        }

        FBLike.Attributes["src"] = string.Format(
            "http://www.facebook.com/widgets/like.php?href={0}",
            HttpUtility.UrlEncode(Page.Request.Url.ToString()));

        MTBUser user = LoginState.User;

        if (user == null)
        {
            Rank.SelectedIndex = -1;
        }
        else
        {
            Rank r = DBHelper.GetRank(user.Id, GetRoute().Id);
            Rank.SelectedIndex = r == null ? -1 : r.RankNumber - 1;
        }
    }
Beispiel #4
0
        public string GetRouteUrl(bool editMode)
        {
            string routeFolderPath = PathFunctions.GetRoutePathFromName(Name);
            string url             =
                editMode
                ? PathFunctions.GetUrlFromPath(PathFunctions.EditRoutePage, false).Replace("'", "\\'") + "?Route=" + Name
                : (string.IsNullOrEmpty(Page)
                    ? PathFunctions.GetUrlFromPath(PathFunctions.RoutesPage, false).Replace("'", "\\'") + "?Route=" + Name
                    : PathFunctions.GetUrlFromPath(Path.Combine(routeFolderPath, Page), false).Replace("'", "\\'"));

            return(url);
        }
Beispiel #5
0
    public void GenerateMarkers()
    {
        Response.Write("<script type=\"text/javascript\">\r\n");
        Response.Write("function addMarkers(){\r\n");

        if (parser != null && !string.IsNullOrEmpty(parser.SourceFile))
        {
            string thumbsFolder = PathFunctions.GetThumbsFolder(parser.SourceFile);

            foreach (WayPoint wp in parser.WayPoints)
            {
                bool hasPhoto =
                    !string.IsNullOrEmpty(wp.link) &&
                    wp.link.EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase);

                string color = hasPhoto
                    ? "blue"
                    : "red";

                string name        = wp.name.Replace("'", "\\'");
                string description = wp.description.Replace("'", "\\'");
                string icon        = hasPhoto
                    ? "/Images/camera_icon.png"
                    : "";
                string photo = hasPhoto
                    ? PathFunctions.GetUrlFromPath(Path.Combine(thumbsFolder, Path.GetFileName(wp.link)), false).Replace("'", "\\'")
                    : "";
                string url = hasPhoto
                    ? PathFunctions.GetUrlFromPath(wp.link, false).Replace("'", "\\'")
                    : "";
                Response.Write(string.Format(
                                   "GV_Draw_Marker({{ lat: {0}, lon: {1}, name: '{2}', desc: '{3}', color: '{4}', icon: '{5}', photo: '{6}', url: '{7}' }});\r\n",
                                   wp.lat.ToString(System.Globalization.CultureInfo.InvariantCulture),
                                   wp.lon.ToString(System.Globalization.CultureInfo.InvariantCulture),
                                   name,
                                   description,
                                   color,
                                   icon,
                                   photo,
                                   url));
            }
        }
        Response.Write("}\r\n");
        Response.Write("</script>\r\n");
    }
Beispiel #6
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     PDFXC.HRef   = PathFunctions.GetUrlFromPath(Page.MapPath("XCGiu2007.pdf"), true);
     PDFXC.Target = "_blank";
 }