Example #1
0
 protected void RemoveMedia(MediaPart part)
 {
     if (!string.IsNullOrEmpty(part.FileName))
     {
         _mediaLibraryService.DeleteFile(part.FolderPath, part.FileName);
     }
 }
        private JsonResult PostFileFunction(HttpPostedFileBase file, string contentType = "")
        {
            if (!_orchardServices.Authorizer.Authorize(mlib.Permissions.ImportMediaContent))
            {
                return(Json(_utilsServices.GetResponse(ResponseType.UnAuthorized)));
            }
            Int32  output     = 0;
            string LinkFile   = "/Media/" + _settings.Name + "/Upload";
            string pathString = Server.MapPath("~/Media/" + _settings.Name) + @"\Upload" + (contentType != "" ? "\\" + contentType : "");

            VerificaPath(pathString);
            string nomefile = System.IO.Path.GetFileName(file.FileName);

            if (_contentExtensionsServices.FileAllowed(nomefile))
            {
                int    contatore = 0;
                string cont      = "";
                while (System.IO.File.Exists(System.IO.Path.Combine(pathString, cont + nomefile)))
                {
                    contatore++;
                    cont = contatore.ToString() + "_";
                }
                // file.SaveAs(System.IO.Path.Combine(pathString, cont + nomefile));

                //    var CIimage = _orchardServices.ContentManager.New("Image");
                MediaPart mediaPart = _mediaLibraryService.ImportMedia(file.InputStream, Path.GetFullPath(pathString).Replace(Server.MapPath("~/Media/" + _settings.Name + "/"), ""), cont + nomefile);
                // CIimage.As<MediaPart>()= mediaPart;
                var CIimage = _orchardServices.ContentManager.New(mediaPart.ContentItem.ContentType);
                _orchardServices.ContentManager.Create(mediaPart.ContentItem, VersionOptions.Published);
                //          filelist.ElencoUrl.Add(mediaPart.ContentItem.As<MediaPart>().Id);
                output = mediaPart.Id;
            }
            return(Json(new { Id = output }));
        }
Example #3
0
 protected void RemoveMedia(MediaPart part)
 {
     if (!string.IsNullOrEmpty(part.FileName))
     {
         var path = _storageProvider.Combine(part.FolderPath, part.FileName);
         _storageProvider.DeleteFile(path);
     }
 }
Example #4
0
        // the AdminService attribute prevents the PolicyFilter to check policies
        // when a file is called through this action.
        public RedirectResult Image(string Path, int?Width, int?Height, string Mode, string Alignment, string PadColor)
        {
            var    httpContext = _httpContextAccessor.Current();
            int    n           = 0;
            string url;
            bool   isNumeric = int.TryParse(Path, out n);

            if (isNumeric)
            {
                MediaPart mediaPart = ((ContentItem)_orchardServices.ContentManager.Get(n)).As <MediaPart>();
                Path = mediaPart.MediaUrl;
            }

            if (Width == null || Height == null)
            {
                var baseUrl         = httpContext.Request.ToApplicationRootUrlString();
                var applicationPath = httpContext.Request.ApplicationPath ?? String.Empty;
                if (Path.StartsWith(applicationPath, StringComparison.OrdinalIgnoreCase))
                {
                    Path = Path.Substring(applicationPath.Length);
                }
                url = String.Concat(baseUrl, Path);
            }
            else
            {
                int notNullWidth  = Width.GetValueOrDefault();
                int notNullHeight = Height.GetValueOrDefault();

                var state = new Dictionary <string, string> {
                    { "Width", notNullWidth.ToString(CultureInfo.InvariantCulture) },
                    { "Height", notNullHeight.ToString(CultureInfo.InvariantCulture) },
                    { "Mode", Mode },
                    { "Alignment", Alignment },
                    { "PadColor", PadColor },
                };

                var filter = new FilterRecord {
                    Category = "Transform",
                    Type     = "Resize",
                    State    = FormParametersHelper.ToString(state)
                };

                var profile = "Transform_Resize"
                              + "_w_" + Convert.ToString(Width)
                              + "_h_" + Convert.ToString(Height)
                              + "_m_" + Convert.ToString(Mode)
                              + "_a_" + Convert.ToString(Alignment)
                              + "_c_" + Convert.ToString(PadColor);
                Path = HttpUtility.UrlDecode(Path);
                //  url = _imageProfileManager.Value.GetImageProfileUrl(Path, profile, filter);
                url = _imageProfileManager.GetImageProfileUrl(Path, profile, filter);
            }
            if (url == null)
            {
                return(null);
            }
            return(Redirect(url));
        }
Example #5
0
 private string GetProfileUrl(
     MediaPart mediaPart,
     int Width,
     int Height,
     string Mode,
     string Alignment,
     string PadColor)
 {
     return(GetProfileUrl(mediaPart.MediaUrl, Width, Height, Mode, Alignment, PadColor, mediaPart.ContentItem));
 }
 protected void RemoveMedia(MediaPart part)
 {
     if (!string.IsNullOrEmpty(part.FileName))
     {
         var mediaItemsUsingTheFile = _contentManager.Query <MediaPart, MediaPartRecord>()
                                      .ForVersion(VersionOptions.Latest)
                                      .Where(x => x.FolderPath == part.FolderPath && x.FileName == part.FileName)
                                      .Count();
         if (mediaItemsUsingTheFile == 1)   // if the file is referenced only by the deleted media content, the file too can be removed.
         {
             _mediaLibraryService.DeleteFile(part.FolderPath, part.FileName);
         }
     }
 }
Example #7
0
        public MediaModel UploadFile(MediaPart part, string type)
        {
            var       url         = GetApiUrl(URL_UPLOADFILE, type);
            WebClient myWebClient = new WebClient();

            myWebClient.Credentials = CredentialCache.DefaultCredentials;
            var filepath = HttpContext.Current.Server.MapPath(part.MediaUrl);

            try
            {
                byte[] responseArray = myWebClient.UploadFile(url, "POST", filepath);
                var    result        = System.Text.Encoding.Default.GetString(responseArray, 0, responseArray.Length);
                var    model         = System.Web.Helpers.Json.Decode <MediaModel>(result);
                return(model);
            }
            catch { }
            return(null);
        }
