[Bast-commits] r3141 - in trunk/Anything: bin lib lib/Anything/Controller lib/Anything/Model lib/Anything/Model/Anything lib/Anything/Store/DBIC lib/DB lib/DB/Anything root/base root/item root/static/css

castaway at dev.catalyst.perl.org castaway at dev.catalyst.perl.org
Sat Mar 24 22:39:23 GMT 2007


Author: castaway
Date: 2007-03-24 22:39:13 +0000 (Sat, 24 Mar 2007)
New Revision: 3141

Modified:
   trunk/Anything/bin/import_dataset.pl
   trunk/Anything/lib/Anything.pm
   trunk/Anything/lib/Anything/Controller/Global.pm
   trunk/Anything/lib/Anything/Controller/Item.pm
   trunk/Anything/lib/Anything/Model/Anything.pm
   trunk/Anything/lib/Anything/Model/Anything/ItemValues.pm
   trunk/Anything/lib/Anything/Model/Anything/Items.pm
   trunk/Anything/lib/Anything/Store/DBIC/User.pm
   trunk/Anything/lib/DB/Anything.pm
   trunk/Anything/lib/DB/Anything/ItemValues.pm
   trunk/Anything/lib/DB/Anything/Items.pm
   trunk/Anything/lib/DB/Anything/Type.pm
   trunk/Anything/root/base/edit_macros.tt
   trunk/Anything/root/base/form_macros.tt
   trunk/Anything/root/base/list_macros.tt
   trunk/Anything/root/base/login.tt
   trunk/Anything/root/item/add.tt
   trunk/Anything/root/item/edit.tt
   trunk/Anything/root/item/view_macros.tt
   trunk/Anything/root/static/css/anything.css
Log:
Tidy up, and introducing ttform


Modified: trunk/Anything/bin/import_dataset.pl
===================================================================
--- trunk/Anything/bin/import_dataset.pl	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/bin/import_dataset.pl	2007-03-24 22:39:13 UTC (rev 3141)
@@ -2,6 +2,7 @@
 
 use warnings;
 use strict;
+use Anything::Utils;
 use Getopt::Long;
 use XML::Simple;
 use DB::Anything;
@@ -34,172 +35,4 @@
     exit;
 }
 
-my $datalayout = XMLin($dataset, KeyAttr => [],
-                        GroupTags => { types => 'type',
-                                       attributes => 'attribute',
-                                       fields => 'field',
-                                       items => 'item',
-                                       values => 'value',
-                                       relationships => 'relationship'
-                                       },
-                       SuppressEmpty => 1,
-                       ForceArray => [qw/item 
-                                      type 
-                                      field 
-                                      attribute 
-                                      value
-                                      relationship
-                                      major
-                                      minor/]);
-use Data::Dumper;
-print Dumper($datalayout);
-
-print "Importing dataset: $datalayout->{name}, version $datalayout->{version}, created on $datalayout->{created}\n";
-
-DB::Anything->load_classes({ 'Anything::Model::Anything' => 
-                                 ['Type',
-                                  'Items',
-                                  'Relationships', 
-                                  'Admin',
-                                  'MajorMinor',
-                                  'TypeFields',
-                                  'ItemValues',
-                                  'TypeAttributes'
-                                  ]
-                              });
-my $dbschema = DB::Anything->connection($dsn, $db_user, $db_pass);
-
-my $admin = $dbschema->resultset('Admin')->find_or_create({ 
-    Package => $datalayout->{name},
-    Version => $datalayout->{version} });
-                                                          
-
-foreach my $type (@{$datalayout->{types} || []})
-{
-#    $type = $type->{type};
-    my ($pobj) = $dbschema->resultset('Type')->search({Name => 'Item'});
-    if($type->{parent})
-    {
-        ($pobj) = $dbschema->resultset('Type')->search({
-            Name => $type->{parent}});
-    }
-    my $tobj = $dbschema->resultset('Type')->find_or_create({
-        Name => $type->{name},
-        Description => $type->{description},
-        ParentID => $pobj->ID,
-        System => 0,
-    });
-    while (my ($f, $v) = each %{$type})
-    {
-        next if(ref($v));
-        next if($f eq 'name' or $f eq 'description');
-        if($tobj->has_column($f))
-        {
-            $tobj->set_column($f, $v);
-        }
-        else
-        {
-            warn "$type->{name} does not have a column called $f\n";
-        }
-    }
-    $tobj->update;
-
-    foreach my $field (@{$type->{fields} || []})
-    {
-#        $field = $field->{field};
-        next if(!$field);
-        my ($ftobj) = $dbschema->resultset('Type')->search({
-            Name => $field->{type}
-        });
-        if(!$ftobj)
-        {
-            warn "Can't find field type $field->{type}\n";
-            next;
-        }
-        my $fobj = $dbschema->resultset('Items')->find_or_create({
-            Name => $field->{name},
-            Description => $field->{description},
-            TypeID => $ftobj->ID,
-        });
-        my $tfobj = $tobj->find_or_create_related('typefields', {
-            FieldID => $fobj->ID,
-        });
-        $tfobj->update;
-#         while (my ($f, $v) = each %{$field})
-#         {
-#             next if(ref($v));
-#             next if($f eq 'name' or $f eq 'description');
-#             if($fobj->has_column($f))
-#             {
-#                 $fobj->set_column($f, $v);
-#             }
-#         }
-        $fobj->update;
-    }
-
-    if(@{$type->{attributes} || []})
-    {
-        my $aobj = $tobj->find_or_create_related('attributes', {});
-        foreach my $attr (@{$type->{attributes}})
-        {
-#            $attr = $attr->{attribute};
-            $aobj->set_column("$attr->{name}Field" => $attr->{text});
-        }
-        $aobj->update;
-    }
-
-    foreach my $item (@{$type->{items} || []})
-    {
-#        $item = $item->{item};
-        next if(!$item);
-        my $iobj = $tobj->find_or_create_related('items', {
-            Name => $item->{name},
-            Description => $item->{name},
-        });
-
-        foreach my $value (@{$item->{values} || []})
-        {
-#            $value = $value->{value};
-            my ($field) = $tobj->typefields->search_related('FieldID', {
-                Name => $value->{field}
-            });
-            if(!$field)
-            {
-                warn "$type->{name} does not have a field name $value->{field}\n";
-                next;
-            }
-            $iobj->find_or_create_related('itemvalues',{
-                FieldID => $field->ID,
-                Value   => $value->{value},
-            });
-        }
-    }
-}
-
-foreach my $major (@{$datalayout->{admin}{major} || []})
-{
-    my ($majtype) = $dbschema->resultset('Type')->search({
-        Name => $major->{name} });
-    if(!$majtype)
-    {
-        warn "Unknown major type: $major->{name}\n";
-        next;
-    }
-    foreach my $minor (@{$major->{minor} || []})
-    {
-        my ($mintype) = $dbschema->resultset('Type')->search({
-            Name => $minor->{name} });
-        if(!$mintype)
-        {
-            warn "Unknown major type: $minor->{name}\n";
-            next;
-        }
-        
-        my ($majmin) = $dbschema->resultset('MajorMinor')->find_or_create({
-            PackageID => $admin->PackageID,
-            MajorID => $majtype->ID,
-            MinorID => $mintype->ID,
-        });
-    }
-}
-
+Anything::Utils::import_dataset($dataset, $dsn, $db_user, $db_pass, 1);

