Send Netdot-devel mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."


Today's Topics:

   1. lib/Netdot/UI.pm add_to_fields() method question  (v1.0.4)
      (William Bulley)
   2. Re: lib/Netdot/UI.pm add_to_fields() method question      (v1.0.4)
      (William Bulley)


----------------------------------------------------------------------

Message: 1
Date: Fri, 21 Feb 2014 16:31:18 -0500
From: William Bulley <[email protected]>
Subject: [Netdot-devel] lib/Netdot/UI.pm add_to_fields() method
        question        (v1.0.4)
To: Carlos Vicente <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

I have a situation where I want to combine more than one column of
a PostgreSQL table to be presented in the UI on the right-hand side
of a view.  For example, in htdocs/management/device.html we have:

   (@field_headers, @cell_data) = ();
   $ui->add_to_fields(o=>$o, edit=>$editloc, fields=>['owner', 'used_by'],
                   field_headers=>\@field_headers, cell_data=>\@cell_data,
                   linkpages=>['view.html','view.html','view.html']);

On the "Device" "Basics" "Location/Contacts" view, this turns into:

        Owner: <name of owner>
      Used by: <name of user>
     Contacts: _______________
     etc.

I want to do something like this for another table (other than Device):

   push( @field_headers, $ui->col_descr_link('Contact', 'person', "Person: ");
   $ui->add_to_fields(o=>$person, edit=>$editcontacts,
        fields=>['firstname', 'lastname'], field_headers=>\@field_headers,
        cell_data=>\@cell_data, linkpages=>['view.html', '']);

However, rather than concatenate 'firstname' and 'lastname' into one
HTML anchor like so:

     Person: Tom Jones
             ---------
(where the underscores indicate a "hotlink") instead this is what I see:

     Person: Tom
             ---------
             Jones
             ---------

I was able to confirm this behaviour by adding a second "Contact" to a
Device already present in the database with one "Contact":

        Owner: <name of owner>
      Used by: <name of user>
     Contacts: <first contact>
               <second contact>

I had hoped, naively, that the above Contact(s) would be comma separated.

If I want to "solve" this "problem" with (or enhance this behaviour of)
the add_to_fields() method of lib/Netdot/UI.pm what technique should I
use?

   1) modify add_to_fields() to support this behaviour, provide diffs

   2) create a different method in lib/Netdot/UI.pm, provide diffs

   3) wait for Carlos or Anton to show me how to do this today (!)

   4) come up with a workaround that does not involve code changes

What I have done to date for the "Person" case above is as follows:

   my $fullname = $person->firstname . " " . $person->lastname;
   my $email = $person->email;
   push @field_headers, "Person:";
   push (@cell_data, '<a href="view.html?table=Person&id=' . $person->id . '">'
         . $fullname . "</a>". " " . "<a href=\"mailto:$email\";>$email</a>");

This presents an acceptable display like this:

   Person: Tom Jones [email protected]
           --- ----- -------------

where the underscores indicate "hotlinks", but when I "edit" the page
with $editcontacts as above (similar to "editgen", "editloc", or
"editmgmt" as found in htdocs/management/device.html), the entire line
above ("Person: Tom Jones [email protected]") is not made "active" for the
editing process.  I'm not sure how to resolve this problem.  Ideas?


Regards,

web...

-- 
William Bulley                     Email: [email protected]

72 characters width template ----------------------------------------->|


------------------------------

Message: 2
Date: Fri, 21 Feb 2014 21:11:46 -0500
From: William Bulley <[email protected]>
Subject: Re: [Netdot-devel] lib/Netdot/UI.pm add_to_fields() method
        question        (v1.0.4)
To: Carlos Vicente <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Nevermind...

I found the html_field() method in the same lib/Netdot/UI.pm module
to be exactly what I needed.  Sorry to bother you and the list...

Regards,

web...

-- 
William Bulley                     Email: [email protected]

72 characters width template ----------------------------------------->|


------------------------------

_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel


End of Netdot-devel Digest, Vol 83, Issue 12
********************************************

Reply via email to