Example #8
0
            public static ImageInfo New(
                MediaPart mediaPart,
                ImagePart imagePart,
                int width,
                int height)
            {
                if (mediaPart == null)
                {
                    mediaPart = imagePart.As <MediaPart>();
                }
                else if (imagePart == null)
                {
                    imagePart = mediaPart.As <ImagePart>();
                }

                // at minimum, we need a MediaPart to get to a file
                if (mediaPart == null)
                {
                    return(null);
                }

                if (imagePart != null)
                {
                    // Manage Width <= 0, Height <= 0
                    if (width <= 0)
                    {
                        width = imagePart.Width;
                    }
                    if (height <= 0)
                    {
                        height = imagePart.Height;
                    }
                }

                var imagePath = mediaPart.MediaUrl;

                var img = New(imagePath, width, height);

                if (img != null)
                {
                    img.ContentItem = mediaPart.ContentItem;
                }
                return(img);
            }
        public static EagerlyLoadQueryResult <T> IncludeMediaLibraryPickerFields <T>(this EagerlyLoadQueryResult <T> eagerlyLoadQueryResult) where T : class, IContent
        {
            var containerIds = new HashSet <int>();

            foreach (var part in eagerlyLoadQueryResult.Result)
            {
                var mediaLibraryPickerFields = part.ContentItem.Parts.SelectMany(p => p.Fields.Where(f => f is MediaLibraryPickerField).Cast <MediaLibraryPickerField>());
                var ids = mediaLibraryPickerFields.SelectMany(f => f.Ids);
                foreach (var id in ids)
                {
                    if (!containerIds.Contains(id))
                    {
                        containerIds.Add(id);
                    }
                }
            }
            Dictionary <int, MediaPart> containersDictionary = eagerlyLoadQueryResult.ContentManager.GetTooMany <MediaPart>(containerIds, VersionOptions.Published, QueryHints.Empty).ToDictionary(c => c.ContentItem.Id);

            foreach (var resultPart in eagerlyLoadQueryResult.Result)
            {
                var mediaLibraryPickerFields = resultPart.ContentItem.Parts.SelectMany(p => p.Fields.Where(f => f is MediaLibraryPickerField).Cast <MediaLibraryPickerField>());
                foreach (var mediaLibraryPickerField in mediaLibraryPickerFields)
                {
                    var preloadedMedias = new List <MediaPart>();
                    foreach (var mediaId in mediaLibraryPickerField.Ids)
                    {
                        MediaPart preloadedMedia = null;
                        if (containersDictionary.TryGetValue(mediaId, out preloadedMedia))
                        {
                            preloadedMedias.Add(preloadedMedia);
                        }
                    }
                    mediaLibraryPickerField.MediaParts = preloadedMedias;
                }
            }
            return(eagerlyLoadQueryResult);
        }
Example #10
0
        public void SetMediaParts <TKey>(BaseEntity <TKey> entity, IEnumerable <IMediaPart> mediaParts)
        {
            var mediaPartType = GetMediaPartType(entity);
            var parentId      = entity.Id.GetHashCode();
            //delete old media parts
            var records = mediaPartRepository.Table.Where(x => x.MediaPartTypeId == mediaPartType && x.ParentId == parentId).OrderBy(x => x.SortOrder).ToList();

            mediaPartRepository.DeleteMany(records);

            // Insert new parts
            foreach (var mediaPart in mediaParts.Where(mediaPart => !string.IsNullOrEmpty(mediaPart.Url)))
            {
                var record = new MediaPart
                {
                    Id              = Guid.NewGuid(),
                    Url             = mediaPart.Url,
                    Caption         = mediaPart.Caption,
                    SortOrder       = mediaPart.SortOrder,
                    MediaPartTypeId = mediaPartType,
                    ParentId        = parentId
                };
                mediaPartRepository.Insert(record);
            }
        }
Example #11
0
        public ActionResult MediaPicker()
        {
            var matches = _contentDefinitionManager
                          .ListTypeDefinitions()
                          .SelectMany(ct => ct.Parts.SelectMany(p => p.PartDefinition.Fields.Select(y => new { Type = ct, Part = p, Field = y })))
                          .Where(x => x.Field.FieldDefinition.Name == "MediaPickerField");

            foreach (var match in matches)
            {
                foreach (var contentItem in _orchardServices.ContentManager.Query().ForType(match.Type.Name).ForVersion(VersionOptions.AllVersions).List())
                {
                    var contentPart = contentItem.Parts.FirstOrDefault(x => x.PartDefinition.Name == match.Part.PartDefinition.Name);
                    if (contentPart != null)
                    {
                        dynamic contentField = contentPart.Fields.FirstOrDefault(x => x.Name == match.Field.Name);
                        if (contentField != null && contentField.Url != null)
                        {
                            string    url        = Convert.ToString(contentField.Url);
                            var       filename   = Path.GetFileName(url);
                            string    folder     = Path.GetDirectoryName(url);
                            var       mediaItems = _orchardServices.ContentManager.Query <MediaPart, MediaPartRecord>().Where(x => filename == x.FileName).List().ToList();
                            MediaPart media      = null;

                            // in case multiple media have the same filename find based on the folder
                            if (mediaItems.Count() > 1)
                            {
                                media = mediaItems.FirstOrDefault(x => folder.EndsWith(x.FolderPath));
                            }
                            else
                            {
                                media = mediaItems.FirstOrDefault();
                            }

                            if (media != null)
                            {
                                contentField.Url = "{" + media.Id + "}";
                            }
                            else
                            {
                                // We don't want "broken" links left behind so instead want them converted to empty fields as broken links cause the page to crash
                                // Because this might be run "twice", don't override already valid contentField Url's
                                string contentFieldUrl = contentField.Url;
                                if (!contentFieldUrl.StartsWith("{"))
                                {
                                    contentField.Url = "";
                                }
                            }
                        }
                    }
                }
            }

            var processedParts = new List <string>();

            foreach (var match in matches)
            {
                // process each part only once as they could be used by multiple content types
                if (processedParts.Contains(match.Part.PartDefinition.Name))
                {
                    continue;
                }

                processedParts.Add(match.Part.PartDefinition.Name);

                string hint, required;
                match.Field.Settings.TryGetValue("MediaPickerFieldSettings.Hint", out hint);
                match.Field.Settings.TryGetValue("MediaPickerFieldSettings.Required", out required);

                _contentDefinitionManager.AlterPartDefinition(match.Part.PartDefinition.Name, cfg => cfg.RemoveField(match.Field.Name));

                _contentDefinitionManager.AlterPartDefinition(match.Part.PartDefinition.Name, cfg => cfg
                                                              .WithField(match.Field.Name, builder => builder
                                                                         .OfType("MediaLibraryPickerField")
                                                                         .WithDisplayName(match.Field.DisplayName)
                                                                         .WithSetting("MediaLibraryPickerFieldSettings.Hint", hint ?? "")
                                                                         .WithSetting("MediaLibraryPickerFieldSettings.Required", required ?? "")
                                                                         .WithSetting("MediaLibraryPickerFieldSettings.Multiple", false.ToString(CultureInfo.InvariantCulture))
                                                                         .WithSetting("MediaLibraryPickerFieldSettings.DisplayedContentTypes", String.Empty)
                                                                         ));
            }
            return(RedirectToAction("Index"));
        }
 protected void LazyLoadHandlers(MediaPart part) {
     // add handlers that will load content for id's just-in-time
     part.TermPartField.Loader(() => part.Record.TermPartRecord == null ? null : _contentManager.Get<TermPart>(part.Record.TermPartRecord.Id));
 }
