Project

General

Profile

« Previous | Next » 

Revision de017852

Added by Andreas Kohlbecker over 4 years ago

fix #8718 humane error message in case the page does not exists: bug fixes and revering erroneously comitted change

View differences:

modules/cdm_dataportal/cdm_dataportal.module
1241 1241
  $media = cdm_ws_get(CDM_WS_PORTAL_MEDIA, $mediaUuid);
1242 1242
  if (!$media) {
1243 1243
    drupal_set_title(t('Media does not exist'), PASS_THROUGH);
1244
    return FALSE;
1244
    return "";
1245 1245
  }
1246 1246
  return theme('cdm_media_page', array(
1247 1247
    'media' => $media,
......
1551 1551
  $polytomousKey = cdm_ws_get(CDM_WS_POLYTOMOUSKEY, $polytomousKeyUuid);
1552 1552
  if (!$polytomousKey) {
1553 1553
    drupal_set_title(t('Polytomous key does not exist'), PASS_THROUGH);
1554
    return FALSE;
1554
    return "";
1555 1555
  }
1556 1556

  
1557 1557
  $sourcePager = cdm_ws_get(CDM_WS_POLYTOMOUSKEY, array($polytomousKeyUuid, 'sources'));
......
1811 1811
 */
1812 1812
function cdm_dataportal_description_view($uuid, $descriptive_dataset_uuid = NULL) {
1813 1813
    $description = cdm_ws_get(CDM_WS_PORTAL_DESCRIPTION, $uuid);
1814
    $description_page = new stdClass();
1814 1815
    if (empty($description)) {
1815
        drupal_set_title(t('Description does not exist'), PASS_THROUGH);
1816
        return FALSE;
1817
    }
1818
    $descriptionpage = new stdClass();
1816
      $description_page->title = t('Description does not exist');
1817
      drupal_set_title($description_page->title, PASS_THROUGH); // not necessary if correctly implemented as drupal node
1818
      $description_page->content = "";
1819 1819

  
1820
    $descriptionpage->title = $description->titleCache;
1821
    drupal_set_title($descriptionpage->title); // not necessary if correctly implemented as drupal node
1820
    } else {
1821
      $description_page->title = $description->titleCache;
1822
      drupal_set_title($description_page->title); // not necessary if correctly implemented as drupal node
1822 1823

  
1823
    // Render the description page.
1824
    $render_array = compose_cdm_description($description->uuid, $descriptive_dataset_uuid);
1825
    $descriptionpage->content = drupal_render($render_array);
1824
      // Render the description page.
1825
      $render_array = compose_cdm_description($description->uuid, $descriptive_dataset_uuid);
1826
      $description_page->content = drupal_render($render_array);
1827
    }
1826 1828

  
1827
    return $descriptionpage;
1829
    return $description_page;
1828 1830
}
1829 1831

  
1830 1832
function cdm_dataportal_description_page_view($uuid, $descriptive_dataset_uuid = NULL) {
......
1835 1837
    return cdm_node_show_simulate($descriptionpage->content);
1836 1838
  }
1837 1839
  else {
1838
    drupal_set_title(t('Description does not exist'), PASS_THROUGH);
1839
    return false;
1840
    return NULL;
1840 1841
  }
1841 1842
}
1842 1843

  
modules/cdm_dataportal/includes/pages.inc
1386 1386
  $reference = cdm_ws_get(CDM_WS_REFERENCE, $uuid);
1387 1387
  if (!$reference) {
1388 1388
    drupal_set_title(t('Reference does not exist'), PASS_THROUGH);
1389
    return null;
1389
    return "";
1390 1390
  }
1391 1391
  if (isset($reference->titleCache)) {
1392 1392
    drupal_set_title($reference->titleCache, PASS_THROUGH);
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
165 165
       * Special case: Child nodes with empty statements but taxa as leaf are to
166 166
       * treated as if all those taxa where direct children of the source node.
167 167
       */
168
      $target_taxon_child = [];
169
      foreach($child->children as $sub_child) {
170
        if(!isset($sub_child->statement) && isset($sub_child->taxon->uuid)){
171
          $target_taxon_child[$sub_child->uuid] = $sub_child;
172
        }
173
      }
174
      $islinkToManyTaxa = count($target_taxon_child) > 0;
168
      $islinkToManyTaxa = !isset($child->children[0]->statement) && isset($child->children[0]->taxon->uuid);
175 169
      $islinkToTaxon = isset($child->taxon->uuid);
176 170
      $islinkToSubKey = isset($child->subkey->uuid);
177 171
      $islinkToOtherNode = isset($child->otherNode);

Also available in: Unified diff