Package org.opencms.ui
Class CmsUserIconHelper
- java.lang.Object
-
- org.opencms.ui.CmsUserIconHelper
-
public class CmsUserIconHelper extends java.lang.Object
Generates user ident-icons.
-
-
Field Summary
Fields Modifier and Type Field Description static java.awt.Color
ADMIN_COLOR
The color reserved for admin users.static java.lang.String
BIG_ICON_SUFFIX
The big icon suffix.static java.lang.String
ICON_FOLDER
The target folder name.static java.lang.String
SMALL_ICON_SUFFIX
The small icon suffix.static java.lang.String
TEMP_FOLDER
The temp folder name.static java.lang.String
TINY_ICON_SUFFIX
The tiny icon suffix.static java.lang.String
USER_IMAGE_FOLDER
The user image folder.static java.lang.String
USER_IMAGE_INFO
The user image additional info key.
-
Constructor Summary
Constructors Constructor Description CmsUserIconHelper(CmsObject adminCms)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteUserImage(CmsObject cms)
Deletes the user image of the current user.java.lang.String
getBigIconPath(CmsObject cms, CmsUser user)
Returns the big ident-icon path for the given user.java.lang.String
getSmallIconPath(CmsObject cms, CmsUser user)
Returns the small ident-icon path for the given user.java.lang.String
getTinyIconPath(CmsObject cms, CmsUser user)
Returns the tiny ident-icon path for the given user.boolean
handleImageUpload(CmsObject cms, java.util.List<java.lang.String> uploadedFiles)
Handles a user image upload.boolean
handleImageUpload(CmsObject cms, CmsUser user, java.lang.String uploadedFile)
Handles a user image upload.static boolean
hasUserImage(CmsUser user)
Checks whether the given user has an individual user image.void
setUserImage(CmsObject cms, CmsUser user, java.lang.String rootPath)
Sets the user image for the given user.
-
-
-
Field Detail
-
ADMIN_COLOR
public static final java.awt.Color ADMIN_COLOR
The color reserved for admin users.
-
BIG_ICON_SUFFIX
public static final java.lang.String BIG_ICON_SUFFIX
The big icon suffix.- See Also:
- Constant Field Values
-
ICON_FOLDER
public static final java.lang.String ICON_FOLDER
The target folder name.- See Also:
- Constant Field Values
-
SMALL_ICON_SUFFIX
public static final java.lang.String SMALL_ICON_SUFFIX
The small icon suffix.- See Also:
- Constant Field Values
-
TEMP_FOLDER
public static final java.lang.String TEMP_FOLDER
The temp folder name.- See Also:
- Constant Field Values
-
TINY_ICON_SUFFIX
public static final java.lang.String TINY_ICON_SUFFIX
The tiny icon suffix.- See Also:
- Constant Field Values
-
USER_IMAGE_FOLDER
public static final java.lang.String USER_IMAGE_FOLDER
The user image folder.- See Also:
- Constant Field Values
-
USER_IMAGE_INFO
public static final java.lang.String USER_IMAGE_INFO
The user image additional info key.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsUserIconHelper
public CmsUserIconHelper(CmsObject adminCms)
Constructor.- Parameters:
adminCms
- the admin cms context
-
-
Method Detail
-
hasUserImage
public static boolean hasUserImage(CmsUser user)
Checks whether the given user has an individual user image.- Parameters:
user
- the user- Returns:
true
if the given user has an individual user image
-
deleteUserImage
public void deleteUserImage(CmsObject cms)
Deletes the user image of the current user.- Parameters:
cms
- the cms context
-
getBigIconPath
public java.lang.String getBigIconPath(CmsObject cms, CmsUser user)
Returns the big ident-icon path for the given user.- Parameters:
cms
- the cms contextuser
- the user- Returns:
- the icon path
-
getSmallIconPath
public java.lang.String getSmallIconPath(CmsObject cms, CmsUser user)
Returns the small ident-icon path for the given user.- Parameters:
cms
- the cms contextuser
- the user- Returns:
- the icon path
-
getTinyIconPath
public java.lang.String getTinyIconPath(CmsObject cms, CmsUser user)
Returns the tiny ident-icon path for the given user.- Parameters:
cms
- the cms contextuser
- the user- Returns:
- the icon path
-
handleImageUpload
public boolean handleImageUpload(CmsObject cms, CmsUser user, java.lang.String uploadedFile)
Handles a user image upload. The uploaded file will be scaled and save as a new file beneath /system/userimages/, the original file will be deleted.- Parameters:
cms
- the cms contextuser
- the useruploadedFile
- the uploaded file- Returns:
true
in case the image was set successfully
-
handleImageUpload
public boolean handleImageUpload(CmsObject cms, java.util.List<java.lang.String> uploadedFiles)
Handles a user image upload. The uploaded file will be scaled and save as a new file beneath /system/userimages/, the original file will be deleted.- Parameters:
cms
- the cms contextuploadedFiles
- the uploaded file paths- Returns:
true
in case the image was set successfully
-
setUserImage
public void setUserImage(CmsObject cms, CmsUser user, java.lang.String rootPath) throws CmsException
Sets the user image for the given user.- Parameters:
cms
- the cms contextuser
- the userrootPath
- the image root path- Throws:
CmsException
- in case anything goes wrong
-
-