PDA

View Full Version : Moderators Functions - [AJAX] Edit Attachment Filenames


Abe1
05-11-2008, 10:00 PM
Edit Attachment Filenames 3.0

Click here to Nominate this Mod for Mod the Month (https://vborg.vbsupport.ru/vborg_miscactions.php?do=nominatehotm&t=178937)

About this hack:
This hack is a pretty useful hack. It lets you edit filenames of attachments. Only users with 'canmoderateattachments' permissions on the forum that the attachment it posted by will be allowed to edit the filenames.

You access the edit by double clicking right near the filename of an attachment. It will bring up an edit box similar to the edit thread title vb feature. You will get an option to save or cancel the edit.

Now that you can see a list of all attachments in one thread, you would want to name some attachments differently so they can be identified with out looking at the post.

The filename extension cannot be edited.

Installation information on hack:

Files edited: 0
Templates edited: 2
Files to upload via FTP: 1
Time to install: 1 minute maxUpdates:

Version 3.0 (05/11/08):

First release of this hack for vb 3.7.

Please post your comments or suggestions for this hack. I read ALL posts.

MAKE SURE YOU CLICK INSTALL (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=178937)!
You will get an email when a new version is released.

veenuisthebest
05-12-2008, 01:30 AM
reserved !!

RvG2
05-12-2008, 02:18 AM
installed!

Boofo
05-12-2008, 07:24 AM
Will this work for attachments as files as well as attachments in the db?

Milad
05-12-2008, 09:30 AM
I wish you can eliminate the template edits! Can you?

Stoebi
05-12-2008, 09:57 AM
I wish you can eliminate the template edits! Can you?
Do you have installed Template Modification System from Andreas? Use the attachment. ;)

@Abe1
Better use $vbphrase[save] and $vbphrase[cancel], please. :)

Javascript error, if I want inline edit an attachment in postbit template (see attached thumbnail, please):
Error: document.getElementById("attachment_filename_" + attachmentid) has no properties
Source file: .../clientscript/edit_attachment_filenames.js
Line: 9

document.getElementById('attachment_filename_' + attachmentid).innerHTML = ''
Edit:
Updated templateedits, because copy & paste error. Please download the templateedits-abe1_edit_attachment_name.xml (https://vborg.vbsupport.ru/attachment.php?attachmentid=80451&d=1210595430) again and reimport. sorry. :(

Regards

Abe1
05-12-2008, 10:54 AM
Do you have installed Template Modification System from Andreas? Use the attachment. ;)

@Abe1
Better use $vbphrase[save] and $vbphrase[cancel], please. :)

Will be hard. It hard codes this into the plugin because I use 'button' and not 'submit'. It right now compares the Save or Cancel text.


Javascript error, if I want inline edit an attachment in postbit template (see attached thumbnail, please):
Error: document.getElementById("attachment_filename_" + attachmentid) has no properties
Source file: .../clientscript/edit_attachment_filenames.js
Line: 9

document.getElementById('attachment_filename_' + attachmentid).innerHTML = ''
Regards
You did not do the template edits perfectly then. It seems like you are missing the 2nd template edit for postbit_attachment

Abe1
05-12-2008, 11:00 AM
Will this work for attachments as files as well as attachments in the db?
Sure.

Abe1
05-12-2008, 11:01 AM
I wish you can eliminate the template edits! Can you?
Nope. I wish I was able to though. I can make the headinclude edit go automatic. Maybe for next version.

Stoebi
05-12-2008, 11:32 AM
Thank you very much Abe1 for this hint, this was a typically copy & paste error. Copied twice same text for find and replace :(

Regards

TWTCommish
05-12-2008, 02:45 PM
This looks awfully slick. Nice addition. :)

Stoebi
05-12-2008, 03:46 PM
Will be hard. It hard codes this into the plugin because I use 'button' and not 'submit'. It right now compares the Save or Cancel text.

Hm, i see no differents, if I use $vbphrase[save] instead save etc.

Abe1
05-12-2008, 11:00 PM
Hm, i see no differents, if I use $vbphrase[save] instead save etc.
If you change the language, it wont work.

NAZIA
05-13-2008, 04:41 PM
Opps.
not working.. It is leading to downloading the file..
And when I ve import the second attachment this is leading to

Invalid File Specified

Please help because I want to rename the attachment...
Thanks in advance

Abe1
05-14-2008, 10:52 PM
Opps.
not working.. It is leading to downloading the file..
And when I ve import the second attachment this is leading to



Please help because I want to rename the attachment...
Thanks in advance
I would need to test on your site to figure out what is wrong.

maxicep
06-02-2008, 07:25 AM
if new attachment filename value including latin characters ( like "ş, ğ, İ" ) it is looking

