Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#571 2006-06-04 07:10:03
- mazso
- Member
- Registered: 2005-09-29
- Posts: 25
Re: upm_img_popper
I’m sure, it’s my fault: I installed upm_image_popper plugin and maybe I installed it two times. Now I get an message:
Fatal error: Cannot redeclare upm_img_popper_help() (previously declared in /www/htdocs/w006da50/textpattern/lib/txplib_misc.php(459) : eval()’d code:3) in /www/htdocs/w006da50/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 2
I’ve neither access to the website nor to the admin area. What can I do? Updating a fresh txplib_misc.php didn’t help. Has anyone any idea?
Thanks
Mazso
Last edited by mazso (2006-06-04 16:02:41)
Offline
#572 2006-06-04 14:25:36
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: upm_img_popper
Remove upm_img_popper completely (and upm_image, if it is there), then try adding it again.
Offline
#573 2006-06-04 16:09:31
- mazso
- Member
- Registered: 2005-09-29
- Posts: 25
Re: upm_img_popper
Mary wrote:
Remove upm_img_popper completely (and upm_image, if it is there), then try adding it again.
Thanks Mary, but this one didn’t help, because I had no access to the —frontend— backend. But just one hour ago I found a solution.
I called the online database (with phpmyadmin), made a local copy of the whole db. Then I made copy of the txp_plugin-table, removed all the data and uploaded the data from the non-wrecked local installation txp_plugin-table.
Don’t forget to remove all the “create table”-stuff at the beginning of the data.
Mazso
Last edited by mazso (2006-06-05 18:05:51)
Offline
#574 2006-06-16 18:07:56
Re: upm_img_popper
Hi Mary
Thanks for a great plugin!
I want to use upm_img_popper to insert image tags into a field into the genral info field in jmc_event_manager. I’m a PHP/SQL programmer / SysAdmin and my experience writing Java Script is limited.
I know these are quite basic questions but I just want to be sure I’m integrating it correctly:
1) What code do I need to insert into the jmc_event_manager code page to call the upm_img_popper from a java script function link so that all the relevant java script variables are set?
2) What code/variables/config options do I need to change to alter the target form and form field or text area where the tag gets inserted? (the insertTag(type, id, ext, width, height, alt, title) function looks like a likely place to start!?)
It wouldbe great to add “target” config options to upm_img_popper so that plugin devs can use it as a ‘ standard’ image inserting tool in their plugins.
Any help or pointers on this would be greatly appreciated.
Thanks
Offline
#575 2006-06-16 19:20:33
Re: upm_img_popper
There are a couple way you can go about it. You could specify a new type that gets passed to insertTag() and build a link pasisng this type to the appropriate condition to insert it where you want. This would require a new type, link and switch for every new location.
Most flexible thing to do would probably be to modify how the current variable is set. Right now it is globally set to “Body” in the opener window at around line 140. If you came up with a way to pass the value of current to the pop up you could then create Insert image links that would pass the locations you wanted the resulting tag to be inserted into.
You could pass the value as a URL parameter grab it with php set a javascript variable using the parameter in the popup and then change line 532 from window.opener.current to current
Or actually after a better look probably the best thing would be to extend the function in line 142 to loop through the inputs in the page and have an onClick event attached to all of them that would change current to that element. That way it would insert the data in the last area you clicked in making it pretty universal.
Ok now I’m just rambling.
btw. These line numbers are coming from just copying teh plugin code form teh TXP admin interface and pasting them in a text editor
Shoving is the answer – pusher robot
Offline
#576 2006-06-16 19:34:09
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: upm_img_popper
- The url you need is just
?event=upm_img_popper&bm=true - That’s correct,
insertTag()handles where tags get inserted.
One thing you need to worry about: the edit links. If you click on an image’s name, it’ll bring you away from whatever screen you’re on to the image editing screen. The plugin won’t know about your screen. See goEditImage().
It wouldbe great to add “target” config options to upm_img_popper so that plugin devs can use it as a ‘standard’ image inserting tool in their plugins.
I think you’re the first person to ask for this. I’m not sure if it’ll happen, but I’ll keep it in mind.
Offline
#577 2006-06-16 20:38:54
Re: upm_img_popper
Howdy
thanks for both of your replies
So taking both of your inputs and going the most simple (and inelegant) route
I could use a specific link in jmc_event_managerlike
?event=upm_img_popper&bm=true&target=event_image
to open the pop up .
Then in upm_img_popper I’ve used
<code>
if(isset($_GET[‘target’])){
var current = ‘OtherInfo’;//the name of text area in jmc
}else{
var current = ‘Body’;//the name of main textarea in the TXP write form}
</code>
Which should enter the the result from append or replace into the “OtherInfo” textarea.
But it doesnt. Where am I going wrong??? Do I also need to update the inserTag() function?
Thnx
Last edited by ollieclubb (2006-06-16 20:40:28)
Offline
#578 2006-06-16 20:49:09
Re: upm_img_popper
var current is set in the opening window. So you probably have to set it using
window.opener.current = "OtherInfo";
Remember that you have to have the setting be visible to javascript since current is set by javascript. So you probably want to do.
bc..
if(isset($_GET[‘target’])){
$js = ‘<script type=“text/javascript”>’;
$js .= ‘window.opener.current = “OtherInfo”;//the name of text area in jmc’;
$js .= ‘</script>’;
echo $js;
}
you don’t really need the else since if target is not in $_GET[] current just won’t change.
Last edited by hakjoon (2006-06-16 21:22:57)
Shoving is the answer – pusher robot
Offline
#579 2006-06-16 21:53:54
Re: upm_img_popper
Thanx 4 your help but its still not working :-/
Opening window is the window that is being opened ie upm_img_popper rrright?
Thought about using something like this js code from upm_img_popper
<code>
if (document.article.Excerpt)
{
document.article.Body.setAttribute(‘onclick’, “current = ‘Body’;”);
document.article.Excerpt.setAttribute(‘onclick’, “current = ‘Excerpt’;”);
}
</code>
which is used to change the insertion target from the body to the Excerpt field. So it might be easier to write something like this
<code>
if (window.opener.document.OtherInfo){
document.OtherInfo.setAttribute(‘onclick’, “current = ‘OtherInfo’;”);
}
</code>
its just that dont really have enough js knowledge to write the ifs or the set statement – I’m sure I’m not referencing the right DOM object/item. Its like knowing the needle is in the upper left corner of the haystack but not being able to quite put your finger on it…
Last edited by ollieclubb (2006-06-16 22:02:45)
Offline
#580 2006-06-16 22:11:42
Re: upm_img_popper
Ok I think stuff might not be where it needs to be.
To do the previous method you need to add the directive to function upm_img_popper_list(). Change:
bc..
pagetop(upm_img_popper_gTxt(‘image_selector’), $message);
to
bc..
pagetop(upm_img_popper_gTxt(‘image_selector’), $message);
if(isset($_GET[‘target’])){
$js = ‘<script type=“text/javascript”>’;
$js .= ‘window.opener.current = “OtherInfo”;//the name of text area in jmc’;
$js .= ‘</script>’;
echo $js;
}
and it should work. To do the onclick you want to do the following in the same function that does the excerpt one that you pointed out above.
bc..
if (document.jmc_event_form.OtherInfo){
document.jmc_event_form.OtherInfo.setAttribute(‘onclick’, “current = ‘OtherInfo’;”);
}
replace jmc_event_form with the name of the form that jmc_event_manager uses (I don’t know if it’s still article or not), however this method requires that the user click on Otherinfo for current to change.
Last edited by hakjoon (2006-06-16 22:13:49)
Shoving is the answer – pusher robot
Offline
#581 2006-06-17 00:58:57
Re: upm_img_popper
Hello again
I ultimately settled for the easiest option and heres what worked for me:
at line 464 of jmc_event_manager give the events forrm a name of ‘jmc_article’
echo '<form name="jmc_article" id="jmc_article" action="index.php" method="post">';
Then I simply copied the functions already in insertTag() function at line 590 and adapted them based on the form name and fields which are only present in the jmc_event_manager events form:
<code>
if (window.opener.document.jmc_article){ //if the document contains a form called “jmc_article”
if (type 'append-article-image'){
if (window.opener.document.jmc_article.OtherInfo.value ‘’)
{
window.opener.document.jmc_article.OtherInfo.value = insert; //Update the jmc_event_manager field OtherInfo
success();
}
}}
// etc etc etc
</code>
many thanks to hakjoon for helping to blow enough fog out of my brain to find the needle!
Offline
#582 2006-08-17 01:49:10
Re: upm_img_popper
I can’t find the needle in the haystack: how can I align a thumbnail image with the popper? I tried adding align=“left” to the tag, but didn’t work.
—-
Anton aka mistersugar – ‘yumi stap storian’ – antonzuiker.com
Offline
#583 2006-08-17 02:36:37
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: upm_img_popper
The plugin comes with help documentation, laying out all the attributes the tags accept. You need to use a class.
Offline
#584 2006-08-19 00:00:29
Re: upm_img_popper
Ah, got it. Thanks. And now I remember doing just that on another of my Txp sites.
—-
Anton aka mistersugar – ‘yumi stap storian’ – antonzuiker.com
Offline
#585 2006-09-12 01:58:27
Re: upm_img_popper
Mary,
Any chance that you’ve got a working version of this for the latest SVN?
I don’t get the “insert image” link on revision Textpattern version: 4.0.3 (r1788)
(this is the most recent “test” release that Sencer let go in the forum)
:)
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline