From: Bharat M. <bh...@us...> - 2002-04-28 19:39:29
|
Update of /cvsroot/gallery/gallery/classes In directory usw-pr-cvs1:/tmp/cvs-serv1708 Modified Files: Tag: class-revolt-branch AlbumItem.class GalleryItem.class GalleryNucleus.class GalleryStorage.class Log Message: I decided that it wasn't a good idea to store common info in the unorganized $properties map. I broke all of that out into actual members in the appropriate classes. The Properties map now serves the purpose that the ExtendedProperties used to (ie, it's a place where Gallery mod developers can store additional data without having to modify the schema). * Got rid of STORAGE_ID, since we're using sequences so an id is just an integer anyway. * Added STORAGE_TEXT for long text values * Added STORAGE_BOOLEAN for tiny int values Index: AlbumItem.class =================================================================== RCS file: /cvsroot/gallery/gallery/classes/Attic/AlbumItem.class,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- AlbumItem.class 27 Apr 2002 06:05:31 -0000 1.1.2.7 +++ AlbumItem.class 27 Apr 2002 20:38:04 -0000 1.1.2.8 @@ -37,30 +37,132 @@ */ /** - * Properties of this GalleryItem + * Primary background color * - * Valid properties are: - * - bgcolor (string) primary background color - * - bgcolor2 (string) secondary background color - * - textcolor (string) text color - * - linkcolor (string) link color - * - font (string) font name - * - border (string) amount of table border - * - bordercolor (string) color of border - * - showBreadcrumb (string) whether or not to show the breadcrumb links - * - thumbSize (string) target size of the thumbnail - * - resizeSize (string) target size of the intermediate image - * - rows (int) number of rows to show - * - cols (int) number of columns to show - * - useFullOnly (bool) allow the user to choose to show unresized only? - * - printService (bool) allow printing? - * - viewExtendedData (bool) allow user to view extended data? - * - layout (string) the layout to use for this album - * - htmlHeader (string) the html_header to use for this album - * - htmlFooter (string) the html_footer to use for this album - * - displayViewCount (bool) show view counts for my items? + * @var string $_backgroundColor; */ - + var $_backgroundColor; + + + /** + * Secondary background color + * + * @var string $_backgroundColor2 + */ + var $_backgroundColor2; + + /** + * Amount of table border + * + * @var string $_border + */ + var $_border; + + /** + * Color of border + * + * @var string $_borderColor + */ + var $_borderColor; + + /** + * Number of columns to show + * + * @var int $_columns + */ + var $_columns; + + /** + * Show view counts for my items? + * + * @var bool $_displayViewCount + */ + var $_displayViewCount; + + /** + * Font name + * + * @var string $_font + */ + var $_font; + + /** + * The html_footer to use for this album + * + * @var string $_htmlFooter + */ + var $_htmlFooter; + + /** + * The html_header to use for this album + * + * @var string $_htmlHeader + */ + var $_htmlHeader; + + /** + * The layout to use for this album + * + * @var string $_layout + */ + var $_layout; + + /** + * Link color + * + * @var string $_linkColor + */ + var $_linkColor; + + /** + * Allow printing? + * + * @var bool $_allowPrinting + */ + var $_allowPrinting; + + /** + * Target size of the intermediate image + * + * @var string $_resizeSize + */ + var $_resizeSize; + + /** + * Number of rows to show + * + * @var int $_rows + */ + var $_rows; + + /** + * Whether or not to show the breadcrumb links + * + * @var string $_showBreadCrumb + */ + var $_showBreadCrumb; + + /** + * Text color + * + * @var string $_textColor + */ + var $_textColor; + + /** + * Target size of thumbnails inside this album + * + * @var string $_thumbSize + */ + var $_thumbSize; + + /** + * Allow user to view extended data? + * + * @var bool $_viewExtendedData + */ + var $_viewExtendedData; + /* * **************************************** * Methods @@ -77,11 +179,32 @@ */ function AlbumItem() { $this->GalleryItem(); + + $this->registerPersistentMember("AlbumItem", "backgroundColor", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "backgroundColor2", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "border", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "borderColor", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "columns", STORAGE_INTEGER); + $this->registerPersistentMember("AlbumItem", "displayViewCount", STORAGE_BOOLEAN); + $this->registerPersistentMember("AlbumItem", "font", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "htmlFooter", STORAGE_TEXT); + $this->registerPersistentMember("AlbumItem", "htmlHeader", STORAGE_TEXT); + $this->registerPersistentMember("AlbumItem", "layout", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "linkColor", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "allowPrinting", STORAGE_BOOLEAN); + $this->registerPersistentMember("AlbumItem", "resizeSize", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "rows", STORAGE_INTEGER); + $this->registerPersistentMember("AlbumItem", "showBreadCrumb", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "textColor", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "thumbSize", STORAGE_STRING); + $this->registerPersistentMember("AlbumItem", "viewExtendedData", STORAGE_BOOLEAN); } /** * Create a new instance of this GalleryNucleus in the persistent store * + * Also create the album directory on the filesystem + * * @return int a status code */ function create($albumName) { @@ -141,6 +264,8 @@ * @return boolean false if the path already exists, true otherwise */ function setPath($newname) { + // rename dir here + parent::setPath($newname); } /** @@ -179,6 +304,7 @@ * @return int a status code */ function becomeTheRootAlbum() { + // XXX this require more thought. } /** @@ -190,5 +316,416 @@ global $gallery; return ($this->getId() == $gallery->getRootAlbumItemId()); } + + /* + * ============================================================ + * BEGIN: Accessor methods + * Don't modify anything inside this block as it will get + * overwritten by the code that generates these accessor + * methods. + * ============================================================ + */ + + /** + * Set the value of allowPrinting + * + * @param the new value for allowPrinting + * @access public + */ + function setAllowPrinting($value) { + assert('isset($value)'); + $this->_allowPrinting = $value; + $this->modifyPersistentMember('allowPrinting'); + } + + /** + * Get the value of allowPrinting + * + * @access public + * @return the current value of allowPrinting + */ + function getAllowPrinting() { + return $this->_allowPrinting; + } + + /** + * Set the value of backgroundColor + * + * @param string the new value for backgroundColor + * @access public + */ + function setBackgroundColor($value) { + assert('isset($value)'); + $this->_backgroundColor = $value; + $this->modifyPersistentMember('backgroundColor'); + } + + /** + * Get the value of backgroundColor + * + * @access public + * @return string the current value of backgroundColor + */ + function getBackgroundColor() { + return $this->_backgroundColor; + } + + /** + * Set the value of backgroundColor2 + * + * @param string the new value for backgroundColor2 + * @access public + */ + function setBackgroundColor2($value) { + assert('isset($value)'); + $this->_backgroundColor2 = $value; + $this->modifyPersistentMember('backgroundColor2'); + } + + /** + * Get the value of backgroundColor2 + * + * @access public + * @return string the current value of backgroundColor2 + */ + function getBackgroundColor2() { + return $this->_backgroundColor2; + } + + /** + * Set the value of border + * + * @param string the new value for border + * @access public + */ + function setBorder($value) { + assert('isset($value)'); + $this->_border = $value; + $this->modifyPersistentMember('border'); + } + + /** + * Get the value of border + * + * @access public + * @return string the current value of border + */ + function getBorder() { + return $this->_border; + } + + /** + * Set the value of borderColor + * + * @param string the new value for borderColor + * @access public + */ + function setBorderColor($value) { + assert('isset($value)'); + $this->_borderColor = $value; + $this->modifyPersistentMember('borderColor'); + } + + /** + * Get the value of borderColor + * + * @access public + * @return string the current value of borderColor + */ + function getBorderColor() { + return $this->_borderColor; + } + + /** + * Set the value of columns + * + * @param int the new value for columns + * @access public + */ + function setColumns($value) { + assert('isset($value)'); + $this->_columns = $value; + $this->modifyPersistentMember('columns'); + } + + /** + * Get the value of columns + * + * @access public + * @return int the current value of columns + */ + function getColumns() { + return $this->_columns; + } + + /** + * Set the value of displayViewCount + * + * @param bool the new value for displayViewCount + * @access public + */ + function setDisplayViewCount($value) { + assert('isset($value)'); + $this->_displayViewCount = $value; + $this->modifyPersistentMember('displayViewCount'); + } + + /** + * Get the value of displayViewCount + * + * @access public + * @return bool the current value of displayViewCount + */ + function getDisplayViewCount() { + return $this->_displayViewCount; + } + + /** + * Set the value of font + * + * @param string the new value for font + * @access public + */ + function setFont($value) { + assert('isset($value)'); + $this->_font = $value; + $this->modifyPersistentMember('font'); + } + + /** + * Get the value of font + * + * @access public + * @return string the current value of font + */ + function getFont() { + return $this->_font; + } + + /** + * Set the value of htmlFooter + * + * @param string the new value for htmlFooter + * @access public + */ + function setHtmlFooter($value) { + assert('isset($value)'); + $this->_htmlFooter = $value; + $this->modifyPersistentMember('htmlFooter'); + } + + /** + * Get the value of htmlFooter + * + * @access public + * @return string the current value of htmlFooter + */ + function getHtmlFooter() { + return $this->_htmlFooter; + } + + /** + * Set the value of htmlHeader + * + * @param string the new value for htmlHeader + * @access public + */ + function setHtmlHeader($value) { + assert('isset($value)'); + $this->_htmlHeader = $value; + $this->modifyPersistentMember('htmlHeader'); + } + + /** + * Get the value of htmlHeader + * + * @access public + * @return string the current value of htmlHeader + */ + function getHtmlHeader() { + return $this->_htmlHeader; + } + + /** + * Set the value of layout + * + * @param string the new value for layout + * @access public + */ + function setLayout($value) { + assert('isset($value)'); + $this->_layout = $value; + $this->modifyPersistentMember('layout'); + } + + /** + * Get the value of layout + * + * @access public + * @return string the current value of layout + */ + function getLayout() { + return $this->_layout; + } + + /** + * Set the value of linkColor + * + * @param string the new value for linkColor + * @access public + */ + function setLinkColor($value) { + assert('isset($value)'); + $this->_linkColor = $value; + $this->modifyPersistentMember('linkColor'); + } + + /** + * Get the value of linkColor + * + * @access public + * @return string the current value of linkColor + */ + function getLinkColor() { + return $this->_linkColor; + } + + /** + * Set the value of resizeSize + * + * @param string the new value for resizeSize + * @access public + */ + function setResizeSize($value) { + assert('isset($value)'); + $this->_resizeSize = $value; + $this->modifyPersistentMember('resizeSize'); + } + + /** + * Get the value of resizeSize + * + * @access public + * @return string the current value of resizeSize + */ + function getResizeSize() { + return $this->_resizeSize; + } + + /** + * Set the value of rows + * + * @param int the new value for rows + * @access public + */ + function setRows($value) { + assert('isset($value)'); + $this->_rows = $value; + $this->modifyPersistentMember('rows'); + } + + /** + * Get the value of rows + * + * @access public + * @return int the current value of rows + */ + function getRows() { + return $this->_rows; + } + + /** + * Set the value of showBreadCrumb + * + * @param string the new value for showBreadCrumb + * @access public + */ + function setShowBreadCrumb($value) { + assert('isset($value)'); + $this->_showBreadCrumb = $value; + $this->modifyPersistentMember('showBreadCrumb'); + } + + /** + * Get the value of showBreadCrumb + * + * @access public + * @return string the current value of showBreadCrumb + */ + function getShowBreadCrumb() { + return $this->_showBreadCrumb; + } + + /** + * Set the value of textColor + * + * @param string the new value for textColor + * @access public + */ + function setTextColor($value) { + assert('isset($value)'); + $this->_textColor = $value; + $this->modifyPersistentMember('textColor'); + } + + /** + * Get the value of textColor + * + * @access public + * @return string the current value of textColor + */ + function getTextColor() { + return $this->_textColor; + } + + /** + * Set the value of thumbSize + * + * @param string the new value for thumbSize + * @access public + */ + function setThumbSize($value) { + assert('isset($value)'); + $this->_thumbSize = $value; + $this->modifyPersistentMember('thumbSize'); + } + + /** + * Get the value of thumbSize + * + * @access public + * @return string the current value of thumbSize + */ + function getThumbSize() { + return $this->_thumbSize; + } + + /** + * Set the value of viewExtendedData + * + * @param bool the new value for viewExtendedData + * @access public + */ + function setViewExtendedData($value) { + assert('isset($value)'); + $this->_viewExtendedData = $value; + $this->modifyPersistentMember('viewExtendedData'); + } + + /** + * Get the value of viewExtendedData + * + * @access public + * @return bool the current value of viewExtendedData + */ + function getViewExtendedData() { + return $this->_viewExtendedData; + } + + /* + * ============================================================ + * END: Accessor methods + * ============================================================ + */ } ?> Index: GalleryItem.class =================================================================== RCS file: /cvsroot/gallery/gallery/classes/Attic/GalleryItem.class,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -r1.1.2.8 -r1.1.2.9 --- GalleryItem.class 27 Apr 2002 06:11:41 -0000 1.1.2.8 +++ GalleryItem.class 27 Apr 2002 20:38:04 -0000 1.1.2.9 @@ -41,11 +41,11 @@ */ /** - * The id of the User who owns this item + * An ordered list of 0+ GalleryItem children contained by this item * - * @var int $_ownerId + * @var object GalleryList $_childIds */ - var $_ownerId; + var $_childIds; /** * An ordered list of 0+ CommentContainer ids. @@ -55,33 +55,56 @@ var $_commentIds; /** - * Properties of this GalleryItem + * Date and time this item was created, in seconds since the epoch. + * + * @var int $_creationTimestamp; + */ + var $_creationTimestamp; + + /** + * The (long) description of this item * - * Valid properties are: - * - creationDate (string) date in "YYYYMMDDHHMMSS" format - * (we don't want it limited by the epoch) - * - modificationDate (int) unix timestamp - * - viewedSinceDate (int) unix timestamp click count start date - * - viewCount (int) number of times this item has been accessed - * - keywords (string) key words about this item - * - title (string) title of this item (short) - * - description (string) details of this item (long) - * - isHtmlAllowed (bool) allow html in the title & description - * - isHidden (bool) is this item hidden? + * @var int $_description; + */ + var $_description; + + /** + * Is HTML allowed in this item's title and description? * - * @var object GalleryMap $_properties + * @var int $_isHtmlAllowed; */ - var $_properties; + var $_isHtmlAllowed; + + /** + * A set of keywords that describe this item + * + * @var int $_keywords; + */ + var $_keywords; + + /** + * Date and time this item was last modified, in seconds since the epoch. + * + * @var int $_modificationTimestamp; + */ + var $_modificationTimestamp; + + /** + * The id of the User who owns this item + * + * @var int $_ownerId + */ + var $_ownerId; /** - * An associative array of item specific properties about this - * item. Each subclass can have an interface to read and - * write values into this store (or they can use GalleryItem's - * get/set methods). Either way, this data is item specific. + * Properties of this GalleryItem + * + * This area is reserved for extensions to Gallery. Any string data can be + * stored in this table. * - * @var object GalleryMap $_extendedProperties + * @var object GalleryMap $_properties */ - var $_extendedProperties; + var $_properties; /** * The id of the ImageContainer containing this GalleryItem's thumbnail @@ -91,11 +114,25 @@ var $_thumbnailId; /** - * An ordered list of 0+ GalleryItem children contained by this item + * The (short) title of this item * - * @var object GalleryList $_childIds + * @var int $_title; */ - var $_childIds; + var $_title; + + /** + * How many times this item has been viewed + * + * @var int $_viewCount; + */ + var $_viewCount; + + /** + * Date and time marking the beginning of the view count + * + * @var int $_viewedSinceTimestamp; + */ + var $_viewedSinceTimestamp; /** * A GalleryMap of usernames mapped to allowed permissions @@ -132,10 +169,17 @@ $this->registerPersistentMember("GalleryItem", "childIds", STORAGE_LIST); $this->registerPersistentMember("GalleryItem", "commentIds", STORAGE_LIST); - $this->registerPersistentMember("GalleryItem", "extendedProperties", STORAGE_MAP); + $this->registerPersistentMember("GalleryItem", "creationTimestamp", STORAGE_INTEGER); + $this->registerPersistentMember("GalleryItem", "description", STORAGE_TEXT); + $this->registerPersistentMember("GalleryItem", "isHtmlAllowed", STORAGE_BOOLEAN); + $this->registerPersistentMember("GalleryItem", "keywords", STORAGE_STRING); + $this->registerPersistentMember("GalleryItem", "modificationTimestamp", STORAGE_INTEGER); $this->registerPersistentMember("GalleryItem", "ownerId", STORAGE_INTEGER); $this->registerPersistentMember("GalleryItem", "properties", STORAGE_MAP); $this->registerPersistentMember("GalleryItem", "thumbnailId", STORAGE_INTEGER); + $this->registerPersistentMember("GalleryItem", "title", STORAGE_STRING); + $this->registerPersistentMember("GalleryItem", "viewCount", STORAGE_INTEGER); + $this->registerPersistentMember("GalleryItem", "viewedSinceTimestamp", STORAGE_INTEGER); /* HINT: Do not auto-generate accessors for these members */ $this->registerPersistentMember("GalleryItem", "allowedPermission", STORAGE_MAP); @@ -485,15 +529,113 @@ } /** - * Get a reference to extendedProperties + * Set the value of creationTimestamp + * + * @param int the new value for creationTimestamp + * @access public + */ + function setCreationTimestamp($value) { + assert('isset($value)'); + $this->_creationTimestamp = $value; + $this->modifyPersistentMember('creationTimestamp'); + } + + /** + * Get the value of creationTimestamp + * + * @access public + * @return int the current value of creationTimestamp + */ + function getCreationTimestamp() { + return $this->_creationTimestamp; + } + + /** + * Set the value of description + * + * @param string the new value for description + * @access public + */ + function setDescription($value) { + assert('isset($value)'); + $this->_description = $value; + $this->modifyPersistentMember('description'); + } + + /** + * Get the value of description + * + * @access public + * @return string the current value of description + */ + function getDescription() { + return $this->_description; + } + + /** + * Set the value of isHtmlAllowed * - * Return a reference to the actual instance of extendedProperties + * @param bool the new value for isHtmlAllowed + * @access public + */ + function setIsHtmlAllowed($value) { + assert('isset($value)'); + $this->_isHtmlAllowed = $value; + $this->modifyPersistentMember('isHtmlAllowed'); + } + + /** + * Get the value of isHtmlAllowed + * + * @access public + * @return bool the current value of isHtmlAllowed + */ + function getIsHtmlAllowed() { + return $this->_isHtmlAllowed; + } + + /** + * Set the value of keywords + * + * @param string the new value for keywords + * @access public + */ + function setKeywords($value) { + assert('isset($value)'); + $this->_keywords = $value; + $this->modifyPersistentMember('keywords'); + } + + /** + * Get the value of keywords + * + * @access public + * @return string the current value of keywords + */ + function getKeywords() { + return $this->_keywords; + } + + /** + * Set the value of modificationTimestamp + * + * @param int the new value for modificationTimestamp + * @access public + */ + function setModificationTimestamp($value) { + assert('isset($value)'); + $this->_modificationTimestamp = $value; + $this->modifyPersistentMember('modificationTimestamp'); + } + + /** + * Get the value of modificationTimestamp * * @access public - * @return object GalleryMap the extendedProperties + * @return int the current value of modificationTimestamp */ - function getExtendedProperties() { - return $this->_extendedProperties; + function getModificationTimestamp() { + return $this->_modificationTimestamp; } /** @@ -550,6 +692,72 @@ */ function getThumbnailId() { return $this->_thumbnailId; + } + + /** + * Set the value of title + * + * @param string the new value for title + * @access public + */ + function setTitle($value) { + assert('isset($value)'); + $this->_title = $value; + $this->modifyPersistentMember('title'); + } + + /** + * Get the value of title + * + * @access public + * @return string the current value of title + */ + function getTitle() { + return $this->_title; + } + + /** + * Set the value of viewCount + * + * @param int the new value for viewCount + * @access public + */ + function setViewCount($value) { + assert('isset($value)'); + $this->_viewCount = $value; + $this->modifyPersistentMember('viewCount'); + } + + /** + * Get the value of viewCount + * + * @access public + * @return int the current value of viewCount + */ + function getViewCount() { + return $this->_viewCount; + } + + /** + * Set the value of viewedSinceTimestamp + * + * @param int the new value for viewedSinceTimestamp + * @access public + */ + function setViewedSinceTimestamp($value) { + assert('isset($value)'); + $this->_viewedSinceTimestamp = $value; + $this->modifyPersistentMember('viewedSinceTimestamp'); + } + + /** + * Get the value of viewedSinceTimestamp + * + * @access public + * @return int the current value of viewedSinceTimestamp + */ + function getViewedSinceTimestamp() { + return $this->_viewedSinceTimestamp; } /* Index: GalleryNucleus.class =================================================================== RCS file: /cvsroot/gallery/gallery/classes/Attic/GalleryNucleus.class,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -r1.1.2.8 -r1.1.2.9 --- GalleryNucleus.class 27 Apr 2002 06:08:42 -0000 1.1.2.8 +++ GalleryNucleus.class 27 Apr 2002 20:38:04 -0000 1.1.2.9 @@ -109,7 +109,7 @@ /* * Register the persistent variables for this class */ - $this->registerPersistentMember("GalleryNucleus", "id", STORAGE_ID); + $this->registerPersistentMember("GalleryNucleus", "id", STORAGE_INTEGER); $this->registerPersistentMember("GalleryNucleus", "dataVersion", STORAGE_INTEGER); $this->registerPersistentMember("GalleryNucleus", "parentId", STORAGE_INTEGER); $this->registerPersistentMember("GalleryNucleus", "path", STORAGE_STRING); Index: GalleryStorage.class =================================================================== RCS file: /cvsroot/gallery/gallery/classes/Attic/GalleryStorage.class,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- GalleryStorage.class 27 Apr 2002 06:09:46 -0000 1.1.2.4 +++ GalleryStorage.class 27 Apr 2002 20:38:04 -0000 1.1.2.5 @@ -52,11 +52,18 @@ define("STORAGE_MAP", 0x00000008); /** - * id type + * Text type * - * @constant STORAGE_ID + * @constant STORAGE_TEXT */ -define("STORAGE_ID", 0x00000010); +define("STORAGE_TEXT", 0x00000010); + +/** + * Text type + * + * @constant STORAGE_BOOLEAN + */ +define("STORAGE_BOOLEAN", 0x00000020); /** * Interface to the storage mechanism |