Example #13
0
 protected void RemoveMedia(MediaPart part) {
     if (!string.IsNullOrEmpty(part.FileName)) {
         var path = _storageProvider.Combine(part.FolderPath, part.FileName);
         _storageProvider.DeleteFile(path);
     }
 }
Example #14
0
 public string GetMediaAbsoluteUrl(MediaPart part)
 {
     return(_orchardServices.WorkContext.CurrentSite.BaseUrl + part.MediaUrl);
 }
 protected void RemoveMedia(MediaPart part) {
     if (part.Resource.StartsWith("~/")) {
         var path = _storageProvider.GetLocalPath(part.Resource);
         _storageProvider.DeleteFile(path);
     }
 }
Example #16
0
        private void ButtonStartVoice_Click(object sender, RoutedEventArgs e)
        {
            /*    me = new MediaPart(AudioStream, null);
            me.InitCall();
            Datastore.Add(me.localEp, "localEp");
            Datastore.Add(me.stream, "stream");
            Datastore.Add(me.localEp,"remoteEp");
            this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative));
             */
            this.hack = false;
            if (ButtonStartVoice.Content.ToString() == "Start Voice Call")
            {
                this.hack = true;
                me = new MediaPart(AudioStream, null);
                me.InitCall();
                SendMessage("Call from " + me.localEp.ToString());
                this.Focus();
            }
            else if (ButtonStartVoice.Content.ToString() == "Accept Voice Call")
            {
                me.InitCall();
                this.Focus();
                Datastore.Add(me.localEp, "localEp");
                Datastore.Add(me.stream, "stream");
                Datastore.Add(me.remote, "remoteEp");
                Deployment.Current.Dispatcher.BeginInvoke(() => { ButtonStartVoice.Content = "End Voice Call"; });
                SendMessage("Call ok " + me.localEp.ToString());
                this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative));

            }
        }
Example #17
0
        public void ImageTag(
            dynamic Shape,
            dynamic Display,
            TextWriter Output,
            /* Parameters for the image we want to show */
            MediaPart MediaPart,
            ImagePart ImagePart,
            string ImagePath,
            int Width,
            int Height,
            string Mode,
            string Alignment,
            string PadColor,
            string alt,
            string title,
            /* Parameters for the thumbnail used for lazy loading of image */
            MediaPart StubMediaPart,
            ImagePart StubImagePart,
            string StubImagePath,
            int StubWidth,
            int StubHeight,
            string StubMode,
            string StubAlignment,
            string StubPadColor,
            IDictionary <string, object> htmlAttributes)
        {
            ImageInfo mainImage = ImageInfo.New(MediaPart, ImagePart, Width, Height);

            if (mainImage == null)
            {
                // attempt to validate the information without using the ContentItem
                mainImage = ImageInfo.New(ImagePath, Width, Height);
            }

            if (mainImage == null)
            {
                Logger.Error("It was impossible to figure out the image to render.");
                return;
            }

            // At this point, mainImage contains all the information to render the image
            if (MediaPart != null)
            {
                // The MediaPart may have its own alternate text and title
                title = string.IsNullOrWhiteSpace(MediaPart.Title) ? title : MediaPart.Title;
                alt   = string.IsNullOrWhiteSpace(MediaPart.AlternateText) ? alt : MediaPart.AlternateText;
            }

            // Check whether we are also trying to render a thumbnail/stub for lazy loading
            // thumbnail cannot be larger than full image:
            StubWidth = StubWidth > mainImage.Width ? mainImage.Width : StubWidth;
            // thumbnail cannot be taller than full image:
            StubHeight = StubHeight > mainImage.Height ? mainImage.Height : StubHeight;
            ImageInfo stubImage = ImageInfo.New(StubMediaPart, StubImagePart, StubWidth, StubHeight);

            if (stubImage == null)
            {
                stubImage = ImageInfo.New(StubImagePath, StubWidth, StubHeight);
            }
            // Lastly, we may want to generate a stub based on the main image:
            if (stubImage == null && StubWidth > 0 && StubHeight > 0)
            {
                stubImage = new ImageInfo()
                {
                    ContentItem = mainImage.ContentItem,
                    ImagePath   = mainImage.ImagePath,
                    Width       = StubWidth,
                    Height      = StubHeight
                };
            }

            // Generate tag, with attributes that are common to both normal and lazyload cases
            TagBuilder tagBuilder = new TagBuilder("img");

            tagBuilder.MergeAttributes(htmlAttributes); // this for example allows adding a class
            if (!string.IsNullOrWhiteSpace(title))
            {
                tagBuilder.MergeAttribute("title", title);
            }
            if (!string.IsNullOrWhiteSpace(alt))
            {
                tagBuilder.MergeAttribute("alt", alt);
            }
            // Generate stuff needed for the image profiles
            var imagePath = GetProfileUrl(mainImage, Mode, Alignment, PadColor);

            if (stubImage == null)
            {
                // "normal" behaviour, without stub image for lazyload
                tagBuilder.MergeAttribute("src", imagePath);
            }
            else
            {
                // stub settings:
                StubMode      = string.IsNullOrWhiteSpace(StubMode) ? Mode : StubMode;
                StubAlignment = string.IsNullOrWhiteSpace(StubAlignment) ? Alignment : StubAlignment;
                StubPadColor  = string.IsNullOrWhiteSpace(StubPadColor) ? PadColor : StubPadColor;
                // generate tag with stub image for lazyload
                var imageStub = GetProfileUrl(stubImage, StubMode, StubAlignment, StubPadColor);
                tagBuilder.MergeAttribute("src", imageStub);
                tagBuilder.MergeAttribute("data-src", imagePath);
            }

            Output.Write(tagBuilder.ToString(TagRenderMode.Normal));
        }
        public ActionResult Index(UploadFileVM filelist, HttpPostedFileBase file)
        {
            string linkFile   = "/Media/" + _settings.Name;
            string pathString = Server.MapPath("~/Media/" + _settings.Name);

            //         pathString += @"\Upload";
            //         LinkFile += "/Upload";
            VerificaPath(pathString);
            if (filelist != null)
            {
                if (filelist.FolderField != "")
                {
                    pathString += @"\" + filelist.FolderField;
                    linkFile   += "/" + filelist.FolderField;
                    VerificaPath(pathString);
                }

                if (filelist.SubFolder == "random")
                {
                    pathString += @"\" + Session.SessionID;
                    linkFile   += @"/" + Session.SessionID;
                    VerificaPath(pathString);
                }
                else
                if (_orchardServices.WorkContext.CurrentUser != null)
                {
                    if (filelist.SubFolder == "")
                    {
                        string folder = _orchardServices.WorkContext.CurrentUser.Id.ToString();
                        pathString += @"\" + folder;   //pathString += @"\" + Session.SessionID + @"\";
                        linkFile   += "/" + folder;    //LinkFile += @"\" + Session.SessionID + @"\";
                        VerificaPath(pathString);
                    }
                    else
                    {
                        string folder = _orchardServices.WorkContext.CurrentUser.Id.ToString();
                        pathString += @"\" + filelist.SubFolder;   //pathString += @"\" + Session.SessionID + @"\";
                        linkFile   += "/" + filelist.SubFolder;    //LinkFile += @"\" + Session.SessionID + @"\";
                        VerificaPath(pathString);
                    }
                }
            }
            pathString += @"\";   //pathString += @"\" + Session.SessionID + @"\";
            linkFile   += "/";
            string nomefile = System.IO.Path.GetFileName(file.FileName);

            if (_contentExtensionsServices.FileAllowed(nomefile))
            {
                int    contatore = 0;
                string cont      = "";
                while (System.IO.File.Exists(System.IO.Path.Combine(pathString, cont + nomefile)))
                {
                    contatore++;
                    cont = contatore.ToString() + "_";
                }
                // file.SaveAs(System.IO.Path.Combine(pathString, cont + nomefile));

                //    var CIimage = _orchardServices.ContentManager.New("Image");
                MediaPart mediaPart = _mediaLibraryService.ImportMedia(file.InputStream, Path.GetFullPath(pathString).Replace(Server.MapPath("~/Media/" + _settings.Name + "/"), ""), cont + nomefile);
                // CIimage.As<MediaPart>()= mediaPart;
                var CIimage = _orchardServices.ContentManager.New(mediaPart.ContentItem.ContentType);

                _orchardServices.ContentManager.Create(mediaPart.ContentItem, VersionOptions.Published);
                //          filelist.ElencoUrl.Add(mediaPart.ContentItem.As<MediaPart>().Id);
                if (filelist != null)
                {
                    filelist.ElencoUrl.Add(linkFile.Replace("//", "/") + cont + nomefile);
                    filelist.ElencoId.Add(mediaPart.Id);
                }
            }
            else
            {
                _notifier.Error(T("The file extension in the filename is not allowed or has not been provided."));
            }

            return(View(filelist));
        }
