[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 6ac3ebd60d830772598242ee21ccddc37b0a4c04
Stefan Hornburg
racke at rt.icdevgroup.org
Fri Feb 6 11:34:52 UTC 2009
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange wellwell catalog".
The branch, master has been updated
via 6ac3ebd60d830772598242ee21ccddc37b0a4c04 (commit)
via 3b07bd63887e82b8e6e0628130cad10d44d6d329 (commit)
from 7be4fea92be103cd4f7c500a6a8227656d8ec6a1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6ac3ebd60d830772598242ee21ccddc37b0a4c04
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Fri Feb 6 12:33:59 2009 +0100
remove debug message
pick up URI passed in CGI for new content
commit 3b07bd63887e82b8e6e0628130cad10d44d6d329
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Fri Feb 6 12:32:57 2009 +0100
new create_link parameter
-----------------------------------------------------------------------
Summary of changes and diff:
plugins/content/code/content.tag | 56 +++++++++++++----------
plugins/content/code/form_content_edit_load.sub | 16 ++++---
2 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/plugins/content/code/content.tag b/plugins/content/code/content.tag
index 59fbe12..1406a71 100644
--- a/plugins/content/code/content.tag
+++ b/plugins/content/code/content.tag
@@ -15,46 +15,52 @@ sub {
$ctset = $Db{content}->query({sql => qq{select * from content where uri = $uri_qt},
hashref => 1});
-
+
if (@$ctset) {
$code = $ctset->[0]->{code};
$ctref = $ctset->[0];
- } else {
- $Tag->error({name => 'content',
- set => 'Content not found'});
- return '';
}
}
else {
- unless ($ctref = $Db{content}->row_hash($code)) {
- Log("Code $code not found.");
- $Tag->error({name => 'content',
- set => 'Content not found'});
- return '';
- }
+ $ctref = $Db{content}->row_hash($code);
}
- if ($opt->{edit_link}) {
- my (@edit_perms, $uri);
+ if ($ctref) {
+ if ($opt->{edit_link}) {
+ my (@edit_perms, $uri);
+
+ # determine whether uses has permissions to edit content
+ @edit_perms = ('edit_content');
- # determine whether uses has permissions to edit content
- @edit_perms = ('edit_content');
+ if ($Session->{logged_in} && $Session->{username} == $ctref->{uid}) {
+ push (@edit_perms, 'edit_own_content');
+ }
- if ($Session->{logged_in} && $Session->{username} == $ctref->{uid}) {
- push (@edit_perms, 'edit_own_content');
+ if ($Tag->acl({function => 'check', permission => \@edit_perms})) {
+ $uri = $Tag->area({href => "content/edit/$ctref->{code}"});
+ $content{edit_link} = qq{<a href="$uri">Edit</a>};
+ }
}
- if ($Tag->acl({function => 'check', permission => \@edit_perms})) {
- $uri = $Tag->area({href => "content/edit/$ctref->{code}"});
- $content{edit_link} = qq{<a href="$uri">Edit</a>};
+ unless ($opt->{no_title}) {
+ $content{title} = $ctref->{title};
}
- }
- unless ($opt->{no_title}) {
- $content{title} = $ctref->{title};
- }
+ $content{body} = $ctref->{body};
+ }
+ else {
+ if ($opt->{create_link}) {
+ my ($uri);
+
+ # determine whether uses has permissions to edit content
+ if ($Tag->acl({function => 'check', permission => 'create_content'})) {
+ $uri = $Tag->area({href => "content/edit",
+ form => "uri=$opt->{uri}"});
- $content{body} = $ctref->{body};
+ $content{edit_link} = qq{<a href="$uri">Create</a>};
+ }
+ }
+ }
if ($body) {
return $Tag->uc_attr_list({hash => \%content, body => $body});
diff --git a/plugins/content/code/form_content_edit_load.sub b/plugins/content/code/form_content_edit_load.sub
index 4d85506..0cce58d 100644
--- a/plugins/content/code/form_content_edit_load.sub
+++ b/plugins/content/code/form_content_edit_load.sub
@@ -1,16 +1,20 @@
Sub form_content_edit_load <<EOS
sub {
my (@fields, @content);
-Log("Loading form");
+
@fields = qw/title body uri/;
$Tag->perl({tables => 'content'});
-
- @content = $Db{content}->get_slice($CGI->{code}, \@fields);
- for (my $i = 0; $i <= @fields; $i++) {
- $Values->{$fields[$i]} = $content[$i];
+ if ($CGI->{code}) {
+ @content = $Db{content}->get_slice($CGI->{code}, \@fields);
+
+ for (my $i = 0; $i <= @fields; $i++) {
+ $Values->{$fields[$i]} = $content[$i];
+ }
+ }
+ else {
+ $Values->{uri} = $CGI->{uri};
}
-
}
EOS
hooks/post-receive
--
Interchange wellwell catalog
More information about the wellwell-devel
mailing list