-
☆ A M B ☆
- 24,524 Posts
Are you sure you modified the appropriate variable assignments at the beginning of the snippet to reflect the names of the groups you put in the database? By default, they are set to "docman" for managers and "files" for users. Basically, all that I did was zip up the folder for the snippet I’m using, with a dump of the database, so I’m not sure why you had that problem. I need to learn how to use your snippet "properties" tab to handle stuff like that.
I had no trouble installing it; it worked out of the box, but I know I need to come up with a better installation for it. I’m in the process of planning a total overhaul, involving buckling down and learning your TV stuff and making the whole thing OOP; file classes that know their categories and their users, category classes that know their parents and children and the files assigned to them, and users that know their rights and the files assigned to them. I’m also studying up on passing raw data to the client and letting the client do most of the processing through Javascript. Interesting stuff, and gets a load off the server, as well as making tabbed pages possible. I was in a sort of a hurry to get the basic model working for my client (they are very pleased with it, it’s exactly what they require), but now I can take a bit of time and really make it good.
First, I’ll get a very basic one-dimensional category structure set up, so it will at least have that going until I get the rewrite done. The logic is all already there; that’s the hard part, now it’s just a matter of reorganizing it and making the code pretty, as well as using as much of the native ModX functionality that I can figure out (like error message passing). So there will be one more iteration of the snippet as it is in another day or so.
-
☆ A M B ☆
- 24,524 Posts
Hm. I don’t see why that should make any difference. I will give it a try here and see what happens.
[few minutes later] Nope, changed my group names to DocMan Admin and DocMan Users, and it works just fine. Are you sure you assigned your docman admin user to both webgroups? (I’m working on it for public use, and don’t have a document group set up at this point). If you feel like hacking in the code a bit, in the "list.php" you can put at the top of the page: "checkArray($_SESSION);" and get a look at whether or not your session’s docgroups array is getting set. Although if it’s not, it should throw an ugly error when it tries to run the in_array permissions check. (that checkarray line may already be there, just commented out; I have them everywhere for ease of finding out WTF is going on!)
-
☆ A M B ☆
- 24,524 Posts
Final version of this one on the downloads topic. A few improvements, some bug fixes, and simplification of the code, using more modx API functions. Now I start working on the object version. Should be much nicer, although I don’t think the front-end will change much (expect for nested categories and the option to have a given file in more than one category. This thing was never meant to be so complex; I just needed a simple download/file manager for a single purpose!
There is one issue I’m still trying to figure out. When you download or check out a file, the page just sits there. I want it to refresh back to a file listing with the file’s status and download count updated! The way it is, a user is liable to be clicking on the download button several times, not realizing that the download worked the first time!
-
MODX Staff
- 12,272 Posts
something you might want to do is to disable the download button when it’s clicked and add a message that says it’s downloading. Simple little JS to solve the "clickitis" that some folks seem so prone to suffer from.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
☆ A M B ☆
- 24,524 Posts
I tried that...it disabled the download too! Maybe some kind of time-delay function to submit the form, the after a brief delay disable the button? I’m done for today; updated my site to the latest and fiddled the CSS file to make it fit in with my template. Looks pretty good. Works OK. It’s really more than I inteded to make it into, but I’m having fun with it (when I’m not frustrated and irritated with the stupid thing). I keep reminding myself that computers always do exactly what you tell them to do! Unlike teenage boys...
-
☆ A M B ☆
- 24,524 Posts
I’ve spent over six hours trying to figure out how to either disable the download button or refresh the page. I have found a dozen scripts to disable the button, but then the file won’t download. Or if the file downloads, the button won’t disable. It’s driving me crazy! There HAS to be a way to do it; how does everybody else who makes download managers do it? I can’t figure it out. Maybe I should switch from buttons to links.
I don’t believe this! Not five minutes after this post, I figured out that when the button is disabled, its value is not passed in the POST, so the switchboard script never sees the "download". Since I’m using REQUEST, I used javascript to re-write the form’s action to include &download=true in the query string. So now I get a disabled button and a download! I would still rather refresh the page, but this will have to do for now. Whew.
Sometimes, a small accomplishment helps!
Now, you can let the problem brew a few days instead of having to pull your hair out just to get something working!
:)
Tangent-Warrior

-
MODX Staff
- 12,272 Posts
Hey Susan, any DB changes on the last version (4, I think)?
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
☆ A M B ☆
- 24,524 Posts
sorry...I’m afraid I was more interested in just cranking this thing out for a client, and really didn’t keep track of changes as I should.
# Table structure for table `files_categories`
CREATE TABLE `files_categories` (
`id` int(11) NOT NULL auto_increment,
`catname` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='Categories for uploaded files';
INSERT INTO `files_categories` (`catid`,`catname`) VALUES (0,'Any');
UPDATE `files_categories` SET `id` = '0';
# Table structure for table `files_data`
CREATE TABLE `files_data` (
`id` int(11) NOT NULL auto_increment,
`category` int(11) NOT NULL default '0',
`owner` int(11) NOT NULL default '0',
`realname` varchar(255) NOT NULL default '',
`size` bigint(20) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`description` varchar(255) default NULL,
`notes` text NOT NULL,
`notify` tinyint(2) unsigned NOT NULL default '0',
`remove` tinyint(2) unsigned NOT NULL default '0',
`visible` tinyint(2) unsigned NOT NULL default '0',
`status` int(11) NOT NULL default '0',
`downloads` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM PACK_KEYS=0 COMMENT='Info on uploaded files';
# Table structure for table `files_log`
CREATE TABLE `files_log` (
`fid` int(11) NOT NULL default '0',
`modified` datetime NOT NULL default '0000-00-00 00:00:00',
`modified_by` int(11) NOT NULL default '0',
`action` varchar(15) NOT NULL default '',
`notes` text NOT NULL
) TYPE=MyISAM COMMENT='Logs file info on checkin';
# Table structure for table `files_perms`#
CREATE TABLE `files_perms` (
`fid` int(11) NOT NULL default '0',
`uid` int(11) NOT NULL default '0',
`rights` tinyint(4) NOT NULL default '0'
) TYPE=MyISAM COMMENT='Permissions for uploaded files';