Esempio n. 1
0
function budgets_supplier_form(&$node, &$param)
{
    $type = node_get_types('type', $node);
    if (!empty($param['values'])) {
        $node = (object) $param['values'];
    }
    guifi_log(GUIFILOG_TRACE, 'function budgets_supplier_form(READ)', $node->role);
    if ($type->has_title) {
        $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title);
    }
    /*
     * Professional or Volunteer?
     */
    $form['role'] = array('#type' => 'radios', '#title' => t('Role'), '#options' => array('volunteer' => t('Volunteer'), 'professional' => t('Professional')), '#default_value' => $node->role, '#description' => t('Use professional for Service Level commitments and economic professional activities, volunteer when is not.<br>' . 'Note: You can rebuild the form to select available capabilities by pressing "Preview" button.'), '#required' => TRUE);
    /*
     * Address
     */
    $form['address'] = array('#type' => 'fieldset', '#attributes' => array('class' => 'supplier-fieldset'), '#title' => t('Address'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    if (empty($node->address1) or empty($node->postal_code) or empty($node->city) or empty($node->country)) {
        $form['address']['#collapsed'] = FALSE;
    }
    $form['address']['address1'] = array('#type' => 'textfield', '#size' => 256, '#maxlength' => 256, '#title' => t('Postal Address'), '#required' => TRUE, '#default_value' => $node->address1);
    $form['address']['address2'] = array('#type' => 'textfield', '#size' => 256, '#maxlength' => 256, '#required' => FALSE, '#default_value' => $node->address2);
    $form['address']['postal_code'] = array('#type' => 'textfield', '#title' => t('Postal Code'), '#description' => t('Postal or zip code'), '#size' => 10, '#maxlength' => 20, '#required' => TRUE, '#default_value' => $node->postal_code);
    $form['address']['city'] = array('#type' => 'textfield', '#title' => t('City'), '#size' => 25, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->city);
    $form['address']['region'] = array('#type' => 'textfield', '#title' => t('Region or province'), '#size' => 25, '#maxlength' => 128, '#required' => FALSE, '#default_value' => $node->region);
    $form['address']['country'] = array('#type' => 'textfield', '#title' => t('Country'), '#size' => 25, '#maxlength' => 128, '#required' => TRUE, '#default_value' => $node->country);
    /*
     * Zones
     */
    $zone_ids = array();
    $form['zones'] = array('#type' => 'fieldset', '#title' => t('Zones'), '#description' => t('Zones where the offerings are available, includes the selected node and childs belonging to the selected zone.<br>' . 'Use "Preview" button if all nodes are filled, and you need more rows to fill.'), '#collapsible' => TRUE, '#collapsed' => $node->zones[0] != '' ? TRUE : FALSE, '#attributes' => array('class' => 'zones'), '#tree' => TRUE);
    $zone_id = 0;
    $nzones = count($node->zones);
    guifi_log(GUIFILOG_TRACE, 'function budgets_supplier_form(zones)', $node->zones);
    do {
        $form['zones'][$zone_id] = array('#type' => 'textfield', '#size' => 80, '#default_value' => $node->zones[$zone_id] != '' ? $node->zones[$zone_id] . '-' . guifi_get_zone_name($node->zones[$zone_id]) : NULL, '#maxsize' => 256, '#autocomplete_path' => 'guifi/js/select-zone');
        $zone_id++;
    } while ($zone_id < $nzones + 3);
    if ($type->has_body) {
        $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
    }
    /*
     * Tax & fiscal information
     */
    $zone_ids = array();
    $form['tax'] = array('#type' => 'fieldset', '#title' => t('Tax & Fiscal information'), '#description' => t('Zones where the offerings are available, includes the selected node and childs belonging to the selected zone.<br>' . 'Use "Preview" button if all nodes are filled, and you need more rows to fill.'), '#collapsible' => TRUE, '#collapsed' => $node->tax_code != '' ? TRUE : FALSE, '#attributes' => array('class' => 'tax supplier-fieldset'));
    $form['tax']['tax_code'] = array('#type' => 'textfield', '#size' => 25, '#maxlength' => 50, '#title' => t('Tax Code / Fiscal Number'), '#required' => TRUE, '#default_value' => $node->tax_code, '#description' => t('Whatever is the legal id in your country for tax and fiscal purposes.'));
    $form['tax']['default_tax_rate'] = array('#type' => 'textfield', '#size' => 10, '#maxlength' => 10, '#title' => t('Default tax rate'), '#required' => TRUE, '#default_value' => $node->default_tax_rate, '#description' => t('When loading quotes and items into proposals.<br> "0" means that the prices are given with the tax included.'));
    /*
     * Certifications
     */
    if (!empty($node->role)) {
        $form['certs'] = array('#type' => 'fieldset', '#title' => t('Enabling Certifications'), '#attributes' => array('class' => 'supplier-fieldset'), '#description' => t('Certificates held by the supplier for empowering activities.<br>' . "Leave blank if unknown/don't have or specify issue date in DD/MM/YYYY format. Note that the provider is required to send a copy of some of those certifications to the Foundation, and be available at any time upon request."), '#collapsible' => TRUE, '#collapsed' => ($node->tp_certs or $node->guifi_certs or $node->other_certs) ? TRUE : FALSE, '#tree' => TRUE);
    }
    $options_tp_certs = guifi_types('tp_certs');
    $count = 1;
    $totalv = count($options_tp_certs);
    if ($node->role == 'professional') {
        foreach ($options_tp_certs as $key => $cert) {
            $prefix = '';
            $suffix = '';
            if ($count == 1) {
                $prefix = '<div class=certs><table><tr><th>' . t('date') . '</th><th>' . t('Professional certificate') . '</th></tr>';
            }
            if ($count == $totalv) {
                $suffix = '</table></div>';
            }
            $form['certs']['tp_certs'][$key] = array('#type' => 'textfield', '#size' => 10, '#default_value' => $node->certs['tp_certs'][$key], '#attributes' => array('class' => "cert-field"), '#prefix' => $prefix . '<tr><td>', '#suffix' => '</td><td>' . $cert . '</td>' . $suffix);
            $count++;
        }
    }
    $options_guifi_certs = guifi_types('guifi_certs');
    $count = 1;
    $totalv = count($options_guifi_certs);
    if (!empty($node->role)) {
        foreach ($options_guifi_certs as $key => $cert) {
            $prefix = '';
            $suffix = '';
            if ($count == 1) {
                $prefix = '<div class=certs><table><tr><th>' . t('date') . '</th><th>' . t('guifi.net certificate') . '</th></tr>';
            }
            if ($count == $totalv) {
                $suffix = '</table></div>';
            }
            $form['certs']['guifi_certs'][$key] = array('#type' => 'textfield', '#size' => 10, '#default_value' => $node->certs['guifi_certs'][$key], '#attributes' => array('class' => "cert-field"), '#prefix' => $prefix . '<tr><td>', '#suffix' => '</td><td>' . $cert . '</td>' . $suffix);
            $count++;
        }
    }
    if (!empty($node->role)) {
        $form['certs']['other_certs'] = array('#type' => 'textfield', '#title' => t('Other certificates'), '#description' => t('Other certifications that might be on the interest for the activity, i.e. Quality,ISO Certs, ...<br>' . 'List them sepparated by commas.'), '#size' => 256, '#maxlength' => 1024, '#required' => FALSE, '#tree' => FALSE, '#default_value' => $node->other_certs);
    }
    /*
     * Capabilities
     */
    $skills_list = guifi_types('skills');
    if (!empty($node->role)) {
        foreach ($skills_list as $k => $value) {
            if (guifi_type_relation('skills', $k, $node->role)) {
                $skill_opts[$k] = $value;
            }
        }
    }
    if (!empty($node->role)) {
        $form['caps'] = array('#type' => 'fieldset', '#title' => t('Capabilities, services & offerings'), '#attributes' => array('class' => 'supplier-fieldset'), '#description' => t('Grid for selecting capabilities, offerings & services built for %role. Press "Preview" if you switched the role to rebuild this grid.', array('%role' => $node->role)), '#collapsible' => TRUE, '#collapsed' => ($node->caps_services or $node->caps_network or $node->caps_services or $node->other_caps) ? TRUE : FALSE, '#tree' => TRUE);
    }
    $skills = t('capability & skills');
    $opt_caps = guifi_types('caps_services');
    $count = 1;
    $totalv = count($opt_caps);
    if (!empty($node->role)) {
        foreach ($opt_caps as $key => $cap) {
            $prefix = '';
            $suffix = '';
            if ($count == 1) {
                $prefix = '<div class=certs><table><tr><th>' . $skills . '</th><th>' . t('services & content providers') . '</th></tr>';
            }
            if ($count == $totalv) {
                $suffix = '</table></div>';
            }
            $form['caps']['caps_services'][$key] = array('#type' => 'select', '#options' => $skill_opts, '#disabled' => guifi_type_relation('caps_services', $key, $node->role) ? false : true, '#default_value' => $node->caps['caps_services'][$key], '#attributes' => array('class' => "cert-field"), '#prefix' => $prefix . '<tr><td>', '#suffix' => guifi_type_relation('caps_services', $key, $node->role) ? '</td><td>' . $cap . '</td>' . $suffix : '</td><td><strike>' . $cap . '</strike></td>' . $suffix);
            $count++;
        }
    }
    $opt_caps = guifi_types('caps_network');
    $count = 1;
    $totalv = count($opt_caps);
    if (!empty($node->role)) {
        foreach ($opt_caps as $key => $cap) {
            $prefix = '';
            $suffix = '';
            if ($count == 1) {
                $prefix = '<div class=certs><table><tr><th>' . $skills . '</th><th>' . t('network dev. & mgmt.') . '</th></tr>';
            }
            if ($count == $totalv) {
                $suffix = '</table></div>';
            }
            $form['caps']['caps_network'][$key] = array('#type' => 'select', '#options' => $skill_opts, '#disabled' => guifi_type_relation('caps_network', $key, $node->role) ? false : true, '#default_value' => $node->caps['caps_network'][$key], '#attributes' => array('class' => "cert-field"), '#prefix' => $prefix . '<tr><td>', '#suffix' => guifi_type_relation('caps_network', $key, $node->role) ? '</td><td>' . $cap . '</td>' . $suffix : '</td><td><strike>' . $cap . '</strike></td>' . $suffix);
            $count++;
        }
    }
    $opt_caps = guifi_types('caps_project');
    $count = 1;
    $totalv = count($opt_caps);
    if (!empty($node->role)) {
        foreach ($opt_caps as $key => $cap) {
            $prefix = '';
            $suffix = '';
            if ($count == 1) {
                $prefix = '<div class=certs><table><tr><th>' . $skills . '</th><th>' . t('project development') . '</th></tr>';
            }
            if ($count == $totalv) {
                $suffix = '</table></div>';
            }
            $form['caps']['caps_project'][$key] = array('#type' => 'select', '#options' => $skill_opts, '#disabled' => guifi_type_relation('caps_project', $key, $node->role) ? false : true, '#default_value' => $node->caps['caps_project'][$key], '#prefix' => $prefix . '<tr><td>', '#suffix' => guifi_type_relation('caps_project', $key, $node->role) ? '</td><td>' . $cap . '</td>' . $suffix : '</td><td><strike>' . $cap . '</strike></td>' . $suffix);
            $count++;
        }
    }
    if (!empty($node->role)) {
        $form['caps']['other_caps'] = array('#type' => 'textfield', '#title' => t('Other capabilities'), '#description' => t('Other capabilities & oferings of this supplier that might be on the interest for networking infrastructure deployment and management.<br>' . 'List them sepparated by commas.'), '#size' => 256, '#maxlength' => 1024, '#required' => FALSE, '#tree' => FALSE, '#default_value' => $node->other_caps);
    }
    /*
     * Ratings
     */
    $form['ratings'] = array('#type' => 'fieldset', '#title' => t('Ratings'), '#description' => t('Self evaluation and objective rating'), '#collapsible' => TRUE, '#collapsed' => ($node->self_rating != '~~' or $node->official_rating != '~~') ? TRUE : FALSE);
    $form['ratings']['self'] = array('#type' => 'fieldset', '#title' => t('Self Ratings') . ' ' . $node->self_rating, '#attributes' => array('class' => 'supplier-fieldset'), '#description' => t('Self evaluation'), '#collapsible' => TRUE, '#collapsed' => FALSE);
    $form['ratings']['self']['sr_commitment'] = array('#type' => 'select', '#title' => t('Commitment'), '#description' => t('Commitment to the Commons and the Community'), '#default_value' => $node->sr_commitment ? $node->sr_commitment : '~', '#options' => guifi_types('commitment_rate'));
    $form['ratings']['self']['sr_experience'] = array('#type' => 'select', '#title' => t('Experience'), '#default_value' => $node->sr_experience ? $node->sr_experience : '~', '#description' => t('Proven experience on executed projects'), '#options' => guifi_types('experience_rate'));
    $form['ratings']['official'] = array('#type' => 'fieldset', '#title' => t('Official Ratings') . ' ' . $node->official_rating, '#attributes' => array('class' => 'supplier-fieldset'), '#description' => t('Objective evaluation'), '#collapsible' => TRUE, '#collapsed' => FALSE);
    $form['ratings']['official']['or_commitment'] = array('#type' => 'select', '#title' => t('Commitment'), '#description' => t('Commitment to the Commons and the Community'), '#default_value' => $node->or_commitment ? $node->or_commitment : '~', '#options' => guifi_types('commitment_rate'), '#access' => user_access('official rating'));
    $form['ratings']['official']['or_experience'] = array('#type' => 'select', '#title' => t('Experience'), '#description' => t('Proven experience on executed projects'), '#default_value' => $node->or_experience ? $node->or_experience : '~', '#options' => guifi_types('experience_rate'), '#access' => user_access('official rating'));
    $form['ratings']['official']['or_trend'] = array('#type' => 'select', '#title' => t('Trend'), '#description' => t('Revision to'), '#default_value' => $node->or_trend ? $node->or_trend : ' ', '#options' => array('+' => '+', ' ' => t('Stable'), '-' => '-'), '#access' => user_access('official rating'));
    /*
     * Accounting URLs
     */
    $k = 0;
    $total = count($node->accounting_urls);
    $form['accounting_urls'] = array('#type' => 'fieldset', '#title' => t('Accounting urls'), '#description' => t('URLs (links) to track accountings, use "Preview" if you need to fill more rows'), '#collapsible' => TRUE, '#tree' => TRUE, '#collapsed' => TRUE);
    do {
        $form['accounting_urls'][$k] = array('#type' => 'fieldset', '#title' => t('Link #') . ($k + 1), '#attributes' => array('class' => 'supplier-fieldset'), '#collapsible' => FALSE, '#tree' => TRUE, '#collapsed' => FALSE, '#attributes' => array('class' => "cert-field"));
        $form['accounting_urls'][$k]['node_id'] = array('#type' => 'textfield', '#title' => t('Node'), '#size' => 25, '#maxlength' => 256, '#description' => t('Affected guifi.net node'), '#autocomplete_path' => 'guifi/js/select-node', '#default_value' => $node->accounting_urls[$k]['node_id']);
        $form['accounting_urls'][$k]['url'] = array('#type' => 'textfield', '#title' => t('Url'), '#size' => 50, '#maxlength' => 256, '#description' => t('link to the accounting object'), '#default_value' => $node->accounting_urls[$k]['url']);
        $form['accounting_urls'][$k]['comment'] = array('#type' => 'textfield', '#title' => t('Comment'), '#size' => 256, '#maxlength' => 256, '#default_value' => $node->accounting_urls[$k]['comment']);
        $k++;
    } while (!empty($node->accounting_urls[$k - 1]['url']));
    /*
     * Contact
     */
    $form['contact'] = array('#type' => 'fieldset', '#title' => t('Contact'), '#attributes' => array('class' => 'supplier-fieldset'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    if (empty($node->notification) or empty($node->phone)) {
        $form['contact']['#collapsed'] = FALSE;
    }
    $form['contact']['notification'] = array('#type' => 'textfield', '#size' => 25, '#maxlength' => 50, '#title' => t('Contact'), '#required' => TRUE, '#element_validate' => array('guifi_emails_validate'), '#default_value' => $node->notification, '#description' => t('Mailid where changes on the device will be notified, ' . 'if many, separated by \',\'.'));
    $form['contact']['phone'] = array('#type' => 'textfield', '#size' => 25, '#maxlength' => 50, '#title' => t('Phone(s)'), '#required' => FALSE, '#default_value' => $node->phone, '#description' => t('Phone(s) for contacting this supplier'));
    $form['contact']['web_url'] = array('#type' => 'textfield', '#size' => 25, '#maxlength' => 128, '#title' => t('Web'), '#required' => FALSE, '#default_value' => $node->web_url, '#description' => t('Will be redirected if clicking on the logo'));
    if (empty($node->logo)) {
        $form['contact']['logo'] = array('#type' => 'file', '#title' => t('Logo'), '#description' => t('Best results with 4:3 ratio and 300 width (300x225 size)'), '#default_value' => $node->logo, '#prefix' => '<table><td>');
        $form['contact']['upload'] = array('#type' => 'submit', '#value' => t('Upload'), '#name' => 'Upload', '#executes_submit_callback' => TRUE, '#submit' => array('budgets_supplier_form_submit'), '#suffix' => '</td></table>');
        $form['#attributes']['enctype'] = 'multipart/form-data';
    } else {
        $form['contact']['logo'] = array('#type' => 'hidden', '#prefix' => '<table><td>', '#value' => $node->logo);
        $form['contact']['display_logo'] = array('#type' => 'item', '#title' => t('Logo'), '#description' => $node->logo, '#value' => '<img src="/' . $node->logo . '" width="100" alt="' . $node->logo . '">');
        $form['contact']['delete_logo'] = array('#type' => 'submit', '#value' => t('Delete logo'), '#name' => 'Delete', '#executes_submit_callback' => TRUE, '#submit' => array('budgets_supplier_form_submit'), '#suffix' => '</td></table>');
    }
    /*
     * Acknowledgement on the Terms & Condition and the p2p agreement
     */
    $form['ack'] = array('#type' => 'checkbox', '#title' => t('Terms & conditions agreement'), '#required' => TRUE, '#default_value' => $node->ack, '#options' => array('0' => 'No', '1' => t('Yes, I agree')), '#description' => t('I agree on:<br>' . '<ul><li>I\'m responsible for all the information I provided, that is truthfulness and available for being verified upon request. ' . 'May be corrected or cancelled if found inaccurate or inappropriate</li>' . '<li>I\'ve read and understood the <a href="http://guifi.net/ComunsXOLN">Comuns XOLN peer to peer agreement</a>, ' . 'I\'m aware that is applicable in many of the activities happening around the scope of this site ' . 'and that the guifi.net Foundation is competent for mediating in case of dispute.</li>' . '<li>Beyond the <a href="http://guifi.net/ComunsXOLN">Comuns XOLN peer to peer agreement</a> but developing it, there are Best Practices ' . 'and Ethics guidelines that also require compliance.</li>' . '<li>This information is provided with the solely purpose of being advertised through the listings of this web under the ' . '<a href="http://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA licensing</a> and be subject to the site publishing criteria.' . '<li>I can exercise the right of update or cancelation of this information directly by accessing this site by myself by using the web site interface' . '</li></ul>'));
    return $form;
}
Esempio n. 2
0
function budgets_quote_form(&$node, &$param)
{
    $type = node_get_types('type', $node);
    if (!empty($param['values'])) {
        $node = (object) $param['values'];
    }
    guifi_log(GUIFILOG_TRACE, 'function budgets_quote_form()', $node);
    $type = node_get_types('type', $node);
    if ($type->has_title) {
        $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title);
    }
    if (isset($node->supplier)) {
        $form['supplier'] = array('#type' => 'textfield', '#required' => TRUE, '#title' => t('Supplier'), '#description' => t('Supplier for this quote.'), '#default_value' => $node->supplier, '#autocomplete_path' => 'budgets/js/select-supplier');
    } else {
        $suppliers = array();
        $qsup = db_query('SELECT id, title ' . 'FROM {supplier} ' . 'ORDER BY title');
        while ($sup = db_fetch_object($qsup)) {
            if (!user_access('administer suppliers')) {
                if (budgets_supplier_access('update', $sup->id)) {
                    $suppliers[$sup->id] = $sup->title;
                }
            } else {
                $suppliers[$sup->id] = $sup->title;
            }
        }
        $form['supplier_id'] = array('#type' => 'select', '#required' => TRUE, '#title' => t('Supplier'), '#description' => t('Supplier for this quote.'), '#default_value' => $node->supplier_id, '#options' => $suppliers);
    }
    /*
     * Quote Properties
     */
    $form['props'] = array('#type' => 'fieldset', '#title' => t('Quote properties'), '#collapsible' => false, '#collapsed' => false, '#tree' => false, '#attributes' => array('class' => 'quote'));
    $form['props']['partno'] = array('#type' => 'textfield', '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#title' => t('Part number'), '#description' => t('Part number/Code to identify this quote.'), '#default_value' => $node->partno);
    $form['props']['tax'] = array('#type' => 'textfield', '#title' => t('Tax'), '#size' => 3, '#required' => TRUE, '#maxlength' => 3, '#attributes' => array('' . 'class' => 'number required', 'min' => 0), '#default_value' => $node->tax, '#description' => t('Tax (%) to be applied to this quote.<br> 0 means tax included'));
    $form['props']['cost'] = array('#type' => 'textfield', '#title' => t('Cost'), '#size' => 12, '#required' => TRUE, '#maxlength' => 15, '#attributes' => array('' . 'class' => 'number required', 'min' => 1), '#default_value' => $node->cost, '#description' => t('Quoted value (cost) for this quoted item.'));
    $form['props']['arrexpires'] = array('#type' => 'date', '#title' => t('Expiration'), '#default_value' => $node->arrexpires, '#description' => t("Date when this quote will expire"), '#required' => TRUE);
    if ($type->has_body) {
        $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
    }
    return $form;
}
Esempio n. 3
0
/**
 * Present the guifi zone editing form.
 */
function guifi_service_form($node, $param)
{
    global $user;
    guifi_log(GUIFILOG_TRACE, 'guifi_service_form()', $node);
    drupal_set_breadcrumb(guifi_zone_ariadna($node->zone_id, 'node/%d/view/services'));
    // $f = guifi_form_hidden_var($node,array('id'));
    if (empty($node->nid) and is_numeric($node->title)) {
        $zone = guifi_zone_load($node->title);
        $node->zone_id = $node->title;
        $node->contact = $user->mail;
        $default = t('<service>');
        $node->title = NULL;
        $node->nick = $zone->nick . $default;
        $node->status_flag = 'Planned';
    }
    if (isset($node->id)) {
        $f['id'] = array('#type' => 'hidden', '#value' => $node->id);
    }
    $type = db_fetch_object(db_query("SELECT description FROM {guifi_types} WHERE type='service' AND text='%s'", $node->service_type));
    if ($node->nid > 0) {
        $f['service_type'] = array('#type' => 'item', '#value' => t('Service type'), '#description' => t($type->description));
    }
    //$output = form_item(t('Service type'),$node->service_type,t($type->description));
    $type = node_get_types('type', $node);
    if ($type->has_title) {
        $f['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title);
    }
    $f['nick'] = array('#type' => 'textfield', '#title' => t('Nick'), '#required' => FALSE, '#size' => 20, '#maxlength' => 20, '#default_value' => $node->nick, '#element_validate' => array('guifi_service_nick_validate'), '#collapsible' => FALSE, '#tree' => TRUE, '#description' => t("Unique identifier for this service. Avoid generic names such 'Disk Server', use something that really describes what is doing and how can be distinguished from the other similar services.<br />Short name, single word with no spaces, 7-bit chars only."));
    //$output .= form_textfield(t("Nick"), "nick", $node->nick, 20, 20, t("Unique identifier for this service. Avoid generic names such 'Disk Server', use something that really describes what is doing and how can be distinguished from the other similar services.<br />Short name, single word with no spaces, 7-bit chars only.") . ($error['nick'] ? $error["nick"] : ''), NULL, TRUE);
    $f['notification'] = array('#type' => 'textfield', '#title' => t('Contact'), '#required' => FALSE, '#size' => 60, '#maxlength' => 128, '#default_value' => $node->notification, '#element_validate' => array('guifi_emails_validate'), '#description' => t("Who did possible this service or who to contact with regarding this service if it is distinct of the owner of this page."));
    //$output .= form_textfield(t("Contact"), "contact", $node->contact, 60, 128, t("Who did possible this service or who to contact with regarding this service if it is distinct of the owner of this page.") . ($error['contact'] ? $error["contact"] : ''));
    ////  $output .= form_select(t('Zone'), 'zone_id', $node->zone_id, guifi_zones_listbox(), t('The zone where this node where this node belongs to.'));
    $f['server'] = array('#type' => 'textfield', '#title' => t("Device"), '#size' => 60, '#maxlength' => 128, '#default_value' => guifi_server_descr($node->device_id), '#element_validate' => array('guifi_servername_validate'), '#autocomplete_path' => 'guifi/js/select-server', '#description' => t('Where it runs.'));
    //$params .= guifi_form_column(form_select(t('Device'), "device_id", $node->device_id, guifi_servers_select(),t('Where it runs.')));
    if (!$node->nid) {
        $f['service_type'] = array('#type' => 'select', '#title' => t("Service"), '#default_value' => $node->service_type, '#options' => guifi_types('service'), '#description' => t('Type of service'));
        //$types = guifi_types('service');
        //array_shift($types);
        //$params.= guifi_form_column(form_select(t('Service'), "service_type", $node->service_type, $types,t('Type of service')));
    } else {
        $f['protocol'] = array('#type' => 'hidden', '#title' => t("service_type"), '#value' => $node->service_type);
    }
    //$output .= form_hidden("service_type",$node->service_type);
    $f['status_flag'] = array('#type' => 'select', '#title' => t("Status"), '#default_value' => $node->status_flag, '#options' => guifi_types('status'), '#description' => t('Current status'));
    //$params .= guifi_form_column(form_select(t('Status'), 'status_flag', $node->status_flag, guifi_types('status'), t('Current status')));
    //$output .= guifi_form_column_group(t('General parameters'),$params, NULL);
    // $node->var = unserialize($node->extra);
    if ($node->nid > 0) {
        $f['var'] = array('#type' => 'fieldset', '#title' => $node->service_type . ' ' . t("settings"), '#tree' => TRUE, '#collapsible' => TRUE, '#collapsed' => FALSE);
    }
    if ($node->nid > 0) {
        switch ($node->service_type) {
            case 'mail':
                $f['var']['in'] = array('#type' => 'textfield', '#title' => t('Inbound mail server'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['in'], '#description' => t('Where email clients have to be configured for getting email messages'));
                $f['var']['out'] = array('#type' => 'textfield', '#title' => t('Outbound mail server'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['out'], '#description' => t('Where email clients have to be configured for sending email messages'));
                $f['var']['webmail'] = array('#type' => 'textfield', '#title' => t('Webmail url'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['webmail'], '#description' => t('URL for accessing to this mail server, if there is'));
                $f['var']['admin'] = array('#type' => 'textfield', '#title' => t('Admin web interface'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['admin'], '#description' => t('Where to create/edit/delete users, change passwords, etc...'));
                break;
            case 'asterisk':
                $f['var']['prefix'] = array('#type' => 'textfield', '#title' => t('Dial prefix'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['prefix'], '#description' => t('Dial prefix for calling this server extensions'));
                $f['var']['incoming'] = array('#type' => 'textfield', '#title' => t('Incoming calls'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['incoming'], '#description' => t('Server or IP address where the calls have to be sent'));
                $f['var']['protocols'] = array('#type' => 'checkboxes', '#title' => t('Protocols'), '#required' => TRUE, '#default_value' => $node->var['protocols'], '#options' => array('IAX' => 'IAX', 'SIP' => 'SIP'));
                break;
            case 'NTP':
                $f['var']['ntp'] = array('#type' => 'textfield', '#title' => t('IP address or hostname'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['ntp']);
                break;
            case 'ftp':
                $f['var']['ftphost'] = array('#type' => 'textfield', '#title' => t('IP address or hostname'), '#required' => TRUE, '#size' => 60, '#maxlength' => 60, '#default_value' => $node->var['ftphost']);
                $f['var']['protocols'] = array('#type' => 'checkboxes', '#title' => t('Protocols'), '#required' => TRUE, '#default_value' => $node->var['protocols'], '#options' => array('SMB' => 'SMB (Samba)', 'ftp' => 'FTP', 'nfs' => 'NFS'));
                break;
            case 'Proxy':
            case 'ADSL':
                $f['var']['down'] = array('#type' => 'select', '#title' => t('Download'), '#default_value' => $node->var['down'], '#options' => guifi_bandwidth_types(), '#description' => t('Download bandwidth'));
                $f['var']['up'] = array('#type' => 'select', '#title' => t('Upload'), '#options' => guifi_bandwidth_types(), '#default_value' => $node->var['up'], '#description' => t('Upload bandwidth'));
                if ($node->service_type == 'ADSL') {
                    break;
                }
                if (empty($node->var['fed'])) {
                    $node->var['fed'] = array('IN' => '0', 'OUT' => '0');
                }
                $f['var']['fed'] = array('#type' => 'checkboxes', '#title' => t('Proxy federation'), '#default_value' => $node->var['fed'], '#options' => array('IN' => t('Allow login of users from OUT federated proxys'), 'OUT' => t('Allow proxy users to use other IN federated proxys')));
                $f['var']['proxy'] = array('#type' => 'textfield', '#title' => t("Name"), '#default_value' => $node->var['proxy'], '#size' => 60, '#maxlength' => 60);
                $f['var']['port'] = array('#type' => 'textfield', '#title' => t("Port"), '#default_value' => $node->var['port'], '#size' => 60, '#maxlength' => 60);
                $f['var']['type'] = array('#type' => 'select', '#title' => t("Type"), '#default_value' => $node->var['type'], '#options' => array('HTTP' => 'HTTP', 'Socks4' => 'SOCKS4', 'Socks5' => 'SOCKS5', 'arp' => 'ARP', 'ftp' => 'FTP'));
                break;
            case 'SNPgraphs':
                $f['var']['version'] = array('#type' => 'select', '#title' => t('version'), '#default_value' => $node->var['version'], '#options' => drupal_map_assoc(array('1.0', '2.0')), '#description' => t('version of the CNML services'));
                $f['var']['url'] = array('#type' => 'textfield', '#title' => t('url'), '#size' => 60, '#maxlength' => 250, '#default_value' => $node->var['url'], '#description' => t('Base url to call CNML services'));
                break;
            default:
                $f['var']['url'] = array('#type' => 'textfield', '#title' => t('url'), '#size' => 60, '#maxlength' => 250, '#default_value' => $node->var['url']);
                break;
        }
    }
    // multiple fields
    $delta = 0;
    if ($node->nid > 0) {
        switch ($node->service_type) {
            case 'mail':
                $f['var']['domains'] = guifi_service_multiplefield($node->var['domains'], 'domains', t('Managed domains'));
                break;
            case 'web':
                $f['var']['homepages'] = guifi_service_multiplefield($node->var['homepages'], 'homepages', t('URL pointing to the website homepage'));
                break;
            case 'irc':
                $f['var']['irc'] = guifi_service_multiplefield($node->var['irc'], 'irc', t('IRC server hostname'));
                break;
        }
    }
    if ($type->has_body) {
        $f['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
    }
    return $f;
}
Esempio n. 4
0
function guifi_node_form(&$node, $form_state)
{
    global $user;
    $form_weight = 0;
    $type = node_get_types('type', $node);
    if (!empty($node->zone_id)) {
        drupal_set_breadcrumb(guifi_node_ariadna($node));
    } else {
        drupal_set_breadcrumb(NULL);
    }
    // ----
    // El títol el primer de tot
    // ------------------------------------------------
    if ($type->has_title) {
        $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title);
    }
    $form_weight = 2;
    /*
     * maintainers fieldset
     */
    $form_weight = -3;
    $form['maintainers'] = guifi_maintainers_form($node, $form_weight);
    /*
     * funders fieldset
     */
    $form_weight = -4;
    $form['funders'] = guifi_funders_form($node, $form_weight);
    $form_weight = 0;
    $form['nick'] = array('#type' => 'textfield', '#title' => t('Nick'), '#required' => FALSE, '#size' => 20, '#maxlength' => 20, '#element_validate' => array('guifi_node_nick_validate'), '#default_value' => $node->nick, '#description' => t("Unique identifier for this node. Avoid generic names such 'MyNode', use something that really identifies your node.<br />Short name, single word with no spaces, 7-bit chars only, will be used for  hostname, reports, etc."), '#weight' => $form_weight++);
    $form['notification'] = array('#type' => 'textfield', '#title' => t('Contact'), '#required' => FALSE, '#size' => 60, '#maxlength' => 1024, '#element_validate' => array('guifi_emails_validate'), '#default_value' => $node->notification, '#description' => t("Who did possible this node or who to contact with regarding this node if it is distinct of the owner of this page. Use valid emails, if you like to have more than one, separated by commas.'"), '#weight' => $form_weight++);
    $form['settings'] = array('#type' => 'fieldset', '#title' => t('Node settings'), '#weight' => $form_weight++, '#collapsible' => TRUE, '#collapsed' => TRUE);
    // Si ets administrador pots definir el servidor de dades
    if (user_access('administer guifi zones')) {
        $graphstr = guifi_service_str($node->graph_server);
        $form['settings']['graph_serverstr'] = array('#type' => 'textfield', '#title' => t('default graphs server'), '#maxlength' => 60, '#required' => FALSE, '#default_value' => $graphstr, '#autocomplete_path' => 'guifi/js/select-service/SNPgraphs', '#element_validate' => array('guifi_service_name_validate', 'guifi_zone_service_validate'), '#description' => t('Select the <em>graph server</em> to be used at this node.<br />You can find the <em>graph server</em> by introducing part of the id number, zone name or graph server name. A list with all matching values with a maximum of 50 values will be created.<br />You can refine the text to find your choice.'));
        $form['settings']['graph_server'] = array('#type' => 'hidden', '#value' => $node->graph_server);
    }
    $form['settings']['stable'] = array('#type' => 'select', '#title' => t("It's supposed to be a stable online node?"), '#required' => FALSE, '#default_value' => $node->stable ? $node->stable : 'Yes', '#options' => array('Yes' => t('Yes, is intended to be kept always on,  avalable for extending the mesh'), 'No' => t("I'm sorry. Will be connected just when I'm online")), '#description' => t("That helps while planning a mesh network. We should know which locations are likely available to provide stable links."), '#weight' => 1);
    // Ask for a license agreement if is a new node
    if (empty($node->nid)) {
        $form['license'] = array('#type' => 'item', '#title' => t('License and usage agreement'), '#value' => t(variable_get('guifi_license', NULL)), '#description' => t('You must accept this agreement to be authorized to create new nodes.'), '#weight' => 1);
        if (empty($node->agreement)) {
            $agreement = 'No';
        } else {
            $agreement = $node->agreement;
        }
        $form['agreement'] = array('#type' => 'radios', '#default_value' => $agreement, '#options' => array('Yes' => t('Yes, I have read this and accepted')), '#element_validate' => array('guifi_node_agreement_validate'), '#weight' => 2);
    } else {
        $form['agreement'] = array('#type' => 'hidden', '#default_value' => 'Yes');
    }
    if (empty($node->nid)) {
        if (empty($node->ndfzone)) {
            if (empty($node->zone_id)) {
                if (!empty($user->guifi_default_zone)) {
                    $zone_id = $user->guifi_default_zone;
                }
            } else {
                $zone_id = $node->zone_id;
            }
        } else {
            $zone_id = $node->ndfzone;
        }
    } else {
        $zone_id = $node->zone_id;
    }
    $form['zone_id'] = guifi_zone_autocomplete_field($zone_id, 'zone_id');
    //  $form['zone_id'] = guifi_zone_select_field($zone_id,'zone_id');
    $form['zone_id']['#weight'] = 3;
    // ----
    // position
    // ------------------------------------------------
    $form['position'] = array('#type' => 'fieldset', '#title' => t('Node position settings'), '#weight' => 4, '#collapsible' => FALSE);
    if (guifi_gmap_key()) {
        drupal_add_js(drupal_get_path('module', 'guifi') . '/js/guifi_gmap_node.js', 'module');
        $form['position']['GMAP'] = array('#type' => 'item', '#title' => t('Map'), '#description' => t('Select the point where the node has to be placed.'), '#suffix' => '<input style="width: 240px;" id="mapSearch" type="text" /><div id="map" style="width: 100%; height: 437px; margin:5px;"></div>', '#weight' => 0);
        $form['guifi_wms'] = array('#type' => 'hidden', '#value' => variable_get('guifi_wms_service', ''));
        $form['lat'] = array('#type' => 'hidden', '#value' => $node->lat);
        $form['lon'] = array('#type' => 'hidden', '#value' => $node->lon);
    }
    $form['position']['longitude'] = array('#type' => 'item', '#title' => t('Longitude'), '#prefix' => '<table><tr><th>&nbsp;</th><th>' . t('degrees (decimal values allowed)') . '</th><th>' . t('minutes') . '</th><th>' . t('seconds') . '</th></tr><tr><td>', '#suffix' => '</td>', '#weight' => 1);
    $form['position']['londeg'] = array('#type' => 'textfield', '#default_value' => $node->londeg, '#size' => 12, '#maxlength' => 24, '#element_validate' => array('guifi_lon_validate'), '#prefix' => '<td>', '#suffix' => '</td>', '#weight' => 2);
    $form['position']['lonmin'] = array('#type' => 'textfield', '#default_value' => $node->lonmin, '#size' => 12, '#maxlength' => 24, '#prefix' => '<td>', '#suffix' => '</td>', '#weight' => 3);
    $form['position']['lonseg'] = array('#type' => 'textfield', '#default_value' => $node->lonseg, '#size' => 12, '#maxlength' => 24, '#prefix' => '<td>', '#suffix' => '</td></tr>', '#weight' => 4);
    $form['position']['latitude'] = array('#type' => 'item', '#title' => t('Latitude'), '#prefix' => '<tr><td>', '#suffix' => '</td>', '#weight' => 5);
    $form['position']['latdeg'] = array('#type' => 'textfield', '#default_value' => $node->latdeg, '#size' => 12, '#maxlength' => 24, '#element_validate' => array('guifi_lat_validate'), '#prefix' => '<td>', '#suffix' => '</td>', '#weight' => 6);
    $form['position']['latmin'] = array('#type' => 'textfield', '#default_value' => $node->latmin, '#size' => 12, '#maxlength' => 24, '#prefix' => '<td>', '#suffix' => '</td>', '#weight' => 7);
    $form['position']['latseg'] = array('#type' => 'textfield', '#default_value' => $node->latseg, '#size' => 12, '#maxlength' => 24, '#prefix' => '<td>', '#suffix' => '</td></tr></table>', '#weight' => 8);
    $form['position']['zone_description'] = array('#type' => 'textfield', '#title' => t('Zone description'), '#required' => FALSE, '#size' => 60, '#maxlength' => 128, '#default_value' => $node->zone_description, '#description' => t("Zone, address, neighborhood. Something that describes your area within your location.<br />If you don't know your lat/lon, please provide street and number or crossing street."), '#weight' => 9);
    $form['position']['elevation'] = array('#type' => 'textfield', '#title' => t('Antenna elevation'), '#required' => FALSE, '#size' => 5, '#length' => 20, '#maxlength' => 20, '#default_value' => $node->elevation, '#element_validate' => array('guifi_elevation_validate'), '#description' => t("Antenna height over the floor level."), '#weight' => 10);
    if ($type->has_body) {
        $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
    }
    $radios = array();
    $query = db_query("SELECT * FROM {guifi_radios} WHERE nid=%d", $node->id);
    while ($radio = db_fetch_array($query)) {
        $radios[] = $radio;
    }
    if (count($radios) < 1) {
        $form['status_flag'] = array('#type' => 'select', '#title' => t("Node status"), '#default_value' => $node->status_flag ? $node->status_flag : 'Planned', '#required' => FALSE, '#options' => array('Reserved' => t('Reserved'), 'Inactive' => t('Inactive'), 'Planned' => t('Planned')));
    } else {
        $form['status_flag'] = array('#type' => 'hidden', '#default_value' => $node->status_flag);
    }
    return $form;
}
Esempio n. 5
0
/** guifi_zone_form(): Present the guifi zone editing form.
 */
function guifi_zone_form(&$node, &$param)
{
    guifi_log(GUIFILOG_TRACE, 'function guifi_zone_form()', $node);
    drupal_set_breadcrumb(guifi_zone_ariadna($node->id));
    $form_weight = -20;
    $type = node_get_types('type', $node);
    if ($type->has_title) {
        $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title, '#weight' => $form_weight++);
    }
    $form['jspath'] = array('#type' => 'hidden', '#value' => base_path() . drupal_get_path('module', 'guifi') . '/js/');
    $form['master'] = guifi_zone_autocomplete_field($node->master, 'master');
    $form['master']['#weight'] = $form_weight++;
    if ($type->has_body) {
        $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
        $form['body_field']['#weight'] = $form_weight++;
    }
    // This is for non-admin users, they don't need to edit more information
    if (!user_access('administer guifi zones')) {
        return $form;
    }
    $form['nick'] = array('#type' => 'textfield', '#title' => t('Short abreviation'), '#required' => FALSE, '#default_value' => $node->nick, '#size' => 8, '#maxlength' => 10, '#element_validate' => array('guifi_zone_nick_validate'), '#description' => t('Single word, 7-bits characters. Used while default values as hostname, SSID, etc...'), '#weight' => $form_weight++);
    /*
     * maintainers fieldset
     */
    $form['maintainers'] = guifi_maintainers_form($node, $form_weight);
    $form['time_zone'] = array('#type' => 'select', '#title' => t('Time zone'), '#required' => FALSE, '#default_value' => $node->time_zone, '#options' => guifi_types('tz'), '#weight' => $form_weight++);
    $form['homepage'] = array('#type' => 'textfield', '#title' => t('Zone homepage'), '#required' => FALSE, '#default_value' => $node->homepage, '#size' => 60, '#maxlength' => 128, '#description' => t('URL of the local community homepage, if exists. Useful for those who want to use this site just for network administration, but have their own portal.'), '#weight' => $form_weight++);
    $form['notification'] = array('#type' => 'textfield', '#title' => t('email notification'), '#required' => TRUE, '#default_value' => $node->notification, '#size' => 60, '#maxlength' => 1024, '#element_validate' => array('guifi_emails_validate'), '#description' => t('Mails where changes at the zone will be notified. Useful for decentralized administration. If more than one, separated by \',\''), '#weight' => $form_weight++);
    // Service parameters
    $form['zone_services'] = array('#type' => 'fieldset', '#title' => t('Zone services'), '#weight' => $form_weight++, '#collapsible' => FALSE, '#collapsed' => TRUE, '#prefix' => '<div>');
    $proxystr = guifi_service_str($node->proxy_id);
    function _service_descr($type)
    {
        return t('Select the default %type to be used at this ' . 'zone.<br />' . 'You can find the %type by introducing part of the id number, ' . 'zone name or proxy name. A list with all matching values ' . 'with a maximum of 50 values will be created.<br />' . 'You can refine the text to find your choice.', array('%type' => $type));
    }
    $form['zone_services']['proxystr'] = array('#type' => 'textfield', '#title' => t('default proxy'), '#maxlength' => 80, '#default_value' => $proxystr, '#autocomplete_path' => 'guifi/js/select-service/proxy', '#element_validate' => array('guifi_service_name_validate', 'guifi_zone_service_validate'), '#description' => _service_descr('proxy'));
    $form['zone_services']['proxy_id'] = array('#type' => 'hidden', '#value' => $node->proxy_id);
    $graphstr = guifi_service_str($node->graph_server);
    $form['zone_services']['graph_serverstr'] = array('#type' => 'textfield', '#title' => t('default graphs server'), '#maxlength' => 80, '#required' => FALSE, '#default_value' => $graphstr, '#autocomplete_path' => 'guifi/js/select-service/SNPgraphs', '#element_validate' => array('guifi_service_name_validate', 'guifi_zone_service_validate'), '#description' => _service_descr('graph server'));
    $form['zone_services']['graph_server'] = array('#type' => 'hidden', '#value' => $node->graph_server, '#suffix' => '</div>');
    // Separació Paràmetre globals de xarxa
    $form['zone_network_settings'] = array('#type' => 'fieldset', '#title' => t('Zone global network parameters'), '#weight' => $form_weight++, '#collapsible' => TRUE, '#collapsed' => TRUE, '#preffix' => '<div>');
    $form['zone_network_settings']['sep-global-param'] = array('#value' => '<hr /><h2>' . t('zone global network parameters') . '</h2>', '#weight' => $form_weight++);
    $form['zone_network_settings']['dns_servers'] = array('#type' => 'textfield', '#title' => t('DNS Servers'), '#required' => FALSE, '#default_value' => $node->dns_servers, '#size' => 60, '#maxlength' => 128, '#description' => t('The Name Servers of this zone, will inherit parent DNS servers if blank. Separated by ",".'), '#weight' => $form_weight++);
    $form['zone_network_settings']['ntp_servers'] = array('#type' => 'textfield', '#title' => t('NTP Servers'), '#required' => FALSE, '#default_value' => $node->ntp_servers, '#size' => 60, '#maxlength' => 128, '#description' => t('The network time protocol (clock) servers of this zone, will inherit parent NTP servers if blank. Separated by ",".'), '#weight' => $form_weight++);
    $form['zone_network_settings']['ospf_zone'] = array('#type' => 'textfield', '#title' => t('OSPF zone id'), '#required' => FALSE, '#default_value' => $node->ospf_zone, '#size' => 60, '#maxlength' => 128, '#element_validate' => array('guifi_zone_ospf_validate'), '#description' => t('The id that will be used when creating configuration files for the OSPF routing protocol so all the routers within the zone will share a dynamic routing table.'), '#weight' => $form_weight++, '#suffix' => '</div>');
    // Separació Paràmetres dels mapes
    $form['zone_mapping'] = array('#type' => 'fieldset', '#title' => t('Zone mapping parameters'), '#weight' => $form_weight++, '#collapsible' => TRUE, '#collapsed' => FALSE);
    $form['zone_mapping']['sep-maps-param'] = array('#value' => '<hr /><h2>' . t('zone mapping parameters') . '</h2>', '#weight' => $form_weight++);
    // if gmap key defined, prepare scripts anf launch google maps integration
    if (guifi_gmap_key()) {
        drupal_add_js(drupal_get_path('module', 'guifi') . '/js/guifi_gmap_zonelimits.js', 'module');
        $form['zone_mapping']['GMAP'] = array('#type' => 'item', '#title' => t('Map'), '#description' => t('Drag the South-West/North-East corners over the map to change the zone boundaries.'), '#suffix' => '<div id="map" style="width: 100%; height: 437px; margin:5px;"></div>', '#weight' => $form_weight++);
        $form['guifi_wms'] = array('#type' => 'hidden', '#value' => variable_get('guifi_wms_service', ''));
    }
    $form['zone_mapping']['MIN_help'] = array('#type' => 'item', '#title' => t('Bottom-left (SW) corner'), '#description' => t('Coordinates (Lon/Lat) of the bottom-left (South-West) corner of the map.'), '#weight' => $form_weight++);
    $form['zone_mapping']['minx'] = array('#type' => 'textfield', '#default_value' => $node->minx, '#size' => 12, '#maxlength' => 24, '#prefix' => '<table style="width: 32em"><tr><td style="width: 12em">', '#suffix' => '</td>', '#element_validate' => array('guifi_lon_validate'), '#description' => t('Longitude'), '#weight' => $form_weight++);
    $form['zone_mapping']['miny'] = array('#type' => 'textfield', '#default_value' => $node->miny, '#size' => 12, '#prefix' => '<td style="width: 12em">', '#suffix' => '</td></tr></table>', '#element_validate' => array('guifi_lat_validate'), '#description' => t('Latitude'), '#maxlength' => 24, '#weight' => $form_weight++);
    $form['zone_mapping']['MAX_help'] = array('#type' => 'item', '#title' => t('Upper-right (NE) corner'), '#description' => t('Coordinates (Lon/Lat) of the upper-right (North-East) corner of the map.'), '#weight' => $form_weight++);
    $form['zone_mapping']['maxx'] = array('#type' => 'textfield', '#default_value' => $node->maxx, '#size' => 12, '#maxlength' => 24, '#prefix' => '<table style="width: 32em"><tr><td style="width: 12em">', '#suffix' => '</td>', '#element_validate' => array('guifi_lon_validate'), '#description' => t('Longitude'), '#weight' => $form_weight++);
    $form['zone_mapping']['maxy'] = array('#type' => 'textfield', '#default_value' => $node->maxy, '#size' => 12, '#maxlength' => 24, '#prefix' => '<td style="width: 12em">', '#suffix' => '</td></tr></table>', '#element_validate' => array('guifi_lat_validate'), '#description' => t('Latitude'), '#weight' => $form_weight++);
    $form['#attributes'] = array('class' => zone_form);
    return $form;
}