Modified: trunk/Anything/lib/Anything/Controller/Global.pm
===================================================================
--- trunk/Anything/lib/Anything/Controller/Global.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/Anything/Controller/Global.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -50,6 +50,7 @@
         }
     }
     my ($usertype) = $c->model('Anything::Type')->search({ Name => 'User' });
+    $c->stash->{page_title} = 'Login';
     $c->stash->{usertype} = $usertype->ID;
     $c->stash->{template} = 'login.tt';
 }
@@ -72,9 +73,13 @@
     }
 
     my $searchcond = $args[0] == -1 ? {} : {TypeID => $args[0]};
-    my @items = $c->model('Anything::Items')->search($searchcond);
+    my $items = $c->model('Anything::Items')->search($searchcond,
+                                                     { columns => ['ID', 'Name'],
+                                                       order_by => ['Name'],
+                                                           }
+                                                     );
 
-    foreach my $item (@items)
+    while ( my $item = $items->next)
     {
         $select .= "<option value='" . $item->ID . "'>" . $item->Name 
             . "</option>\n";

Modified: trunk/Anything/lib/Anything/Controller/Item.pm
===================================================================
--- trunk/Anything/lib/Anything/Controller/Item.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/Anything/Controller/Item.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -82,16 +82,22 @@
 #    my @values = $item->itemvalues;
     my @fieldnames = map { $_->FieldID->Name } @values;
     my @fieldvalues = map { $_->Value } @values;
-    my @cols = map { my $n = $_; $n =~ s/[^\w\.-]//g; $n } @fieldnames;
+#    my @cols = map { my $n = $_; $n =~ s/[^\w\.-]//g; $n } @fieldnames;
+#    $c->stash->{field_values} = sub { $c->stash->{item}->value($_[0]) };
+#    $c->stash->{field_view_columns} = [ @cols ];
+#    $c->stash->{field_values} = { zip(@cols, @fieldvalues) };
+#    $c->stash->{field_monikers} = {  zip(@cols, @fieldnames) };
     $c->stash->{field_values} = sub { $c->stash->{item}->value($_[0]) };
-    $c->stash->{field_view_columns} = [ @cols ];
-    $c->stash->{field_values} = { zip(@cols, @fieldvalues) };
-    $c->stash->{field_monikers} = {  zip(@cols, @fieldnames) };
+    $c->stash->{field_view_columns} = [ @fieldnames ];
+    $c->stash->{field_values} = { zip(@fieldnames, @fieldvalues) };
+    $c->stash->{field_monikers} = {  zip(@fieldnames, @fieldnames) };
 
     $c->stash->{connected_sorted} = $item->connected_items->search({
         'attributes.InlineDisplay' => { '=', 
            ['link', undef ], }, }, {
-         join => { 'TypeID' => 'attributes' },
+         join => [{ 'TypeID' => 'attributes' }],
+#         join => [ { 'TypeID' => 'attributes' }, 'attached_items' ],
+#         '+select' => [ \('CASE attached_items_2') ],
          prefetch => 'TypeID',
          order_by => [qw/attached_items.TypeID attached_items.Name/],
       }
@@ -113,7 +119,9 @@
     my $page = $c->req->params->{page} || 1;
 #    $c->log->info("user ref" . ref($c->user->obj) . "ID " . $c->user->obj->ID);
 #    my $rows = $c->user_exists && $c->user && $c->user->obj->value('Page Size') || 20;
-    my $rows = $c->user_exists && $c->user->obj->value('Page Size') || 20;
+    my $rows = $c->user_exists && $c->user && $c->user->obj->value('Page Size') || 20;
+#    $c->log->info("Page Size :" . $c->user->obj->value('Page Size'));
+#    $c->log->info("Page Size :" . overload::StrVal $c->user->obj->value('Page Size'));
     if(@args && $args[0] ne 'item' && $args[0] > 0)
     {
         my $type = $c->model('Anything::Type')->find($args[0]);
@@ -122,7 +130,9 @@
         my $itemrs = $c->comp('DB::Anything')->sub_items($type, { 
             page => $page,
             rows => $rows });
-
+        $c->log->info("Page: $page, Rows: $rows");
+#        $c->log->info('Storage: ' . ref($itemrs->result_source->schema->storage));
+#        $c->log->info('Syntax: '. $itemrs->result_source->schema->storage->_find_syntax($itemrs->result_source->schema->storage->dbh));
         $c->stash->{items} = [ $itemrs->all ];
         $c->stash->{pager} = $itemrs->pager;
         $c->stash->{message} = "No items found of type ${type}." 
@@ -230,21 +240,13 @@
 #    $c->log->info("VALID");
 #    $c->log->_dump($c->form->valid);
 #    $c->log->_dump($c->req->params);
+    $c->log->_dump($c->req->params);
+    $c->log->info("Success? " . $c->form->success);
     $c->form->success or return( $c->forward('/item/add', [ $c->req->params->{TypeID} ]) );
 
     
     my $res = $self->SUPER::do_add(@_);
-#    $c->log->_dump($c->stash->{newitem});
-#     my $item;
-#     $self->run_safe($c,
-#         sub  { $item = $c->model('Anything::Type')->create_from_form( $c->form ) },
-#         "add", "Could not create record",
-#     ) or return;
 
-#     $c->log->_dump($item);
-#     $c->stash->{newitem} = $item;
-#     $c->stash->{message} = "Record created OK";
-
     $c->log->info("do_add: $res");
     return $res if(!$c->stash->{newitem});
     $c->stash->{newitem}->discard_changes();
@@ -257,16 +259,10 @@
         # TypeID.FieldID.Fieldname
         if($f =~ /^(\d+)\.(\d+)\.(\w+)$/)
         {
-            $c->stash->{newitem}->create_related('itemvalues',
-                                                 {
-                                                FieldID => $2,
-                                                Value => $fields->{$f}
-                                            });
+            $c->stash->{newitem}->value($2, $fields->{$f});
         }
     }
 
-#    $c->log->info("User count: " . $usertype->items->count);
-#    $c->log->info("Current type == usertype: " . $c->stash->{newitem}->TypeID->ID == $usertype->ID);
     if($c->stash->{newitem}->TypeID->ID == $usertype->ID &&
        $usertype->items->count == 1)
     {
@@ -287,23 +283,16 @@
         my $otheritem = $c->model('Anything::Items')->
             find($c->form->valid('linkitem'));
 #        $c->log->info("Otheritem: $otheritem");
-        my $linktype = $c->model('Anything::RelationTypes')->find($fields->{'linktype'});
-        $linktype = $linktype ? $linktype->ID : 1;
-        if($otheritem)
+
+        if(! $c->stash->{newitem}->connect_item($otheritem, $fields->{'linktype'}))
         {
-            $c->model('Anything::Relationships')->create({
-                LItemID => $otheritem->ID,
-                RItemID => $c->stash->{newitem}->ID,
-                RelTypeID => $linktype,
-            });
-        }
-        else
-        {
             $c->flash->{message} .= " Can't add relationship to non-existant item: " . $fields->{'linkitem'};
         }
     }
 
-    return( $c->res->redirect($c->uri_for('view', $c->stash->{newitem}->id)) );
+    $c->log->info("Redirect to: " . $c->uri_for('/item/view', $c->stash->{newitem}->id) );
+
+    return( $c->res->redirect($c->uri_for('/item/view', $c->stash->{newitem}->id)) );
 #    return $res;
 }
 
@@ -376,10 +365,10 @@
 # #    $c->log->_dump($c->stash->{values});
 # #    $c->log->_dump($c->stash->{edit_columns});
 # #    $c->log->_dump($c->stash->{column_monikers});
-     $c->stash->{alltypes} = [ $c->model('Anything::Type')->search({},
-                                                              {order_by => 'Name'}) ];
-     $c->stash->{allitems} = [ $c->model('Anything::Items')->search({},
-                                                                  {order_by => 'Name'}) ];
+     $c->stash->{alltypes} = $c->model('Anything::Type')->search({},
+                                                              {order_by => 'Name'});
+#     $c->stash->{allitems} = $c->model('Anything::Items')->search({},
+#                                                                  {order_by => 'Name'});
     
 # #    $c->log->_dump($c->stash->{alltypes});
 # #    $c->log->_dump($c->stash->{allitems});
@@ -441,19 +430,22 @@
     {
         my $otheritem = $c->model('Anything::Items')->
             find($c->form->valid('linkitem'));
-        my $linktype = $c->model('Anything::RelationTypes')->find($fields->{'linktype'});
-        $linktype = $linktype ? $linktype->ID : 1;
-        $c->log->info("Otheritem: $otheritem");
-        if($otheritem)
+
+        if(! $item->connect_item($otheritem, $fields->{'linktype'}))
         {
-            $c->model('Anything::Relationships')->create({
-                LItemID => $otheritem->ID,
-                RItemID => $item->ID,
-                RelTypeID => $linktype,
-            });
-        }
-        else
-        {
+#         my $linktype = $c->model('Anything::RelationTypes')->find($fields->{'linktype'});
+#         $linktype = $linktype ? $linktype->ID : 1;
+#         $c->log->info("Otheritem: $otheritem");
+#         if($otheritem)
+#         {
+#             $c->model('Anything::Relationships')->create({
+#                 LItemID => $otheritem->ID,
+#                 RItemID => $item->ID,
+#                 RelTypeID => $linktype,
+#             });
+#         }
+#         else
+#         {
             $c->flash->{message} .= " Can't add relationship to non-existant item: " . $fields->{'linkitem'};
         }
     }
@@ -535,11 +527,11 @@
     $c->stash->{typename} = $type->Name;
     $c->stash->{typeid} = $type->ID;
 
-    $c->log->_dump(keys %{$c->stash->{values}});
-    $c->log->_dump($c->stash->{values});
-    $c->log->_dump($c->stash->{column_monikers});
-    $c->log->_dump($c->stash->{edit_columns});
-    $c->log->_dump(\@cols);
+#     $c->log->_dump(keys %{$c->stash->{values}});
+#     $c->log->_dump($c->stash->{values});
+#     $c->log->_dump($c->stash->{column_monikers});
+#     $c->log->_dump($c->stash->{edit_columns});
+#     $c->log->_dump(\@cols);
     ## Need to set up $self->{crud_config}{data_form_validator} for this type!
     ## Model needs to set defaults for its fields
     my %dfv = %{$self->crud_config->{default_data_form_validator}};
@@ -571,12 +563,12 @@
     $self->crud_config->{data_form_validator} = \%dfv;
     $c->log->_dump(\%dfv);
 
-    $c->stash->{alltypes} = [ $c->model('Anything::Type')->search({},
-                                                             {order_by => 'Name'}) ];
-    $c->stash->{allitems} = [ $c->model('Anything::Items')->search({},
-                                                                 {order_by => 'Name'}) ];
-    $c->stash->{reltypes} = [ $c->model('Anything::RelationTypes')->search({},
-                                                                           { order_by => 'Name'}) ];
+    $c->stash->{alltypes} = $c->model('Anything::Type')->search({},
+                                                             {order_by => 'Name'}) ;
+#     $c->stash->{allitems} = [ $c->model('Anything::Items')->search({},
+#                                                                {order_by => 'Name'}) ];
+    $c->stash->{reltypes} = $c->model('Anything::RelationTypes')->search({},
+                                                                           { order_by => 'Name'}) ;
 
 }
 

Modified: trunk/Anything/lib/Anything/Model/Anything/ItemValues.pm
===================================================================
--- trunk/Anything/lib/Anything/Model/Anything/ItemValues.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/Anything/Model/Anything/ItemValues.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -6,7 +6,11 @@
 # use base qw/Catalyst::Enzyme::CRUD::Model::DBIC Anything::Model::Anything/;
 use strict;
 
-use overload '""' => sub { return $_[0]->FieldID->Name };
+# use overload '""' => sub { return $_[0]->FieldID->Name };
+use overload 
+    '""' => sub { return $_[0]->Value}, 
+    '+'  => sub { return $_[0]->Value}, 
+    fallback => 1;
 
 sub ACCEPT_CONTEXT 
 { 

Modified: trunk/Anything/lib/Anything/Model/Anything/Items.pm
===================================================================
--- trunk/Anything/lib/Anything/Model/Anything/Items.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/Anything/Model/Anything/Items.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -1,6 +1,7 @@
 package Anything::Model::Anything::Items;
 
 use DB::Anything;
+use Scalar::Util 'blessed';
 use base qw/Catalyst::Enzyme::CRUD::Model::DBIC DB::Anything::Items/;
 # use base qw/Catalyst::Enzyme::CRUD::Model::DBIC Anything::Model::Anything/;
 use strict;
@@ -11,11 +12,7 @@
     return $c->comp('DB::Anything')->resultset('Items');
 }
 
-#__PACKAGE__->columns(Stringify => "NAME");
-#__PACKAGE__->columns(view_columns => qw/  /);
-#__PACKAGE__->columns(list_columns => qw/  /);
 
-
 #See the Catalyst::Enzyme docs and tutorial for information on what
 #CRUD options you can configure here. These include: moniker,
 #column_monikers, rows_per_page, data_form_validator.
@@ -37,10 +34,10 @@
             moniker => 'Item',
             rows_per_page => 0,
             stringify_field  => 'Name',
-            list_columns  => [qw/TypeID Name Description /],
-            view_columns  => [qw/TypeID Name Description /],
-            edit_columns  => [qw/TypeID Name Description /],
-            default_edit_columns  => [qw/TypeID Name Description /],
+            list_columns  => [qw/TypeID Name /],
+            view_columns  => [qw/TypeID Name /],
+            edit_columns  => [qw/TypeID Name /],
+            default_edit_columns  => [qw/TypeID Name /],
 #            column_monikers => { __PACKAGE__->default_column_monikers },
              column_monikers => { 
                  __PACKAGE__->default_column_monikers,
@@ -50,14 +47,41 @@
 #                 Created => 'Created',
 #                 Modified => 'Modified',
              },
-            default_data_form_validator => { required => [ 'Name',
-                                                   'Description',
-                                                   'TypeID' ]
-                                                   }
+            default_data_form_validator => {
+                required => [ 'Name',
+                              'TypeID',
+                              ],
+            }
         }
     }
 );
 
