Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.

If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping

Answers may be delayed for posts that do not include sufficient information.

Issue in display Sub-representation(sub-object) on main object detail page in pawtucket version1.4

edited April 2014 in Pawtucket
I am upgrading providence and pawtucket  1.2 to 1.4 version.
all the things runs very well. but i face one problem on object representation detail page. where i m unable to see sub-representation name with its all detail (like object id, sort_name, locale_id, label_id etc)  (sub-object) on  main object(representation) detail page.

here i attached 2 snapshot is existing_1.2version.png file is my existing version layout where PARTS title have display with sub-representation(sub-object) name with its all detail (like object id, sort_name, locale_id, label_id etc).

and second snapshot is new_1.4version.png file is my upgraded version layout where PARTS title wouldn't display sub-representation(sub-object) name with its its all detail (like object id, sort_name, locale_id, label_id etc).

Also i debug code where i got different array values for sub-representation(sub-object). this value(in array) you can see in snapshot. in newer version i got only sub-object title name where in existing version i got all the detail of sub-object.

Can you guide me for same to where should i change for displaying sub-representation title with its link in upgraded(1.4) version or how can i get this all detail in newer version?

Thnx in advance



  • Hi Seth, 
    can you guide me on this? 
    or can anyone address this same?
  • This install is having this issue, too. 
  • I'm totally new to CollectiveAccess, but tried to solve the hierarchical-details-display on my own (had to learn PHP syntax by reading the code :-( )

    Same problem here (CollectiveAccess-Quickstart-Windows-1.4 (1).zip) .

    Line 112 in \xampp\htdocs\pawtucket\themes\default\views\Detail\ca_objects_detail_html.php needs the object id. 

    I now understand that it is supposed to come from the array $va_children, but this one contains only the names of the objects.

    Looking up this name and object_id element in $va_child even generates an error as it is only a string now, what can be seen with the "var_dump($va_children);"

    Warning: Illegal string offset 'name' inC:\xampp\htdocs\pawtucket\themes\default\views\Detail\ca_objects_detail_html.phpon line 112

    Warning: Illegal string offset 'object_id' inC:\xampp\htdocs\pawtucket\themes\default\views\Detail\ca_objects_detail_html.phpon line 112

    Was looking at the wrong place (the caNavLink call at line 112) , the root cause seems to be at the line 102.
    $va_children = $t_object->get("ca_objects.children.preferred_labels", array('returnAsArray' => 1, 'checkAccess' => $va_access_values));
    returning only one dimension of the array.

    Too complex for me .... where is that get-method ?

  • Looks like the comment in Basemodel.php " returnAsArray: if true, fields that can return multiple values [currently only <table_name>.children.<field>] will return values in an indexed array; default is false" is what should be happening in pawtucket 1.4 if the object has children. Only an array with the preferred_names however is returned. 

    The example of Priyam is showing that array in the new_1.4version.png.

    I'm working with the 1.4 quickstart package, with no modifications.

    Thanks in advance for looking at this. 
  • In your theme what is the line that is printing out those 1's?
  • There is one character/line printed per child item. For Priyam it's a "c" , for dlawman it's a "1" , in my case it was somewhere between the error messages, and it was a "b" as far as I remember.

    Anway the print comes from line 112 ( print "<div>".caNavLink($this->request, $va_child['name'], '', 'Detail', 'Object', 'Show', array('object_id' => $va_child['object_id']))."</div>";) , a print command that expects '$va_child' to be an array, what it is not in version 1.4 . $va_child is one element from the array $va_children, that Priyam dumped in his examples outputs. (Left example is OK, right is not OK for that print command)

    At least that's what I understand from the code ...

  • C, 1 or b ... ? as different output per user for the same problem?
    Is it he first letter of the child_object_name ?
    The child-object's name for Priyam was "Chanji" , dlawman probably had a number "1", and my object name was "book" .

    Hope this helps, seems to be the same problem. The current version of PHP generates a warning, as it is configured in the todays quickstart package 1.4 .
  • yes, in my case it is a date start so the first character of any date 1984_obj... any resolution for this?
  • Seth helped me with this today. The error is in the get function calling the array in pawtucket/themes/[yourtheme]/views/Detail/ca_objects_detail_html.php about line 101.

    # --- child hierarchy info
    $va_children = $t_object->get("ca_objects.children.preferred_labels", array('returnAsArray' => 1, 'checkAccess' => $va_access_values));
    if(sizeof($va_children) > 0){
    print "<div class='unit'><h2>"._t("Part%1", ((sizeof($va_children) > 1) ? "s" : ""))."</h2> ";
    $i = 0;
    foreach($va_children as $va_child){
    # only show the first 5 and have a more link
    if($i == 5){
    print "<div id='moreChildrenLink'><a href='#' onclick='$(\"#moreChildren\").slideDown(250); $(\"#moreChildrenLink\").hide(1); return false;'>["._t("More")."]</a></div><!-- end moreChildrenLink -->";
    print "<div id='moreChildren' style='display:none;'>";
    print "<div>".caNavLink($this->request, $va_child['name'], '', 'Detail', 'Object', 'Show', array('object_id' => $va_child['object_id']))."</div>";
    if($i == sizeof($va_children)){
    print "</div><!-- end moreChildren -->";
    print "</div><!-- end unit -->";
  • Okay, so this is still breaking in CA1.4. As I understand it. $va_child is returning as a string, not an array now. So when it's a string, then you CAN treat it as an array, but non-numeric indexes will be treated as 0 - meaning you're accessing the first (zero-index) char of that string. var_dump confirms this. So then, how do we get the string to display all of the characters instead of just the first character?  
  • I assume this is the same thing you posted on GitHub?
  • edited April 2016
    It is, I wasn't sure where to ask anymore- here or Github? This has been an open issue for awhile (2014). No real resolution. This is CA1.4. I have been hesitant to go forward with any other release because I don't have a stable front end for 1.4 yet. This is the same child hierarchy code still found everywhere I look in Pawtucket. Most of the themes have just disabled it. I still find it in the default theme and the iphone theme on Github, however. 
  • We don't really support v1.4 anymore, and the old Pawtucket(1) is basically just around for compatibility and legacy project. Most of the themes in there are terribly outdated and (probably) at least partially broken.

    That being said, fixing that problem in your theme really shouldn't be that hard if all you want is a list of child objects.
  • I know I need an echo statement, but I just don't have it structured correctly. I get the strings to echo but not as links.
  • try:

    if ($vs_children = $t_object->get('ca_objects.children.preferred_labels', array('returnAsLink' => true, 'delimiter' => '<br/>'))) {
    print "<div>".$vs_children."</div>";
  • That does work @sophie, but gives me a terminally repeating problem. 
  • edited April 2016
    This seems to work. 
    # --- child hierarchy info
    $va_children = $t_object->get("ca_objects.children.preferred_labels", array('returnAsArray' => 1, 'returnAsLink' => true, 'checkAccess' => $va_access_values));
    if(sizeof($va_children) > 0){
    print "<div class='unit'><h2>"._t("Part%1", ((sizeof($va_children) > 1) ? "s" : ""))."</h2> ";

    echo implode(", ", $va_children);
    print "</div><!-- end unit -->";
Sign In or Register to comment.