test-changed %u015F.rar (http://www.maxicep.com/attachments/11189d1212393260/)How can i use a replacement about Turkish some characters to English character

Like

ş > s
ğ > g
İ > i

Thanks

Boofo
06-03-2008, 12:30 AM
Abe1, any way to get this to work on attachment thumbnail file names?

Boofo
06-03-2008, 12:50 AM
I just recieved a security token error while editing a filename. Here is the info:

Missing or Invalid Security Token detected.

Script Call Backtrace
=====================
#0 /xxxx/xxxx/public_html/forums/includes/functions.php line 2592: eval()
#1 /xxxx/xxxx/public_html/forums/includes/init.php line 419: fetch_error(security_token_missing,ltr,sendmessage .php)
#2 /xxxx/xxxx/public_html/forums/global.php line 20: require_once(/xxxx/xxxx/public_html/forums/includes/init.php)
#3 /xxxx/xxxx/public_html/forums/ajax.php line 58: require_once(/xxx/xxxx/public_html/forums/global.php)

POST Variables
==============

Array
(
[ajax] => 1
[securitytoken] =>
)

Request URI
===========
/forums/ajax.php

Referrer
========
http://www.fathers-rights-forums.com/forums/showthread.php?t=261

Fonzi
06-23-2008, 06:52 PM
I just recieved a security token error while editing a filename. Here is the info:

I'm getting the same error, did you find a fix for it?

Boofo
06-23-2008, 07:45 PM
Not fixed yet, waiting on Abe to do the support thing.

ErrorLog
07-25-2008, 07:38 PM
Thanks ..

İnstalled Button =}

testebr
09-09-2008, 01:04 AM
How to I can edit one image file name with this tool?

thumbnails are enabled in my board.

Makc666
05-22-2009, 06:00 AM
Abe1, any way to get this to work on attachment thumbnail file names?

How to I can edit one image file name with this tool?

thumbnails are enabled in my board.

1st,
if you click on page forumdisplay.php on the URL -->> https://vborg.vbsupport.ru/external/2009/05/5.gif <<-- for the thread where you need to edit thumbnail image name then you will be able to do so.

2nd,
You can do so...

Open template:
postbit_attachmentmoderated

Find:
<tr>

REPLACE with this:
<tr<if condition="can_moderate($threadinfo['forumid'], 'canmoderateattachments')"> ondblclick="edit_attachment_name($attachment[attachmentid]);"</if>>

Find:
<td><if condition="$show['modattachmentlink']"><a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;d=$attachment[dateline]"<if condition="$show['newwindow']"> target="_blank"</if>>$attachment[filename]</a> ($attachment[filesize])<else />$attachment[filename]</if></td>

REPLACE with this:
<td><if condition="$show['modattachmentlink']"><a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;d=$attachment[dateline]"<if condition="$show['newwindow']"> target="_blank"</if> id="attachment_filename_$attachment[attachmentid]">$attachment[filename]</a><a id="attachment_filename_edit_$attachment[attachmentid]"></a> ($attachment[filesize])<else />$attachment[filename]</if></td>


After that you can take any post.
Select it with inline moderation.
Then "Unapprove Attachments"
By double clicking on file name icon change the file name you like.
Then "Approve Attachments" for that post again.


3rd,

You can open the template:
postbit_attachmentthumbnail

ADD to the END of the template:
<if condition="can_moderate($threadinfo['forumid'], 'canmoderateattachments')"><a id="attachment_filename_$attachment[attachmentid]" ondblclick="edit_attachment_name($attachment[attachmentid]);">$attachment[filename]</a><a id="attachment_filename_edit_$attachment[attachmentid]"></a></if>


After that in the thread up to the right of any thumbnail you will see the filename.
Double click on it and you can change the name.


I know that it's not beautiful, but I could not find a better way to do so for that template.

You can try to add:
<if condition="can_moderate($threadinfo['forumid'], 'canmoderateattachments')"><a id="attachment_filename_$attachment[attachmentid]" ondblclick="edit_attachment_name($attachment[attachmentid]);">*</a><a id="attachment_filename_edit_$attachment[attachmentid]"></a></if>

Then you will only have "*" after each thumbnail and not file name.

shyguy82
02-16-2010, 03:26 PM
Any way you can make it work with vB 4.x???

Thanks

shyguy82
08-08-2010, 12:52 AM
Any news on this plugin working for vB 4 ?

:)

majidmozaffari
02-27-2011, 01:43 PM
please working this plugin for vB 4

p30suite
09-24-2011, 07:21 PM
it is not work on v4 :( please ...
i need this mod for v4 :(

xorex
12-25-2012, 10:33 PM
SECURITY WARNING

This hack allow execute scripts e.t.c

try rename file as

<script>alert('hi');</script>

and it work

same situation in admincp if you view attachements stats

Farsisat
03-21-2013, 10:08 AM
please make it for vb 4.2