steps to duplicate content_image tag as content_pdf (or other content types)?
steps to duplicate content_image tag as content_pdf (or other content types)?
Howdy. I am currently in need of a (relatively) user friendly way to allow site admins to associate a PDF with a given page (and possibly other filetypes as well). Functionally, the "content_image" tag behaviour is ideal but unfortunately, the filename parameters are hardcoded into a core CMSMadeSimple class. What I want then is a "content_pdf" tag that behaves the same except it looks for a different filename pattern.
Looking through the codebase I see that there is a plugin for handling the display portion of the problem which can be trivially copied and modified for the display side of things ("plugins/function.content_image.php").
What I am unclear about is how to hook a similar version of the logic from "lib/classes/contenttypes/Content.inc.php" associated with the "content_image" tag with a new "custom_file" tag *without* modifying the core class (which would break updgrading). This happens between lines 490 and 566 and again, looks like it should be a copy and paste job mostly if I knew how to hook this in.
Any guidance much appreciated.
Cheers
Looking through the codebase I see that there is a plugin for handling the display portion of the problem which can be trivially copied and modified for the display side of things ("plugins/function.content_image.php").
What I am unclear about is how to hook a similar version of the logic from "lib/classes/contenttypes/Content.inc.php" associated with the "content_image" tag with a new "custom_file" tag *without* modifying the core class (which would break updgrading). This happens between lines 490 and 566 and again, looks like it should be a copy and paste job mostly if I knew how to hook this in.
Any guidance much appreciated.
Cheers
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Have you looked at the AdvancedContent module? I'm not too familiar with it, but from what I hear, it has many amazing features.
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Thanks for the heads up about that module. Unfortunately it does not appear to have *any* documentation:
http://dev.cmsmadesimple.org/projects/content2
It apparently messes with the default content and content_image tags so I am somewhat nervous about adding it since I already have a large amount of content created and do not want to have to redo everything.
Have you installed this module on an existing site (with existing content)? How does it affect existing templates?
On the surface it seems like overkill for my needs so hopefully there is a less obtrusive way to achieve this via a custom module or plugin (as per my initial question).
Cheers
http://dev.cmsmadesimple.org/projects/content2
It apparently messes with the default content and content_image tags so I am somewhat nervous about adding it since I already have a large amount of content created and do not want to have to redo everything.
Have you installed this module on an existing site (with existing content)? How does it affect existing templates?
On the surface it seems like overkill for my needs so hopefully there is a less obtrusive way to achieve this via a custom module or plugin (as per my initial question).
Cheers
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Most don't have any documentation... They show up in the "help" text when you install. I think that this info should be available (at minimum) in the download area.codegrunt wrote:Thanks for the heads up about that module. Unfortunately it does not appear to have *any* documentation:
I'll try right now in one of my test installs.codegrunt wrote:Have you installed this module on an existing site (with existing content)? How does it affect existing templates?

Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Here's the documentation:
http://teamwishbone.com/1.9/advc.html
I've converted all pages to "AdvancedContent", and it didn't seem to adversely affect the existing content. There is a 'filepicker' mode.. I'm testing it out now.
http://teamwishbone.com/1.9/advc.html
I've converted all pages to "AdvancedContent", and it didn't seem to adversely affect the existing content. There is a 'filepicker' mode.. I'm testing it out now.
Last edited by Wishbone on Tue Nov 16, 2010 9:37 pm, edited 1 time in total.
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Hmm.. As of v0.6, 'filepicker' was removed. 
http://forum.cmsmadesimple.org/index.ph ... #msg227569
I do like this module, though.

