permalink / image editing of database

8 views
Skip to first unread message

0bvious

unread,
Aug 10, 2010, 8:40:55 AM8/10/10
to Lifepress
Hello

I have been trying to add a 'permalink' option to the editing form in
the sweetcron backend. I would also like to add an edit 'image' box
too.

I tried adding a new option to the edit menu via: views/admin/
write.php, thus:

<p><label class="title" for="permalink_input">Permalink</label>
<input id="permalink_input" class="text_input" name="permalink"
value="<?php if (!$_POST && isset($item)): echo $item->item_permalink;
else: echo $this->input->post('permalink'); endif;?>" /></p>


This seems to add the right content to the edit page, but when you go
to save it nothing happens. What Am I missing? What do I need to add
elsewhere to get this to work?

As stated above, I would love to have a similar function for adding/
editing the images saved in the database

Any ideas would be greatly appreciated

Carlos K

unread,
Aug 10, 2010, 11:43:14 AM8/10/10
to Lifepress
For this to work you'd need to add a field to the database (otherwise
there's nowhere for it to be saved), luckily I'm going to be mucking
around in the DB in a couple of days so I'll be sure to add the field
to the appropriate table. (However, I'm not sure when the new DB
features (I've got a bunch of cool ones in mind) are going to land)

-Carlos

0bvious

unread,
Aug 11, 2010, 5:12:45 AM8/11/10
to Lifepress
Surely there is one already in the database?

It is called 'item_permalink'

If it weren't there then you couldn't save anything.

The code I attached above shows the permalink for the particular post
(try it) but when you edit and save it nothing happens

Carlos Killpack

unread,
Aug 11, 2010, 11:07:03 AM8/11/10
to life...@googlegroups.com
Hmm, let me look again.. Is your HTML inside of the <form> tag with everything else you're submitting?

0bvious

unread,
Aug 11, 2010, 11:40:14 AM8/11/10
to Lifepress
Here's the entire page:



<div id="main_content">

<?php if (isset($editing)): ?>
<p id="breadcrumb"><a href="<?php echo $referer?>">Back to Items</a>
&rsaquo; Editing <span class="highlight"><?php echo $item->item_title?
></span></p>
<?php endif; ?>

<?php if (isset($errors)): ?>
<div class="error"><?php echo $errors?></div>
<?php endif; ?>

<form action="" method="post" class="generic">

<p><label class="title" for="title_input">Title</label>
<input id="title_input" type="text" class="text_input" name="title"
value="<?php if (!$_POST && isset($item)): echo $item->item_title;
else: echo $this->input->post('title'); endif;?>" /></p>

<p><label class="title" for="content_input">Content</label>
<textarea id="content_input" class="text_input" name="content"><?php
if (!$_POST && isset($item)): echo $item->item_content; else: echo
$this->input->post('content'); endif;?></textarea></p>

<p><label class="title" for="permalink_input">Permalink</label>
<input id="permalink_input" class="text_input" name="permalink"
value="<?php if (!$_POST && isset($item)): echo $item->item_permalink;
else: echo $this->input->post('permalink'); endif;?>" /></p>

<p><label class="title" for="tag_input">Tags</label>
<input id="tag_input" type="text" class="text_input" name="tags"
value="<?php if (!$_POST && isset($tag_string)): echo $tag_string;
else: echo $this->input->post('tags'); endif;?>" /></p>
<span class="input_explain">Separate with commas e.g. these, are, my,
tags</span></p>

<?php if (isset($editing) && empty($item->item_feed_id)): ?>

<p><label class="title" for="feed_url_input">Timestamp / Publish
Options</label>
<span class="option_container">
<span class="option"><input<?php if (!$_POST || $this->input-
>post('timestamp') == 'no_change'): ?> checked="checked"<?php endif; ?
> type="radio" name="timestamp" value="no_change"
id="radio_no_change" /> <label for="radio_no_change">No Change</
label></span>
<span class="option"><input<?php if ($this->input->post('timestamp')
== 'make_current'): ?> checked="checked"<?php endif; ?> type="radio"
name="timestamp" value="make_current" id="radio_make_current" />
<label for="radio_make_current">Make Current Time</label></span>
<?php if ($item->item_status == 'draft'): ?>
<span class="option"><input<?php if ($this->input->post('timestamp')
== 'make_current_publish'): ?> checked="checked"<?php endif; ?>
type="radio" name="timestamp" value="make_current_publish"
id="radio_make_current_publish" /> <label
for="radio_make_current_publish">Make Current Time and Publish Now</
label></span>
<?php endif; ?>
</span>
</p>

<?php endif; ?>

<div class="buttons">

<input type="hidden" value="false" name="draft" />
<div class="clear"></div>
<?php if (isset($editing)): ?>
<input type="hidden" name="referer" value="<?php echo $referer?>" />
<input type="hidden" name="save_edit" value="true" />
<button type="submit" class="positive">
<img src="<?php echo $this->config->item('base_url')?>public/
images/system/icons/silk/accept.png" alt="" />
Save Changes
</button>
<?php else: ?>
<button type="submit" class="positive">
<img src="<?php echo $this->config->item('base_url')?>public/
images/system/icons/silk/accept.png" alt="" />
Publish Post Now
</button>
<a href="#draft" class="draft_button">
<img src="<?php echo $this->config->item('base_url')?>public/
images/system/icons/silk/page_white.png" alt="" />
Save as Draft
</a>
<?php endif; ?>
</div>

</form>

</div>

<div id="side_content">
<p class="tip"><strong>Shorthand</strong><br />The blog post content
area supports the <a href="http://daringfireball.net/projects/markdown/
syntax" rel="external">Markdown</a> method of shorthand markup.</p>

</div>



On Aug 11, 4:07 pm, Carlos Killpack <killpac...@gmail.com> wrote:
> Hmm, let me look again.. Is your HTML inside of the <form> tag with
> everything else you're submitting?
>

0bvious

unread,
Aug 11, 2010, 11:58:49 AM8/11/10
to Lifepress
Also, I noticed that you've add a 'Preview' box to the lifepress edit
screen. It doesn't seem to work though. Have I missed something?

Thanks

Carlos Killpack

unread,
Aug 11, 2010, 12:09:27 PM8/11/10
to life...@googlegroups.com
I just read through the controller that this view talks to (admin/write.php) and it doesn't look for a 'permalink' field so the additional data that you're POSTing is getting ignored. I'll be sure to fix that when I start working on some DB stuff. (Unless of course you can fix it and submit a patch)

In any case file an issue over at http://code.google.com/p/lifepress so nobody forgets to get it done.

-Carlos

PS. One of the milestones for Heathcliff (the first official release of Lifepress) is a revamp of the admin area. I haven't worked on it myself but I would assume that Carsten added it while he was working on the UI.

Carsten

unread,
Aug 12, 2010, 12:33:05 AM8/12/10
to Lifepress
On 11 Aug., 18:09, Carlos Killpack <killpac...@gmail.com> wrote:
> PS. One of the milestones for Heathcliff (the first official release of
> Lifepress) is a revamp of the admin area. I haven't worked on it myself but
> I would assume that Carsten added it while he was working on the UI.
That's right. I wanted to include a good editor for the posts,, allow
editing of the feed icons and stuff.

0bvious

unread,
Aug 13, 2010, 6:06:04 AM8/13/10
to Lifepress
OK, so I messed around in the application/controllers/admin/write.php
file

Underneath this:

$new_post->item_title = $this->validation->title;
if (!$this->validation->content) {
$new_post->item_content = '';
} else {
$new_post->item_content = $this->validation->content;
}

I added this:

if (!$this->validation->permalink) {
$new_post->item_permalink = '';
} else {
$new_post->item_permalink = $this->validation-
>permalink;
}

Along witht he edit I made to the other write.php files (outlined
above) this seems to make it possible to now edit permalinks directly
from the edit menu. Once the new permalink is saved the edit screen
loads for awhile and then seems to crash, but the edit does work.

I am not sure if this also adds the abilility to add permalinks from
scratch. I am going to go and test that out now. Also, I might try and
add some other abilities.

Success!

0bvious

unread,
Aug 13, 2010, 6:39:12 AM8/13/10
to Lifepress
I tried to do the same with 'feed_id', but it didn't work
Reply all
Reply to author
Forward
0 new messages