The file browsing at node editing is not works?

Comments

Ectar’s picture

Can you provide more information or details?
In my case if I do any disknode edit, I can browse.

falu’s picture

OK!

I have solved this problem with adding this line to function __disknode_form(&$node) in disknode.module:
drupal_add_js(drupal_get_path('module', 'disknode').'/disknode.js');
and removing this line:
<script type="text/javascript" src="${base_url}/modules/disknode/disknode.js"></script>
And the working disknode.module:

function __disknode_form(&$node) {
  global $base_url;

  drupal_add_js(drupal_get_path('module', 'disknode').'/disknode.js');

  $form['files'] = array(
    '#type' => 'fieldset',
    '#title' => t('Files'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE
  );

  $fileentries = "";
  $output = "";
  $filepaths = "";
  $maxfiles = intval(variable_get("disknode_maxfiles", 1));
  if ($maxfiles == 0) $maxfiles = 1;

  if (isset($node->filepaths)) {
    $filepaths = $node->filepaths;
  }
  else if (is_array($node->disknodefiles)) {
    foreach ($node->disknodefiles as $file) {
      $filepaths .= $file->filepath."\n";
    }
  }
  else $filepaths = "";

  if ($maxfiles != 1) {
    $form['files']["filepaths"] = array(
      '#type' => 'textarea',
      '#title' => t("File paths"),
      '#default_value' => trim($filepaths),
      '#cols' => 80,
      '#rows' => ($maxfiles<=-1?5:$maxfiles),
      '#description' => t("Each line represents a file download. Each one is the relative file path in the files directory. (Maximum = %max)", array("%max" => $maxfiles)),
    );
  }
  else {
    $form['files']["filepaths"] = array(
      '#type' => 'textfield',
      '#title' => t("File path"),
      '#default_value' => $filepaths,
      '#size' => 60,
      '#maxlength' => 65535,
      '#description' => t("The relative filepath in the files directory.") . ($error["filepaths"] ? $error["filepaths"] : ''),
    );
  }

  $form['files']["browsebtn"] = array(
    '#type' => 'button',
    '#button_type' => 'button',
    '#attributes' => array(
      "onclick" => "disknodeFiles.openWindow(); return false;",
    ),
    '#value' => 'browse files',
  );

  $fbURL = url("disknode/browse", "disknodeutil", NULL, true);

  $form['files']["disknode_script"] = array(
    '#value' => <<<EOF
<script type="text/javascript">disknodeFiles = new disknodeCallback(document.getElementById('edit-filepaths'), $maxfiles, '$fbURL');</script>
EOF
  );
  return $form;
}

I think that the source of the problem was that my disknode module is in the sites/all/modules directory.

mooffie’s picture

Status: Active » Closed (duplicate)

This is a duplicate of http://drupal.org/node/178231