/*
* Box Socialâ„¢
* http://boxsocial.net/
* Copyright © 2007, David Lachlan Smith
*
* $Id:$
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using BoxSocial.Internals;
using BoxSocial.IO;
namespace BoxSocial.Applications.Gallery
{
///
/// Represents a user gallery item
///
[Obsolete("Use the generic GalleryItem", true)]
public class UserGalleryItem : GalleryItem
{
///
/// Initialises a new instance of the UserGalleryItem class.
///
/// Core token
/// Gallery item owner
/// Gallery item Id
public UserGalleryItem(Core core, User owner, long itemId)
: base(core, (Primitive)owner, itemId)
{
}
///
/// Initialises a new instance of the UserGalleryItem class.
///
/// Core token
/// Gallery item owner
/// Raw data row of gallery item
public UserGalleryItem(Core core, User owner, DataRow itemRow)
: base(core, (Primitive)owner, itemRow)
{
}
///
/// Initialises a new instance of the UserGalleryItem class.
///
/// Core token
/// Gallery item owner
/// Gallery item path
public UserGalleryItem(Core core, User owner, string path)
: base(core, (Primitive)owner, path)
{
}
///
/// Creates a new user gallery item
///
/// Core token
/// Owner
/// Gallery
/// Title
/// Slug
/// File name
/// Storage name
/// Content type
/// Bytes
/// Description
/// Permissions mask
/// License
/// Classification
/// Slug is a reference
/// New gallery item
public static GalleryItem Create(Core core, User owner, Gallery parent, string title, ref string slug, string fileName, string storageName, string contentType, ulong bytes, string description, ushort permissions, byte license, Classifications classification)
{
/*long itemId = GalleryItem.create(core, (Primitive)owner, parent, title, ref slug, fileName, storageName, contentType, bytes, description, permissions, license, classification);
UserGalleryItem myGalleryItem = new UserGalleryItem(core, owner, itemId);
if (Access.FriendsCanRead(myGalleryItem.Permissions))
{
Action action = core.CallingApplication.GetMostRecentFeedAction(owner);
bool update = false;
if (action != null)
{
TimeSpan ts = core.tz.Now.Subtract(action.GetTime(core.tz));
if (ts.TotalDays < 2)
{
update = true;
}
else
{
update = false;
}
}
else
{
update = false;
}
if (update)
{
if (Regex.Matches(action.Body, Regex.Escape("[/thumb]")).Count < 4)
{
core.CallingApplication.UpdateFeedAction(action, "uploaded new photos", string.Format("{0} [iurl={1}][thumb]{2}/{3}[/thumb][/iurl]",
action.Body, myGalleryItem.BuildUri(), myGalleryItem.ParentPath, myGalleryItem.Path));
}
else
{
// otherwise we'll just leave as is
}
}
else
{
core.CallingApplication.PublishToFeed(owner, "uploaded a new photo", string.Format("[iurl={0}][thumb]{1}/{2}[/thumb][/iurl]",
myGalleryItem.BuildUri(), myGalleryItem.ParentPath, myGalleryItem.Path));
}
}
return myGalleryItem;*/
throw new NotImplementedException();
}
///
/// Returns user gallery delete item URI
///
///
public string BuildDeleteUri()
{
return core.Uri.BuildAccountSubModuleUri("galleries", "delete", Id, true);
}
///
/// Returns user gallery tag item URI
///
///
public string BuildTagUri()
{
return core.Uri.BuildAccountSubModuleUri("galleries", "tag", Id, true);
}
}
}