+sub inflate_result
+{
+    my $self = shift;
+    my $newobj = $self->next::method(@_);
+
+    # If we're going to allow multiple datasets to be loaded at once
+    # at some point we're going to have to make each type/item know its 
+    # packageID!
+    # Using single is very much a hack here!
+
+    # Skipping if it was a minimal-column search
+    return $newobj if(!$newobj->has_column_loaded('TypeID'));
+    
+    my $schema = $newobj->result_source->schema;
+    $schema->_packagename($schema->_packagename || $schema->resultset('Admin')->single()->Package);
+    my $newclass = $schema->_packagename . '::Type::' . $newobj->TypeID->Name;
+    if(not ( $self->load_optional_class($newclass) &&   
+             $newclass->isa(blessed($newobj))
+             ))
+    {
+        $self->inject_base($newclass, blessed($newobj));
+    }
+    bless($newobj, $newclass);
+    return $newobj;
+}
+
 =head1 NAME
 
 Anything::Model::Anything::Items - DBIC Table Class

Modified: trunk/Anything/lib/Anything/Model/Anything.pm
===================================================================
--- trunk/Anything/lib/Anything/Model/Anything.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/Anything/Model/Anything.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -36,11 +36,12 @@
     my $dbpass = $c->config->{DBPASS};
     $dbpass = undef if $dbpass eq '';
 #    my $schema = DB::Anything->compose_connection('Anything::Model::Anything', $dsn, $dbuser, $dbpass)