Example #19
0
        void XMPPClient_OnNewConversationItem(RosterItem item, bool bReceived, TextMessage msg)
        {
            if (msg.Message.IndexOf("Call from ") == 0 && this.hack == false)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() => ButtonStartVoice.Content = "Accept Voice Call");
                string ipen = msg.Message.Substring(10);
                int pos = ipen.IndexOf(':');
                me = new MediaPart(AudioStream, null);
                me.remote = new IPEndPoint(IPAddress.Parse(ipen.Substring(0, pos)), Convert.ToInt32(ipen.Substring(pos + 1)));
            }
            else if (msg.Message.IndexOf("Call ok") == 0 && this.hack == true)
            {
                string ipen = msg.Message.Substring(8);
                int pos = ipen.IndexOf(':');
                me.remote = new IPEndPoint(IPAddress.Parse(ipen.Substring(0, pos)), Convert.ToInt32(ipen.Substring(pos + 1)));
                Deployment.Current.Dispatcher.BeginInvoke(() => { ButtonStartVoice.Content = "End Voice Call"; });
                Datastore.Add(me.localEp, "localEp");
                Datastore.Add(me.stream, "stream");
                Datastore.Add(me.remote, "remoteEp");
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                this.NavigationService.Navigate(new Uri("/TestPAge.xaml?", UriKind.Relative)));

            }

            Dispatcher.BeginInvoke(new System.Net.XMPP.XMPPClient.DelegateNewConversationItem(DoOnNewConversationItem), item, bReceived, msg);
        }
        private string importTrack(Newtonsoft.Json.Linq.JToken item)
        {
            string       track_category_result = "";
            string       track_result          = "";
            string       import_result         = "";
            const string baseTrackURL          = "http://www.giroparchi.it/it/resource/track/";

            Dictionary <dynamic, dynamic> TrackCategoryDictionary = new Dictionary <dynamic, dynamic>();
            Dictionary <dynamic, dynamic> TrackDictionary         = new Dictionary <dynamic, dynamic>();

            HttpWebRequest  request;
            HttpWebResponse response;

            try {
                string URL = baseURL + item["geojson"].ToString();

                request             = (HttpWebRequest)WebRequest.Create(URL);
                request.ContentType = "application/json; charset=utf-8";
                request.Method      = "GET";

                response = (HttpWebResponse)request.GetResponse();
                using (var streamReader = new StreamReader(response.GetResponseStream())) {
                    track_category_result   = streamReader.ReadToEnd();
                    TrackCategoryDictionary = JsonConvert.DeserializeObject <Dictionary <dynamic, dynamic> >(track_category_result);
                }

                if (!String.IsNullOrWhiteSpace(TrackCategoryDictionary["features"].ToString()))
                {
                    Newtonsoft.Json.Linq.JArray features = TrackCategoryDictionary["features"];
                    URL = baseURL + "RPC2";

                    foreach (Newtonsoft.Json.Linq.JToken poi in features)
                    {
                        request             = (HttpWebRequest)WebRequest.Create(URL);
                        request.ContentType = "application/json; charset=utf-8";
                        request.Method      = "POST";

                        using (var streamWriter = new StreamWriter(request.GetRequestStream())) {
                            string json = "{\"id\":\"djangorpc\", \"method\" : \"resources.get_track\", \"params\" : [\"" + poi["properties"]["id"].ToString() + "\"]}";

                            streamWriter.Write(json);
                            streamWriter.Flush();
                        }

                        response = (HttpWebResponse)request.GetResponse();
                        using (var streamReader = new StreamReader(response.GetResponseStream())) {
                            track_result    = streamReader.ReadToEnd();
                            import_result  += track_result + "\n";
                            TrackDictionary = JsonConvert.DeserializeObject <Dictionary <dynamic, dynamic> >(track_result);
                        }

                        if (!String.IsNullOrWhiteSpace(TrackDictionary["result"].ToString()))
                        {
                            if ((int)TrackDictionary["result"]["fields"]["status"] == 1)
                            {
                                int difficulty = Convert.ToInt16(TrackDictionary["result"]["fields"]["difficulty_foot"]);

                                //Creo contenuto master (la lingua di default di Orchard dev'essere impostata a "it-IT")
                                //Per la lingua di default non bisogna settare espliticamente la cultura

                                var TrackItemIT = _contentManager.New("Percorso");

                                ((dynamic)TrackItemIT).TitlePart.Title      = TrackDictionary["result"]["fields"]["name_it"].ToString();
                                ((dynamic)TrackItemIT).MapPart.LocationInfo = TrackDictionary["result"]["fields"]["name_it"].ToString();

                                string bodyIT = "";
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["track_percent"]) > 0)
                                {
                                    bodyIT += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["it"]["track_percent"]).Name.ToString();
                                    bodyIT += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["track_percent"]) + "%<br/>";
                                }
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["offroad_percent"]) > 0)
                                {
                                    bodyIT += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["it"]["offroad_percent"]).Name.ToString();
                                    bodyIT += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["offroad_percent"]) + "%<br/>";
                                }
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["coated_percent"]) > 0)
                                {
                                    bodyIT += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["it"]["coated_percent"]).Name.ToString();
                                    bodyIT += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["coated_percent"]) + "%<br/>";
                                }
                                if (bodyIT != "")
                                {
                                    bodyIT = "Tipologie di terreno:<br/>" + bodyIT;
                                }
                                ((dynamic)TrackItemIT).BodyPart.Text = bodyIT;

                                _contentManager.Create(TrackItemIT);

                                ((dynamic)TrackItemIT).Percorso.Descrizionedelpercorso.Value = TrackDictionary["result"]["fields"]["description_it"].ToString();
                                ((dynamic)TrackItemIT).Percorso.PeriodoConsigliato.Value     = stripHTML(TrackDictionary["result"]["fields"]["suggested_time_it"].ToString());
                                ((dynamic)TrackItemIT).Percorso.Partenza.Value = TrackDictionary["result"]["fields"]["start_info_it"].ToString();
                                ((dynamic)TrackItemIT).Percorso.Arrivo.Value   = TrackDictionary["result"]["fields"]["end_info_it"].ToString();
                                ((dynamic)TrackItemIT).Percorso.Segnavia.Value = stripHTML(TrackDictionary["result"]["fields"]["signals_it"].ToString());

                                TermPart termIT = _contentManager.Get <TermPart>(TracksTermsDictionary["it"][difficulty]);
                                _taxonomyService.UpdateTerms(TrackItemIT, new List <TermPart> {
                                    termIT
                                }, "Difficoltadelpercorso");

                                //Creo contenuto in francese

                                var TrackItemFR = _contentManager.New("Percorso");

                                ((dynamic)TrackItemFR).TitlePart.Title      = TrackDictionary["result"]["fields"]["name_fr"].ToString();
                                ((dynamic)TrackItemFR).MapPart.LocationInfo = TrackDictionary["result"]["fields"]["name_fr"].ToString();

                                string bodyFR = "";
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["track_percent"]) > 0)
                                {
                                    bodyFR += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["fr"]["track_percent"]).Name.ToString();
                                    bodyFR += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["track_percent"]) + "%<br/>";
                                }
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["offroad_percent"]) > 0)
                                {
                                    bodyFR += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["fr"]["offroad_percent"]).Name.ToString();
                                    bodyFR += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["offroad_percent"]) + "%<br/>";
                                }
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["coated_percent"]) > 0)
                                {
                                    bodyFR += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["fr"]["coated_percent"]).Name.ToString();
                                    bodyFR += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["coated_percent"]) + "%<br/>";
                                }
                                if (bodyFR != "")
                                {
                                    bodyFR = "Typologies de terrain:<br/>" + bodyFR;
                                }
                                ((dynamic)TrackItemFR).BodyPart.Text = bodyFR;

                                _contentManager.Create(TrackItemFR);

                                ((LocalizationPart)((dynamic)TrackItemFR).LocalizationPart).MasterContentItem = TrackItemIT;
                                _localizationService.SetContentCulture(TrackItemFR, "fr-FR");

                                ((dynamic)TrackItemFR).Percorso.Descrizionedelpercorso.Value = TrackDictionary["result"]["fields"]["description_fr"].ToString();
                                ((dynamic)TrackItemFR).Percorso.PeriodoConsigliato.Value     = stripHTML(TrackDictionary["result"]["fields"]["suggested_time_fr"].ToString());
                                ((dynamic)TrackItemFR).Percorso.Partenza.Value = TrackDictionary["result"]["fields"]["start_info_fr"].ToString();
                                ((dynamic)TrackItemFR).Percorso.Arrivo.Value   = TrackDictionary["result"]["fields"]["end_info_fr"].ToString();
                                ((dynamic)TrackItemFR).Percorso.Segnavia.Value = stripHTML(TrackDictionary["result"]["fields"]["signals_fr"].ToString());

                                TermPart termFR = _contentManager.Get <TermPart>(TracksTermsDictionary["fr"][difficulty]);
                                _taxonomyService.UpdateTerms(TrackItemFR, new List <TermPart> {
                                    termFR
                                }, "Difficoltadelpercorso");

                                //Creo contenuto in inglese

                                var TrackItemEN = _contentManager.New("Percorso");

                                ((dynamic)TrackItemEN).TitlePart.Title      = TrackDictionary["result"]["fields"]["name_en"].ToString();
                                ((dynamic)TrackItemEN).MapPart.LocationInfo = TrackDictionary["result"]["fields"]["name_en"].ToString();

                                string bodyEN = "";
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["track_percent"]) > 0)
                                {
                                    bodyEN += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["en"]["track_percent"]).Name.ToString();
                                    bodyEN += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["track_percent"]) + "%<br/>";
                                }
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["offroad_percent"]) > 0)
                                {
                                    bodyEN += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["en"]["offroad_percent"]).Name.ToString();
                                    bodyEN += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["offroad_percent"]) + "%<br/>";
                                }
                                if (Convert.ToInt32(TrackDictionary["result"]["fields"]["coated_percent"]) > 0)
                                {
                                    bodyEN += _contentManager.Get <TermPart>(TerrainTypeTermsDictionary["en"]["coated_percent"]).Name.ToString();
                                    bodyEN += ": " + Convert.ToInt32(TrackDictionary["result"]["fields"]["coated_percent"]) + "%<br/>";
                                }
                                if (bodyEN != "")
                                {
                                    bodyEN = "Terrain types:<br/>" + bodyEN;
                                }
                                ((dynamic)TrackItemEN).BodyPart.Text = bodyEN;

                                _contentManager.Create(TrackItemEN);

                                ((LocalizationPart)((dynamic)TrackItemEN).LocalizationPart).MasterContentItem = TrackItemIT;
                                _localizationService.SetContentCulture(TrackItemEN, "en-US");

                                ((dynamic)TrackItemEN).Percorso.Descrizionedelpercorso.Value = TrackDictionary["result"]["fields"]["description_en"].ToString();
                                ((dynamic)TrackItemEN).Percorso.PeriodoConsigliato.Value     = stripHTML(TrackDictionary["result"]["fields"]["suggested_time_en"].ToString());
                                ((dynamic)TrackItemEN).Percorso.Partenza.Value = TrackDictionary["result"]["fields"]["start_info_en"].ToString();
                                ((dynamic)TrackItemEN).Percorso.Arrivo.Value   = TrackDictionary["result"]["fields"]["end_info_en"].ToString();
                                ((dynamic)TrackItemEN).Percorso.Segnavia.Value = stripHTML(TrackDictionary["result"]["fields"]["signals_en"].ToString());

                                TermPart termEN = _contentManager.Get <TermPart>(TracksTermsDictionary["en"][difficulty]);
                                _taxonomyService.UpdateTerms(TrackItemEN, new List <TermPart> {
                                    termEN
                                }, "Difficoltadelpercorso");

                                //Aggiungo campi comuni a tutte le lingue

                                ((dynamic)TrackItemIT).Percorso.DislivelloPositivo.Value = Convert.ToDecimal(TrackDictionary["result"]["fields"]["climb_up"]);
                                ((dynamic)TrackItemIT).Percorso.DislivelloNegativo.Value = Math.Abs(Convert.ToDecimal(TrackDictionary["result"]["fields"]["climb_down"]));
                                ((dynamic)TrackItemIT).Percorso.Lunghezza.Value          = Convert.ToInt32(TrackDictionary["result"]["fields"]["length"]);
                                ((dynamic)TrackItemIT).Percorso.QuotaMassima.Value       = Convert.ToDecimal(TrackDictionary["result"]["fields"]["max_height"]);

                                ((dynamic)TrackItemFR).Percorso.DislivelloPositivo.Value = Convert.ToDecimal(TrackDictionary["result"]["fields"]["climb_up"]);
                                ((dynamic)TrackItemFR).Percorso.DislivelloNegativo.Value = Math.Abs(Convert.ToDecimal(TrackDictionary["result"]["fields"]["climb_down"]));
                                ((dynamic)TrackItemFR).Percorso.Lunghezza.Value          = Convert.ToInt32(TrackDictionary["result"]["fields"]["length"]);
                                ((dynamic)TrackItemFR).Percorso.QuotaMassima.Value       = Convert.ToDecimal(TrackDictionary["result"]["fields"]["max_height"]);

                                ((dynamic)TrackItemEN).Percorso.DislivelloPositivo.Value = Convert.ToDecimal(TrackDictionary["result"]["fields"]["climb_up"]);
                                ((dynamic)TrackItemEN).Percorso.DislivelloNegativo.Value = Math.Abs(Convert.ToDecimal(TrackDictionary["result"]["fields"]["climb_down"]));
                                ((dynamic)TrackItemEN).Percorso.Lunghezza.Value          = Convert.ToInt32(TrackDictionary["result"]["fields"]["length"]);
                                ((dynamic)TrackItemEN).Percorso.QuotaMassima.Value       = Convert.ToDecimal(TrackDictionary["result"]["fields"]["max_height"]);

                                //Aggiungo KML

                                string    kmlUrl       = baseTrackURL + TrackDictionary["result"]["fields"]["slug"].ToString() + ".kml";
                                var       webClient    = new WebClient();
                                byte[]    kmlBytes     = webClient.DownloadData(kmlUrl);
                                MediaPart kmlMediaPart = _mediaLibraryService.ImportMedia(new MemoryStream(kmlBytes), @"Percorsi\KML", TrackDictionary["result"]["fields"]["slug"].ToString() + ".kml", "Document");
                                _contentManager.Create(kmlMediaPart);

                                string   kmlString             = System.Text.Encoding.Default.GetString(kmlBytes);
                                int      coordinatesPosition   = kmlString.IndexOf(">", kmlString.IndexOf("<coordinates>")) + 1;
                                int      firstPointPositionEnd = kmlString.IndexOf(" ", coordinatesPosition);
                                string[] firstPointCoordinates = kmlString.Substring(coordinatesPosition, firstPointPositionEnd - coordinatesPosition).Split(',');

                                ((dynamic)TrackItemIT).MapPart.Longitude = float.Parse(firstPointCoordinates[0], CultureInfo.InvariantCulture.NumberFormat);
                                ((dynamic)TrackItemIT).MapPart.Latitude  = float.Parse(firstPointCoordinates[1], CultureInfo.InvariantCulture.NumberFormat);

                                ((dynamic)TrackItemFR).MapPart.Longitude = float.Parse(firstPointCoordinates[0], CultureInfo.InvariantCulture.NumberFormat);
                                ((dynamic)TrackItemFR).MapPart.Latitude  = float.Parse(firstPointCoordinates[1], CultureInfo.InvariantCulture.NumberFormat);

                                ((dynamic)TrackItemEN).MapPart.Longitude = float.Parse(firstPointCoordinates[0], CultureInfo.InvariantCulture.NumberFormat);
                                ((dynamic)TrackItemEN).MapPart.Latitude  = float.Parse(firstPointCoordinates[1], CultureInfo.InvariantCulture.NumberFormat);

                                ((dynamic)TrackItemIT).MapPart.MapSourceFile.Ids = new Int32[] { kmlMediaPart.Id };
                                ((dynamic)TrackItemFR).MapPart.MapSourceFile.Ids = new Int32[] { kmlMediaPart.Id };
                                ((dynamic)TrackItemEN).MapPart.MapSourceFile.Ids = new Int32[] { kmlMediaPart.Id };

                                //Aggiungo immagine fittizia

                                ((dynamic)TrackItemIT).Percorso.Gallery.Ids = new Int32[] { 228 };
                                ((dynamic)TrackItemFR).Percorso.Gallery.Ids = new Int32[] { 228 };
                                ((dynamic)TrackItemEN).Percorso.Gallery.Ids = new Int32[] { 228 };
                            }
                        }
                    }
                }

                return(import_result);
            } catch (Exception e) {
                return(e.Message);
            }
        }
 protected void RemoveMedia(MediaPart part) {
     if (!string.IsNullOrEmpty(part.FileName)) {
         _mediaLibraryService.DeleteFile(part.FolderPath, part.FileName);
     }
 }
