vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced Dynamics > vBa Dynamics v1.0 Support > "How Do I..." Questions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-21-2007, 04:29 AM
tfw2005 tfw2005 is offline
Senior Member
 
Join Date: Aug 2004
Posts: 352
Default Attachments - Groups?

I know this one is probably gonna be a toughie.

I am setting up an instance that will be used for articles. Each article will have 20+ images attached to it. These need to be displayed in various areas throughout the article, not just lumped at the bottom/top/side.

As of right now, Im going to tell my staff to upload, view thread in private Skin with default view of attachments, view source, copy code, paste into custom field -> show up in spot of article needed. However, this can get redundant.

Is it possible to add a designation to attachments so that you can use within a template:

Various HTML

if attachment group 1 then print $group1

Various HTML

if attachment group 2 then print $group2

Etc.

Second possibility, attachment manager shows HTML for attachments like a photobucket or imageshack situation, copy/paste. I might be able to work that out, but a grouping designation would be best, so they have to do less work to make the page look good.

OK, back to coding cave.
Reply With Quote
  #2  
Old 08-21-2007, 05:00 PM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Attachments - Groups?

What exactly would determine which "group" an attachment is in?
Reply With Quote
  #3  
Old 08-21-2007, 09:18 PM
tfw2005 tfw2005 is offline
Senior Member
 
Join Date: Aug 2004
Posts: 352
Default Re: Attachments - Groups?

Some sort of marker. Manual entry, drop down, check box. Back end CP choices, so you can create groups and variable names once. I don't really care how its done. I would be fine with a drop down offering:

Group 1
Group 2
Group 3
Group 4
Group 5

and so on.

In an attachment manager pop up, when viewing already uploaded images, you would see...

Current Attachments
shade.gif (946 Bytes) - Group 1 - |Drop down Box for Changing|
Save

Does that make sense?
Reply With Quote
  #4  
Old 08-23-2007, 11:38 AM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Attachments - Groups?

I like the idea of that, but I'm not sure how widely used it would be, so I might not be able to work something like that into the default code in the immediate future. I'm not sure how familiar you are with PHP, but that's something that probably would not be that hard to hack in. You would mostly just need to add a new column to the 'adv_dyna_attachments' table for the 'groupid', edit the newattachment templates to add your select menus for the groups, change the query in dynamics/newattachment.php to include the groupid, and then modify the dynamics/showentry.php file and ADV_DYNA_SHOWENTRY template so that attachments could be sorted and arranged by their group.
Reply With Quote
  #5  
Old 08-23-2007, 11:46 AM
tfw2005 tfw2005 is offline
Senior Member
 
Join Date: Aug 2004
Posts: 352
Default Re: Attachments - Groups?

I may give that a try. I'm pretty sure I understand exactly what you are saying, only reservation is that im on a live enviornment. Have to wait till dead of night to play around in case there are errors.
Reply With Quote
  #6  
Old 08-23-2007, 12:26 PM
tfw2005 tfw2005 is offline
Senior Member
 
Join Date: Aug 2004
Posts: 352
Default Re: Attachments - Groups?

Also, if I do these changes, how would the database columns be affected when upgrades are performed down the road? Im assuming file edits will need to be manually put back in, which sucks but not that bad. DB columns is a whole nother story.
Reply With Quote
  #7  
Old 08-23-2007, 02:49 PM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Attachments - Groups?

Any reason you can't setup a development board where you can test changes like that first? That's really the best way to go when you're adding new hacks or doing things like that yourself, and you can pretty much get an exact replica of your database and such. I believe there are instructions posted on vb.com or in their forums if you're not familiar with how to set that up.

As for upgrades... You would of course need to re-apply any file changes after upgrading. If you have any comparison programs (Beyond Compare is what I use and recommend), that makes things very easy. It could also be used to compare templates if you just copy the code from your version and the original, save them as files on your computer, and then load them up in the program to compare.
As for adding that column, I would recommend naming it something like 'twf_groupid'. That way there would not be any conflicts during an upgrade if we add a 'groupid' column at some point, and it would be easy to transfer things over to the default code.
Reply With Quote
  #8  