-
+#    print STDERR "DEBUG: Called COMPONENT\n";
     my $schema = DB::Anything->compose_namespace('Anything::Model::Anything')->
 connect($dsn, $dbuser, $dbpass)
       or die "Couldn't connect to database dsn=$dsn, dbuser=$dbuser";
 #    $schema->compose_namespace('Anything::Model::Anything');
+#    print STDERR "DEBUG ", ref($schema), "\n";
     return $schema;
 }
 

Modified: trunk/Anything/lib/Anything/Store/DBIC/User.pm
===================================================================
--- trunk/Anything/lib/Anything/Store/DBIC/User.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/Anything/Store/DBIC/User.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -11,7 +11,7 @@
     my $userclass = ref $config->{auth}->{user_class} ? 
         $config->{auth}->{user_class} :
         $config->{auth}->{dbic_schema}->resultset($config->{auth}->{user_class});
-    print STDERR "UserClass: $userclass\n";
+#    print STDERR "UserClass: $userclass\n";
     my ($user) = $userclass->search(
                           { 'itemvalues.Value' => $id,
                             'FieldID.Name' => 'Username' },
@@ -19,8 +19,8 @@
                             prefetch => 'itemvalues', }
                                                        );
     return unless $user;
-    print STDERR "User: $user\n";
-    print STDERR "Found user: ", $user->Name, "\n";
+#    print STDERR "User: $user\n";
+#    print STDERR "Found user: ", $user->Name, "\n";
 
     bless {
         id     => $id,
@@ -35,7 +35,7 @@
 
     my $userobj = $self->user;
     use Data::Dumper;
-    print STDERR "UserObject", Dumper($userobj);
+#    print STDERR "UserObject", Dumper($userobj);
 #    print STDERR "TypeID", Dumper($userobj->TypeID);
 #    print STDERR "TypeIDCan", $userobj->TypeID->can("fields");
 #    my $method = $userobj->TypeID->can("fields");
@@ -64,7 +64,7 @@
     # Returns a list of roles that the current user has
     my ($self, @wanted_roles) = @_;
 
-    print STDERR "Looking for .. ", $self->user->ID, "\n";
+#    print STDERR "Looking for .. ", $self->user->ID, "\n";
     my $schema = $self->user->result_source->schema;
     my @roles = ();
     foreach my $wr (@wanted_roles)
@@ -77,7 +77,7 @@
     }
 
     use Data::Dumper;