http://forum.cmsmadesimple.org/index.ph ... #msg227569
I do like this module, though.
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
....but the functionality was put in GBFilePicker module (can be used in AdvancedContent).. Trying to get it to work.
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Howdy. If there is no filepicker then the AdvancedContent module is not a solution unfortunately. So this brings things back to my original question. . .
Does CMSMadeSimple have an external "hook" for content tags that can be used here? Literally all that needs to change is that a section is duplicated but with its own filename regular expression match. The issue is just that I want to avoid messing with core files if at all possible.
Cheers
Does CMSMadeSimple have an external "hook" for content tags that can be used here? Literally all that needs to change is that a section is duplicated but with its own filename regular expression match. The issue is just that I want to avoid messing with core files if at all possible.
Cheers
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
GBFilepicker looks potentially dangerous to me. . .way too much file manipulation is provided when all is needed is a simple file lister.wishbone wrote: ....but the functionality was put in GBFilePicker module (can be used in AdvancedContent).. Trying to get it to work.
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Here's what I got (the file picker at the bottom):
http://teamwishbone.com/uploads/images/ ... picker.jpg
Here's the result:
http://teamwishbone.com/1.9/index.php?p ... msms-works
(I added the "Click HERE for your PDF file", using the filepicker data)
http://teamwishbone.com/uploads/images/ ... picker.jpg
Here's the result:
http://teamwishbone.com/1.9/index.php?p ... msms-works
(I added the "Click HERE for your PDF file", using the filepicker data)
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
There's many options that can be used to limit content editors from doing funny things... It might be overkill for a one-off use, but I can see many uses of AdvancedContent and the file picker.codegrunt wrote:GBFilepicker looks potentially dangerous to me. . .way too much file manipulation is provided when all is needed is a simple file lister.
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
A duplication of the {content_image} tag to select pdf files (or whatever) is not that easy since the main work (the dropdown with files) is done in the content type itself. Not in the tag. The tag just grabs the content that has been stored in this content block and prints it out.
You would need to modify the content object to achieve this or create an own one.
This is why i forked the TinyMCE filepicker (GBFilePicker) to be a standalone module to provide file selection functions to the content and even to other modules without modification of anything.
Just kidding, i know what you mean
Did you ever logged in as an editor with limited permission?
No?
Please just do so and try to do "dangerous things" with GBFilePicker.
(I mean it! Do it. I need feedback
)
In GBFilePicker file manipulations are only allowed to users that belong to the admin group.
Non-admins are restricted to the "Modify Files" permission of the FileManager.
A non-admin user without "Modify Files" permission but permission to use the GBFilePicker will not see any file manipulation functions in the filepicker.
By default it just shows a dropdown where only images are listed.
Nothing else. (same like {content_image})
You can specify what filetypes may be listed (even multiple ones).
You can use mime-type functions to get the filetype (instead of just checking the file extension - depends on your server settings).
Non-admin users are always "trapped" in the specified directory.
The specified directory will always be relative to the uploads dir.
(No matter what ever you enter in the browsers address bar to call the module directly)
Dangerous?
Hm.
I don't think so.
Honestly i don't know any better solution at the moment.
(correct me if i'm wrong)
If you try this module please use the latest SVN revision or this patched release:
http://forum.cmsmadesimple.org/index.ph ... #msg234398
(there are some issues in the current public release)
You would need to modify the content object to achieve this or create an own one.
This is why i forked the TinyMCE filepicker (GBFilePicker) to be a standalone module to provide file selection functions to the content and even to other modules without modification of anything.
Dangerous? Are we talking about users trustfull enough that you allow them to access the backend to manage content or are we talking about pirates?codegrunt wrote:
GBFilepicker looks potentially dangerous to me. . .way too much file manipulation is provided when all is needed is a simple file lister.
Just kidding, i know what you mean

Did you ever logged in as an editor with limited permission?
No?
Please just do so and try to do "dangerous things" with GBFilePicker.
(I mean it! Do it. I need feedback

In GBFilePicker file manipulations are only allowed to users that belong to the admin group.
Non-admins are restricted to the "Modify Files" permission of the FileManager.
A non-admin user without "Modify Files" permission but permission to use the GBFilePicker will not see any file manipulation functions in the filepicker.
By default it just shows a dropdown where only images are listed.
Nothing else. (same like {content_image})
You can specify what filetypes may be listed (even multiple ones).
You can use mime-type functions to get the filetype (instead of just checking the file extension - depends on your server settings).
Non-admin users are always "trapped" in the specified directory.
The specified directory will always be relative to the uploads dir.
(No matter what ever you enter in the browsers address bar to call the module directly)
Dangerous?
Hm.
I don't think so.
Honestly i don't know any better solution at the moment.
(correct me if i'm wrong)
If you try this module please use the latest SVN revision or this patched release:
http://forum.cmsmadesimple.org/index.ph ... #msg234398
(there are some issues in the current public release)
Last edited by NaN on Wed Nov 17, 2010 12:40 am, edited 1 time in total.
Re: steps to duplicate content_image tag as content_pdf (or other content types)?
Thanks, NaN for these fine modules.. Only feedback I have is that in the help in the latest version, there are still some references to 'filepicker', which was removed.