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.ColorADMIN_COLORThe color reserved for admin users.static java.lang.StringBIG_ICON_SUFFIXThe big icon suffix.static java.lang.StringICON_FOLDERThe target folder name.static java.lang.StringSMALL_ICON_SUFFIXThe small icon suffix.static java.lang.StringTEMP_FOLDERThe temp folder name.static java.lang.StringTINY_ICON_SUFFIXThe tiny icon suffix.static java.lang.StringUSER_IMAGE_FOLDERThe user image folder.static java.lang.StringUSER_IMAGE_INFOThe 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 voiddeleteUserImage(CmsObject cms)Deletes the user image of the current user.java.lang.StringgetBigIconPath(CmsObject cms, CmsUser user)Returns the big ident-icon path for the given user.java.lang.StringgetSmallIconPath(CmsObject cms, CmsUser user)Returns the small ident-icon path for the given user.java.lang.StringgetTinyIconPath(CmsObject cms, CmsUser user)Returns the tiny ident-icon path for the given user.booleanhandleImageUpload(CmsObject cms, java.util.List<java.lang.String> uploadedFiles)Handles a user image upload.booleanhandleImageUpload(CmsObject cms, CmsUser user, java.lang.String uploadedFile)Handles a user image upload.static booleanhasUserImage(CmsUser user)Checks whether the given user has an individual user image.voidsetUserImage(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:
trueif 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:
truein 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:
truein 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
-
-