[interchange-cvs] interchange - heins modified 3 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon May 16 01:21:49 EDT 2005
User: heins
Date: 2005-05-16 05:21:49 GMT
Modified: lib/Vend/Table Editor.pm
Modified: dist/lib/UI/pages/admin content_editor.html meta_editor.html
Log:
* Make defaults for meta editor on views work.
* Allow saving defaults from meta-less editor starts to initialize
meta editor.
* Allow an overlay of certain meta values based on a subkey.
Revision Changes Path
1.77 +18 -3 interchange/lib/Vend/Table/Editor.pm
rev 1.77, prev_rev 1.76
Index: Editor.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- Editor.pm 2 May 2005 14:12:11 -0000 1.76
+++ Editor.pm 16 May 2005 05:21:48 -0000 1.77
@@ -1,6 +1,6 @@
# Vend::Table::Editor - Swiss-army-knife table editor for Interchange
#
-# $Id: Editor.pm,v 1.76 2005/05/02 14:12:11 mheins Exp $
+# $Id: Editor.pm,v 1.77 2005/05/16 05:21:48 mheins Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
package Vend::Table::Editor;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.76 $, 10);
+$VERSION = substr(q$Revision: 1.77 $, 10);
use Vend::Util;
use Vend::Interpolate;
@@ -655,7 +655,7 @@
}
sub meta_record {
- my ($item, $view, $mdb, $extended_only) = @_;
+ my ($item, $view, $mdb, $extended_only, $overlay) = @_;
#::logDebug("meta_record: item=$item view=$view mdb=$mdb");
return undef unless $item;
@@ -711,6 +711,12 @@
ref $view_hash
and @$record{keys %$view_hash} = values %$view_hash;
}
+
+ # Allow overlay of certain settings
+ if($overlay and $record->{overlay}) {
+ my $ol_hash = $record->{overlay}{$overlay};
+ Vend::Util::copyref($ol_hash, $record) if $ol_hash;
+ }
#::logDebug("return meta_record=" . ::uneval($record) );
return $record;
}
@@ -950,6 +956,15 @@
}
#::logDebug("calling Vend::Form");
+ if($record->{save_defaults}) {
+ my $sd = $Vend::Session->{meta_defaults} ||= {};
+ $sd = $sd->{"${table}::$column"} ||= {};
+ while (my ($k,$v) = each %$record) {
+ next if ref($v) eq 'CODE';
+ $sd->{$k} = $v;
+ }
+ }
+
$w = Vend::Form::display($record);
if($record->{filter}) {
$w .= qq{<INPUT TYPE=hidden NAME="ui_filter:$record->{name}" VALUE="};
1.9 +22 -7 interchange/dist/lib/UI/pages/admin/content_editor.html
rev 1.9, prev_rev 1.8
Index: content_editor.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/content_editor.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- content_editor.html 8 May 2005 03:50:06 -0000 1.8
+++ content_editor.html 16 May 2005 05:21:49 -0000 1.9
@@ -29,13 +29,28 @@
They can be relocated to a catalog-specific place
by copying to CATROOT/include.
[/comment]
-[calcn]
-unless ($CGI->{new} || $CGI->{ui_name} =~ /\S/) {
- $CGI->{new} = 1;
- $Tag->error({name => 'ui_name', set => 'Please supply name'});
-}
-return;
-[/calcn]
+
+[perl tables=mv_metadata]
+ #open this puppy for [page-calc];
+ #probably returning from meta
+ if($CGI->{item_id}) {
+ $CGI->{ui_name} ||= $Scratch->{saved_ui_name};
+ $CGI->{ui_type} ||= $Scratch->{saved_ui_type};
+ $CGI->{ui_page_template} ||= $Scratch->{saved_ui_page_template};
+ }
+ else {
+ $Scratch->{saved_ui_name} = $CGI->{ui_name};
+ $Scratch->{saved_ui_type} = $CGI->{ui_type};
+ $Scratch->{saved_ui_page_template} = $CGI->{ui_page_template};
+ }
+
+ unless ($CGI->{new} || $CGI->{ui_name} =~ /\S/) {
+ $CGI->{new} = 1;
+ $Tag->error({name => 'ui_name', set => 'Please supply name'});
+ }
+ return;
+[/perl]
+
[if cgi new]
<form action="[area __UI_BASE__/content_editor]">
[form-session-id]
2.18 +5 -3 interchange/dist/lib/UI/pages/admin/meta_editor.html
rev 2.18, prev_rev 2.17
Index: meta_editor.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/meta_editor.html,v
retrieving revision 2.17
retrieving revision 2.18
diff -u -r2.17 -r2.18
--- meta_editor.html 14 Apr 2005 20:30:33 -0000 2.17
+++ meta_editor.html 16 May 2005 05:21:49 -0000 2.18
@@ -248,7 +248,8 @@
# Always want this removed first, don't proceed if no view
$Tag->tmp('tmp_defaults');
- return unless $CGI->{ui_meta_view};
+#Debug("meta_view=$CGI->{ui_meta_view}, item_id=$CGI->{item_id}");
+ return unless $m_view;
my $db = $Db{$CGI->{mv_data_table}};
@@ -257,7 +258,8 @@
my $id = $CGI->{item_id};
$id =~ s/^[^:]+:+//;
- my $rec = $db->row_hash($id)
+#Debug("checking id=$id");
+ my $rec = $db->row_hash($id) || $Session->{meta_defaults}{$id}
or return;
delete $rec->{code};
$Scratch->{tmp_defaults} = $rec;
@@ -285,4 +287,4 @@
][/table-editor]
@_UI_STD_FOOTER_@
-<!-- page: @@MV_PAGE@@ version: $Revision: 2.17 $ -->
+<!-- page: @@MV_PAGE@@ version: $Revision: 2.18 $ -->
More information about the interchange-cvs
mailing list