diff --git a/docs/create.sql b/docs/create.sql
index 527941a21..9a4a5e8db 100644
--- a/docs/create.sql
+++ b/docs/create.sql
@@ -34,6 +34,7 @@ CREATE TABLE Article (
CREATE TABLE DownloadManager (
widgetId int(11) NOT NULL default '0',
paginateAfter int(11) NOT NULL default '50',
+ displayThumbnails int(11) NOT NULL default '0',
PRIMARY KEY (widgetId)
) TYPE=MyISAM;
@@ -498,7 +499,7 @@ INSERT INTO help VALUES (16,'WebGUI','English','Add/Edit','Style','Styles are We
INSERT INTO help VALUES (17,'WebGUI','English','Add/Edit','Group','See Manage Group for a description of grouping functions and the default groups.\r\n
\r\n\r\nGroup Name
\r\nA name for the group. It is best if the name is descriptive so you know what it is at a glance.\r\n
\r\n\r\nDescription
\r\nA longer description of the group so that other admins and content managers (or you if you forget) will know what the purpose of this group is.','0');
INSERT INTO help VALUES (24,'WebGUI','English','Edit','Miscellaneous Settings','Not Found Page
\r\nIf a page that a user requests is not found in the system, the user can be redirected to the home page or to an error page where they can attempt to find what they were looking for. You decide which is better for your users.\r\n
\r\n\r\nSession Timeout
\r\nThe time (in seconds) that a user session remains active (before needing to log in again). This timeout is reset each time a visitor hits a page. Therefore if you set the timeout for 8 hours, a user would have to log in again if s/he hadn\'t visited the site for 8 hours.\r\n
\r\n\r\n1800 = half hour
\r\n3600 = 1 hour
\r\n28000 = 8 hours
\r\n86400 = 1 day
\r\n604800 = 1 week
\r\n1209600 = 2 weeks
\r\n\r\n
\r\nDocument Type Declaration
\r\nThis setting allows you to specify what type of HTML you\'re generating with WebGUI. This is usually useful for HTML validation or for gaining special functionality in certain browsers. Most people should leave this at the default setting.\r\n\r\n
\r\nPrevent Proxy Caching
\r\nSome companies have proxy servers that cause problems with WebGUI. If you\'re experiencing problems with WebGUI, and you have a proxy server, you may want to set this setting to Yes. Beware that WebGUI\'s URLs will not be as user-friendly after this feature is turned on.','6');
INSERT INTO help VALUES (18,'WebGUI','English','Using','Style Sheets','Cascading Style Sheets (CSS) are a great way to manage the look and feel of any web site. They are used extensively in WebGUI.\r\n
\r\n\r\nIf you are unfamiliar with how to use CSS, Plain Black Software provides training classes on XHTML and CSS. Alternatively, Bradsoft makes an excellent CSS editor called Top Style.\r\n
\r\n\r\nThe following is a list of classes used to control the look of WebGUI:\r\n
\r\n\r\nA
\r\nThe links throughout the style.\r\n
\r\n\r\nBODY
\r\nThe default setup of all pages within a style.\r\n
\r\n\r\nH1
\r\nThe headers on every page.\r\n
\r\n\r\n.accountOptions
\r\nThe links that appear under the login and account update forms.\r\n
\r\n\r\n.adminBar
\r\nThe bar that appears at the top of the page when you\'re in admin mode.\r\n
\r\n\r\n.content
\r\nThe main content area on all pages of the style.\r\n
\r\n\r\n.crumbTrail
\r\nThe crumb trail (if you\'re using that macro).\r\n
\r\n\r\n.formDescription
\r\nThe tags on all forms next to the form elements. \r\n
\r\n\r\n.formSubtext
\r\nThe tags below some form elements.\r\n
\r\n\r\n.highlight
\r\nDenotes a highlighted item, such as which message you are viewing within a list.\r\n
\r\n\r\n.homeLink
\r\nUsed by the my home (^H;) macro.\r\n
\r\n\r\n.horizontalMenu
\r\nThe horizontal menu (if you use a horizontal menu macro).\r\n
\r\n\r\n.loginBox
\r\nThe login box (^L;) macro.\r\n
\r\n\r\n.makePrintableLink
\r\nUsed by the make printable (^r;) macro.\r\n
\r\n\r\n.myAccountLink
\r\nUsed by the my account (^a;) macro.\r\n
\r\n\r\n.pagination
\r\nThe Previous and Next links on pages with pagination.\r\n
\r\n\r\n.searchBox
\r\nUsed by the search (^?;) macro.\r\n
\r\n\r\n.selectedMenuItem
\r\nUsed by the FlexMenu (^FlexMenu;) macro.\r\n
\r\n\r\n.tableData
\r\nThe data rows on things like message boards and user contributions.\r\n
\r\n\r\n.tableHeader
\r\nThe headings of columns on things like message boards and user contributions.\r\n
\r\n\r\n.tableMenu
\r\nThe menu on things like message boards and user submissions.\r\n
\r\n\r\n.verticalMenu
\r\nThe vertical menu (if you use a verticall menu macro).\r\n
\r\n\r\nNote: Some widgets have their own unique styles.\r\n\r\n','0');
-INSERT INTO help VALUES (19,'WebGUI','English','Using','Macros','WebGUI macros are used to create dynamic content within otherwise static content. For instance, you may wish to show which user is logged in on every page, or you may wish to have a dynamically built menu or crumb trail. \r\n
\r\nMacros always begin with a carat (^) and follow with at least one other character and ended with w semicolon (;). Some macros can be extended/configured by taking the format of ^x(\"config text\");. The following is a description of all the macros in the WebGUI system.\r\n
\r\n^a; or ^a(); - My Account Link
\r\nA link to your account information. In addition you can change the link text by creating a macro like this ^a(\"Account Info\");.\r\n
\r\n^C; or ^C(); - Crumb Trail
\r\nA dynamically generated crumb trail to the current page. You can optionally specify a delimeter to be used between page names by using ^C(::);. The default delimeter is >.\r\n
\r\n^c; - Company Name
\r\nThe name of your company specified in the settings by your Administrator.\r\n
\r\n^D; or ^D(); - Date
\r\nThe current date and time.\r\n
\r\nYou can configure the date by using date formatting symbols. For instance, if you created a macro like this ^D(\"%c %D, %y\"); it would output September 26, 2001. The following are the available date formatting symbols:\r\n
\r\n| %% = %\r\n |
| %y | 4 digit year |
\r\n| %Y | 2 digit year |
\r\n| %m | 2 digit month |
\r\n| %M | variable digit month |
\r\n| %c | month name |
\r\n| %d | 2 digit day of month |
\r\n| %D | variable digit day of month |
\r\n| %w | day of week name |
\r\n| %h | 2 digit base 12 hour |
\r\n| %H | variable digit base 12 hour |
\r\n| %j | 2 digit base 24 hour |
\r\n| %J | variable digit base 24 hour |
\r\n| %p | lower case am/pm |
\r\n| %P | upper case AM/PM |
\r\n
\r\n\r\n^e; - Company Email Address
\r\nThe email address for your company specified in the settings by your Administrator.\r\n
\r\n^Execute();
\r\nAllows a content manager or administrator to execute an external program. Takes the format of ^Execute(\"/this/file.sh\");.\r\n
\r\n^FlexMenu;
\r\nThis menu macro creates a top-level menu that expands as the user selects each menu item.\r\n
\r\n^H; or ^H(); - Home Link
\r\nA link to the home page of this site. In addition you can change the link text by creating a macro like this ^H(\"Go Home\");.\r\n
\r\n^I(); - Image Manager Image with Tag
\r\nThis macro returns an image tag with the parameters for an image defined in the image manager. Specify the name of the image using a tag like this ^I(\"imageName\");.\r\n
\r\n^i(); - Image Manager Image Path
\r\nThis macro returns the path of an image uploaded using the Image Manager. Specify the name of the image using a tag like this ^i(\"imageName\");.\r\n
\r\n^Include();
\r\nAllows a content manager or administrator to include a file from the local filesystem. Takes the format of ^Include(\"/this/file.html\");\r\n
\r\n^L; - Login
\r\nA small login form.\r\n
\r\n^M; or ^M(); - Current Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the current level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^M(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^m; - Current Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the current level. You can optionally specify a delimeter to be used between page names by using ^m(:--:);. The default delimeter is ·.\r\n
\r\n^P; or ^P(); - Previous Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the previous level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^P(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^p; - Previous Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the previous level. You can optionally specify a delimeter to be used between page names by using ^p(:--:);. The default delimeter is ·.\r\n
\r\n^PageTitle;
\r\nDisplays the title of the current page.\r\n
\r\n^r; or ^r(); - Make Page Printable
\r\nCreates a link to remove the style from a page to make it printable. In addition, you can change the link text by creating a macro like this ^r(\"Print Me!\");.\r\n
\r\n^S(); - Specific SubMenu (Vertical)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^S(\"home\",0);. The first value is the urlized title of the page and the second value is the depth you\'d like the menu to go. By default it will show only the first level. To go three levels deep create a macro like this ^S(\"home\",3);.\r\n
\r\n^s(); - Specific SubMenu (Horizontal)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^s(\"home\");. The value is the urlized title of the page. You can optionally specify a delimeter to be used between page names by using ^s(\"home\",\":--:\");. The default delimeter is ·.\r\n
\r\n^T; or ^T(); - Top Level Menu (Vertical)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^T(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^t; - Top Level Menu (Horizontal)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). You can optionally specify a delimeter to be used between page names by using ^t(:--:);. The default delimeter is ·.\r\n
\r\n^u; - Company URL
\r\nThe URL for your company specified in the settings by your Administrator.\r\n
\r\n^/; - System URL
\r\nThe URL to the gateway script (including the domain for this site). This is often used within pages so that if your development server is on a domain different than your production server that your URLs will still worked when moved.\r\n
\r\n^\\; - Page URL
\r\nThe URL to the current page (including the domain for this site). This is often used within pages so that if your development server is on a domain different than your production server that your URLs will still worked when moved.\r\n
\r\n^@; - Username
\r\nThe username of the currently logged in user.\r\n
\r\n^?; - Search
\r\nAdd a search box.\r\n
\r\n^#; - User ID
\r\nThe user id of the currently logged in user.\r\n
\r\n^*; or ^*(); - Random Number
\r\nA randomly generated number. This is often used on images (such as banner ads) that you want to ensure do not cache. In addition, you may configure this macro like this ^*(100); to create a random number between 0 and 100.\r\n
\r\n^-;,^0;,^1;,^2;,^3;, etc.
\r\nThese macros are reserved for widget-specific functions as in the SQL Report widget.\r\n','0');
+INSERT INTO help VALUES (19,'WebGUI','English','Using','Macros','WebGUI macros are used to create dynamic content within otherwise static content. For instance, you may wish to show which user is logged in on every page, or you may wish to have a dynamically built menu or crumb trail. \r\n
\r\nMacros always begin with a carat (^) and follow with at least one other character and ended with w semicolon (;). Some macros can be extended/configured by taking the format of ^x(\"config text\");. The following is a description of all the macros in the WebGUI system.\r\n
\r\n^a; or ^a(); - My Account Link
\r\nA link to your account information. In addition you can change the link text by creating a macro like this ^a(\"Account Info\");.\r\n
\r\n^C; or ^C(); - Crumb Trail
\r\nA dynamically generated crumb trail to the current page. You can optionally specify a delimeter to be used between page names by using ^C(::);. The default delimeter is >.\r\n
\r\n^c; - Company Name
\r\nThe name of your company specified in the settings by your Administrator.\r\n
\r\n^D; or ^D(); - Date
\r\nThe current date and time.\r\n
\r\nYou can configure the date by using date formatting symbols. For instance, if you created a macro like this ^D(\"%c %D, %y\"); it would output September 26, 2001. The following are the available date formatting symbols:\r\n
\r\n| %% | % |
\r\n| %y | 4 digit year |
\r\n| %Y | 2 digit year |
\r\n| %m | 2 digit month |
\r\n| %M | variable digit month |
\r\n| %c | month name |
\r\n| %d | 2 digit day of month |
\r\n| %D | variable digit day of month |
\r\n| %w | day of week name |
\r\n| %h | 2 digit base 12 hour |
\r\n| %H | variable digit base 12 hour |
\r\n| %j | 2 digit base 24 hour |
\r\n| %J | variable digit base 24 hour |
\r\n| %p | lower case am/pm |
\r\n| %P | upper case AM/PM |
\r\n
\r\n\r\n^e; - Company Email Address
\r\nThe email address for your company specified in the settings by your Administrator.\r\n
\r\n^Execute();
\r\nAllows a content manager or administrator to execute an external program. Takes the format of ^Execute(\"/this/file.sh\");.\r\n
\r\n^FlexMenu;
\r\nThis menu macro creates a top-level menu that expands as the user selects each menu item.\r\n
\r\n^H; or ^H(); - Home Link
\r\nA link to the home page of this site. In addition you can change the link text by creating a macro like this ^H(\"Go Home\");.\r\n
\r\n^I(); - Image Manager Image with Tag
\r\nThis macro returns an image tag with the parameters for an image defined in the image manager. Specify the name of the image using a tag like this ^I(\"imageName\");.\r\n
\r\n^i(); - Image Manager Image Path
\r\nThis macro returns the path of an image uploaded using the Image Manager. Specify the name of the image using a tag like this ^i(\"imageName\");.\r\n
\r\n^Include();
\r\nAllows a content manager or administrator to include a file from the local filesystem. Takes the format of ^Include(\"/this/file.html\");\r\n
\r\n^L; or ^L(); - Login
\r\nA small login form. You can also configure this macro. You can set the width of the login box like this ^L(20);. You can also set the message displayed after the user is logged in like this ^L(20,Hi ^a(^@;);. Click %here% if you wanna log out!)\r\n
\r\n^M; or ^M(); - Current Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the current level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^M(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^m; - Current Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the current level. You can optionally specify a delimeter to be used between page names by using ^m(:--:);. The default delimeter is ·.\r\n
\r\n^P; or ^P(); - Previous Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the previous level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^P(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^p; - Previous Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the previous level. You can optionally specify a delimeter to be used between page names by using ^p(:--:);. The default delimeter is ·.\r\n
\r\n^PageTitle;
\r\nDisplays the title of the current page.\r\n
\r\n^r; or ^r(); - Make Page Printable
\r\nCreates a link to remove the style from a page to make it printable. In addition, you can change the link text by creating a macro like this ^r(\"Print Me!\");.\r\n
\r\n^S(); - Specific SubMenu (Vertical)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^S(\"home\",0);. The first value is the urlized title of the page and the second value is the depth you\'d like the menu to go. By default it will show only the first level. To go three levels deep create a macro like this ^S(\"home\",3);.\r\n
\r\n^s(); - Specific SubMenu (Horizontal)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^s(\"home\");. The value is the urlized title of the page. You can optionally specify a delimeter to be used between page names by using ^s(\"home\",\":--:\");. The default delimeter is ·.\r\n
\r\n^T; or ^T(); - Top Level Menu (Vertical)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^T(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^t; - Top Level Menu (Horizontal)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). You can optionally specify a delimeter to be used between page names by using ^t(:--:);. The default delimeter is ·.\r\n
\r\n^Thumbnail();
\r\nReturns the URL of a thumbnail for an image from the image manager. Specify the name of the image like this ^Thumbnail(\"imageName\");.\r\n
\r\n^u; - Company URL
\r\nThe URL for your company specified in the settings by your Administrator.\r\n
\r\n^/; - System URL
\r\nThe URL to the gateway script (including the domain for this site). This is often used within pages so that if your development server is on a domain different than your production server that your URLs will still worked when moved.\r\n
\r\n^\\; - Page URL
\r\nThe URL to the current page (including the domain for this site). This is often used within pages so that if your development server is on a domain different than your production server that your URLs will still worked when moved.\r\n
\r\n^@; - Username
\r\nThe username of the currently logged in user.\r\n
\r\n^?; - Search
\r\nAdd a search box.\r\n
\r\n^#; - User ID
\r\nThe user id of the currently logged in user.\r\n
\r\n^*; or ^*(); - Random Number
\r\nA randomly generated number. This is often used on images (such as banner ads) that you want to ensure do not cache. In addition, you may configure this macro like this ^*(100); to create a random number between 0 and 100.\r\n
\r\n^-;,^0;,^1;,^2;,^3;, etc.
\r\nThese macros are reserved for widget-specific functions as in the SQL Report widget.\r\n','0');
INSERT INTO help VALUES (1,'SQLReport','English','Add/Edit','SQL Report','SQL Reports are perhaps the most powerful widget in the WebGUI arsenal. They allow a user to query data from any database that they have access to. This is great for getting sales figures from your Accounting database or even summarizing all the message boards on your web site.\r\n
\r\n\r\nTitle
\r\nThe title of this report.\r\n
\r\n\r\nDisplay the title?
\r\nDo you wish to disply the title?\r\n
\r\n\r\nProcess macros?
\r\nDo you wish to process WebGUI macros? Unchecking this box will not process macros and will speed up page execution.\r\n
\r\n\r\nPosition
\r\nSelect the position in the current page template where this widget should be placed.\r\n
\r\n\r\nDescription
\r\nDescribe the content of this report so your users will better understand what the report is all about.\r\n
\r\n\r\nTemplate
\r\nLayout a template of how this report should look. Usually you\'ll use HTML tables to generate a report. An example is included below. If you leave this field blank a template will be generated based on your result set.\r\n
\r\n\r\nThere are special macro characters used in generating SQL Reports. They are ^-;, ^0;, ^1;, ^2;, ^3;, etc. These macros will be processed regardless of whether you checked the process macros box above. The ^- macro represents split points in the document where the report will begin and end looping. The numeric macros represent the data fields that will be returned from your query.\r\n
\r\n
\r\nSample Template:\r\n<table>\r\n<tr><th>Employee Name</th><th>Employee #</th><th>Vacation Days Remaining</th><th>Monthly Salary</th></tr>\r\n^-;\r\n<tr><td>^0;</td><td>^1;</td><td>^2;</td><td>^3;</td></tr>\r\n^-;\r\n</table>\r\n
\r\nQuery
\r\nThis is a standard SQL query. If you are unfamiliar with SQL, Plain Black Software provides training courses in SQL and database management.\r\n\r\n\r\nDSN
\r\nData Source Name is the unique identifier that Perl uses to describe the location of your database. It takes the format of DBI:[driver]:[database name]:[host]. \r\n
\r\n\r\nExample: DBI:mysql:WebGUI:localhost\r\n
\r\n\r\nDatabase User\r\nThe username you use to connect to the DSN.\r\n
\r\n\r\nDatabase Password\r\nThe password you use to connect to the DSN.\r\n
\r\n\r\nPaginate After\r\nHow many rows should be displayed before splitting the results into separate pages? In other words, how many rows should be displayed per page?\r\n
\r\n\r\nConvert carriage returns?\r\nDo you wish to convert the carriage returns in the resultant data to HTML breaks (<br>).\r\n','1,2,3,4,5');
INSERT INTO help VALUES (21,'WebGUI','English','Using','Widget','Widgets are the true power of WebGUI. Widgets are tiny pluggable applications built to run under WebGUI. Message boards and polls are examples of widgets.\r\n
\r\nTo add a widget to a page, first go to that page, then select Add Content... from the upper left corner of your screen. Each widget has it\'s own help so be sure to read the help if you\'re not sure how to use a widget.\r\n','0');
INSERT INTO help VALUES (1,'Article','English','Add/Edit','Article','Articles are the Swiss Army knife of WebGUI. Most pieces of static content can be added via the Article widget.\r\n
\r\nTitle
\r\nWhat\'s the title for this content? Even if you don\'t wish the title to appear, it\'s a good idea to title your content so that if it is ever copied to the clipboard it will have a name.\r\n
\r\nDisplay the title?
\r\nDo you wish to display the title?\r\n
\r\nProcess macros?
\r\nDo you wish to process WebGUI macros on this article? Unchecking this box will not process macros and will speed up page execution.\r\n
\r\nPosition
\r\nSelect the position in the current page template where this widget should be placed.\r\n
\r\nStart Date
\r\nWhat date do you want this article to appear on the site? Dates are in the format of MM/DD/YYYY. You can use the JavaScript wizard to choose your date from a calendar by clicking on the set date button. By default the date is set to 01/01/2000.\r\n
\r\nEnd Date
\r\nWhat date do you want this article to be removed from the site? By default the date is set to 100 years in the future, 01/01/2100.\r\n
\r\nBody
\r\nThe body of the article is where all content is placed. You may feel free to add HTML tags as necessary to format your content. Be sure to put a <p> between paragraphs to add white space to your content.\r\n
\r\nImage
\r\nChoose an image (.jpg, .gif, .png) file from your hard drive. This file will be uploaded to the server and displayed in the upper-right corner of your article.\r\n
\r\nLink Title
\r\nIf you wish to add a link to your article, enter the title of the link in this field. \r\n
\r\nExample: Google\r\n
\r\nLink URL
\r\nIf you added a link title, now add the URL (uniform resource locator) here. \r\n
\r\nExample: http://www.google.com\r\n
\r\nAttachment
\r\nIf you wish to attach a word processor file, a zip file, or any other file for download by your users, then choose it from your hard drive.\r\n
\r\nConvert carriage returns?
\r\nIf you\'re publishing HTML there\'s generally no need to check this option, but if you aren\'t using HTML and you want a carriage return every place you hit your \"Enter\" key, then check this option.\r\n','1,2,3,4,5');
@@ -523,7 +524,7 @@ INSERT INTO help VALUES (1,'Item','English','Add/Edit','Item','Like Articles, It
INSERT INTO help VALUES (30,'WebGUI','English','Select','Package','Packages are groups of pages and widgets that are predefined to be deployed together. A package manager may see the need to create a package several pages with a message board, an FAQ, and a Poll because that task is performed quite often. Packages are often defined to lessen the burden of repetitive tasks.\r\n
\r\nOne package that many people create is a Page/Article package. It is often the case that you want to add a page with an article on it for content. Instead of going through the steps of creating a page, going to the page, and then adding an article to the page, you may wish to simply create a package to do those steps all at once.','0');
INSERT INTO help VALUES (31,'WebGUI','English','Add/Edit','Package','To create a package follow these simple steps:\r\n
\r\n- From the admin menu select \"View Packages.\"\r\n
- Add a page and give it a name. The name of the page will be the name of the package.\r\n
- Go to the new page you created and start adding pages and widgets. Any pages or widgets you add will be created each time this package is deployed. \r\n
\r\nNotes:
\r\nIn order to add, edit, or delete packages you must be in the Package Mangers group or in the Admins group.\r\n
\r\nIf you add content to any of the widgets, that content will automatically be copied also when the package is deployed.\r\n
\r\nPrivileges and styles assigned to pages in the package will not be copied when the package is deployed. Instead the pages will take the privileges and styles of the area to which they are deployed.','0');
INSERT INTO help VALUES (20,'WebGUI','English','Add/Edit','Image','Name
\r\nThe label that this image will be referenced by to include it into pages.\r\n\r\n\r\nFile
\r\nSelect a file from your local drive to upload to the server.\r\n
\r\n\r\nParameters
\r\nAdd any HTML <img&rt; parameters that you wish to act as the defaults for this image.\r\n
\r\nExample:
\r\nalign=\"right\"\r\nalt=\"This is an image\"','15');
-INSERT INTO help VALUES (1,'DownloadManager','English','Add/Edit','Download Manager','The Download Manager is designed to help you manage file distribution on your site. It allows you to specify who may download files from your site.\r\n
\r\nTitle
\r\nWhat is the title of this Download Manager?\r\n
\r\nDisplay the title?
\r\nDo you wish to display the title?\r\n
\r\nProcess macros?
\r\nDo you wish to process WebGUI macros? Unchecking this box will not process macros and will speed up page execution.\r\n
\r\nPosition
\r\nSelect the position in the current page template where this widget should be placed.\r\n
\r\nDescription
\r\nDescribe the purpose of this Download Manager.\r\n
\r\n\r\nPaginate After
\r\nHow many files should be displayed before splitting the results into separate pages? In other words, how many files should be displayed per page?\r\n
\r\n\r\nProceed to add file?
\r\nIf you wish to start adding files to download right away, leave this checked.\r\n
\r\n\r\nAdding Files
\r\nAfter you\'ve created a download manager you can add as many files as you wish to it. The properties for each file are Download File, Alternate Version #1, Alternate Version #2, File Title, Brief Synopsis, and Group to Download. All of these should be self explainatory except for the alternate versions. Alternate versions are used for when you\'re distributing different file formats of the same file, such as a Microsoft Word document and a PDF version. Or a JPEG, GIF, and TIFF.\r\n','0');
+INSERT INTO help VALUES (1,'DownloadManager','English','Add/Edit','Download Manager','The Download Manager is designed to help you manage file distribution on your site. It allows you to specify who may download files from your site.\r\n
\r\nTitle
\r\nWhat is the title of this Download Manager?\r\n
\r\nDisplay the title?
\r\nDo you wish to display the title?\r\n
\r\nProcess macros?
\r\nDo you wish to process WebGUI macros? Unchecking this box will not process macros and will speed up page execution.\r\n
\r\nPosition
\r\nSelect the position in the current page template where this widget should be placed.\r\n
\r\nDescription
\r\nDescribe the purpose of this Download Manager.\r\n
\r\n\r\nPaginate After
\r\nHow many files should be displayed before splitting the results into separate pages? In other words, how many files should be displayed per page?\r\n
\r\n\r\nDisplay thumbnails?
\r\nCheck this if you want to display thumbnails for any images that are uploaded. Note that the thumbnail is only displayed for the main attachment, not the alternate versions.\r\n
\r\n\r\nProceed to add file?
\r\nIf you wish to start adding files to download right away, leave this checked.\r\n
\r\n\r\nAdding Files
\r\nAfter you\'ve created a download manager you can add as many files as you wish to it. The properties for each file are Download File, Alternate Version #1, Alternate Version #2, File Title, Brief Synopsis, and Group to Download. All of these should be self explainatory except for the alternate versions. Alternate versions are used for when you\'re distributing different file formats of the same file, such as a Microsoft Word document and a PDF version. Or a JPEG, GIF, and TIFF.\r\n','1,2,3,4,5');
INSERT INTO help VALUES (23,'WebGUI','English','Delete','Image','When you delete an image it will be removed from the server and cannot be recovered. Therefore, be sure that you really wish to delete the image before you confirm the delete.','15');
INSERT INTO help VALUES (26,'WebGUI','English','Manage','Image','Using the built in image manager in WebGUI you can upload images to one central location for use anywhere else in the site with no need for any special software or knowledge.\r\n
\r\n To place the images you\'ve uploaded use the ^I(); and ^i(); macros. More information on them can be found in the Using Macros help.','15');
@@ -1475,11 +1476,12 @@ INSERT INTO international VALUES (37,'WebGUI','Dutch','Geen toegang!');
INSERT INTO international VALUES (37,'WebGUI','English','Permission Denied!');
INSERT INTO international VALUES (37,'WebGUI','Español','Permiso Denegado!');
INSERT INTO international VALUES (37,'WebGUI','Português','Permissão negada!');
-INSERT INTO international VALUES (38,'WebGUI','Deutsch','Sie sind nicht berechtigt, diese Aktion auszuführen. ^a(Melden Sie sich bitte mit einem Benutzernamen an);, der über ausreichende Rechte verfügt.');
+INSERT INTO international VALUES (38,'WebGUI','Português','\"Não tem privilégios para essa operação. ^a(Identifique-se na entrada); com uma conta que permita essa operação.\"');
+INSERT INTO international VALUES (404,'WebGUI','English','First Page');
+INSERT INTO international VALUES (38,'WebGUI','Español','\"No tiene privilegios suficientes para realizar ésta operación. Por favor ^a(ingrese con una cuenta); que posea los privilegios suficientes antes de intentar ésta operación.\"');
INSERT INTO international VALUES (38,'WebGUI','Dutch','U heeft niet voldoende privileges om deze operatie te doen. ^a(Log in); als een gebruiker met voldoende privileges.');
INSERT INTO international VALUES (38,'WebGUI','English','You do not have sufficient privileges to perform this operation. Please ^a(log in with an account); that has sufficient privileges before attempting this operation.');
-INSERT INTO international VALUES (38,'WebGUI','Español','\"No tiene privilegios suficientes para realizar ésta operación. Por favor ^a(ingrese con una cuenta); que posea los privilegios suficientes antes de intentar ésta operación.\"');
-INSERT INTO international VALUES (38,'WebGUI','Português','\"Não tem privilégios para essa operação. ^a(Identifique-se na entrada); com uma conta que permita essa operação.\"');
+INSERT INTO international VALUES (38,'WebGUI','Deutsch','Sie sind nicht berechtigt, diese Aktion auszuführen. ^a(Melden Sie sich bitte mit einem Benutzernamen an);, der über ausreichende Rechte verfügt.');
INSERT INTO international VALUES (39,'WebGUI','Deutsch','Sie sind nicht berechtigt, diese Seite anzuschauen.');
INSERT INTO international VALUES (39,'WebGUI','Dutch','U heeft niet voldoende privileges om deze pagina op te vragen.');
INSERT INTO international VALUES (39,'WebGUI','English','You do not have sufficient privileges to access this page.');
@@ -2503,6 +2505,11 @@ INSERT INTO international VALUES (401,'WebGUI','English','Are you certain you wi
INSERT INTO international VALUES (21,'MessageBoard','English','Who can moderate?');
INSERT INTO international VALUES (22,'MessageBoard','English','Delete Message');
INSERT INTO international VALUES (402,'WebGUI','English','The message you requested does not exist.');
+INSERT INTO international VALUES (403,'WebGUI','English','Prefer not to say.');
+INSERT INTO international VALUES (405,'WebGUI','English','Last Page');
+INSERT INTO international VALUES (406,'WebGUI','English','Thumbnail Size');
+INSERT INTO international VALUES (21,'DownloadManager','English','Display thumbnails?');
+INSERT INTO international VALUES (407,'WebGUI','English','Click here to register.');
#
# Table structure for table 'messageLog'
@@ -2577,25 +2584,6 @@ INSERT INTO page VALUES (3,0,'Trash',4,3,1,1,3,1,1,0,0,1,'','trash',0,'Default')
INSERT INTO page VALUES (2,0,'Clipboard',4,3,1,1,4,1,1,0,0,1,'','clipboard',0,'Default');
INSERT INTO page VALUES (5,0,'Packages',1,3,0,0,6,1,1,0,0,1,'','packages',0,'Default');
-#
-# Table structure for table 'session'
-#
-
-CREATE TABLE session (
- sessionId varchar(60) NOT NULL default '',
- expires int(11) default NULL,
- lastPageView int(11) default NULL,
- adminOn int(11) NOT NULL default '0',
- lastIP varchar(50) default NULL,
- userId int(11) default NULL,
- PRIMARY KEY (sessionId)
-) TYPE=MyISAM;
-
-#
-# Dumping data for table 'session'
-#
-
-
#
# Table structure for table 'settings'
#
@@ -2635,6 +2623,7 @@ INSERT INTO settings VALUES ('profileHome','0');
INSERT INTO settings VALUES ('profileWork','0');
INSERT INTO settings VALUES ('docTypeDec','');
INSERT INTO settings VALUES ('preventProxyCache','0');
+INSERT INTO settings VALUES ('thumbnailSize','50');
#
# Table structure for table 'style'
@@ -2684,6 +2673,25 @@ INSERT INTO style VALUES (3,'Make Page Printable','
\r\n\r\n\r\n\r\n  | \r\n  ^@; | \r\n       | \r\n
\r\n\r\n ^C; | \r\n ^D(\"%c %D, %y\"); | \r\n
\r\n
\r\n\r\n\r\n \r\n | ',' | \r\n
\r\n\r\n 
| \r\n
\r\n
\r\n\r\n\r\n  | \r\n ^r(\' \'); | \r\n
\r\n
\r\n\r\n','');
+#
+# Table structure for table 'userSession'
+#
+
+CREATE TABLE userSession (
+ sessionId varchar(60) NOT NULL default '',
+ expires int(11) default NULL,
+ lastPageView int(11) default NULL,
+ adminOn int(11) NOT NULL default '0',
+ lastIP varchar(50) default NULL,
+ userId int(11) default NULL,
+ PRIMARY KEY (sessionId)
+) TYPE=MyISAM;
+
+#
+# Dumping data for table 'userSession'
+#
+
+
#
# Table structure for table 'users'
#
@@ -2718,7 +2726,7 @@ CREATE TABLE users (
workPhone varchar(30) default NULL,
cellPhone varchar(30) default NULL,
pager varchar(30) default NULL,
- gender varchar(6) default NULL,
+ gender varchar(6) NOT NULL default 'neuter',
birthdate varchar(30) default NULL,
homepage text,
PRIMARY KEY (userId)
@@ -2728,31 +2736,31 @@ CREATE TABLE users (
# Dumping data for table 'users'
#
-INSERT INTO users VALUES (1,'Visitor','No Login','','WebGUI',NULL,NULL,'English',NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (2,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+INSERT INTO users VALUES (1,'Visitor','No Login','','WebGUI',NULL,NULL,'English',NULL,NULL,NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (2,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
INSERT INTO users VALUES (3,'Admin','RvlMjeFPs2aAhQdo/xt/Kg','','WebGUI','','','English','','','','','','','','','','','','','','','','','','','','','','male','','');
-INSERT INTO users VALUES (4,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (5,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (6,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (7,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (8,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (9,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (10,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (11,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (12,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (13,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (14,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (15,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (16,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (17,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (18,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (19,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (20,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (21,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (22,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (23,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (24,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-INSERT INTO users VALUES (25,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+INSERT INTO users VALUES (4,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (5,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (6,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (7,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (8,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (9,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (10,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (11,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (12,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (13,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (14,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (15,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (16,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (17,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (18,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (19,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (20,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (21,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (22,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (23,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (24,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
+INSERT INTO users VALUES (25,'Reserved','No Login',NULL,'WebGUI',NULL,NULL,'English',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL);
#
# Table structure for table 'widget'
@@ -2781,6 +2789,3 @@ CREATE TABLE widget (
INSERT INTO widget VALUES (-1,4,'SiteMap',0,'Page Not Found',1,'The page you were looking for could not be found on this system. Perhaps it has been deleted or renamed. The following list is a site map of this site. If you don\'t find what you\'re looking for on the site map, you can always start from the Home Page.',1,1001744792,3,1013215663,3,'A');
-insert into international values (403,'WebGUI','English','Prefer not to say.');
-alter table users change column gender gender varchar(6) not null default 'neuter';
-
diff --git a/docs/credits.txt b/docs/credits.txt
index 15f660e1a..6dba1d1aa 100644
--- a/docs/credits.txt
+++ b/docs/credits.txt
@@ -13,4 +13,7 @@ Spanish Translation..................Ricardo Markiewicz
Portuguese Translation...............Jose Caneira
Dutch Translation....................Joeri de Bruin
mod_rewrite Support..................Peter Beardsley / Appropriate Solutions, Inc.
+Oracle testing.......................Richard Caelius
+Image Manager concept................Frank Dillon
+
diff --git a/docs/gotcha.txt b/docs/gotcha.txt
index 6cf32b081..0d5313f79 100644
--- a/docs/gotcha.txt
+++ b/docs/gotcha.txt
@@ -7,6 +7,12 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief.
+3.3.0
+--------------------------------------------------------------------
+ * You need to get a new Perl module before you upgrade. It is
+ Image::Magick. On some systems you may also need to download
+ and compile the C compliment to it from www.imagemagick.org.
+
3.2.1
--------------------------------------------------------------------
* We released a faulty upgrade script with 3.2.0. If you happened
diff --git a/docs/install.txt b/docs/install.txt
index d8bc57a8c..a32f69ce6 100644
--- a/docs/install.txt
+++ b/docs/install.txt
@@ -24,6 +24,7 @@ QnD INSTALL INSTRUCTIONS:
Tie::CPHash
Date::Calc
HTML::CalendarMonthSimple
+ Image::Magick
3. Install Apache (with or without mod_perl) and set up your config.
diff --git a/docs/previousVersion.sql b/docs/previousVersion.sql
index 60fa478aa..527941a21 100644
--- a/docs/previousVersion.sql
+++ b/docs/previousVersion.sql
@@ -2781,3 +2781,6 @@ CREATE TABLE widget (
INSERT INTO widget VALUES (-1,4,'SiteMap',0,'Page Not Found',1,'The page you were looking for could not be found on this system. Perhaps it has been deleted or renamed. The following list is a site map of this site. If you don\'t find what you\'re looking for on the site map, you can always start from the Home Page.',1,1001744792,3,1013215663,3,'A');
+insert into international values (403,'WebGUI','English','Prefer not to say.');
+alter table users change column gender gender varchar(6) not null default 'neuter';
+
diff --git a/docs/upgrades/upgrade_3.2.4-3.3.0.sql b/docs/upgrades/upgrade_3.2.4-3.3.0.sql
new file mode 100644
index 000000000..6bb63a9fa
--- /dev/null
+++ b/docs/upgrades/upgrade_3.2.4-3.3.0.sql
@@ -0,0 +1,27 @@
+INSERT INTO settings VALUES ('thumbnailSize','50');
+alter table DownloadManager add column displayThumbnails int not null default 0;
+alter table session rename userSession;
+delete from help where helpId=19 and namespace='WebGUI';
+
+INSERT INTO help VALUES (19,'WebGUI','English','Using','Macros','WebGUI macros are used to create dynamic content within otherwise static content. For instance, you may wish to show which user is logged in on every page, or you may wish to have a dynamically built menu or crumb trail. \r\n\r\nMacros always begin with a carat (^) and follow with at least one other character and ended with w semicolon (;). Some macros can be extended/configured by taking the format of ^x(\"config text\");. The following is a description of all the macros in the WebGUI system.\r\n
\r\n^a; or ^a(); - My Account Link
\r\nA link to your account information. In addition you can change the link text by creating a macro like this ^a(\"Account Info\");.\r\n
\r\n^C; or ^C(); - Crumb Trail
\r\nA dynamically generated crumb trail to the current page. You can optionally specify a delimeter to be used between page names by using ^C(::);. The default delimeter is >.\r\n
\r\n^c; - Company Name
\r\nThe name of your company specified in the settings by your Administrator.\r\n
\r\n^D; or ^D(); - Date
\r\nThe current date and time.\r\n
\r\nYou can configure the date by using date formatting symbols. For instance, if you created a macro like this ^D(\"%c %D, %y\"); it would output September 26, 2001. The following are the available date formatting symbols:\r\n
\r\n| %% | % |
\r\n| %y | 4 digit year |
\r\n| %Y | 2 digit year |
\r\n| %m | 2 digit month |
\r\n| %M | variable digit month |
\r\n| %c | month name |
\r\n| %d | 2 digit day of month |
\r\n| %D | variable digit day of month |
\r\n| %w | day of week name |
\r\n| %h | 2 digit base 12 hour |
\r\n| %H | variable digit base 12 hour |
\r\n| %j | 2 digit base 24 hour |
\r\n| %J | variable digit base 24 hour |
\r\n| %p | lower case am/pm |
\r\n| %P | upper case AM/PM |
\r\n
\r\n\r\n^e; - Company Email Address
\r\nThe email address for your company specified in the settings by your Administrator.\r\n
\r\n^Execute();
\r\nAllows a content manager or administrator to execute an external program. Takes the format of ^Execute(\"/this/file.sh\");.\r\n
\r\n^FlexMenu;
\r\nThis menu macro creates a top-level menu that expands as the user selects each menu item.\r\n
\r\n^H; or ^H(); - Home Link
\r\nA link to the home page of this site. In addition you can change the link text by creating a macro like this ^H(\"Go Home\");.\r\n
\r\n^I(); - Image Manager Image with Tag
\r\nThis macro returns an image tag with the parameters for an image defined in the image manager. Specify the name of the image using a tag like this ^I(\"imageName\");.\r\n
\r\n^i(); - Image Manager Image Path
\r\nThis macro returns the path of an image uploaded using the Image Manager. Specify the name of the image using a tag like this ^i(\"imageName\");.\r\n
\r\n^Include();
\r\nAllows a content manager or administrator to include a file from the local filesystem. Takes the format of ^Include(\"/this/file.html\");\r\n
\r\n^L; or ^L(); - Login
\r\nA small login form. You can also configure this macro. You can set the width of the login box like this ^L(20);. You can also set the message displayed after the user is logged in like this ^L(20,Hi ^a(^@;);. Click %here% if you wanna log out!)\r\n
\r\n^M; or ^M(); - Current Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the current level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^M(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^m; - Current Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the current level. You can optionally specify a delimeter to be used between page names by using ^m(:--:);. The default delimeter is ·.\r\n
\r\n^P; or ^P(); - Previous Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the previous level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^P(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^p; - Previous Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the previous level. You can optionally specify a delimeter to be used between page names by using ^p(:--:);. The default delimeter is ·.\r\n
\r\n^PageTitle;
\r\nDisplays the title of the current page.\r\n
\r\n^r; or ^r(); - Make Page Printable
\r\nCreates a link to remove the style from a page to make it printable. In addition, you can change the link text by creating a macro like this ^r(\"Print Me!\");.\r\n
\r\n^S(); - Specific SubMenu (Vertical)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^S(\"home\",0);. The first value is the urlized title of the page and the second value is the depth you\'d like the menu to go. By default it will show only the first level. To go three levels deep create a macro like this ^S(\"home\",3);.\r\n
\r\n^s(); - Specific SubMenu (Horizontal)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^s(\"home\");. The value is the urlized title of the page. You can optionally specify a delimeter to be used between page names by using ^s(\"home\",\":--:\");. The default delimeter is ·.\r\n
\r\n^T; or ^T(); - Top Level Menu (Vertical)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^T(3);. If you set the macro to \"0\" it will track the entire site tree.\r\n
\r\n^t; - Top Level Menu (Horizontal)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). You can optionally specify a delimeter to be used between page names by using ^t(:--:);. The default delimeter is ·.\r\n
\r\n^Thumbnail();
\r\nReturns the URL of a thumbnail for an image from the image manager. Specify the name of the image like this ^Thumbnail(\"imageName\");.\r\n
\r\n^u; - Company URL
\r\nThe URL for your company specified in the settings by your Administrator.\r\n
\r\n^/; - System URL
\r\nThe URL to the gateway script (including the domain for this site). This is often used within pages so that if your development server is on a domain different than your production server that your URLs will still worked when moved.\r\n
\r\n^\\; - Page URL
\r\nThe URL to the current page (including the domain for this site). This is often used within pages so that if your development server is on a domain different than your production server that your URLs will still worked when moved.\r\n
\r\n^@; - Username
\r\nThe username of the currently logged in user.\r\n
\r\n^?; - Search
\r\nAdd a search box.\r\n
\r\n^#; - User ID
\r\nThe user id of the currently logged in user.\r\n
\r\n^*; or ^*(); - Random Number
\r\nA randomly generated number. This is often used on images (such as banner ads) that you want to ensure do not cache. In addition, you may configure this macro like this ^*(100); to create a random number between 0 and 100.\r\n
\r\n^-;,^0;,^1;,^2;,^3;, etc.
\r\nThese macros are reserved for widget-specific functions as in the SQL Report widget.\r\n','0');
+delete from help where helpId=1 and namespace='DownloadManager';
+INSERT INTO help VALUES (1,'DownloadManager','English','Add/Edit','Download Manager','The Download Manager is designed to help you manage file distribution on your site. It allows you to specify who may download files from your site.\r\n
\r\nTitle
\r\nWhat is the title of this Download Manager?\r\n
\r\nDisplay the title?
\r\nDo you wish to display the title?\r\n
\r\nProcess macros?
\r\nDo you wish to process WebGUI macros? Unchecking this box will not process macros and will speed up page execution.\r\n
\r\nPosition
\r\nSelect the position in the current page template where this widget should be placed.\r\n
\r\nDescription
\r\nDescribe the purpose of this Download Manager.\r\n
\r\n\r\nPaginate After
\r\nHow many files should be displayed before splitting the results into separate pages? In other words, how many files should be displayed per page?\r\n
\r\n\r\nDisplay thumbnails?
\r\nCheck this if you want to display thumbnails for any images that are uploaded. Note that the thumbnail is only displayed for the main attachment, not the alternate versions.\r\n
\r\n\r\nProceed to add file?
\r\nIf you wish to start adding files to download right away, leave this checked.\r\n
\r\n\r\nAdding Files
\r\nAfter you\'ve created a download manager you can add as many files as you wish to it. The properties for each file are Download File, Alternate Version #1, Alternate Version #2, File Title, Brief Synopsis, and Group to Download. All of these should be self explainatory except for the alternate versions. Alternate versions are used for when you\'re distributing different file formats of the same file, such as a Microsoft Word document and a PDF version. Or a JPEG, GIF, and TIFF.\r\n','1,2,3,4,5');
+
+INSERT INTO international VALUES (404,'WebGUI','English','First Page');
+INSERT INTO international VALUES (405,'WebGUI','English','Last Page');
+INSERT INTO international VALUES (406,'WebGUI','English','Thumbnail Size');
+INSERT INTO international VALUES (21,'DownloadManager','English','Display thumbnails?');
+INSERT INTO international VALUES (407,'WebGUI','English','Click here to register.');
+alter table users change gender gender varchar(6) NOT NULL default 'neuter';
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/etc/some_other_site.conf b/etc/some_other_site.conf
new file mode 100644
index 000000000..9d92437a3
--- /dev/null
+++ b/etc/some_other_site.conf
@@ -0,0 +1,5 @@
+dsn = DBI:mysql:some_other_site
+dbuser = webgui
+dbpass = password
+logfile = /data/webgui.log
+#scripturl = /
diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm
index 3cc4c2042..3a055d49b 100644
--- a/lib/WebGUI.pm
+++ b/lib/WebGUI.pm
@@ -1,5 +1,5 @@
package WebGUI;
-our $VERSION = "3.2.4";
+our $VERSION = "3.3.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black Software.
@@ -148,7 +148,7 @@ sub _loadWidgets {
#-------------------------------------------------------------------
sub page {
my (%contentHash, $cmd, $pageEdit, $widgetType, $functionOutput, @availableWidgets, @widgetList, $sth, $httpHeader, $header, $footer, $content, $operationOutput, $adminBar);
- WebGUI::Session::open($_[0]);
+ WebGUI::Session::open($_[0],$_[1]);
# For some reason we have to pre-cache the templates when running under mod_perl
# so that's what we're doing with this next command.
WebGUI::Template::loadTemplates();
diff --git a/lib/WebGUI/Attachment.pm b/lib/WebGUI/Attachment.pm
index c568a26ce..09e687367 100644
--- a/lib/WebGUI/Attachment.pm
+++ b/lib/WebGUI/Attachment.pm
@@ -1,142 +1,344 @@
package WebGUI::Attachment;
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
+=head1 LEGAL
+
+ -------------------------------------------------------------------
+ WebGUI is Copyright 2001-2002 Plain Black Software.
+ -------------------------------------------------------------------
+ Please read the legal notices (docs/legal.txt) and the license
+ (docs/license.txt) that came with this distribution before using
+ this software.
+ -------------------------------------------------------------------
+ http://www.plainblack.com info@plainblack.com
+ -------------------------------------------------------------------
+
+=cut
use File::Copy cp;
use File::Path;
use FileHandle;
+use Image::Magick;
use POSIX;
use strict;
+use WebGUI::ErrorHandler;
+use WebGUI::Node;
use WebGUI::Session;
use WebGUI::URL;
use WebGUI::Utility;
+=head1 NAME
+
+ Package WebGUI::Attachment
+
+=head1 SYNOPSIS
+
+ use WebGUI::Attachment;
+ $attachment = WebGUI::Attachment->new("file.txt","100","20");
+ $attachment->copy("files","10");
+ $attachment->delete;
+ $attachment->deleteNode;
+ $attachment->getFilename;
+ $attachment->getIcon;
+ $attachment->getPath;
+ $attachment->getThumbnail;
+ $attachment->getType;
+ $attachment->getURL;
+ $attachment->save("formImage");
+
+=head1 DESCRIPTION
+
+ Package to manipulate WebGUI Attachments.
+
+=head1 METHODS
+
+ These methods are available from this class:
+
+=cut
+
+
#-------------------------------------------------------------------
-# eg: copy(filename,oldWidgetId,newWidgetId,oldSubId,newSubId);
-sub copy {
- my ($a, $b, $newFile, $oldFile);
- if ($_[0] ne "") {
- $oldFile = $session{setting}{attachmentDirectoryLocal}.'/'.$_[1];
- if ($_[3] ne "") {
- $oldFile .= '/'.$_[3];
+sub _createThumbnail {
+ my ($image, $error, $x, $y, $r, $n);
+ if (isIn($_[0]->getType, qw(jpg jpeg gif png tif tiff bmp))) {
+ $image = Image::Magick->new;
+ $error = $image->Read($_[0]->getPath);
+ WebGUI::ErrorHandler::warning($error) if $error;
+ ($x, $y) = $image->Get('width','height');
+ $n = $_[1] || $session{setting}{thumbnailSize};
+ $r = $x>$y ? $x / $n : $y / $n;
+ $image->Scale(width=>($x/$r),height=>($y/$r));
+ if (isIn($_[0]->getType, qw(tif tiff bmp))) {
+ $error = $image->Write($_[0]->{_node}->getPath.'/thumb-'.$_[0]->getFilename.'.png');
+ } else {
+ $error = $image->Write($_[0]->{_node}->getPath.'/thumb-'.$_[0]->getFilename);
}
- $oldFile .= '/'.$_[0];
- $newFile = $session{setting}{attachmentDirectoryLocal}.'/'.$_[2];
- mkdir ($newFile,0755);
- if ($_[4] ne "") {
- $newFile .= '/'.$_[4];
- mkdir ($newFile,0755);
- }
- $newFile .= '/'.$_[0];
- $a = FileHandle->new($oldFile,"r");
- $b = FileHandle->new(">".$newFile);
- binmode($a);
- binmode($b);
- cp($a,$b);
- $a->close;
- $b->close;
+ WebGUI::ErrorHandler::warning($error) if $error;
}
}
-#-------------------------------------------------------------------
-sub deleteSubmission {
- my ($dir);
- $dir = $session{setting}{attachmentDirectoryLocal}.'/'.$_[0].'/'.$_[1];
- rmtree($dir);
-}
#-------------------------------------------------------------------
-sub getType {
- my ($extension, $icon, %type);
- $extension = lc($_[0]);
- $extension =~ s/.*?\.(.*?)$/$1/;
- if ($extension eq "doc" || $extension eq "dot" || $extension eq "wri") {
- $icon = $session{setting}{lib}."/fileIcons/doc.gif";
- } elsif ($extension eq "txt" || $extension eq "log" || $extension eq "config" || $extension eq "conf") {
- $icon = $session{setting}{lib}."/fileIcons/txt.gif";
- } elsif ($extension eq "xls" || $extension eq "xlt" || $extension eq "csv") {
- $icon = $session{setting}{lib}."/fileIcons/xls.gif";
- } elsif ($extension eq "html" || $extension eq "htm" || $extension eq "xml") {
- $icon = $session{setting}{lib}."/fileIcons/html.gif";
- } elsif ($extension eq "ram" || $extension eq "mpeg" || $extension eq "mpg" ||
- $extension eq "wav" || $extension eq "mp3" || $extension eq "avi") {
- $icon = $session{setting}{lib}."/fileIcons/html.gif";
- } elsif ($extension eq "html" || $extension eq "htm" || $extension eq "xml") {
- $icon = $session{setting}{lib}."/fileIcons/html.gif";
- } elsif ($extension eq "rar" || $extension eq "tgz" || $extension eq "tar.gz" ||
- $extension eq "tar" || $extension eq "gz" || $extension eq "Z") {
- $icon = $session{setting}{lib}."/fileIcons/rar.gif";
+
+=head2 copy ( newNode [, newNodeSub ] )
+
+ Copies an attachment from one node to another.
+
+=item newNode
+
+ Define the node to copy the attachment to.
+
+=item newNodeSub
+
+ If there is a subordinate element on this node define it here.
+
+=cut
+
+sub copy {
+ my ($a, $b, $newNode);
+ $newNode = WebGUI::Node->new($_[1],$_[2]);
+ $a = FileHandle->new($_[0]->getPath,"r");
+ $b = FileHandle->new(">".$newNode->getPath.'/'.$_[0]->getFilename);
+ binmode($a);
+ binmode($b);
+ cp($a,$b);
+ $a->close;
+ $b->close;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 delete ( )
+
+ Deletes an attachment from its node.
+
+=cut
+
+sub delete {
+ unlink($_[0]->getPath);
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 deleteNode ( )
+
+ Deletes deletes this attachment's node (and everything in it).
+
+=cut
+
+sub deleteNode {
+ rmtree($_[0]->{_node}->getPath);
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getFilename ( )
+
+ Returns the attachment's filename.
+
+=cut
+
+sub getFilename {
+ return $_[0]->{_filename};
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getIcon ( )
+
+ Returns the full URL to the file icon for this attachment.
+
+=cut
+
+sub getIcon {
+ my ($extension, $icon);
+ $extension = $_[0]->getType;
+ $icon = $session{setting}{lib}."/fileIcons/";
+ if (isIn($extension, qw(doc dot wri))) {
+ $icon .= "doc.gif";
+ } elsif (isIn($extension, qw(txt log config conf))) {
+ $icon .= "txt.gif";
+ } elsif (isIn($extension, qw(xlt csv xls))) {
+ $icon .= "xls.gif";
+ } elsif (isIn($extension, qw(ram mpeg mpg wav mp3 avi))) {
+ $icon .= "wav.gif";
+ } elsif (isIn($extension, qw(html htm xml))) {
+ $icon .= "html.gif";
+ } elsif (isIn($extension, qw(exe com bat pif))) {
+ $icon .= "exe.gif";
+ } elsif (isIn($extension, qw(sit hqx))) {
+ $icon .= "sit.gif";
+ } elsif (isIn($extension, qw(tgz gz tar Z))) {
+ $icon .= "gz.gif";
+ } elsif ($extension eq "rar") {
+ $icon .= "rar.gif";
} elsif ($extension eq "mdb") {
- $icon = $session{setting}{lib}."/fileIcons/mdb.gif";
+ $icon .= "mdb.gif";
} elsif ($extension eq "ppt") {
- $icon = $session{setting}{lib}."/fileIcons/ppt.gif";
- } elsif ($extension eq "tiff" || $extension eq "tif" || $extension eq "bmp" ||
- $extension eq "psd" ||$extension eq "psp" || $extension eq "gif" ||
- $extension eq "jpg" || $extension eq "jpeg") {
- $icon = $session{setting}{lib}."/fileIcons/psp.gif";
+ $icon .= "ppt.gif";
+ } elsif (isIn($extension, qw(psd eps ai))) {
+ $icon .= "psd.gif";
+ } elsif (isIn($extension, qw(tiff tif bmp psp gif jpg jpeg png))) {
+ $icon .= "psp.gif";
} elsif ($extension eq "zip") {
- $icon = $session{setting}{lib}."/fileIcons/zip.gif";
+ $icon .= "zip.gif";
} elsif ($extension eq "mov") {
- $icon = $session{setting}{lib}."/fileIcons/mov.gif";
+ $icon .= "mov.gif";
} elsif ($extension eq "pdf") {
- $icon = $session{setting}{lib}."/fileIcons/pdf.gif";
+ $icon .= "pdf.gif";
} else {
- $icon = $session{setting}{lib}."/fileIcons/unknown.gif";
+ $icon .= "unknown.gif";
}
- %type = (extension => $extension, icon => $icon);
- return %type;
+ return $icon;
}
-#-------------------------------------------------------------------
-sub purgeWidget {
- my ($dir);
- $dir = $session{setting}{attachmentDirectoryLocal}.'/'.$_[0];
- rmtree($dir);
-}
#-------------------------------------------------------------------
-# eg: save(formVarName,widgetId,optionallySubmissionId);
+
+=head2 getPath ( )
+
+ Returns a full path to an attachment.
+
+=cut
+
+sub getPath {
+ return $_[0]->{_node}->getPath.'/'.$_[0]->getFilename;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getThumbnail ( )
+
+ Returns a full URL to the thumbnail for this attachment. Thumbnails
+ are only created for jpg, gif, png, tif, and bmp so getThumbnail
+ only returns a thumbnail if the file is one of those types.
+
+=cut
+
+sub getThumbnail {
+ if (isIn($_[0]->getType, qw(jpg jpeg gif png))) {
+ return $_[0]->{_node}->getURL.'/thumb-'.$_[0]->getFilename;
+ } elsif (isIn($_[0]->getType, qw(tif tiff bmp))) {
+ return $_[0]->{_node}->getURL.'/thumb-'.$_[0]->getFilename.'.png';
+ } else {
+ return "";
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getType ( )
+
+ Returns the extension or type of this attachment.
+
+=cut
+
+sub getType {
+ my ($extension);
+ $extension = $_[0]->getFilename;
+ $extension =~ s/.*\.(.*?)$/$1/;
+ return $extension;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getURL ( )
+
+ Returns a full URL to an attachment.
+
+=cut
+
+sub getURL {
+ return $_[0]->{_node}->getURL.'/'.$_[0]->getFilename;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 new ( filename, node [, nodeSubordinate ] )
+
+ Constructor.
+
+=item filename
+
+ What is the filename for this attachment. If you'll be uploading
+ the attachment using the "save" method then you may leave this
+ field blank.
+
+=item node
+
+ The node where this attachment is (or will be placed).
+
+=item nodeSubordinate
+
+ The subordinate element of the node where this attachment is (or
+ will be placed).
+
+=cut
+
+sub new {
+ my ($class, $filename, $node, $nodeSub) = @_;
+ my $node = WebGUI::Node->new($node, $nodeSub);
+ bless {_node => $node, _filename => $filename}, $class;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 save ( formVariableName [, thumbnailSize ] )
+
+ Grabs an attachment from a form POST and saves it to a node. It
+ then returns the filename of the attachment.
+
+=item formVariableName
+
+ Provide the form variable name to which the file being uploaded
+ is assigned.
+
+=item thumbnailSize
+
+ If an image is being uploaded a thumbnail will be generated
+ automatically. By default, WebGUI will create a thumbnail of the
+ size specified in the attachment settings. You can override that
+ size by specifying one here. Size is measured in pixels of the
+ longest side.
+
+=cut
+
sub save {
- my (%type, $file, $filename, $bytesread, $buffer, $urlizedFilename, $path);
- $filename = $session{cgi}->upload($_[0]);
+ my ($type, $file, $filename, $bytesread, $buffer, $urlizedFilename, $path);
+ $filename = $session{cgi}->upload($_[1]);
if (defined $filename) {
if ($filename =~ /([^\/\\]+)$/) {
- $urlizedFilename = $1;
+ $_[0]->{_filename} = $1;
} else {
- $urlizedFilename = $filename;
+ $_[0]->{_filename} = $filename;
}
- %type = getType($urlizedFilename);
- if ($type{extension} eq "pl" || $type{extension} eq "perl" || $type{extension} eq "sh" ||
- $type{extension} eq "cgi" || $type{extension} eq "php" || $type{extension} eq "asp") {
- $urlizedFilename =~ s/\./\_/g;
- $urlizedFilename .= ".txt";
+ $type = $_[0]->getType();
+ if (isIn($type, qw(pl perl sh cgi php asp))) {
+ $_[0]->{_filename} =~ s/\./\_/g;
+ $_[0]->{_filename} .= ".txt";
}
- $urlizedFilename = WebGUI::URL::urlize($urlizedFilename);
- $path = $session{setting}{attachmentDirectoryLocal}."/".$_[1]."/";
- mkdir ($path,0755);
- if ($_[2] ne "") {
- $path = $path.$_[2].'/';
- mkdir ($path,0755);
- }
- $file = FileHandle->new(">".$path.$urlizedFilename);
+ $_[0]->{_filename} = WebGUI::URL::urlize($_[0]->getFilename);
+ $_[0]->{_node}->create();
+ $file = FileHandle->new(">".$_[0]->getPath);
if (defined $file) {
binmode $file;
while ($bytesread=read($filename,$buffer,1024)) {
print $file $buffer;
}
close($file);
+ _createThumbnail($_[0],$_[2]);
} else {
return "";
}
- return $urlizedFilename;
+ return $_[0]->getFilename;
} else {
return "";
}
diff --git a/lib/WebGUI/Macro/I_imageWithTags.pm b/lib/WebGUI/Macro/I_imageWithTags.pm
index 9c9d531dd..eda577138 100644
--- a/lib/WebGUI/Macro/I_imageWithTags.pm
+++ b/lib/WebGUI/Macro/I_imageWithTags.pm
@@ -12,18 +12,19 @@ package WebGUI::Macro::I_imageWithTags;
use strict;
use Tie::CPHash;
+use WebGUI::Attachment;
use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
sub _replacement {
- my (@param, $temp, %data);
+ my (@param, $temp, %data, $image);
tie %data, 'Tie::CPHash';
@param = WebGUI::Macro::getParams($_[0]);
%data = WebGUI::SQL->quickHash("select * from images where name='$param[0]'");
- $temp = '
';
+ $image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
+ $temp = '
';
return $temp;
}
diff --git a/lib/WebGUI/Macro/L_loginBox.pm b/lib/WebGUI/Macro/L_loginBox.pm
index 739312f09..eae7dcc29 100644
--- a/lib/WebGUI/Macro/L_loginBox.pm
+++ b/lib/WebGUI/Macro/L_loginBox.pm
@@ -17,27 +17,47 @@ use WebGUI::Macro::Backslash_pageUrl;
use WebGUI::Session;
use WebGUI::URL;
+#-------------------------------------------------------------------
+sub _createURL {
+ return ''.$_[0].'';
+}
+
#-------------------------------------------------------------------
sub _replacement {
- my ($temp);
+ my ($temp,$boxSize,@param,$text);
+ @param = WebGUI::Macro::getParams($_[0]);
$temp = '
';
if ($session{var}{sessionId}) {
- $temp .= WebGUI::International::get(48);
- $temp .= '
'.$session{user}{username}.'.';
- $temp .= WebGUI::International::get(49);
- $temp = WebGUI::Macro::Backslash_pageUrl::process($temp);
+ $text = $param[1];
+ if (not defined $text){
+ $temp .= WebGUI::International::get(48);
+ $temp .= '
'.$session{user}{username}.'.';
+ $temp .= WebGUI::International::get(49);
+ $temp = WebGUI::Macro::Backslash_pageUrl::process($temp);
+ } else {
+ $text =~ s/%(.*?)%/_createURL($1)/ge;
+ $temp .= WebGUI::Macro::Backslash_pageUrl::process($text);
+ }
} else {
+ $boxSize = $param[0];
+ if (not defined $boxSize) {
+ $boxSize = 12;
+ }
+ if (index(lc($ENV{HTTP_USER_AGENT}),"msie") < 0) {
+ $boxSize = int($boxSize=$boxSize*2/3);
+ }
$temp .= '
';
- $temp .= '
Click here to register.';
+ $temp .= '
'.WebGUI::International::get(407).'';
}
$temp .= '
';
return $temp;
@@ -47,6 +67,7 @@ sub _replacement {
sub process {
my ($output, $temp);
$output = $_[0];
+ $output =~ s/\^L\((.*?)\)\;/_replacement($1)/ge;
$output =~ s/\^L\;/_replacement()/ge;
return $output;
}
diff --git a/lib/WebGUI/Macro/Thumbnail.pm b/lib/WebGUI/Macro/Thumbnail.pm
new file mode 100644
index 000000000..97b1f1189
--- /dev/null
+++ b/lib/WebGUI/Macro/Thumbnail.pm
@@ -0,0 +1,40 @@
+package WebGUI::Macro::Thumbnail;
+
+#-------------------------------------------------------------------
+# WebGUI is Copyright 2001-2002 Plain Black Software.
+#-------------------------------------------------------------------
+# Please read the legal notices (docs/legal.txt) and the license
+# (docs/license.txt) that came with this distribution before using
+# this software.
+#-------------------------------------------------------------------
+# http://www.plainblack.com info@plainblack.com
+#-------------------------------------------------------------------
+
+use strict;
+use Tie::CPHash;
+use WebGUI::Attachment;
+use WebGUI::Macro;
+use WebGUI::Session;
+use WebGUI::SQL;
+
+#-------------------------------------------------------------------
+sub _replacement {
+ my (@param, %data, $image);
+ tie %data, 'Tie::CPHash';
+ @param = WebGUI::Macro::getParams($_[0]);
+ %data = WebGUI::SQL->quickHash("select * from images where name='$param[0]'");
+ $image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
+ return $image->getThumbnail;
+}
+
+#-------------------------------------------------------------------
+sub process {
+ my ($output, $temp);
+ $output = $_[0];
+ $output =~ s/\^Thumbnail\((.*?)\)\;/_replacement($1)/ge;
+ return $output;
+}
+
+1;
+
+
diff --git a/lib/WebGUI/Macro/i_imageNoTags.pm b/lib/WebGUI/Macro/i_imageNoTags.pm
index 0d8342c6f..4e819d3e2 100644
--- a/lib/WebGUI/Macro/i_imageNoTags.pm
+++ b/lib/WebGUI/Macro/i_imageNoTags.pm
@@ -12,18 +12,19 @@ package WebGUI::Macro::i_imageNoTags;
use strict;
use Tie::CPHash;
+use WebGUI::Attachment;
use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
sub _replacement {
- my (@param, $temp, %data);
+ my (@param, $image, %data);
tie %data, 'Tie::CPHash';
@param = WebGUI::Macro::getParams($_[0]);
%data = WebGUI::SQL->quickHash("select * from images where name='$param[0]'");
- $temp = $session{setting}{attachmentDirectoryWeb}.'/images/'.$data{imageId}.'/'.$data{filename};
- return $temp;
+ $image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
+ return $image->getURL;
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Node.pm b/lib/WebGUI/Node.pm
new file mode 100644
index 000000000..1321d3ff3
--- /dev/null
+++ b/lib/WebGUI/Node.pm
@@ -0,0 +1,131 @@
+package WebGUI::Node;
+
+=head1 LEGAL
+
+ -------------------------------------------------------------------
+ WebGUI is Copyright 2001-2002 Plain Black Software.
+ -------------------------------------------------------------------
+ Please read the legal notices (docs/legal.txt) and the license
+ (docs/license.txt) that came with this distribution before using
+ this software.
+ -------------------------------------------------------------------
+ http://www.plainblack.com info@plainblack.com
+ -------------------------------------------------------------------
+
+=cut
+
+use File::Path;
+use POSIX;
+use strict;
+use WebGUI::Session;
+
+=head1 NAME
+
+ Package WebGUI::Node
+
+=head1 SYNOPSIS
+
+ use WebGUI::Node;
+ $node = WebGUI::Node->new("100","20");
+
+ $node->create;
+ $node->delete;
+ $node->getPath;
+ $node->getURL;
+
+=head1 DESCRIPTION
+
+ Package to manipulate WebGUI storage nodes. The nodes system is a
+ two-tiered filesystem hash that WebGUI uses to keep attachment
+ data separated. There should be no need for anyone other than
+ Plain Black Software to use this package.
+
+=head1 METHODS
+
+ These methods are available from this package:
+
+=cut
+
+
+#-------------------------------------------------------------------
+
+=head2 create ( )
+
+ Creates this node on the file system.
+
+=cut
+
+sub create {
+ mkdir($session{setting}{attachmentDirectoryLocal}.'/'.$_[0]->{_node1},0755);
+ if ($_[0]->{_node2} ne "") {
+ mkdir($session{setting}{attachmentDirectoryLocal}.'/'.$_[0]->{_node1}.'/'.$_[0]->{_node2},0755);
+ }
+}
+
+#-------------------------------------------------------------------
+
+=head2 delete ( )
+
+ Deletes this node and its contents (if any) from the filesystem.
+
+=cut
+
+sub delete {
+ rmtree($_[0]->getPath);
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getPath ( )
+
+ Returns a full path to this node.
+
+=cut
+
+sub getPath {
+ my ($path);
+ $path = $session{setting}{attachmentDirectoryLocal}.'/'.$_[0]->{_node1};
+ if ($_[0]->{_node2} ne "") {
+ $path .= '/'.$_[0]->{_node2};
+ }
+ return $path;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getURL ( )
+
+ Returns a full URL to this node.
+
+=cut
+
+sub getURL {
+ my ($url);
+ $url = $session{setting}{attachmentDirectoryWeb}.'/'.$_[0]->{_node1};
+ if ($_[0]->{_node2} ne "") {
+ $url .= '/'.$_[0]->{_node2};
+ }
+ return $url;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 new ( node1 [, node2 ] )
+
+ Constructor.
+
+=cut
+
+sub new {
+ my ($class, $node1, $node2) = @_;
+ bless {_node1 => $node1, _node2 => $node2}, $class;
+}
+
+
+
+1;
+
+
diff --git a/lib/WebGUI/Operation/Account.pm b/lib/WebGUI/Operation/Account.pm
index cd1a795ed..574f19618 100644
--- a/lib/WebGUI/Operation/Account.pm
+++ b/lib/WebGUI/Operation/Account.pm
@@ -20,6 +20,7 @@ use WebGUI::ErrorHandler;
use WebGUI::Form;
use WebGUI::International;
use WebGUI::Mail;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -489,7 +490,7 @@ sub www_updateAccount {
#-------------------------------------------------------------------
sub www_viewMessageLog {
- my (@data, $output, $sth, @row, $i, $dataRows, $prevNextBar);
+ my (@data, $output, $sth, @row, $i, $p);
if (WebGUI::Privilege::isInGroup(2,$session{user}{userId})) {
$output = ''.WebGUI::International::get(159).'
';
$sth = WebGUI::SQL->read("select messageLogId,message,url,dateOfEntry from messageLog where userId=$session{user}{userId} order by dateOfEntry desc");
@@ -507,16 +508,16 @@ sub www_viewMessageLog {
$i++;
}
$sth->finish;
- ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=viewMessageLog'),\@row);
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewMessageLog'),\@row);
$output .= '';
$output .= '
';
- if ($dataRows eq "") {
+ if ($p->getPage($session{form}{pn}) eq "") {
$output .= '| '.WebGUI::International::get(353).' |
';
} else {
- $output .= $dataRows;
+ $output .= $p->getPage($session{form}{pn});
}
$output .= '
';
- $output .= $prevNextBar;
+ $output .= $p->getBarSimple($session{form}{pn});
$output .= _accountOptions();
} else {
$output = WebGUI::Privilege::insufficient();
diff --git a/lib/WebGUI/Operation/Admin.pm b/lib/WebGUI/Operation/Admin.pm
index 686024349..426d387df 100644
--- a/lib/WebGUI/Operation/Admin.pm
+++ b/lib/WebGUI/Operation/Admin.pm
@@ -22,7 +22,7 @@ our @EXPORT = qw(&www_switchOffAdmin &www_switchOnAdmin);
#-------------------------------------------------------------------
sub www_switchOffAdmin {
if ($session{var}{sessionId}) {
- WebGUI::SQL->write("update session set adminOn=0 where sessionId='$session{var}{sessionId}'");
+ WebGUI::SQL->write("update userSession set adminOn=0 where sessionId='$session{var}{sessionId}'");
WebGUI::Session::refreshSessionVars($session{var}{sessionId});
return "";
} else {
@@ -33,7 +33,7 @@ sub www_switchOffAdmin {
#-------------------------------------------------------------------
sub www_switchOnAdmin {
if ($session{var}{sessionId}) {
- WebGUI::SQL->write("update session set adminOn=1 where sessionId='$session{var}{sessionId}'");
+ WebGUI::SQL->write("update userSession set adminOn=1 where sessionId='$session{var}{sessionId}'");
WebGUI::Session::refreshSessionVars($session{var}{sessionId});
return "";
} else {
diff --git a/lib/WebGUI/Operation/Group.pm b/lib/WebGUI/Operation/Group.pm
index 62228b659..5e4875a34 100644
--- a/lib/WebGUI/Operation/Group.pm
+++ b/lib/WebGUI/Operation/Group.pm
@@ -16,6 +16,7 @@ use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::Form;
use WebGUI::International;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -146,7 +147,7 @@ sub www_editGroupSave {
#-------------------------------------------------------------------
sub www_listGroups {
- my ($output, $dataRows, $prevNextBar, $sth, @data, @row, $i);
+ my ($output, $p, $sth, @data, @row, $i);
if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(10);
$output .= ''.WebGUI::International::get(89).'
';
@@ -165,11 +166,11 @@ sub www_listGroups {
$i++;
}
$sth->finish;
- ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=listGroups'),\@row);
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroups'),\@row);
$output .= '';
- $output .= $dataRows;
+ $output .= $p->getPage($session{form}{pn});
$output .= '
';
- $output .= $prevNextBar;
+ $output .= $p->getBarTraditional($session{form}{pn});
return $output;
} else {
return WebGUI::Privilege::adminOnly();
diff --git a/lib/WebGUI/Operation/Image.pm b/lib/WebGUI/Operation/Image.pm
index 039ab03b7..c7bf61195 100644
--- a/lib/WebGUI/Operation/Image.pm
+++ b/lib/WebGUI/Operation/Image.pm
@@ -16,6 +16,7 @@ use WebGUI::Attachment;
use WebGUI::DateTime;
use WebGUI::Form;
use WebGUI::International;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -56,9 +57,11 @@ sub www_addImageSave {
my ($imageId, $file);
if (WebGUI::Privilege::isInGroup(4)) {
$imageId = getNextId("imageId");
- $file = WebGUI::Attachment::save("filename","images",$imageId);
+ $file = WebGUI::Attachment->new("newFile","images",$imageId);
+ $file->save("filename");
WebGUI::SQL->write("insert into images values ($imageId, ".quote($session{form}{name}).
- ", ".quote($file).", ".quote($session{form}{parameters}).", $session{user}{userId}, ".
+ ", ".quote($file->getFilename).", ".quote($session{form}{parameters}).
+ ", $session{user}{userId}, ".
quote($session{user}{username}).", ".time().")");
return www_listImages();
} else {
@@ -86,8 +89,10 @@ sub www_deleteImage {
#-------------------------------------------------------------------
sub www_deleteImageConfirm {
+ my ($image);
if (WebGUI::Privilege::isInGroup(4)) {
- WebGUI::Attachment::deleteSubmission("images",$session{form}{iid});
+ $image = WebGUI::Attachment->new("","images",$session{form}{iid});
+ $image->deleteNode;
WebGUI::SQL->write("delete from images where imageId=$session{form}{iid}");
return www_listImages();
} else {
@@ -98,7 +103,6 @@ sub www_deleteImageConfirm {
#-------------------------------------------------------------------
sub www_deleteImageFile {
if (WebGUI::Privilege::isInGroup(4)) {
- WebGUI::Attachment::deleteSubmission("images",$session{form}{iid});
WebGUI::SQL->write("update images set filename='' where imageId=$session{form}{iid}");
return www_editImage();
} else {
@@ -108,10 +112,11 @@ sub www_deleteImageFile {
#-------------------------------------------------------------------
sub www_editImage {
- my ($output, %data);
+ my ($output, %data, $image);
tie %data, 'Tie::CPHash';
if (WebGUI::Privilege::isInGroup(4)) {
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
+ $image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
$output = helpLink(20);
$output .= ''.WebGUI::International::get(382).'
';
$output .= formHeader();
@@ -135,9 +140,7 @@ sub www_editImage {
$output .= formSave();
$output .= '';
if ($data{filename} ne "") {
- $output .= ''.WebGUI::International::get(390).'
';
+ $output .= '
'.WebGUI::International::get(390).'
';
}
return $output;
} else {
@@ -147,15 +150,17 @@ sub www_editImage {
#-------------------------------------------------------------------
sub www_editImageSave {
- my ($file);
+ my ($file, $sqlAdd);
if (WebGUI::Privilege::isInGroup(4)) {
- $file = WebGUI::Attachment::save("filename","images",$session{form}{iid});
- if ($file ne "") {
- $file = ", filename=".quote($file);
+ $file = WebGUI::Attachment->new("","images",$session{form}{iid});
+ $file->save("filename");
+ if ($file->getFilename) {
+ $sqlAdd = ", filename=".quote($file->getFilename);
}
WebGUI::SQL->write("update images set name=".quote($session{form}{name}).
- $file.", parameters=".quote($session{form}{parameters}).", userId=$session{user}{userId}, ".
- " username=".quote($session{user}{username}).", dateUploaded=".time()." where imageId=$session{form}{iid}");
+ $sqlAdd.", parameters=".quote($session{form}{parameters}).", userId=$session{user}{userId}, ".
+ " username=".quote($session{user}{username}).
+ ", dateUploaded=".time()." where imageId=$session{form}{iid}");
return www_listImages();
} else {
return WebGUI::Privilege::insufficient();
@@ -164,7 +169,7 @@ sub www_editImageSave {
#-------------------------------------------------------------------
sub www_listImages {
- my ($output, $sth, %data, @row, $dataRows, $prevNextBar, $i, $search, $isAdmin);
+ my ($output, $sth, %data, @row, $image, $p, $i, $search, $isAdmin);
tie %data, 'Tie::CPHash';
if (WebGUI::Privilege::isInGroup(4)) {
$output = helpLink(26);
@@ -173,27 +178,30 @@ sub www_listImages {
$output .= ''.WebGUI::International::get(395).'';
$output .= ''.formHeader().'
';
$output .= WebGUI::Form::hidden("op","listImages");
- $output .= WebGUI::Form::text("keyword",20,50);
+ $output .= WebGUI::Form::text("keyword",20,50,$session{form}{keyword});
$output .= WebGUI::Form::submit(WebGUI::International::get(170));
$output .= ' | ';
if ($session{form}{keyword} ne "") {
$search = " where (name like '%".$session{form}{keyword}.
+ "%' or username like '%".$session{form}{keyword}.
"%' or filename like '%".$session{form}{keyword}."%') ";
}
$isAdmin = WebGUI::Privilege::isInGroup(3);
$sth = WebGUI::SQL->read("select * from images $search order by name");
while (%data = $sth->hash) {
+ $image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
$row[$i] = '
';
if ($session{user}{userId} == $data{userId} || $isAdmin) {
$row[$i] .= ' ';
$row[$i] .= ' ';
- } else {
- $row[$i] .= ' ';
}
+ $row[$i] .= ' ';
$row[$i] .= ' | ';
+ $row[$i] .= ' ';
$row[$i] .= ' | '.$data{name}.' | ';
$row[$i] .= ''.$data{username}.' | ';
$row[$i] .= ''.WebGUI::DateTime::epochToHuman($data{dateUploaded},"%M/%D/%y").' | ';
@@ -201,11 +209,11 @@ sub www_listImages {
$i++;
}
$sth->finish;
- ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=listImages'),\@row);
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=listImages'),\@row);
$output .= '';
- $output .= $dataRows;
+ $output .= $p->getPage($session{form}{pn});
$output .= '
';
- $output .= $prevNextBar;
+ $output .= $p->getBarTraditional($session{form}{pn});
return $output;
} else {
return WebGUI::Privilege::insufficient();
@@ -214,10 +222,11 @@ sub www_listImages {
#-------------------------------------------------------------------
sub www_viewImage {
- my ($output, %data);
+ my ($output, %data, $image);
tie %data, 'Tie::CPHash';
if (WebGUI::Privilege::isInGroup(4)) {
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
+ $image = WebGUI::Attachment->new($data{filename},"images",$data{imageId});
$output .= ''.WebGUI::International::get(396).'
';
$output .= ''.WebGUI::International::get(397).'';
$output .= '';
@@ -229,8 +238,7 @@ sub www_viewImage {
$output .= tableFormRow(WebGUI::International::get(388),
WebGUI::DateTime::epochToHuman($data{dateUploaded},"%M/%D/%y"));
$output .= '
';
- $output .= '
';
+ $output .= '
';
return $output;
} else {
return WebGUI::Privilege::insufficient();
diff --git a/lib/WebGUI/Operation/Search.pm b/lib/WebGUI/Operation/Search.pm
index e80203b1b..2bc8d8058 100644
--- a/lib/WebGUI/Operation/Search.pm
+++ b/lib/WebGUI/Operation/Search.pm
@@ -14,6 +14,7 @@ use Exporter;
use strict;
use Tie::IxHash;
use WebGUI::International;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -26,7 +27,7 @@ our @EXPORT = qw(&www_search);
#-------------------------------------------------------------------
sub www_search {
- my ($dataRows, $prevNextBar, $output, %page, @keyword, $pageId, $term, %result, $sth, @data, @row, $i);
+ my ($p, $output, %page, @keyword, $pageId, $term, %result, $sth, @data, @row, $i);
tie %result,'Tie::IxHash';
$output = formHeader();
$output .= WebGUI::Form::hidden("op","search");
@@ -69,10 +70,10 @@ sub www_search {
}
}
if ($row[0] ne "") {
- ($dataRows, $prevNextBar) = paginate(20,WebGUI::URL::page('op=search'),\@row);
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=search'),\@row,20);
$output .= WebGUI::International::get(365).'
';
- $output .= $dataRows;
- $output .= '
'.$prevNextBar;
+ $output .= $p->getPage($session{form}{pn});
+ $output .= ''.$p->getBarTradiational($session{form}{pn});
} else {
$output .= WebGUI::International::get(366);
}
diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm
index 2b91a749b..7b9cacca6 100644
--- a/lib/WebGUI/Operation/Settings.pm
+++ b/lib/WebGUI/Operation/Settings.pm
@@ -111,10 +111,16 @@ sub www_editFileSettings {
$output .= formHeader();
$output .= WebGUI::Form::hidden("op","editFileSettingsSave");
$output .= '';
- $output .= tableFormRow(WebGUI::International::get(129),WebGUI::Form::text("lib",30,255,$session{setting}{lib}));
- $output .= tableFormRow(WebGUI::International::get(130),WebGUI::Form::text("maxAttachmentSize",30,11,$session{setting}{maxAttachmentSize}));
- $output .= tableFormRow(WebGUI::International::get(131),WebGUI::Form::text("attachmentDirectoryWeb",30,255,$session{setting}{attachmentDirectoryWeb}));
- $output .= tableFormRow(WebGUI::International::get(132),WebGUI::Form::text("attachmentDirectoryLocal",30,255,$session{setting}{attachmentDirectoryLocal}));
+ $output .= tableFormRow(WebGUI::International::get(129),
+ WebGUI::Form::text("lib",30,255,$session{setting}{lib}));
+ $output .= tableFormRow(WebGUI::International::get(130),
+ WebGUI::Form::text("maxAttachmentSize",30,11,$session{setting}{maxAttachmentSize}));
+ $output .= tableFormRow(WebGUI::International::get(406),
+ WebGUI::Form::text("thumbnailSize",30,3,$session{setting}{thumbnailSize}));
+ $output .= tableFormRow(WebGUI::International::get(131),
+ WebGUI::Form::text("attachmentDirectoryWeb",30,255,$session{setting}{attachmentDirectoryWeb}));
+ $output .= tableFormRow(WebGUI::International::get(132),
+ WebGUI::Form::text("attachmentDirectoryLocal",30,255,$session{setting}{attachmentDirectoryLocal}));
$output .= formSave();
$output .= '
';
$output .= ' ';
@@ -128,9 +134,14 @@ sub www_editFileSettings {
sub www_editFileSettingsSave {
if (WebGUI::Privilege::isInGroup(3)) {
WebGUI::SQL->write("update settings set value=".quote($session{form}{lib})." where name='lib'");
- WebGUI::SQL->write("update settings set value=".quote($session{form}{maxAttachmentSize})." where name='maxAttachmentSize'");
- WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryWeb})." where name='attachmentDirectoryWeb'");
- WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryLocal})." where name='attachmentDirectoryLocal'");
+ WebGUI::SQL->write("update settings set value=".
+ quote($session{form}{maxAttachmentSize})." where name='maxAttachmentSize'");
+ WebGUI::SQL->write("update settings set value=".
+ quote($session{form}{thumbnailSize})." where name='thumbnailSize'");
+ WebGUI::SQL->write("update settings set value=".
+ quote($session{form}{attachmentDirectoryWeb})." where name='attachmentDirectoryWeb'");
+ WebGUI::SQL->write("update settings set value=".
+ quote($session{form}{attachmentDirectoryLocal})." where name='attachmentDirectoryLocal'");
return www_manageSettings();
} else {
return WebGUI::Privilege::adminOnly();
diff --git a/lib/WebGUI/Operation/Style.pm b/lib/WebGUI/Operation/Style.pm
index 3a58758c9..8b35911e6 100644
--- a/lib/WebGUI/Operation/Style.pm
+++ b/lib/WebGUI/Operation/Style.pm
@@ -15,6 +15,7 @@ use strict;
use Tie::CPHash;
use WebGUI::Form;
use WebGUI::International;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -142,7 +143,7 @@ sub www_editStyleSave {
#-------------------------------------------------------------------
sub www_listStyles {
- my ($output, $sth, @data, @row, $i, $prevNextBar, $dataRows);
+ my ($output, $sth, @data, @row, $i, $p);
if (WebGUI::Privilege::isInGroup(5)) {
$output = helpLink(9);
$output .= ''.WebGUI::International::get(157).'
';
@@ -161,11 +162,11 @@ sub www_listStyles {
$i++;
}
$sth->finish;
- ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=listStyles'),\@row);
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=listStyles'),\@row);
$output .= '';
- $output .= $dataRows;
+ $output .= $p->getPage($session{form}{pn});
$output .= '
';
- $output .= $prevNextBar;
+ $output .= $p->getBarTraditional($session{form}{pn});
return $output;
} else {
return WebGUI::Privilege::adminOnly();
diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm
index 165647bc8..d1fadf9ed 100644
--- a/lib/WebGUI/Operation/User.pm
+++ b/lib/WebGUI/Operation/User.pm
@@ -17,6 +17,7 @@ use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::Form;
use WebGUI::International;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -67,7 +68,8 @@ sub www_addUser {
sub www_addUserSave {
my ($output, @groups, $uid, $gid, $encryptedPassword, $expireAfter);
if (WebGUI::Privilege::isInGroup(3)) {
- ($uid) = WebGUI::SQL->quickArray("select userId from users where username='$session{form}{username}'");
+ ($uid) = WebGUI::SQL->quickArray("select userId from users where username=".
+ quote($session{form}{username}));
unless ($uid) {
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier});
$uid = getNextId("userId");
@@ -276,7 +278,8 @@ sub www_editUser {
sub www_editUserSave {
my ($error, $uid, $encryptedPassword, $passwordStatement);
if (WebGUI::Privilege::isInGroup(3)) {
- ($uid) = WebGUI::SQL->quickArray("select userId from users where username='$session{form}{username}'");
+ ($uid) = WebGUI::SQL->quickArray("select userId from users where username=".
+ quote($session{form}{username}));
if ($uid == $session{form}{uid} || $uid < 1) {
if ($session{form}{identifier} ne "password") {
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier});
@@ -311,7 +314,7 @@ sub www_editUserGroupSave {
#-------------------------------------------------------------------
sub www_listUsers {
- my ($output, $sth, @data, @row, $dataRows, $prevNextBar, $i, $search);
+ my ($output, $sth, @data, @row, $p, $i, $search);
if (WebGUI::Privilege::isInGroup(3)) {
$output = helpLink(8);
$output .= ''.WebGUI::International::get(149).'
';
@@ -342,11 +345,11 @@ sub www_listUsers {
$i++;
}
$sth->finish;
- ($dataRows, $prevNextBar) = paginate(50,WebGUI::URL::page('op=listUsers'),\@row);
+ $p = WebGUI::Paginator->new(WebGUI::URL::page('op=listUsers'),\@row);
$output .= '';
- $output .= $dataRows;
+ $output .= $p->getPage($session{form}{pn});
$output .= '
';
- $output .= $prevNextBar;
+ $output .= $p->getBarTraditional($session{form}{pn});
return $output;
} else {
return WebGUI::Privilege::adminOnly();
diff --git a/lib/WebGUI/Paginator.pm b/lib/WebGUI/Paginator.pm
new file mode 100644
index 000000000..a6f224777
--- /dev/null
+++ b/lib/WebGUI/Paginator.pm
@@ -0,0 +1,410 @@
+package WebGUI::Paginator;
+
+=head1 LEGAL
+
+ -------------------------------------------------------------------
+ WebGUI is Copyright 2001-2002 Plain Black Software.
+ -------------------------------------------------------------------
+ Please read the legal notices (docs/legal.txt) and the license
+ (docs/license.txt) that came with this distribution before using
+ this software.
+ -------------------------------------------------------------------
+ http://www.plainblack.com info@plainblack.com
+ -------------------------------------------------------------------
+
+=cut
+
+use strict;
+use WebGUI::International;
+use WebGUI::URL;
+
+=head1 NAME
+
+ Package WebGUI::Paginator
+
+=head1 SYNOPSIS
+
+ use WebGUI::Paginator;
+ $p = WebGUI::Paginator->new("/index.pl/page_name?this=that",\@row);
+ $p->getBar(2);
+ $p->getBarAdvanced(2);
+ $p->getBarSimple(2);
+ $p->getBarTraditional(2);
+ $p->getFirstPageLink(2);
+ $p->getLastPageLink(2);
+ $p->getNextPageLink(2);
+ $p->getNumberOfPages;
+ $p->getPage(2);
+ $p->getPageLinks(2);
+ $p->getPreviousPageLink(2);
+
+=head1 DESCRIPTION
+
+ Package that paginates rows of data for display on the web.
+
+=head1 METHODS
+
+ These methods are available from this class:
+
+=cut
+
+
+#-------------------------------------------------------------------
+sub _generatePages {
+ my (@page, $row, @rows, $rowRef, $pn, $i, $itemsPerPage);
+ $rowRef = $_[0];
+ @rows = @{$rowRef};
+ $itemsPerPage = $_[1];
+ foreach $row (@rows) {
+ $page[$pn] .= $row;
+ $i++;
+ if ($i >= $itemsPerPage) {
+ $i = 0;
+ $pn++;
+ }
+ }
+ return \@page;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getBar ( [ pageNumber ] )
+
+ Returns the pagination bar including First, Previous, Next, and
+ last links. If there's only one page, nothing is returned.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getBar {
+ my ($output);
+ if ($_[0]->getNumberOfPages > 1) {
+ $output = '';
+ return $output;
+ } else {
+ return "";
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getBarAdvanced ( [ pageNumber ] )
+
+ Returns the pagination bar including First, Previous, Page Numbers,
+ Next, and Last links. If there's only one page, nothing is
+ returned.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getBarAdvanced {
+ my ($output);
+ if ($_[0]->getNumberOfPages > 1) {
+ $output = '';
+ return $output;
+ } else {
+ return "";
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getBarSimple ( [ pageNumber ] )
+
+ Returns the pagination bar including only Previous and Next links.
+ If there's only one page, nothing is returned.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getBarSimple {
+ my ($output);
+ if ($_[0]->getNumberOfPages > 1) {
+ $output = '';
+ return $output;
+ } else {
+ return "";
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getBarTraditional ( [ pageNumber ] )
+
+ Returns the pagination bar including Previous, Page Numbers,
+ and Next links. If there's only one page, nothing is
+ returned.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getBarTraditional {
+ my ($output);
+ if ($_[0]->getNumberOfPages > 1) {
+ $output = '';
+ return $output;
+ } else {
+ return "";
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getFirstPageLink ( [ pageNumber ] )
+
+ Returns a link to the first page's data.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getFirstPageLink {
+ my ($text, $pn);
+ $pn = $_[1] || 1;
+ $text = '|<'.WebGUI::International::get(404);
+ if ($pn > 1) {
+ return ''.$text.'';
+ } else {
+ return $text;
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getLastPageLink ( [ pageNumber ] )
+
+ Returns a link to the last page's data.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getLastPageLink {
+ my ($text, $pn);
+ $pn = $_[1] || 1;
+ $text = WebGUI::International::get(405).'>|';
+ if ($pn != $_[0]->getNumberOfPages) {
+ return ''.$text.'';
+ } else {
+ return $text;
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getNextPageLink ( [ pageNumber ] )
+
+ Returns a link to the next page's data.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getNextPageLink {
+ my ($text, $pn);
+ $pn = $_[1] || 1;
+ $text = WebGUI::International::get(92).'»';
+ if ($pn < $_[0]->getNumberOfPages) {
+ return ''.$text.'';
+ } else {
+ return $text;
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getNumberOfPages ( )
+
+ Returns the number of pages in this paginator.
+
+=cut
+
+sub getNumberOfPages {
+ return $#{$_[0]->{_pageRef}}+1;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getPage ( [ pageNumber ] )
+
+ Returns the data from the page specified.
+
+=item pageNumber
+
+ The page number you wish to view. If omitted, page one is assumed.
+
+=cut
+
+sub getPage {
+ my ($pn);
+ $pn = $_[1] || 1;
+ return $_[0]->{_pageRef}[$pn-1];
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getPageLinks ( [ pageNumber ] )
+
+ Returns links to all pages in this paginator.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omited, page one
+ is assumed.
+
+=cut
+
+sub getPageLinks {
+ my ($i, $output, $pn);
+ $pn = $_[1] || 1;
+ for ($i=0; $i<$_[0]->getNumberOfPages; $i++) {
+ if ($i+1 == $pn) {
+ $output .= ' '.($i+1).' ';
+ } else {
+ $output .= ' '.($i+1).' ';
+ }
+ }
+ return $output;
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 getPreviousPageLink ( [ pageNumber ] )
+
+ Returns a link to the previous page's data.
+
+=item pageNumber
+
+ The page number you're currently looking at. If omitted, page one
+ is assumed.
+
+=cut
+
+sub getPreviousPageLink {
+ my ($text, $pn);
+ $pn = $_[1] || 1;
+ $text = '«'.WebGUI::International::get(91);
+ if ($pn > 1) {
+ return ''.$text.'';
+ } else {
+ return $text;
+ }
+}
+
+
+#-------------------------------------------------------------------
+
+=head2 new ( currentURL, rowArrayRef [, paginateAfter, alternateFormVar ] )
+
+ Constructor.
+
+=item currentURL
+
+ The URL of the current page including attributes. The page number
+ will be appended to this in all links generated by the paginator.
+
+=item rowArrayRef
+
+ An array reference to all the rows of data for this page.
+
+=item paginateAfter
+
+ The number of rows to display per page. If left blank it defaults
+ to 50.
+
+=item alternateFormVar
+
+ By default the paginator uses a form variable of "pn" to denote the
+ page number. If you wish it to use some other variable, then specify
+ it here.
+
+=cut
+
+sub new {
+ my ($class, $currentURL, $rowsPerPage, $rowRef, $formVar, $pageRef);
+ $class = shift;
+ $currentURL = shift;
+ $rowRef = shift;
+ $rowsPerPage = shift || 50;
+ $formVar = shift || "pn";
+ $pageRef = _generatePages($rowRef,$rowsPerPage);
+ bless {_url => $currentURL, _rpp => $rowsPerPage, _rowRef => $rowRef,
+ _pn => $formVar, _pageRef => $pageRef}, $class;
+}
+
+
+
+
+1;
+
+
diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm
index 669d13804..e44c4b234 100644
--- a/lib/WebGUI/SQL.pm
+++ b/lib/WebGUI/SQL.pm
@@ -1,14 +1,18 @@
package WebGUI::SQL;
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
+=head1 LEGAL
+
+ -------------------------------------------------------------------
+ WebGUI is Copyright 2001-2002 Plain Black Software.
+ -------------------------------------------------------------------
+ Please read the legal notices (docs/legal.txt) and the license
+ (docs/license.txt) that came with this distribution before using
+ this software.
+ -------------------------------------------------------------------
+ http://www.plainblack.com info@plainblack.com
+ -------------------------------------------------------------------
+
+=cut
use CGI::Carp qw(fatalsToBrowser);
use DBI;
@@ -21,12 +25,76 @@ use WebGUI::Session;
our @ISA = qw(Exporter);
our @EXPORT = qw("e &getNextId);
+=head1 NAME
+
+ Package WebGUI::SQL
+
+=head1 SYNOPSIS
+
+ use WebGUI::SQL;
+ $sth = WebGUI::SQL->new($sql);
+ $sth = WebGUI::SQL->read($sql);
+ $sth = WebGUI::SQL->unconditionalRead($sql);
+ $sth->array;
+ $sth->getColumnNames;
+ $sth->hash;
+ $sth->hashRef;
+ $sth->rows;
+ $sth->finish;
+
+ @arr = WebGUI::SQL->buildArray($sql);
+ %hash = WebGUI::SQL->buildHash($sql);
+ @arr = WebGUI::SQL->quickArray($sql);
+ %hash = WebGUI::SQL->quickHash($sql);
+
+ WebGUI::SQL->write($sql);
+
+ $id = getNextId("widgetId");
+ $string = quote($string);
+
+=head1 DESCRIPTION
+
+ Package for interfacing with SQL databases. This package
+ implements Perl DBI functionality in a less code-intensive
+ manner and adds some extra functionality.
+
+=head1 METHODS
+
+ These methods are available from this package:
+
+=cut
+
+
#-------------------------------------------------------------------
+
+=head2 array ( )
+
+ Returns the next row of data as an array.
+
+=cut
+
sub array {
return $_[0]->{_sth}->fetchrow_array() or WebGUI::ErrorHandler::fatalError("Couldn't fetch array. ".$_[0]->{_sth}->errstr);
}
+
#-------------------------------------------------------------------
+
+=head2 buildArray ( sql [, dbh ] )
+
+ Builds an array of data from a series of rows.
+
+=item sql
+
+ An SQL query. The query must select only one column of data.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub buildArray {
my ($sth, $data, @array, $i);
$sth = WebGUI::SQL->read($_[1],$_[2]);
@@ -39,7 +107,25 @@ sub buildArray {
return @array;
}
+
#-------------------------------------------------------------------
+
+=head2 buildHash ( sql [, dbh ] )
+
+ Builds a hash of data from a series of rows.
+
+=item sql
+
+ An SQL query. The query must select only two columns of data, the
+ first being the key for the hash, the second being the value.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub buildHash {
my ($sth, %hash, @data);
tie %hash, "Tie::IxHash";
@@ -55,17 +141,48 @@ sub buildHash {
return %hash;
}
+
#-------------------------------------------------------------------
+
+=head2 finish ( )
+
+ Ends a query after calling the "new" or "read" methods.
+
+=cut
+
sub finish {
return $_[0]->{_sth}->finish;
}
+
#-------------------------------------------------------------------
+
+=head2 getColumnNames {
+
+ Returns an array of column names. Use with a "read" method.
+
+=cut
+
sub getColumnNames {
return @{$_[0]->{_sth}->{NAME}};
}
+
#-------------------------------------------------------------------
+
+=head2 getNextId ( idName )
+
+ Increments an incrementer of the specified type and returns the
+ value. NOTE: This is not a regular method, but is an exported
+ subroutine.
+
+=item idName
+
+ Specify the name of one of the incrementers in the incrementer
+ table.
+
+=cut
+
sub getNextId {
my ($id);
($id) = WebGUI::SQL->quickArray("select nextValue from incrementer where incrementerId='$_[0]'");
@@ -73,7 +190,16 @@ sub getNextId {
return $id;
}
+
#-------------------------------------------------------------------
+
+=head2 hash
+
+ Returns the next row of data in the form of a hash. Must be
+ executed on a statement handler returned by the "read" method.
+
+=cut
+
sub hash {
my ($hashRef);
$hashRef = $_[0]->{_sth}->fetchrow_hashref();
@@ -84,12 +210,38 @@ sub hash {
}
}
+
#-------------------------------------------------------------------
+
+=head2 hashRef
+
+ Returns the next row of data in the form of a hash reference. Must
+ be executed on a statement handler returned by the "read" method.
+
+=cut
+
sub hashRef {
return $_[0]->{_sth}->fetchrow_hashref() or WebGUI::ErrorHandler::fatalError("Couldn't fetch hashref. ".$_[0]->{_sth}->errstr);
}
+
#-------------------------------------------------------------------
+
+=head2 new ( sql [, dbh ] )
+
+ Constructor. Returns a statement handler.
+
+=item sql
+
+ An SQL query.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub new {
my ($class, $sql, $dbh, $sth);
$class = shift;
@@ -100,7 +252,24 @@ sub new {
bless ({_sth => $sth}, $class);
}
+
#-------------------------------------------------------------------
+
+=head2 quickArray ( sql [, dbh ] )
+
+ Executes a query and returns a single row of data as an array.
+
+=item sql
+
+ An SQL query.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub quickArray {
my ($sth, @data);
$sth = WebGUI::SQL->new($_[1],$_[2]);
@@ -109,7 +278,24 @@ sub quickArray {
return @data;
}
+
#-------------------------------------------------------------------
+
+=head2 quickHash ( sql [, dbh ] )
+
+ Executes a query and returns a single row of data as a hash.
+
+=item sql
+
+ An SQL query.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub quickHash {
my ($sth, $data);
$sth = WebGUI::SQL->new($_[1],$_[2]);
@@ -120,23 +306,83 @@ sub quickHash {
}
}
+
#-------------------------------------------------------------------
+
+=head2 quote ( string )
+
+ Returns a string quoted and ready for insert into the database.
+ NOTE: This is not a regular method, but is an exported subroutine.
+
+=item string
+
+ Any scalar variable that needs to be escaped to be inserted into
+ the database.
+
+=cut
+
sub quote {
my $value = $_[0]; #had to add this here cuz Tie::CPHash variables cause problems otherwise.
return $WebGUI::Session::session{dbh}->quote($value);
}
+
#-------------------------------------------------------------------
+
+=head2 read ( sql [, dbh ] )
+
+ An alias of the "new" method. Returns a statement handler.
+
+=item sql
+
+ An SQL query.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub read {
return WebGUI::SQL->new($_[1],$_[2],$_[3]);
}
+
#-------------------------------------------------------------------
+
+=head2 rows ( )
+
+ Returns the number of rows in a statement handler created by the
+ "read" method.
+
+=cut
+
sub rows {
return $_[0]->{_sth}->rows;
}
+
#-------------------------------------------------------------------
+
+=head2 unconditionalRead ( sql [, dbh ] )
+
+ An alias of the "read" method except that it will not cause a fatal
+ error in WebGUI if the query is invalid. This is useful for user
+ generated queries such as those in the SQL Report. Returns a
+ statement handler.
+
+=item sql
+
+ An SQL query.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub unconditionalRead {
my ($sth);
$sth = $_[2]->prepare($_[1]);
@@ -144,7 +390,26 @@ sub unconditionalRead {
bless ({_sth => $sth}, $_[0]);
}
+
#-------------------------------------------------------------------
+
+=head2 write ( sql [, dbh ] )
+
+ A method specifically designed for writing to the database in an
+ efficient manner. Writing can be accomplished using the "new"
+ method, but it is not as efficient.
+
+=item sql
+
+ An SQL insert or update.
+
+=item dbh
+
+ By default this method uses the WebGUI database handler. However,
+ you may choose to pass in your own if you wish.
+
+=cut
+
sub write {
my ($dbh);
$dbh = $_[2] || $WebGUI::Session::session{dbh};
diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm
index 983db4cc2..317fe2fa1 100644
--- a/lib/WebGUI/Session.pm
+++ b/lib/WebGUI/Session.pm
@@ -50,9 +50,9 @@ sub _getSessionVars {
my (%vars, $uid, $encryptedPassword);
tie %vars, 'Tie::CPHash';
if ($_[0] ne "") {
- %vars = WebGUI::SQL->quickHash("select * from session where sessionId='$_[0]'", $_[1]);
+ %vars = WebGUI::SQL->quickHash("select * from userSession where sessionId='$_[0]'", $_[1]);
if ($vars{sessionId} ne "") {
- WebGUI::SQL->write("update session set lastPageView=".time().", lastIP='$ENV{REMOTE_ADDR}', expires=".(time()+$_[2])." where sessionId='$_[0]'",$_[1]);
+ WebGUI::SQL->write("update userSession set lastPageView=".time().", lastIP='$ENV{REMOTE_ADDR}', expires=".(time()+$_[2])." where sessionId='$_[0]'",$_[1]);
}
}
return %vars;
@@ -82,7 +82,7 @@ sub close {
#-------------------------------------------------------------------
sub end {
- WebGUI::SQL->write("delete from session where sessionId='$_[0]'",$session{dbh});
+ WebGUI::SQL->write("delete from userSession where sessionId='$_[0]'",$session{dbh});
refreshSessionVars();
}
@@ -103,7 +103,8 @@ sub open {
tie %VARS, 'Tie::CPHash';
tie %PAGE, 'Tie::CPHash';
$CONFIG{webguiRoot} = $_[0];
- $config = new Data::Config $CONFIG{webguiRoot}.'/etc/WebGUI.conf';
+ $CONFIG{configFile} = $_[1] || "WebGUI.conf";
+ $config = new Data::Config $CONFIG{webguiRoot}.'/etc/'.$CONFIG{configFile};
foreach ($config->param) {
$CONFIG{$_} = $config->param($_);
}
@@ -115,6 +116,10 @@ sub open {
$CONFIG{scripturl} = $ENV{SCRIPT_NAME};
}
$dbh = DBI->connect($CONFIG{dsn}, $CONFIG{dbuser}, $CONFIG{dbpass}, { RaiseError => 0, AutoCommit => 1 });
+ if ( $CONFIG{dsn} =~ /Oracle/ ) { # Set Oracle specific attributes
+ $dbh->{LongReadLen} = 512 * 1024;
+ $dbh->{LongTruncOk} = 1;
+ }
$query = CGI->new();
foreach ($query->param) {
$FORM{$_} = $query->param($_);
@@ -179,7 +184,7 @@ sub start {
tie %user, 'Tie::CPHash';
%user = WebGUI::SQL->quickHash("select * from users where userId='$uid'", $session{dbh});
if (crypt($user{identifier},"yJ") eq $encryptedPassword) {
- WebGUI::SQL->write("insert into session values ('$_[0]', ".(time()+$session{setting}{sessionTimeout}).", ".time().", 0, '$ENV{REMOTE_ADDR}', $uid)",$session{dbh});
+ WebGUI::SQL->write("insert into userSession values ('$_[0]', ".(time()+$session{setting}{sessionTimeout}).", ".time().", 0, '$ENV{REMOTE_ADDR}', $uid)",$session{dbh});
refreshSessionVars($_[0]);
return 1;
} else {
diff --git a/lib/WebGUI/Shortcut.pm b/lib/WebGUI/Shortcut.pm
index 65814df44..fa4ab5d6b 100644
--- a/lib/WebGUI/Shortcut.pm
+++ b/lib/WebGUI/Shortcut.pm
@@ -28,17 +28,15 @@ our @EXPORT = qw(&attachmentBox &formHeader &formSave &tableFormRow &helpLink);
#-------------------------------------------------------------------
sub attachmentBox {
- my ($output, %fileType, $fileUrl);
- $fileUrl = $session{setting}{attachmentDirectoryWeb}.'/'.$_[1].'/';
- if ($_[2] ne "") {
- $fileUrl .= $_[2].'/';
- }
- $fileUrl .= $_[0];
- %fileType = WebGUI::Attachment::getType($_[0]);
+ my ($output, $attachment);
+ $attachment = WebGUI::Attachment->new($_[0],$_[1],$_[2]);
$output = '';
+ '
'.$attachment->getFilename.' |
';
return $output;
}
diff --git a/lib/WebGUI/Utility.pm b/lib/WebGUI/Utility.pm
index 7998711db..1b8d48474 100644
--- a/lib/WebGUI/Utility.pm
+++ b/lib/WebGUI/Utility.pm
@@ -19,41 +19,27 @@ use WebGUI::SQL;
use WebGUI::URL;
our @ISA = qw(Exporter);
-our @EXPORT = qw(&sortByColumn &sortHashDescending &sortHash
- &paginate &randint &round);
+our @EXPORT = qw(&sortByColumn &sortHashDescending &sortHash &isIn &randint &round);
#-------------------------------------------------------------------
-sub paginate {
- my ($pn, $i, $dataRows, $prevNextBar, $itemsPerPage, @row, $url);
- $itemsPerPage = $_[0];
- $url = $_[1];
- @row = @{$_[2]};
- if ($session{form}{pn} < 1) {
- $pn = 0;
- } else {
- $pn = $session{form}{pn};
- }
- for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
- $dataRows .= $row[$i];
- }
- if ($#row+1 > $itemsPerPage) {
- $prevNextBar = '';
- }
- return ($dataRows, $prevNextBar);
+sub isIn {
+ my ($i, @a, @b, @isect, %union, %isect, $e);
+ foreach $e (@_) {
+ if ($a[0] eq "") {
+ $a[0] = $e;
+ } else {
+ $b[$i] = $e;
+ $i++;
+ }
+ }
+ foreach $e (@a, @b) { $union{$e}++ && $isect{$e}++ }
+ @isect = keys %isect;
+ if (defined @isect) {
+ undef @isect;
+ return 1;
+ } else {
+ return 0;
+ }
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Widget.pm b/lib/WebGUI/Widget.pm
index e4970b086..26db7c772 100644
--- a/lib/WebGUI/Widget.pm
+++ b/lib/WebGUI/Widget.pm
@@ -15,8 +15,8 @@ use DBI;
use Exporter;
use strict qw(subs vars);
use Tie::IxHash;
-use WebGUI::Attachment;
use WebGUI::International;
+use WebGUI::Node;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Template;
@@ -63,9 +63,11 @@ sub getProperties {
#-------------------------------------------------------------------
sub purgeWidget {
+ my ($node);
WebGUI::SQL->write("delete from $_[2] where widgetId=$_[0]",$_[1]);
WebGUI::SQL->write("delete from widget where widgetId=$_[0]",$_[1]);
- WebGUI::Attachment::purgeWidget($_[0]);
+ $node = WebGUI::Node->new($_[0]);
+ $node->delete;
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/Widget/Article.pm b/lib/WebGUI/Widget/Article.pm
index 62d62f5b6..e79e4e640 100644
--- a/lib/WebGUI/Widget/Article.pm
+++ b/lib/WebGUI/Widget/Article.pm
@@ -27,14 +27,20 @@ use WebGUI::Widget;
#-------------------------------------------------------------------
sub duplicate {
- my (%data, $newWidgetId, $pageId);
+ my (%data, $newWidgetId, $pageId, $file);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId};
- $newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
- WebGUI::Attachment::copy($data{image},$_[0],$newWidgetId);
- WebGUI::Attachment::copy($data{attachment},$_[0],$newWidgetId);
- WebGUI::SQL->write("insert into Article values ($newWidgetId, $data{startDate}, $data{endDate}, ".quote($data{body}).", ".quote($data{image}).", ".quote($data{linkTitle}).", ".quote($data{linkURL}).", ".quote($data{attachment}).", '$data{convertCarriageReturns}', ".quote($data{alignImage}).")");
+ $newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},
+ $data{description},$data{processMacros},$data{templatePosition});
+ $file = WebGUI::Attachment->new($data{image},$_[0]);
+ $file->copy($newWidgetId);
+ $file = WebGUI::Attachment->new($data{attachment},$_[0]);
+ $file->copy($newWidgetId);
+ WebGUI::SQL->write("insert into Article values ($newWidgetId, $data{startDate}, $data{endDate}, ".
+ quote($data{body}).", ".quote($data{image}).", ".quote($data{linkTitle}).", ".
+ quote($data{linkURL}).", ".quote($data{attachment}).", '$data{convertCarriageReturns}', ".
+ quote($data{alignImage}).")");
}
#-------------------------------------------------------------------
@@ -92,10 +98,24 @@ sub www_add {
sub www_addSave {
my ($widgetId, $image, $attachment);
if (WebGUI::Privilege::canEditPage()) {
- $widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
- $image = WebGUI::Attachment::save("image",$widgetId);
- $attachment = WebGUI::Attachment::save("attachment",$widgetId);
- WebGUI::SQL->write("insert into Article values ($widgetId, '".setToEpoch($session{form}{startDate})."', '".setToEpoch($session{form}{endDate})."', ".quote($session{form}{body}).", ".quote($image).", ".quote($session{form}{linkTitle}).", ".quote($session{form}{linkURL}).", ".quote($attachment).", '$session{form}{convertCarriageReturns}', ".quote($session{form}{alignImage}).")");
+ $widgetId = create($session{page}{pageId},$session{form}{widget},
+ $session{form}{title},$session{form}{displayTitle},
+ $session{form}{description},$session{form}{processMacros},
+ $session{form}{templatePosition});
+ $image = WebGUI::Attachment->new("",$widgetId);
+ $image->save("image");
+ $attachment = WebGUI::Attachment->new("",$widgetId);
+ $attachment->save("attachment");
+ WebGUI::SQL->write("insert into Article values ($widgetId, '".
+ setToEpoch($session{form}{startDate})."', '".
+ setToEpoch($session{form}{endDate})."', ".
+ quote($session{form}{body}).", ".
+ quote($image->getFilename).", ".
+ quote($session{form}{linkTitle}).", ".
+ quote($session{form}{linkURL}).", ".
+ quote($attachment->getFilename).
+ ", '$session{form}{convertCarriageReturns}', ".
+ quote($session{form}{alignImage}).")");
return "";
} else {
return WebGUI::Privilege::insufficient();
@@ -145,15 +165,22 @@ sub www_edit {
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
$output .= WebGUI::Form::hidden("func","editSave");
$output .= '';
- $output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
- $output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
- $output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
+ $output .= tableFormRow(WebGUI::International::get(99),
+ WebGUI::Form::text("title",20,128,$data{title}));
+ $output .= tableFormRow(WebGUI::International::get(174),
+ WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
+ $output .= tableFormRow(WebGUI::International::get(175),
+ WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
%hash = WebGUI::Widget::getPositions();
$array[0] = $data{templatePosition};
- $output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
- $output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::text("startDate",20,30,epochToSet($data{startDate}),1));
- $output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("endDate",20,30,epochToSet($data{endDate}),1));
- $output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::textArea("body",$data{body},50,10,1));
+ $output .= tableFormRow(WebGUI::International::get(363),
+ WebGUI::Form::selectList("templatePosition",\%hash,\@array));
+ $output .= tableFormRow(WebGUI::International::get(3,$namespace),
+ WebGUI::Form::text("startDate",20,30,epochToSet($data{startDate}),1));
+ $output .= tableFormRow(WebGUI::International::get(4,$namespace),
+ WebGUI::Form::text("endDate",20,30,epochToSet($data{endDate}),1));
+ $output .= tableFormRow(WebGUI::International::get(5,$namespace),
+ WebGUI::Form::textArea("body",$data{body},50,10,1));
if ($data{image} ne "") {
$output .= tableFormRow(WebGUI::International::get(6,$namespace),''.WebGUI::International::get(13,$namespace).'');
} else {
- $output .= tableFormRow(WebGUI::International::get(9,$namespace),WebGUI::Form::file("attachment"));
+ $output .= tableFormRow(WebGUI::International::get(9,$namespace),
+ WebGUI::Form::file("attachment"));
}
- $output .= tableFormRow(WebGUI::International::get(10,$namespace),WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}).' '.WebGUI::International::get(11,$namespace).'');
+ $output .= tableFormRow(WebGUI::International::get(10,$namespace),
+ WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}).
+ ' '.WebGUI::International::get(11,$namespace).'');
$output .= formSave();
$output .= '
';
return $output;
@@ -189,18 +221,27 @@ sub www_edit {
#-------------------------------------------------------------------
sub www_editSave {
- my ($image, $attachment);
+ my ($sqlAdd, $image, $attachment);
if (WebGUI::Privilege::canEditPage()) {
update();
- $image = WebGUI::Attachment::save("image",$session{form}{wid});
- if ($image ne "") {
- $image = ', image='.quote($image);
+ $image = WebGUI::Attachment->new("",$session{form}{wid});
+ $image->save("image");
+ if ($image->getFilename ne "") {
+ $sqlAdd = ', image='.quote($image->getFilename);
}
- $attachment = WebGUI::Attachment::save("attachment",$session{form}{wid});
+ $attachment = WebGUI::Attachment->new("",$session{form}{wid});
+ $attachment->save("attachment");
if ($attachment ne "") {
- $attachment = ', attachment='.quote($attachment);
+ $sqlAdd .= ', attachment='.quote($attachment->getFilename);
}
- WebGUI::SQL->write("update Article set alignImage=".quote($session{form}{alignImage}).", startDate='".setToEpoch($session{form}{startDate})."', endDate='".setToEpoch($session{form}{endDate})."', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".quote($session{form}{body}).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).$attachment.$image." where widgetId=$session{form}{wid}");
+ WebGUI::SQL->write("update Article set alignImage=".quote($session{form}{alignImage}).
+ ", startDate='".setToEpoch($session{form}{startDate}).
+ "', endDate='".setToEpoch($session{form}{endDate}).
+ "', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".
+ quote($session{form}{body}).", linkTitle=".
+ quote($session{form}{linkTitle}).", linkURL=".
+ quote($session{form}{linkURL}).$sqlAdd.
+ " where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@@ -217,7 +258,8 @@ sub www_view {
$output = "".$data{title}."
";
}
if ($data{image} ne "") {
- $image = '
new($data{image},$_[0]);
+ $image = '
read("select * from DownloadManager_file where widgetId=$_[0]");
while (%row = $sth->hash) {
$newDownloadId = getNextId("downloadId");
- WebGUI::Attachment::copy($row{downloadFile},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
- WebGUI::Attachment::copy($row{alternateVersion1},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
- WebGUI::Attachment::copy($row{alternateVersion2},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
+ $file = WebGUI::Attachment->new($row{downloadFile},$_[0],$row{downloadId});
+ $file->copy($newWidgetId,$newDownloadId);
+ $file = WebGUI::Attachment->new($row{alternateVersion1},$_[0],$row{downloadId});
+ $file->copy($newWidgetId,$newDownloadId);
+ $file = WebGUI::Attachment->new($row{alternateVersion2},$_[0],$row{downloadId});
+ $file->copy($newWidgetId,$newDownloadId);
WebGUI::SQL->write("insert into DownloadManager_file values ($newDownloadId, $newWidgetId, ".
quote($row{fileTitle}).", ".quote($row{downloadFile}).", $row{groupToView}, ".
quote($row{briefSynopsis}).", $row{dateUploaded}, $row{sequenceNumber}, ".
- quote($row{alternateVersion1}).", ".quote($row{alternateVersion2}).")");
+ quote($row{alternateVersion1}).", ".quote($row{alternateVersion2}).
+ ", $row{displayThumbnails})");
}
$sth->finish;
}
@@ -114,6 +119,10 @@ sub www_add {
WebGUI::International::get(20,$namespace),
WebGUI::Form::text("paginateAfter",20,30,50)
);
+ $output .= tableFormRow(
+ WebGUI::International::get(21,$namespace),
+ WebGUI::Form::checkbox("displayThumbnails",1,1)
+ );
$output .= tableFormRow(
WebGUI::International::get(3,$namespace),
WebGUI::Form::checkbox("proceed",1,1)
@@ -140,7 +149,7 @@ sub www_addSave {
$session{form}{processMacros},
$session{form}{templatePosition}
);
- WebGUI::SQL->write("insert into DownloadManager values ($widgetId, '$session{form}{paginateAfter}')");
+ WebGUI::SQL->write("insert into DownloadManager values ($widgetId, '$session{form}{paginateAfter}', '$session{form}{displayThumbnails}')");
if ($session{form}{proceed} == 1) {
$session{form}{wid} = $widgetId;
return www_addDownload();
@@ -198,21 +207,24 @@ sub www_addDownloadSave {
my ($downloadId,$file,$alt1,$alt2,$sequenceNumber);
if (WebGUI::Privilege::canEditPage()) {
$downloadId = getNextId("downloadId");
- $file = WebGUI::Attachment::save("downloadFile",$session{form}{wid},$downloadId);
- $alt1 = WebGUI::Attachment::save("alternateVersion1",$session{form}{wid},$downloadId);
- $alt2 = WebGUI::Attachment::save("alternateVersion2",$session{form}{wid},$downloadId);
+ $file = WebGUI::Attachment->new("",$session{form}{wid},$downloadId);
+ $file->save("downloadFile");
+ $alt1 = WebGUI::Attachment->new("",$session{form}{wid},$downloadId);
+ $alt1->save("alternateVersion1");
+ $alt2 = WebGUI::Attachment->new("",$session{form}{wid},$downloadId);
+ $alt2->save("alternateVersion2");
($sequenceNumber) = WebGUI::SQL->quickArray("select count(*)+1 from DownloadManager_file where widgetId=$session{form}{wid}");
WebGUI::SQL->write("insert into DownloadManager_file values (".
$downloadId.
", ".$session{form}{wid}.
", ".quote($session{form}{fileTitle}).
- ", ".quote($file).
+ ", ".quote($file->getFilename).
", '$session{form}{groupToView}'".
", ".quote($session{form}{briefSynopsis}).
", ".time().
", ".$sequenceNumber.
- ", ".quote($alt1).
- ", ".quote($alt2).
+ ", ".quote($alt1->getFilename).
+ ", ".quote($alt2->getFilename).
")");
return www_edit();
} else {
@@ -268,8 +280,10 @@ sub www_deleteDownload {
#-------------------------------------------------------------------
sub www_deleteDownloadConfirm {
- my ($output);
+ my ($output, $file);
if (WebGUI::Privilege::canEditPage()) {
+ $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{did});
+ $file->deleteNode;
WebGUI::SQL->write("delete from DownloadManager_file where downloadId=$session{form}{did}");
_reorderDownloads($session{form}{wid});
return www_edit();
@@ -280,19 +294,24 @@ sub www_deleteDownloadConfirm {
#-------------------------------------------------------------------
sub www_download {
- my (%download, $url);
+ my (%download, $file);
tie %download,'Tie::CPHash';
%download = WebGUI::SQL->quickHash("select * from DownloadManager_file where downloadId=$session{form}{did}");
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
- $url = $session{setting}{attachmentDirectoryWeb}."/".$session{form}{wid}."/".$session{form}{did}."/";
if ($session{form}{alternateVersion} == 1) {
- $url .= $download{alternateVersion1};
+ $file = WebGUI::Attachment->new($download{alternateVersion1},
+ $session{form}{wid},
+ $session{form}{did});
} elsif ($session{form}{alternateVersion} == 2) {
- $url .= $download{alternateVersion2};
+ $file = WebGUI::Attachment->new($download{alternateVersion2},
+ $session{form}{wid},
+ $session{form}{did});
} else {
- $url .= $download{downloadFile};
+ $file = WebGUI::Attachment->new($download{downloadFile},
+ $session{form}{wid},
+ $session{form}{did});
}
- $session{header}{redirect} = WebGUI::Session::httpRedirect($url);
+ $session{header}{redirect} = WebGUI::Session::httpRedirect($file->getURL);
return "";
} else {
return WebGUI::Privilege::insufficient();
@@ -339,6 +358,10 @@ sub www_edit {
WebGUI::International::get(20,$namespace),
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter})
);
+ $output .= tableFormRow(
+ WebGUI::International::get(21,$namespace),
+ WebGUI::Form::checkbox("displayThumbnails","1",$data{displayThumbnails})
+ );
$output .= formSave();
$output .= '';
$output .= 'write("update DownloadManager set paginateAfter='$session{form}{paginateAfter}', displayThumbnails='$session{form}{displayThumbnails}' where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@@ -452,25 +475,28 @@ sub www_editDownload {
#-------------------------------------------------------------------
sub www_editDownloadSave {
- my ($file, $alt1, $alt2);
+ my ($file, $alt1, $alt2, $sqlAdd);
if (WebGUI::Privilege::canEditPage()) {
- $file = WebGUI::Attachment::save("downloadFile",$session{form}{wid},$session{form}{did});
- if ($file ne "") {
- $file = ', downloadFile='.quote($file);
+ $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{did});
+ $file->save("downloadFile");
+ if ($file->getFilename ne "") {
+ $sqlAdd = ', downloadFile='.quote($file->getFilename);
}
- $alt1 = WebGUI::Attachment::save("alternateVersion1",$session{form}{wid},$session{form}{did});
- if ($alt1 ne "") {
- $alt1 = ', alternateVersion1='.quote($alt1);
+ $alt1 = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{did});
+ $alt1->save("alternateVersion1");
+ if ($alt1->getFilename ne "") {
+ $sqlAdd .= ', alternateVersion1='.quote($alt1->getFilename);
}
- $alt2 = WebGUI::Attachment::save("alternateVersion2",$session{form}{wid},$session{form}{did});
- if ($alt2 ne "") {
- $alt2 = ', alternateVersion2='.quote($alt2);
+ $alt2 = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{did});
+ $alt2->save("alternateVersion2");
+ if ($alt2->getFilename ne "") {
+ $sqlAdd = ', alternateVersion2='.quote($alt2->getFilename);
}
WebGUI::SQL->write("update DownloadManager_file set ".
" downloadId=".$session{form}{did}.
", widgetId=".$session{form}{wid}.
", fileTitle=".quote($session{form}{fileTitle}).
- $file.$alt1.$alt2.
+ $sqlAdd.
", groupToView='$session{form}{groupToView}'".
", briefSynopsis=".quote($session{form}{briefSynopsis}).
", dateUploaded=".time().
@@ -516,7 +542,7 @@ sub www_moveDownloadUp {
#-------------------------------------------------------------------
sub www_view {
- my ($url, @row, $i, $dataRows, $search, $prevNextBar, %data, @test, %fileType, $output, $sth,
+ my ($url, @row, $i, $p, $search, %data, @test, $file, $alt1, $alt2, $output, $sth,
%download, $flag, $sort, $sortDirection);
tie %download, 'Tie::CPHash';
tie %data, 'Tie::CPHash';
@@ -562,29 +588,38 @@ sub www_view {
$sth = WebGUI::SQL->read("select * from DownloadManager_file where widgetId=$_[0] $search $sort $sortDirection");
while (%download = $sth->hash) {
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
- %fileType = WebGUI::Attachment::getType($download{downloadFile});
+ $file = WebGUI::Attachment->new($download{downloadFile},
+ $_[0], $download{downloadId});
$row[$i] = '';
$row[$i] .= '.') '.
- $download{fileTitle}.' ('.$fileType{extension}.')';
+ $download{fileTitle}.' ('.$file->getType.')';
if ($download{alternateVersion1}) {
- %fileType = WebGUI::Attachment::getType($download{alternateVersion1});
+ $alt1 = WebGUI::Attachment->new($download{alternateVersion1},
+ $_[0], $download{downloadId});
$row[$i] .= ' ·  ('.
- $fileType{extension}.')';
+ $alt1->getType.')';
}
if ($download{alternateVersion2}) {
- %fileType = WebGUI::Attachment::getType($download{alternateVersion2});
+ $alt2 = WebGUI::Attachment->new($download{alternateVersion2},
+ $_[0], $download{downloadId});
$row[$i] .= ' ·  ('.
- $fileType{extension}.')';
+ $alt2->getType.')';
}
- $row[$i] .= ' | '.$download{briefSynopsis}.' | '.
+ $row[$i] .= '';
+ if ($data{displayThumbnails}
+ && isIn($file->getType, qw(gif jpeg jpg tif tiff png bmp))) {
+ $row[$i] .= ' ';
+ }
+ $row[$i] .= $download{briefSynopsis}.' | '.
''.
epochToHuman($download{dateUploaded},"%M/%D/%y").' | '.
'
';
@@ -597,10 +632,10 @@ sub www_view {
$output .= '| '.
WebGUI::International::get(19,$namespace).' |
';
}
- ($dataRows, $prevNextBar) = paginate($data{paginateAfter},$url,\@row);
- $output .= $dataRows;
+ $p = WebGUI::Paginator->new($url,\@row,$data{paginateAfter});
+ $output .= $p->getPage($session{form}{pn});
$output .= '';
- $output .= $prevNextBar;
+ $output .= $p->getBarTraditional($session{form}{pn});
if ($data{processMacros} == 1) {
$output = WebGUI::Macro::process($output);
}
diff --git a/lib/WebGUI/Widget/EventsCalendar.pm b/lib/WebGUI/Widget/EventsCalendar.pm
index cb6372f09..baaa1d517 100644
--- a/lib/WebGUI/Widget/EventsCalendar.pm
+++ b/lib/WebGUI/Widget/EventsCalendar.pm
@@ -18,6 +18,7 @@ use Tie::CPHash;
use WebGUI::DateTime;
use WebGUI::International;
use WebGUI::Macro;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -304,13 +305,14 @@ sub www_edit {
$output .= 'Add New Event
';
$output .= '
';
- $sth = WebGUI::SQL->read("select eventId, name, recurringEventId from EventsCalendar_event where widgetId='$session{form}{wid}' order by startDate");
+ $sth = WebGUI::SQL->read("select eventId, name, recurringEventId, startDate from EventsCalendar_event where widgetId='$session{form}{wid}' order by startDate");
while (@event = $sth->array) {
$output .= '  | '.$event[1].' | ';
+ $session{setting}{lib}.'/delete.gif" border=0>'.
+ epochToHuman($event[3],'%m/%d/%y').' | '.$event[1].' | ';
}
$sth->finish;
$output .= '
';
@@ -373,7 +375,7 @@ sub www_editEventSave {
#-------------------------------------------------------------------
sub www_view {
- my (%data, %event, $dataRows, $prevNextBar, $output, $sth, $flag, %previous, $junk,
+ my (%data, %event, $p, $output, $sth, $flag, %previous, $junk,
@row, $i, $maxDate, $minDate, $nextDate, $first, $last);
tie %data, 'Tie::CPHash';
tie %event, 'Tie::CPHash';
@@ -401,8 +403,10 @@ sub www_view {
$i++;
$nextDate = addToDate($nextDate,0,1,0);
}
- ($dataRows, $prevNextBar) = paginate(1,WebGUI::URL::page(),\@row);
- $output .= $prevNextBar.$dataRows.$prevNextBar;
+ $p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,1);
+ $output .= $p->getBar($session{form}{pn}).
+ $p->getPage($session{form}{pn}).
+ $p->getBarTraditional($session{form}{pn});
$session{form}{pn} = "";
} else {
$sth = WebGUI::SQL->read("select name, description, startDate, endDate from EventsCalendar_event where widgetId='$_[0]' and endDate>".(time()-86400)." order by startDate,endDate");
@@ -434,8 +438,8 @@ sub www_view {
$i++;
}
$sth->finish;
- ($dataRows, $prevNextBar) = paginate($data{paginateAfter},WebGUI::URL::page(),\@row);
- $output .= $dataRows.$prevNextBar;
+ $p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,$data{paginateAfter});
+ $output .= $p->getPage($session{form}{pn}).$p->getBarSimple($session{form}{pn});
}
if ($data{processMacros}) {
$output = WebGUI::Macro::process($output);
diff --git a/lib/WebGUI/Widget/Item.pm b/lib/WebGUI/Widget/Item.pm
index c7d98bfa4..604c97e50 100644
--- a/lib/WebGUI/Widget/Item.pm
+++ b/lib/WebGUI/Widget/Item.pm
@@ -26,13 +26,14 @@ use WebGUI::Widget;
#-------------------------------------------------------------------
sub duplicate {
- my (%data, $newWidgetId, $pageId);
+ my (%data, $newWidgetId, $pageId, $file);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId};
$newWidgetId = create($pageId,$namespace,$data{title},
$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
- WebGUI::Attachment::copy($data{attachment},$_[0],$newWidgetId);
+ $file = WebGUI::Attachment->new($data{attachment},$_[0]);
+ $file->copy($newWidgetId);
WebGUI::SQL->write("insert into Item values ($newWidgetId, ".
quote($data{description}).", ".quote($data{linkURL}).", ".quote($data{attachment}).")");
}
@@ -79,7 +80,8 @@ sub www_addSave {
my ($widgetId, $attachment);
if (WebGUI::Privilege::canEditPage()) {
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
- $attachment = WebGUI::Attachment::save("attachment",$widgetId);
+ $attachment = WebGUI::Attachment->new("",$widgetId);
+ $attachment->save("attachment");
WebGUI::SQL->write("insert into Item values ($widgetId, ".quote($session{form}{description}).", ".quote($session{form}{linkURL}).", ".quote($attachment).")");
return "";
} else {
@@ -149,14 +151,17 @@ sub www_edit {
#-------------------------------------------------------------------
sub www_editSave {
- my ($attachment);
+ my ($attachment, $sqlAdd);
if (WebGUI::Privilege::canEditPage()) {
update();
- $attachment = WebGUI::Attachment::save("attachment",$session{form}{wid});
- if ($attachment ne "") {
- $attachment = ', attachment='.quote($attachment);
+ $attachment = WebGUI::Attachment->new("",$session{form}{wid});
+ $attachment->save("attachment");
+ if ($attachment->getFilename ne "") {
+ $sqlAdd = ', attachment='.quote($attachment->getFilename);
}
- WebGUI::SQL->write("update Item set description=".quote($session{form}{description}).", linkURL=".quote($session{form}{linkURL}).$attachment." where widgetId=$session{form}{wid}");
+ WebGUI::SQL->write("update Item set description=".quote($session{form}{description}).
+ ", linkURL=".quote($session{form}{linkURL}).
+ $sqlAdd." where widgetId=$session{form}{wid}");
return "";
} else {
return WebGUI::Privilege::insufficient();
@@ -165,7 +170,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_view {
- my (%data, @test, $output, %fileType);
+ my (%data, @test, $output, $file);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (defined %data) {
@@ -175,9 +180,8 @@ sub www_view {
$output .= ''.$data{title}.'';
}
if ($data{attachment} ne "") {
- %fileType = WebGUI::Attachment::getType($data{attachment});
- $output .= ' -
getURL.'">
';
}
if ($data{description} ne "") {
@@ -193,7 +197,5 @@ sub www_view {
-
-
-
1;
+
diff --git a/lib/WebGUI/Widget/SQLReport.pm b/lib/WebGUI/Widget/SQLReport.pm
index 125116c8b..5c50fbbde 100644
--- a/lib/WebGUI/Widget/SQLReport.pm
+++ b/lib/WebGUI/Widget/SQLReport.pm
@@ -16,6 +16,7 @@ use strict;
use WebGUI::ErrorHandler;
use WebGUI::International;
use WebGUI::Macro;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -187,7 +188,7 @@ sub www_editSave {
#-------------------------------------------------------------------
sub www_view {
- my (@row, $i, $dataRows, $prevNextBar, $ouch, %data, $output, $sth, $dbh, @result,
+ my (@row, $i, $p, $ouch, %data, $output, $sth, $dbh, @result,
@template, $temp, $col);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
@@ -239,10 +240,10 @@ sub www_view {
$i++;
}
$sth->finish;
- ($dataRows, $prevNextBar) = paginate($data{paginateAfter},WebGUI::URL::page(),\@row);
- $output .= $dataRows;
+ $p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,$data{paginateAfter});
+ $output .= $p->getPage($session{form}{pn});
$output .= $template[2];
- $output .= $prevNextBar;
+ $output .= $p->getBar($session{form}{pn});
} else {
$output .= WebGUI::International::get(11,$namespace).'';
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] There was a problem with the query.");
diff --git a/lib/WebGUI/Widget/UserSubmission.pm b/lib/WebGUI/Widget/UserSubmission.pm
index 161f2ad0d..bb0921f86 100644
--- a/lib/WebGUI/Widget/UserSubmission.pm
+++ b/lib/WebGUI/Widget/UserSubmission.pm
@@ -20,6 +20,7 @@ use WebGUI::International;
use WebGUI::Macro;
use WebGUI::MessageLog;
use WebGUI::Operation;
+use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::Shortcut;
@@ -30,17 +31,21 @@ use WebGUI::Widget;
#-------------------------------------------------------------------
sub duplicate {
- my ($sth, %data, $newWidgetId, @row, $newSubmissionId, $pageId);
+ my ($sth, $file, %data, $newWidgetId, @row, $newSubmissionId, $pageId);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
$pageId = $_[1] || $data{pageId};
- $newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
+ $newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},
+ $data{description},$data{processMacros},$data{templatePosition});
WebGUI::SQL->write("insert into UserSubmission values ($newWidgetId, $data{groupToContribute}, '$data{submissionsPerPage}', '$data{defaultStatus}', $data{groupToApprove})");
$sth = WebGUI::SQL->read("select * from UserSubmission_submission where widgetId=$_[0]");
while (@row = $sth->array) {
$newSubmissionId = getNextId("submissionId");
- WebGUI::Attachment::copy($row[8],$_[0],$newWidgetId,$row[1],$newSubmissionId);
- WebGUI::SQL->write("insert into UserSubmission_submission values ($newWidgetId, $newSubmissionId, ".quote($row[2]).", $row[3], ".quote($row[4]).", '$row[5]', ".quote($row[6]).", ".quote($row[7]).", ".quote($row[8]).", '$row[9]', '$row[10]')");
+ $file = WebGUI::Attachment->new($row[8],$_[0],$row[1]);
+ $file->copy($newWidgetId,$newSubmissionId);
+ WebGUI::SQL->write("insert into UserSubmission_submission values ($newWidgetId, $newSubmissionId, ".
+ quote($row[2]).", $row[3], ".quote($row[4]).", '$row[5]', ".quote($row[6]).", ".
+ quote($row[7]).", ".quote($row[8]).", '$row[9]', '$row[10]')");
}
$sth->finish;
}
@@ -93,7 +98,9 @@ sub www_add {
sub www_addSave {
my ($widgetId);
if (WebGUI::Privilege::canEditPage()) {
- $widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
+ $widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},
+ $session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},
+ $session{form}{templatePosition});
WebGUI::SQL->write("insert into UserSubmission values ($widgetId, $session{form}{groupToContribute}, '$session{form}{submissionsPerPage}', '$session{form}{defaultStatus}', $session{form}{groupToApprove})");
return "";
} else {
@@ -146,14 +153,21 @@ sub www_addSubmissionSave {
%userSubmission = getProperties($namespace,$session{form}{wid});
if (WebGUI::Privilege::isInGroup($userSubmission{groupToContribute},$session{user}{userId})) {
$submissionId = getNextId("submissionId");
- $image = WebGUI::Attachment::save("image",$session{form}{wid},$submissionId);
- $attachment = WebGUI::Attachment::save("attachment",$session{form}{wid},$submissionId);
+ $image = WebGUI::Attachment->new("",$session{form}{wid},$submissionId);
+ $image->save("image");
+ $attachment = WebGUI::Attachment->new("",$session{form}{wid},$submissionId);
+ $attachment->save("attachment");
if ($session{form}{title} ne "") {
$title = $session{form}{title};
} else {
$title = WebGUI::International::get(16,$namespace);
}
- WebGUI::SQL->write("insert into UserSubmission_submission values ($session{form}{wid}, $submissionId, ".quote($title).", ".time().", ".quote($session{user}{username}).", '$session{user}{userId}', ".quote($session{form}{content}).", ".quote($image).", ".quote($attachment).", '$userSubmission{defaultStatus}', '$session{form}{convertCarriageReturns}')");
+ WebGUI::SQL->write("insert into UserSubmission_submission values ($session{form}{wid}, $submissionId, "
+ .quote($title).", ".time().", ".quote($session{user}{username}).
+ ", '$session{user}{userId}', ".quote($session{form}{content}).", ".
+ quote($image->getFilename).", ".
+ quote($attachment->getFilename).
+ ", '$userSubmission{defaultStatus}', '$session{form}{convertCarriageReturns}')");
if ($userSubmission{defaultStatus} ne "Approved") {
WebGUI::MessageLog::addEntry('',$userSubmission{groupToApprove},
WebGUI::URL::page('func=viewSubmission&wid='.$session{form}{wid}.
@@ -233,10 +247,12 @@ sub www_deleteSubmission {
#-------------------------------------------------------------------
sub www_deleteSubmissionConfirm {
- my ($output, $owner);
+ my ($output, $owner, $file);
($owner) = WebGUI::SQL->quickArray("select userId from UserSubmission_submission where submissionId=$session{form}{sid}");
if ($owner == $session{user}{userId}) {
WebGUI::SQL->write("delete from UserSubmission_submission where submissionId=$session{form}{sid}");
+ $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid});
+ $file->deleteNode;
return www_addSubmission();
} else {
return WebGUI::Privilege::insufficient();
@@ -347,24 +363,29 @@ sub www_editSubmission {
#-------------------------------------------------------------------
sub www_editSubmissionSave {
- my ($owner,%userSubmission,$image,$attachment,$title);
+ my ($sqlAdd,$owner,%userSubmission,$image,$attachment,$title);
($owner) = WebGUI::SQL->quickArray("select userId from UserSubmission_submission where submissionId=$session{form}{sid}");
if ($owner == $session{user}{userId}) {
%userSubmission = getProperties($namespace,$session{form}{wid});
- $image = WebGUI::Attachment::save("image",$session{form}{wid},$session{form}{sid});
- if ($image ne "") {
- $image = 'image='.quote($image).', ';
+ $image = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid});
+ $image->save("image");
+ if ($image->getFilename ne "") {
+ $sqlAdd = 'image='.quote($image->getFilename).', ';
}
- $attachment = WebGUI::Attachment::save("attachment",$session{form}{wid},$session{form}{sid});
- if ($attachment ne "") {
- $attachment = 'attachment='.quote($attachment).', ';
+ $attachment = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid});
+ $attachment->save("attachment");
+ if ($attachment->getFilename ne "") {
+ $sqlAdd .= 'attachment='.quote($attachment->getFilename).', ';
}
if ($session{form}{title} ne "") {
$title = $session{form}{title};
} else {
$title = WebGUI::International::get(16,$namespace);
}
- WebGUI::SQL->write("update UserSubmission_submission set dateSubmitted=".time().", convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).", content=".quote($session{form}{content}).", ".$image.$attachment." status='$userSubmission{defaultStatus}' where submissionId=$session{form}{sid}");
+ WebGUI::SQL->write("update UserSubmission_submission set dateSubmitted=".time().
+ ", convertCarriageReturns='$session{form}{convertCarriageReturns}', title=".quote($title).
+ ", content=".quote($session{form}{content}).", ".$sqlAdd.
+ " status='$userSubmission{defaultStatus}' where submissionId=$session{form}{sid}");
if ($userSubmission{defaultStatus} ne "Approved") {
WebGUI::MessageLog::addEntry('',$userSubmission{groupToApprove},
WebGUI::URL::page('func=viewSubmission&wid='.$session{form}{wid}.'&sid='.
@@ -378,7 +399,7 @@ sub www_editSubmissionSave {
#-------------------------------------------------------------------
sub www_view {
- my (%data, @submission, $output, $sth, @row, $i, $dataRows, $prevNextBar);
+ my (%data, @submission, $output, $sth, @row, $i, $p);
tie %data, 'Tie::CPHash';
%data = getProperties($namespace,$_[0]);
if (%data) {
@@ -404,19 +425,21 @@ sub www_view {
$output .= '
';
- ($dataRows, $prevNextBar) = paginate($data{submissionsPerPage},WebGUI::URL::page(),\@row);
+ $p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,$data{submissionsPerPage});
$output .= '';
- $output .= '
';
- $output .= $dataRows;
+ $output .= '
';
+ $output .= $p->getPage($session{form}{pn});
$output .= '
';
- $output .= $prevNextBar;
+ $output .= $p->getBarTraditional($session{form}{pn});
}
return $output;
}
#-------------------------------------------------------------------
sub www_viewSubmission {
- my ($output, %submission);
+ my ($output, %submission, $file);
tie %submission, 'Tie::CPHash';
%submission = WebGUI::SQL->quickHash("select * from UserSubmission_submission where submissionId=$session{form}{sid}");
$output = "".$submission{title}."
";
@@ -448,7 +471,8 @@ sub www_viewSubmission {
$output .= '';
#---content
if ($submission{image} ne "") {
- $output .= ' ';
+ $file = WebGUI::Attachment->new($submission{filename},$session{form}{wid},$session{form}{sid});
+ $output .= ' ';
}
if ($submission{convertCarriageReturns}) {
$submission{content} =~ s/\n/\ /g;
diff --git a/preload.perl b/preload.perl
index ff26afc1e..0a2cf0d11 100644
--- a/preload.perl
+++ b/preload.perl
@@ -14,6 +14,7 @@ use DBD::mysql ();
use Data::Config ();
use Date::Calc ();
use HTML::CalendarMonthSimple ();
+use Image::Magick ();
use Tie::CPHash ();
use Tie::IxHash ();
use Net::LDAP ();
diff --git a/testEnvironment.pl b/testEnvironment.pl
index 757e47df2..458dff0c8 100644
--- a/testEnvironment.pl
+++ b/testEnvironment.pl
@@ -202,6 +202,18 @@ if (eval { require HTML::CalendarMonthSimple }) {
}
}
+print "Image::Magick module.....................";
+if (eval { require Image::Magick }) {
+ print "OK\n";
+} else {
+ if ($ARGV[0] eq "--install-modules") {
+ print "Installing...\n";
+ CPAN::Shell->install("Image::Magick");
+ } else {
+ print "Please install.\n";
+ }
+}
+
# this is here to insure they installed correctly.
print "WebGUI modules...........................";
if (eval { require WebGUI } && eval { require WebGUI::SQL }) {
diff --git a/www/extras/fileIcons/exe.gif b/www/extras/fileIcons/exe.gif
new file mode 100644
index 000000000..fc83ac520
Binary files /dev/null and b/www/extras/fileIcons/exe.gif differ
diff --git a/www/extras/fileIcons/gz.gif b/www/extras/fileIcons/gz.gif
new file mode 100644
index 000000000..aa0830730
Binary files /dev/null and b/www/extras/fileIcons/gz.gif differ
diff --git a/www/extras/fileIcons/psd.gif b/www/extras/fileIcons/psd.gif
new file mode 100644
index 000000000..64cb00ebb
Binary files /dev/null and b/www/extras/fileIcons/psd.gif differ
diff --git a/www/extras/fileIcons/sit.gif b/www/extras/fileIcons/sit.gif
new file mode 100644
index 000000000..1ee80dc9f
Binary files /dev/null and b/www/extras/fileIcons/sit.gif differ
diff --git a/www/index.pl b/www/index.pl
index 1d5cf67c8..7693b2dae 100755
--- a/www/index.pl
+++ b/www/index.pl
@@ -11,6 +11,7 @@
#-------------------------------------------------------------------
my $webguiRoot = "..";
+my $configFile = "WebGUI.conf";
BEGIN {
unshift (@INC, "../lib");
@@ -22,5 +23,5 @@ use CGI::Carp qw(fatalsToBrowser);
use strict;
use WebGUI;
-print WebGUI::page($webguiRoot);
+print WebGUI::page($webguiRoot,$configFile);
|