Old 09-17-2007, 05:01 PM
tfw2005 tfw2005 is offline
Senior Member
 
Join Date: Aug 2004
Posts: 352
Default Re: Attachments - Groups?

Quote:
Originally Posted by Brian View Post
I like the idea of that, but I'm not sure how widely used it would be, so I might not be able to work something like that into the default code in the immediate future. I'm not sure how familiar you are with PHP, but that's something that probably would not be that hard to hack in. You would mostly just need to add a new column to the 'adv_dyna_attachments' table for the 'groupid', edit the newattachment templates to add your select menus for the groups, change the query in dynamics/newattachment.php to include the groupid, and then modify the dynamics/showentry.php file and ADV_DYNA_SHOWENTRY template so that attachments could be sorted and arranged by their group.
Hey Brian,

Working on this in a localhost enviornment. Wondering if you could give some feedback whenever not super busy.

I added tfw_groupid to the attachment table.
I added $tfw_groupid to this block of code in newattachment.php

Code:
$db->query_write("
					INSERT INTO " . ADV_DYNA_TABLE_PREFIX . "attachments
						(entryid, filename, userid, dateline, filesize, hasthumb, valid, extension, posthash, tfw_groupid)
					VALUES (
						$entryid,
						'" . $db->escape_string($vba_image->_info['name']) . "',
						'" . $vbulletin->userinfo['userid'] . "',
						" . TIMENOW . ",
						" . intval($vba_image->_info['filesize']) . ",
						" . intval($vba_image->_info['hasthumb']) . ",
						" . iif($vba_dyna->check_cat_perms('moderateattach'), 0, 1) . ",
						'" . $db->escape_string($vba_image->_info['extension']) . "',
						'" . $db->escape_string($posthash) . "',
						$tfw_groupid
					)
				");
Added this to the newattachment template

Code:
<input type="hidden" name="tfw_groupid" value="$tfw_groupid" />
Tried to apply dropdown menus in various template locations, method or location wrong, no luck.

How and where to apply the select boxes, and exact method needed to pass the variables so that it recognizes and updates it in the DB, im a bit fuzzy.

Sorry, not so great with writing PHP from scratch, not even sure if initial steps I did are right.

Thanks!
Reply With Quote
  #9  
Old 09-18-2007, 10:32 AM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Attachments - Groups?

Where exactly are you trying to add the select box to choose the group?

As for passing the tfw_groupid variable, I would just add a new plugin to the 'vba_dyna_newattachment_start' location with the following code:
PHP Code:
$tfw_groupid $vbulletin->input->clean_gpc('r''tfw_groupid'TYPE_INT); 
That should ensure that the variable is globalized and available anywhere within the newattachment.php file.
Reply With Quote
  #10  
Old 09-18-2007, 03:54 PM
tfw2005 tfw2005 is offline
Senior Member
 
Join Date: Aug 2004
Posts: 352
Default Re: Attachments - Groups?

Quote:
Originally Posted by Brian View Post
Where exactly are you trying to add the select box to choose the group?
Next to the "remove button" on the attachment manager pop-up, after an attachment has been uploaded. Put another "save" button next to the "save category image" button underneath.
Reply With Quote
  #11  
Old 09-20-2007, 10:04 AM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Attachments - Groups?

The 'Remove' button should be located in your 'newattachment' template. Since that's used by vB as well, you would just need to wrap any new code you add in an <if condition>.
PHP Code:
<if condition="VBA_SCRIPT == 'dynamics'"

The 'Save As Category Image' button is located in the 'adv_dyna_newattachment_set_as_row' template.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Dyna's attachments be in the vBulletin attachments folder too? eJM "How Do I..." Questions 2 08-19-2007 01:31 PM
How do I set certain links to certain groups? unforgotten "How Do I..." Questions 9 04-14-2007 12:39 AM
Phrase Groups... James Goddard Feedback & Suggestions 1 10-28-2005 11:32 AM
Pre-loading phrase groups andrewd "How Do I..." Questions 1 10-02-2005 01:32 PM
Stats module, ignore certain groups? Greebo Add-On Modules & Modifications 1 04-12-2005 01:10 PM


All times are GMT -4. The time now is 03:28 PM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.