Example #22
0
 public MediaModel UploadFile(MediaPart part, string type)
 {
     var url = GetApiUrl(URL_UPLOADFILE, type);
     WebClient myWebClient = new WebClient();
     myWebClient.Credentials = CredentialCache.DefaultCredentials;
     var filepath = HttpContext.Current.Server.MapPath(part.MediaUrl);
     try
     {
         byte[] responseArray = myWebClient.UploadFile(url, "POST", filepath);
         var result = System.Text.Encoding.Default.GetString(responseArray, 0, responseArray.Length);
         var model = System.Web.Helpers.Json.Decode<MediaModel>(result);
         return model;
     }
     catch { }
     return null;
 }
        /// <summary>
        /// Sends a contact email.
        /// </summary>
        /// <param name="name">The name of the sender.</param>
        /// <param name="confirmEmail">The email address of the sender.</param>
        /// <param name="email">The email address entered in by spam bot</param>
        /// <param name="subject">The email subject.</param>
        /// <param name="message">The email message.</param>
        /// <param name="mediaid">The id of the attached file or -1 if no file is provided</param>
        /// <param name="sendTo">The email address to send the message to.</param>
        /// <param name="requiredName">Bool of Name is required</param>
        /// <param name="useStaticSubject">Boolean indicating if a fixed subject must be used for all emails</param>
        /// <param name="templateId">The id of the mail template or -1 if no template is selected</param>
        /// <param name="attachFiles">Boolean indicating whether to attach uploaded files (true) or only add their URL to the body of the mail (false)</param>
        public void SendContactEmail(string name, string confirmEmail, string email, string subject, string message, int mediaid, string sendTo, bool requiredName, bool requiredAttachment = false, bool useStaticSubject = false, int templateId = -1, bool attachFiles = false, object additionalData = null)
        {
            if (ValidateContactFields(name, email, message, requiredName, (mediaid != -1), requiredAttachment))
            {
                if (string.IsNullOrEmpty(name))
                {
                    name = email;
                }

                var host = string.Format("{0}://{1}{2}",
                                         _orchardServices.WorkContext.HttpContext.Request.Url.Scheme,
                                         _orchardServices.WorkContext.HttpContext.Request.Url.Host,
                                         _orchardServices.WorkContext.HttpContext.Request.Url.Port == 80
                                        ? string.Empty : ":" + _orchardServices.WorkContext.HttpContext.Request.Url.Port);

                var smtpSettings = _orchardServices.WorkContext.CurrentSite.As <SmtpSettingsPart>();
                var smtpLogger   = new SmtpLogger();
                ((Component)_messageManager).Logger = smtpLogger;

                if (smtpSettings != null && smtpSettings.IsValid())
                {
                    var mailClient          = BuildSmtpClient(smtpSettings);
                    var contactFormSettings = _orchardServices.WorkContext.CurrentSite.As <ContactFormSettingsPart>().Record;

                    if (confirmEmail != email)
                    {
                        // This option allows spam to be sent to a separate email address.
                        if (contactFormSettings.EnableSpamEmail && !string.IsNullOrEmpty(contactFormSettings.SpamEmail))
                        {
                            try {
                                MediaPart mediaData = new MediaPart();
                                if (mediaid != -1)
                                {
                                    mediaData = _contentManager.Get(mediaid).As <MediaPart>();
                                }

                                var body = "<strong>" + name + "</strong><hr/>" + "<br/><br/><div>" + message + "</div>";
                                if (mediaid != -1 && !attachFiles)
                                {
                                    body += "<div><a href=\"" + host + mediaData.MediaUrl + "\">" + T("Attachment") + "</a></div>";
                                }
                                var data = new Dictionary <string, object>();
                                data.Add("Recipients", sendTo);
                                data.Add("ReplyTo", email);
                                data.Add("Subject", subject);
                                data.Add("Body", body);
                                if (mediaid != -1 && attachFiles)
                                {
                                    data.Add("Attachments", new string[] { _orchardServices.WorkContext.HttpContext.Server.MapPath(mediaData.MediaUrl) });
                                }

                                _messageManager.Process(data);

                                string spamMessage = string.Format(T("Your message was flagged as spam. If you feel this was in error contact us directly at: {0}").Text, sendTo);
                                _notifier.Information(T(spamMessage));
                            } catch (Exception e) {
                                Logger.Error(e, T("An unexpected error while sending a contact form message flagged as spam to {0} at {1}").Text, contactFormSettings.SpamEmail, DateTime.Now.ToLongDateString());
                                string errorMessage = string.Format(T("Your message was flagged as spam. If you feel this was in error contact us directly at: {0}").Text, sendTo);
                                _notifier.Error(T(errorMessage));
                            }
                        }
                        else
                        {
                            _notifier.Error(T("'Confirm email' and 'Email' does not match. Please retry."));
                        }
                    }
                    else
                    {
                        try {
                            if (templateId > 0)
                            {
                                ParseTemplateContext templatectx = new ParseTemplateContext();
                                var template  = _templateServices.GetTemplate(templateId);
                                var urlHelper = new UrlHelper(_orchardServices.WorkContext.HttpContext.Request.RequestContext);

                                string mailSubject = "";
                                if (useStaticSubject && !String.IsNullOrWhiteSpace(template.Subject))
                                {
                                    mailSubject = template.Subject;
                                }
                                else
                                {
                                    mailSubject = subject;
                                }

                                MediaPart mediaData = new MediaPart();
                                if (mediaid != -1)
                                {
                                    mediaData = _contentManager.Get(mediaid).As <MediaPart>();
                                }

                                dynamic model = new {
                                    SenderName     = name,
                                    SenderEmail    = email,
                                    Subject        = mailSubject,
                                    Message        = message,
                                    AttachmentUrl  = (mediaid != -1 ? host + mediaData.MediaUrl : ""),
                                    AdditionalData = additionalData
                                };

                                // Creo un model che ha Content (il contentModel), Urls con alcuni oggetti utili per il template
                                // Nel template pertanto Model, diventa Model.Content
                                templatectx.Model = model;
                                var body = _templateServices.ParseTemplate(template, templatectx);
                                var data = new Dictionary <string, object>();
                                data.Add("Recipients", sendTo);
                                data.Add("ReplyTo", email);
                                data.Add("Subject", mailSubject);
                                data.Add("Body", body);
                                if (mediaid != -1 && attachFiles)
                                {
                                    data.Add("Attachments", new string[] { _orchardServices.WorkContext.HttpContext.Server.MapPath(mediaData.MediaUrl) });
                                }

                                _messageManager.Process(data);
                            }
                            else
                            {
                                MediaPart mediaData = new MediaPart();
                                if (mediaid != -1)
                                {
                                    mediaData = _contentManager.Get(mediaid).As <MediaPart>();
                                }

                                var body = "<strong>" + name + "</strong><hr/>" + "<br/><br/><div>" + message + "</div>";
                                if (mediaid != -1 && !attachFiles)
                                {
                                    body += "<div><a href=\"" + host + mediaData.MediaUrl + "\">" + T("Attachment") + "</a></div>";
                                }
                                var data = new Dictionary <string, object>();
                                data.Add("Recipients", sendTo);
                                data.Add("ReplyTo", email);
                                data.Add("Subject", subject);
                                data.Add("Body", body);
                                if (mediaid != -1 && attachFiles)
                                {
                                    data.Add("Attachments", new string[] { _orchardServices.WorkContext.HttpContext.Server.MapPath(mediaData.MediaUrl) });
                                }

                                _messageManager.Process(data);
                            }
                            if (!string.IsNullOrWhiteSpace(smtpLogger.ErrorMessage))
                            {
                                throw new Exception(smtpLogger.ErrorMessage, smtpLogger.Exception);
                            }

                            Logger.Debug(T("Contact form message sent to {0} at {1}").Text, sendTo, DateTime.Now.ToLongDateString());
                            _notifier.Information(T("Operation completed successfully."));
                            //_notifier.Information(T("Thank you for your inquiry, we will respond to you shortly."));
                        }
                        catch (Exception e)
                        {
                            Logger.Error(e, T("An unexpected error while sending a contact form message to {0} at {1}").Text, sendTo, DateTime.Now.ToLongDateString());
                            var errorMessage = string.Format(T("An unexpected error occured when sending your message. You may email us directly at: {0}").Text, sendTo);
                            _notifier.Error(T(errorMessage));
                            throw new System.Exception(errorMessage);
                        }
                    }
                }
                else
                {
                    string errorMessage = string.Format(T("Our email server isn't configured. You may email us directly at: {0}").Text, sendTo);
                    _notifier.Error(T(errorMessage));
                    throw new System.Exception(errorMessage);
                }
            }
            else
            {
                _notifier.Error(T(validationError));
                throw new System.Exception(T(validationError).Text);
            }
        }
Example #24
0
 public string GetMediaAbsoluteUrl(MediaPart part)
 {
     return _orchardServices.WorkContext.CurrentSite.BaseUrl + part.MediaUrl;
 }