Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-18 10:16:59

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,268

caption_edit_link

Almost everything is already done. Not by me. No! I think for creating a caption edit link it’s sufficient to change only some attributes in Rob Sables wonderful rss_article_edit in order to catapult the user onto the image tab with the right image already selected. Just, I don’t have the knowledge to do so :-/

There is just one mini function, one line of code that creates the edit link. If it really is as simple as I imagine, would somebody be so kind and post the necessary changes it takes to create a caption_edit_link? :)

Below is the above-mentioned function:

function rss_caption_edit($atts,$thing="") {
	global $thisarticle, $rss_ae_cookie;
  extract(lAtts(array(
    'prefix' => '',
    'suffix' => '',
    'class' => 'articleedit'
  ),$atts));
	return isset($_COOKIE[$rss_ae_cookie]) ? $prefix.'<a class="'.$class.'" href="'.hu.'textpattern/index.php?event=article&step=edit&amp;ID='.$thisarticle['thisid'].'">'.parse($thing).'</a>'.$suffix : "";
}

In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#2 2008-06-18 16:21:17

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: caption_edit_link

Was thinking about this one my self…

Now that we have <txp:if_privileged> we could do away with the need for the plugin, right?

Hang on…

Offline

#3 2008-06-18 16:31:16

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: caption_edit_link

mrdale wrote:

Now that we have <txp:if_privileged> we could do away with the need for the plugin, right?

Dale, you mean txp:rvm_if_privileged, right?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2008-06-18 16:31:24

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: caption_edit_link

OK, way out of my depth here, but wouldn’t something like this work?

<txp:rvm_if_privileged>
    <txp:php><a href="'.hu.'textpattern/index.php?event=article&step=edit&amp;ID='.$thisarticle['thisid'].'"></txp:php>
        <txp:article_image/>
    </a>
<txp:else/>
    <txp:article_image/>
</txp:rvm_if_privileged>

Last edited by mrdale (2008-06-18 16:32:09)

Offline

#5 2008-06-18 16:33:33

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: caption_edit_link

maniqui wrote:

Dale, you mean txp:rvm_if_privileged, right?

Zackly, you can tell why I suck at scripting. Cleanup is twice as long as the actual coding.

BTW that last chunk of code was a kinda what if… I don’t know php, so feel free to jump in and correct it, cause I’m almost certain it won’t work…

Last edited by mrdale (2008-06-18 16:34:59)

Offline

#6 2008-06-18 19:39:28

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: caption_edit_link

I have no idea what anyone is talking about, but here’s an updated version of mrdale’s PHP:

<txp:rvm_if_privileged>
    <txp:php>
    $root = hu;
    echo <<<EOD
<a href="{$root}textpattern/index.php?event=article&amp;step=edit&amp;ID={$GLOBALS['thisarticle']['thisid']}">
EOD;
    </txp:php>
        <txp:article_image/>
    </a>
<txp:else/>
    <txp:article_image/>
</txp:rvm_if_privileged>

Last edited by jm (2008-06-18 19:39:48)

Offline

#7 2008-06-18 20:31:36

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,268

Re: caption_edit_link

In case I haven’t made my self clear enough: It’s about accompanying the great rss_article_edit tag with its equivalent for images. So if I click the edit link beneath the image I’m taken right to the image tab with the image I want to change caption/alt text/settings for already awaiting me.

Thus, as far as I think, there should be something like this event=image&step=image_edit&id= ... in the code if it’s about editing the image.

But it’s exactly this point where I’m lost. How do I open the right image? Where can I get the image’s ID?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#8 2008-06-18 20:58:38

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: caption_edit_link

uli wrote:

But it’s exactly this point where I’m lost. How do I open the right image? Where can I get the image’s ID?

Yep, those scripts will return edit link to the article. But you don’t need it. Offtopic, but to add, you don’t need any php to do the article edit link:

<txp:rvm_if_privileged><a href="<txp:site_url />textpattern/index.php?event=article&amp;step=edit&amp;ID=<txp:article_id />">Edit article</a></txp:rvm_if_privileged>

To fix that part. But to back to the real uli’s issue: What you use to output the image? Article? Is it an article image? That information is needed, that we know what we should output and where – that we can get the image ID :)

Last edited by Gocom (2008-06-18 20:59:20)

Offline

#9 2008-06-18 21:24:18

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,268

Re: caption_edit_link

Gocom, thanks! Kind of you ;)

What you use to output the image? Article? Is it an article image?

Already guessed that this will become important. As of now i plan to use it for article images only. But would the link in another form be capable of opening “normal images” as well?

Last edited by uli (2008-06-18 21:24:57)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#10 2008-06-18 22:01:04

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: caption_edit_link

Oh, I must have misread the concept, I was trying to make a front side “image” edit link (as an analog to a frontside “article” edit link).

But I think we’re close to doing that, no?

Offline

#11 2008-06-18 22:04:19

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: caption_edit_link

uli wrote:

As of now i plan to use it for article images only.

Then this should (eh, will) form the complete edit link:

<txp:site_url />textpattern/index.php?event=image&step=image_edit&id=<txp:php>echo $GLOBALS['thisarticle']['article_image'];</txp:php>

So we get:

<txp:rvm_if_privileged><a href="<txp:site_url />textpattern/index.php?event=image&step=image_edit&id=<txp:php>echo $GLOBALS['thisarticle']['article_image'];</txp:php>">Edit the image</a></txp:rvm_if_privileged>

That can be edited to fit your personal tastes. That excepts that you use article id’s inside article image field – plus only one image per article. But that can be modified to support multiple images ect :)

But would the link in another form be capable of opening “normal images” as well?

Requires different kind of script as – well, IDs are served from different ways :)

Last edited by Gocom (2008-06-18 22:06:53)

Offline

#12 2008-06-18 22:15:09

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: caption_edit_link

dont see why this wouldnt work:

<txp:rvm_if_privileged>
      <a href="/textpattern/index.php?event=image&step=image_edit&id=<txp:php>echo $thisarticle['article_image'];</txp:php>">EDIT IMAGE</a>
</txp:rvm_if_privileged>

edit: whoops guess im a bit late

Last edited by iblastoff (2008-06-18 22:16:55)

Offline

Board footer

Powered by FluxBB