-    print STDERR "Found roles", Dumper(\@roles);
+#    print STDERR "Found roles", Dumper(\@roles);
     return @roles;
 }
 

Modified: trunk/Anything/lib/Anything.pm
===================================================================
--- trunk/Anything/lib/Anything.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/Anything.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -23,6 +23,8 @@
     Static::Simple/;
 
 our $VERSION = '0.01';
+
+$| = 1;
  
 #
 # Configure the application
@@ -44,6 +46,7 @@
                                  },                     
                      'View::TToolkit' => {
                          DUMP_CONFIG => 1,
+                         EVAL_PERL => 1,
 #                          LOAD_TEMPLATES => [ 
 #                                   Template::Provider->new(),
 #                                   Template::Provider::DBI->new(

Modified: trunk/Anything/lib/DB/Anything/ItemValues.pm
===================================================================
--- trunk/Anything/lib/DB/Anything/ItemValues.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/DB/Anything/ItemValues.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -5,8 +5,30 @@
 # use base qw/Catalyst::Enzyme::CRUD::Model::DBIC Anything::Model::Anything/;
 use strict;
 
-use overload '""' => sub { return $_[0]->FieldID->Name };
+# use overload '""' => sub { return $_[0]->FieldID->Name };
+# use overload 
+#     '""' => sub { return $_[0]->Value}, 
+#     '+'  => sub { return $_[0]->Value}, 
+#     fallback => 1;
 
+sub fieldtype
+{
+    my ($self) = @_;
+
+    return $self->FieldID->TypeID;
+}
+
+sub get_inputname
+{
+    my ($self) = @_;
+
+    return sprintf("%d.%d.%s", 
+                   $self->FieldID->TypeID->ID,
+                   $self->FieldID->ID,
+                   $self->FieldID->Name
+                   );
+}
+
 =head1 NAME
 
 Anything::Model::Anything::Itemvalues - DBIC Table Class

Modified: trunk/Anything/lib/DB/Anything/Items.pm
===================================================================
--- trunk/Anything/lib/DB/Anything/Items.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/DB/Anything/Items.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -4,10 +4,6 @@
 use Text::LevenshteinXS 'distance';
 use strict;
 
-__PACKAGE__->has_many('rel_link', 'DB::Anything::Relationships',
-                      [ { 'foreign.LItemID' => 'self.ID' },
-                        { 'foreign.RItemID' => 'self.ID'} ]);
-
 # our $AUTOLOAD;
 # sub AUTOLOAD {
 #   my ($self, @rest);
@@ -55,33 +51,65 @@
 ## inflate_column ?
 
 sub value_raw {
-  my ($item, $field, $value) = @_;
+    my ($item, $field, $value) = @_;
+    
+    if (not defined $field) {
+        die "Attempt to get no field of an item???";
+    }
+    
+    my $cond = $field =~ /\D/ 
+        ? {'FieldID.Name' => $field } 
+        : { 'me.FieldID' => $field };
+    if (@_ == 2) {
+        my (@values) = $item->search_related
+            ('itemvalues', $cond, {join => 'FieldID'});
+        ## Return an empty/unstored ItemValues obj, if the field does not yet have a value.
+        ## Calling Value on it will return undef, but we can get the Field detail
+        if (@values == 0) {
+           my $tfieldobj = $item->find_typefield($field);
+            return $item->new_related('itemvalues',
+                                      { 'FieldID' => $tfieldobj->FieldID->ID });
+#            return undef;
+        } elsif (@values == 1) {
+            return $values[0];
+#      return $values[0]->Value;
+        } else {
+            die "Multiple values for same field of same item???";
+        }
+    } else {
+        my $tfieldobj = $item->find_typefield($field);
+        
+        return $item->find_or_create_related
+            ('itemvalues', {
+                'FieldID' => $tfieldobj->FieldID->ID,
+                Value => $value,
+            });
+#        })->Value();
+    }
+}
 
-  if (not defined $field) {
-    die "Attempt to get an strange $field of an item???";
-  }
+sub find_typefield
+{
+    my ($self, $field) = @_;
 
-  if (@_ == 2) {
-    my (@values) = $item->search_related
-      ('itemvalues', {'FieldID.Name' => $field}, {join => 'FieldID'});
-    if (@values == 0) {
-      return undef;
-    } elsif (@values == 1) {
-      return $values[0]->Value;
-    } else {
-      die "Multiple values for same field of same item???";
+    my $tfieldobj;
+    $tfieldobj = $self->{_typefieldcache}{$field};
+    my $type = $self->TypeID;
+    my $cond = $field =~ /\D/ 
+        ? {'FieldID.Name' => $field } 
+        : { 'me.FieldID' => $field };
+    while( !$tfieldobj ) {
+        $tfieldobj = $type->find_related('typefields', 
+                                         $cond,
+                                         { prefetch => 'FieldID',
+                                          });
+        last if !$type->ID;
+        $type = $type->ParentID;
     }
-  } else {
-      my $fieldobj = $item->find_related('typefields', 
-                                         { 'FieldID.Name' => $field },
-                                         { join => 'FieldID' });
-      return if !$fieldobj;
-    $item->find_or_create_related
-        ('itemvalues', {
-            'FieldID' => $fieldobj->ID,
-            Value => $value,
-        })->Value();
-  }
+    die "No such field $field on ". $self->TypeID if !$tfieldobj;
+
+    $self->{_typefieldcache}{$field} = $tfieldobj;
+    return $tfieldobj;
 }
 
 sub value {
@@ -89,6 +117,33 @@
   value_raw(@_);
 }
 
+# inflate_column instead? return ItemValue obj and stringify to value?
+{
+    my $ftype;
+    sub get_field
+    {
+        my ($self, $column) = @_;
+        my $val = eval { $self->get_column($column) };
+        if(defined $val)
+        {
+            my $schema = $self->result_source->schema;
+            $ftype ||= $schema->resultset('Type')->find({Name => 'Field'});
+            my $basefield = $schema->resultset('Items')->new({ TypeID => $ftype,
+                                                               Name   => $column });
+            return $self->result_source->schema->resultset('ItemValues')->new
+                ({FieldID => $basefield,
+                  Value => $val });
+        }
+#    $self->result_source->schema->throw_exception($@) 
+#        if($@ !~ /No such column '$column'/);
+        
+        $val = $self->value($column);
+        print STDERR "get_column: $column, $val\n";
+        
+        return $val;
+    }
+}
+
 sub values
 {
     my ($self, $schema) = @_;
@@ -114,6 +169,27 @@
 
 }
 
+sub connect_item
+{
+    my ($self, $item, $linktype) = @_;
+
+    $item = $self->result_source->resultset->find({ ID => $item }) 
+        if(!ref($item));
+    return if(!$item);
+
+    $linktype = $self->result_source->schema->resultset('RelationTypes')->find({ ID => $linktype }) 
+        if(!ref($linktype));
+    $linktype ||= 1;
+
+    $self->result_source->related_source('rel_link')->resultset->create({
+        LItemID => $item,
+        RItemID => $self,
+        RelTypeID => $linktype,
+    });
+
+    return 1;
+}
+
 sub connected_similar
 {
     my ($self, $type, $name, $dist) = @_;
@@ -170,8 +246,39 @@
     return \@sorted;
 }
 
+sub related_namespace
+{
+    my ($self, $column) = @_;
+    
+    return '' if(!$column);
+    my $relinfo = $self->relationship_info($column);
+    if($relinfo)
+    {
+        my $namespace = $relinfo->{class};
+        $namespace =~ s/^(.*?)::(\w+)$/lc($2)/e or return '';
+    
+        return("/$namespace");
+    }
+    return '';
+}
 
+sub related_items
+{
+    my ($self, $column) = @_;
+    
+    return undef if(!$column);
+    my $relinfo = $self->relationship_info($column);
+    if($relinfo)
+    {
+        my $relsource = $self->result_source->related_source($column);
+        my $relitems = $relsource->resultset->search;
+        return $relitems;
+    }
 
+    return '';
+}
+
+
 =head1 NAME
 
 Anything::Model::Anything::Items - DBIC Table Class

Modified: trunk/Anything/lib/DB/Anything/Type.pm
===================================================================
--- trunk/Anything/lib/DB/Anything/Type.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/DB/Anything/Type.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -24,7 +24,7 @@
     $schema ||= $self->result_source->schema;
 
     my @tfields = (map { {typeid => $self->ID, field => $_} } $self->fields($schema));
-    print STDERR "DB::Anything::Type::all_fields: ".$self->ID." = ".$self->Name."\n";
+#    print STDERR "DB::Anything::Type::all_fields: ".$self->ID." = ".$self->Name."\n";
     return (@tfields)
         if(not $self->ParentID);
     my $parent = $schema->resultset('Type')->find($self->ParentID->ID);

Modified: trunk/Anything/lib/DB/Anything.pm
===================================================================
--- trunk/Anything/lib/DB/Anything.pm	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/lib/DB/Anything.pm	2007-03-24 22:39:13 UTC (rev 3141)
@@ -5,7 +5,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.Type');
+__PACKAGE__->table('Type');
 
 __PACKAGE__->add_columns(
     'ID' => {
@@ -64,7 +64,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.TypeAttributes');
+__PACKAGE__->table('TypeAttributes');
 
 __PACKAGE__->add_columns(
     'TypeID' => {
@@ -113,7 +113,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.Items');
+__PACKAGE__->table('Items');
 
 
 __PACKAGE__->add_columns(
@@ -192,7 +192,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.Relationships');
+__PACKAGE__->table('Relationships');
 
 
 __PACKAGE__->add_columns(
@@ -241,7 +241,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.RelationTypes');
+__PACKAGE__->table('RelationTypes');
 
 
 __PACKAGE__->add_columns(
@@ -272,7 +272,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.Admin');
+__PACKAGE__->table('Admin');
 
 __PACKAGE__->add_columns(
     'PackageID' => {
@@ -330,7 +330,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.MajorMinor');
+__PACKAGE__->table('MajorMinor');
 
 __PACKAGE__->add_columns(
     'PackageID' => {
@@ -370,7 +370,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.TypeFields');
+__PACKAGE__->table('TypeFields');
 
 
 __PACKAGE__->add_columns(
@@ -411,7 +411,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.ItemValues');
+__PACKAGE__->table('ItemValues');
 
 
 __PACKAGE__->add_columns(
@@ -451,7 +451,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.Import');
+__PACKAGE__->table('Import');
 
 __PACKAGE__->add_columns(
     'ID' => {
@@ -518,7 +518,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.ImportResults');
+__PACKAGE__->table('ImportResults');
 
 __PACKAGE__->add_columns(
     'ImportID' => {
@@ -567,7 +567,7 @@
 use warnings;
 
 __PACKAGE__->load_components(qw/ PK::Auto WebForm Core/);
-__PACKAGE__->table('missys.ImportResultType');
+__PACKAGE__->table('ImportResultType');
 
 __PACKAGE__->add_columns(
     'ID' => {
@@ -615,12 +615,13 @@
         {
             $cols->{$col} = $results->valid($col);
         }
+## No workee on SQLite !
 ## Mega hack for Type.System, should get it from default_value?
-        else
-        {
-            $cols->{$col} = \('DEFAULT');
- # $me->result_source->column_info($col)->{default_value};
-        }
+#         else
+#         {
+#             $cols->{$col} = \('DEFAULT');
+#  # $me->result_source->column_info($col)->{default_value};
+#         }
     }
     return $me->create($cols);
 }
@@ -636,9 +637,14 @@
 __PACKAGE__->belongs_to('TypeID', 'DB::Anything::Type', undef, { cache => 1 });
 #__PACKAGE__->has_many('itemvalues', 'DB::Anything::ItemValues', 'FieldID');
 __PACKAGE__->has_many('itemvalues', 'DB::Anything::ItemValues', 'ItemID');
+# __PACKAGE_->many_to_many('related', 'rel_link',  ??
 # __PACKAGE__->has_many('rel_link', 'DB::Anything::Relationships',
 #                       [ { 'foreign.LItemID' => 'self.ID' },
 #                         { 'foreign.RItemID' => 'self.ID'} ]);
+__PACKAGE__->has_many('rel_link', 'DB::Anything::Relationships',
+                      [ { 'foreign.LItemID' => 'self.ID' },
+                        { 'foreign.RItemID' => 'self.ID'} ]);
+
 __PACKAGE__->resultset_class('DBIx::Class::WebFormRS');
 
 
@@ -712,6 +718,7 @@
 our $VERSION = '0.2';
 
 __PACKAGE__->mk_classdata('_backupfile');
+__PACKAGE__->mk_classdata('_packagename');
 # __PACKAGE__->load_components('+DBIx::Class::Schema::Versioned');
 # __PACKAGE__->upgrade_directory('./');
 

Modified: trunk/Anything/root/base/edit_macros.tt
===================================================================
--- trunk/Anything/root/base/edit_macros.tt	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/base/edit_macros.tt	2007-03-24 22:39:13 UTC (rev 3141)
@@ -4,7 +4,7 @@
  <select id="linktypelist" name="linkitemtype" onclick="fillItems(this)">
   <option value="-1">&lt;Any&gt;</option>
 
-[% FOR type = alltypes %]
+[% WHILE (type = alltypes.next) %]
   <option value="[%- type.ID -%]">[%- type.Name | html -%]</option>
 [% END; %]
 
@@ -13,11 +13,8 @@
 <label>
  <span class="item_field">Link to (Item)</span>
  <span id="linkitemlist">
-  <select name="linkitem">
-  <option value="-1">&lt;None&gt;</option>
-[%- FOR linkitem = allitems %]
-  <option value="[%- linkitem.ID -%]">[%- linkitem.Name | html -%]</option>
-[% END; %]
+  <select name="linkitem" disabled="disabled">
+  <option value="-1">&lt;Please choose a type&gt;</option>
   </select>
  </span>
 </label>
@@ -26,7 +23,7 @@
  <span id="linkitemtype">
   <select name="linktype">
   <option value="-1">&lt;None&gt;</option>
-[%- FOR linktype = reltypes %]
+[%- WHILE ( linktype = reltypes.next) %]
   <option value="[%- linktype.ID -%]">[%- linktype.Name | html -%]</option>
 [% END; %]
   </select>

Modified: trunk/Anything/root/base/form_macros.tt
===================================================================
--- trunk/Anything/root/base/form_macros.tt	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/base/form_macros.tt	2007-03-24 22:39:13 UTC (rev 3141)
@@ -1,3 +1,5 @@
+[% PROCESS "ttform.tt" %]
+
 [% MACRO form_add_column_input(do_action, column, column_moniker, control_type, thismodel)  BLOCK; %]
         <label>
 
@@ -20,15 +22,17 @@
 [% MACRO form_edit_column_input(this, do_action, column, column_moniker, thismodel)  BLOCK; %]
         <label>
         [% SET thismodel = item IF !thismodel %]
-        [% form_field_item(column, column_moniker, ['list'], 'input_field') %]
+        [%# form_field_item(column, column_moniker, ['list'], 'input_field') %]
+        [% to_field(this, column, 'name', 1, ['list']) %]
         [%
         IF c.action.name == do_action;       #invalid, redisplay req
             element = c.view().element_req(c, do_action, column, '', thismodel); %]
         [% ELSE;                                #display item
-            element = thismodel.to_field(column, undef, this);
+#            element = thismodel.to_field(column, undef, this);
+           to_field(this, column, 'edit', 1, undef, c.req.param(column));
         END;
         %]
-        [% element.as_HTML('<>&"\'') %]
+#        [% element.as_HTML('<>&"\'') %]
 
         [% IF c.form.missing(column); %]
             <span class="error_text">[% c.form.msgs.$column || 'Missing'; %]</span>
@@ -39,17 +43,11 @@
 
 [% END; %]
 
-
-
 [% MACRO form_field_item(column, column_moniker, link_params, span_class, thismodel, filter)  BLOCK; %]
-        [% SET thismodel = item IF !thismodel %]
-        [% SET filter = 'html' IF !filter %]
-        [% namespace = thismodel.namespace_of_column_has_a(c, column); %]
+        [%# SET thismodel = item IF !thismodel %]
+<!--  Column: [% column %] -->
         [% IF span_class %]<span class="[% span_class %]">[% END %]
-        [% IF namespace; %]
-            <a href="[% uri_for_list(namespace, link_params) %]">[% column_moniker | $filter %]</a>
-        [% ELSE; %]
-            [% column_moniker | $filter %]
-        [% END %]
+        [% to_field(item, column, 'name', 1, link_params, column_moniker) %]
+
         [% IF span_class %]</span>[% END %]
 [% END; %]

Modified: trunk/Anything/root/base/list_macros.tt
===================================================================
--- trunk/Anything/root/base/list_macros.tt	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/base/list_macros.tt	2007-03-24 22:39:13 UTC (rev 3141)
@@ -11,14 +11,13 @@
             END;
             %]
 [% END; %]
-
+[% PROCESS ttform.tt %]
 [% MACRO list_row_column(item, column, controller) BLOCK; %]
                 [% contr = '/' _ controller %]
                 <td>
                 [% IF column == crud.stringify_field; %]
+<!-- can this use ttform ? -->
                    <a href="[% c.uri_for(contr,'view', item.id) %]">[% item.$column | html %]</a>
-                [%# ELSIF item.$column.can('can') %]
-                   <a href="[% c.uri_for(contr, 'view', item.$column.id) %]">[% item.$column.config.crud.moniker | html %]</a>
                 [% ELSE; %]
                     [% form_field_item(column, item.$column, ['view', item.$column.id], '') %]
                 [% END; %]

Modified: trunk/Anything/root/base/login.tt
===================================================================
--- trunk/Anything/root/base/login.tt	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/base/login.tt	2007-03-24 22:39:13 UTC (rev 3141)
@@ -1,7 +1,7 @@
 [% INCLUDE "header.tt" %]
 
 <div id="title">Access is only via a registered user</div>
-<form action="[% c.uri_for('/login') %]" method="post">
+<form action="[% c.uri_for('/login') %]" name="login" method="post">
  <fieldset>
   <legend>Enter the site</legend>
   <label>

Modified: trunk/Anything/root/item/add.tt
===================================================================
--- trunk/Anything/root/item/add.tt	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/item/add.tt	2007-03-24 22:39:13 UTC (rev 3141)
@@ -9,7 +9,7 @@
 [%- END -%]
 <div id="title">Add new [% title %]</div>
 
-<form action="[% c.uri_for_controller('do_add') %]" method="post"><fieldset>
+<form action="[% c.uri_for_controller('do_add') %]" method="post" name="add_item" ><fieldset>
 <legend>Add a new [% title %]</legend>
 
     [%

Modified: trunk/Anything/root/item/edit.tt
===================================================================
--- trunk/Anything/root/item/edit.tt	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/item/edit.tt	2007-03-24 22:39:13 UTC (rev 3141)
@@ -5,7 +5,7 @@
 <script type="text/javascript" src="/static/js/linklist.js">
 </script>
 <div id="title">Edit [% crud.moniker | html %]</div>
-<form action="[% c.uri_for_controller('do_edit', item.id) %]" method="post"><fieldset>
+<form action="[% c.uri_for_controller('do_edit', item.id) %]" name="edit_item" method="post"><fieldset>
     <legend>[% crud.moniker %] '[% item | html %]'</legend>
 
     [%
@@ -16,7 +16,8 @@
 
     [%
     FOR column = edit_columns;
-        form_edit_column_input(values.$column, 'do_edit', column, column_monikers.$column);
+#        form_edit_column_input(values.$column, 'do_edit', column, column_monikers.$column);
+        form_edit_column_input(item, 'do_edit', orig_columns.$column, column_monikers.$column);
     END;
     %]
 

Modified: trunk/Anything/root/item/view_macros.tt
===================================================================
--- trunk/Anything/root/item/view_macros.tt	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/item/view_macros.tt	2007-03-24 22:39:13 UTC (rev 3141)
@@ -1,5 +1,6 @@
 [% USE Markdown %]
 [% PROCESS "form_macros.tt" %]
+[% PROCESS "ttform.tt" %]
 [% MACRO form_view_item(item)  BLOCK; %]
   <table>
     [% FOR column = crud.view_columns %]
@@ -8,16 +9,12 @@
 <!--        <div class="item_field_data" style="clear: both;"> -->
         [%
         #The field name
-        form_field_item(column, crud.column_monikers.$column, ['list'], '');
+        to_field(item, column, 'name', 1, ['list'], crud.column_monikers.$column);
         %]
         </td><td class='item_data'>
         [%
         #The field data/contents
-        IF column == 'Description';
-        form_field_item(column, item.$column, ['view', item.$column.id], '', item, 'markdown');
-        ELSE;
-        form_field_item(column, item.$column, ['view', item.$column.id], '', item, 'html');
-        END;
+        to_field(item, column, 'view', 1, ['view'], '', 'html');
         %]
         </td>
 <!--        </div> -->
@@ -28,11 +25,15 @@
         <tr class="item_field_data" style="clear: both;">
           <td class="item_field">
            [% 
-           form_field_item(value, field_monikers.$value, ['list'], ''); 
+           # The field name
+#    item.get_column(value).fieldtype;
+#    item.get_column(value);
+           to_field(item, value, 'name', 1, ['view'], '', 'html');
            %]
            </td><td class='item_data'>
            [%
-           form_field_item(value, field_values.$value, [], '', item);
+           # The field data/contents
+           to_field(item, value, 'view', 1, ['view'], '', 'html');
            %]
           </td>
         </tr>

Modified: trunk/Anything/root/static/css/anything.css
===================================================================
--- trunk/Anything/root/static/css/anything.css	2007-03-23 23:21:53 UTC (rev 3140)
+++ trunk/Anything/root/static/css/anything.css	2007-03-24 22:39:13 UTC (rev 3141)
@@ -16,13 +16,12 @@
 }
 
 .menu {
-/*  position: fixed; */
-  float: left;
+  position: fixed; 
+/*  float: left; */
   padding: 8px;
-  margin-left: 20px;
- margin-top: 20px;
- margin-bottom: 20px;
-
+  margin-left: 10px;
+  margin-top: 10px;
+  margin-bottom: 10px;
   margin-right: 10px;
   height: auto;
   width: 100px;
@@ -38,10 +37,8 @@
 .navlist {
  padding-left: 0;
  margin-left: 0;
-/*
-  border-bottom: 1px solid;
-  width: 200px;
-*/
+/* border-bottom: 1px solid;
+ width: 200px; */
 }
 
 .navlist li {
@@ -49,11 +46,11 @@
  margin: 0;
  padding: 0.1em;
  padding-left: 0.5em;
-/*border-top: 1px solid;*/
+/* border-top: 1px solid; */
 }
 
 .navlist li li {
-/*margin-left: 5px;*/
+/* margin-left: 5px; */
 }
 
 .content {
@@ -62,9 +59,8 @@
 /*  position: fixed;
   width: 80%;
   height: auto;
-  left: 130px;
- float: right;
-*/
+  left: 130px; */
+/*  float: right; */
 }
 
 
@@ -206,12 +202,12 @@
   border: 1px outset;
   background-color: #CCCC99;/*c1-dark*/
   padding: 0px 0px 2px 0px;
-/*  margin-bottom: 5px; */
+//  margin-bottom: 5px;
 }
 
 fieldset input:hover[type=submit] {
   background-color: #DDDDAA;/*c1-light*/
-/*  color: #003399; c2-highlight*/
+//  color: #003399;/*c2-highlight*/
 }
 
 fieldset .error_text {
@@ -223,17 +219,15 @@
 /* view */
 
 tr.item_field_data {
-/*  display:block;
-    width:99%
-*/
+//  display:block;
+//  width:99%
 }
 
 td.item_field {
-/*  float:left;
-    width:25%;
-    margin-right:0.5em;
-    padding-bottom:0.2em;
-*/
+//  float:left;
+//  width:25%;
+//  margin-right:0.5em;
+//  padding-bottom:0.2em;
   text-align:right;
   vertical-align: top;
   font-weight:bold;
@@ -248,9 +242,8 @@
 }
 
 td.item_data {
-/*  width:75%;
-    margin-right: 0.5em;
-*/
+//  width:75%;
+//  margin-right: 0.5em;
 }
 
 .item_local_action {




More information about the Bast-commits mailing list