Полная документация по CMS Drupal (создание сайта, локализация)

Установка и настройка сайта, а также системного окружения. Исключая вопросы программирования новых модулей и тем.

См. документацию на английском: http://drupal.org/node/258

Сбор новостей

Session ID

Module development - 4 часа 28 минуты назад

Hello, I would like to ask if the session ID of the authenticated users are permanently assigned? If not, how often they changed? Thanks in advance.

Категории: Drupal.org

Exchange Links

New Drupal modules - 5 часа 6 минуты назад

With the help of this module site administrators can share links between other site administrators.

Категории: Drupal.org

ubercart, form_alter, _validate :(

Module development - 5 часа 13 минуты назад

Hello
I'm trying, in my module 'cartscheduler', to add a validation test on 'delivery_postal_code', into Ubercart cart checkout. Pretty newbie in Drupal dev, I dont really understand what I should do...
My function doesn't work :

function cartscheduler_form_alter(&$form,&$form_state,$form_id) {
if ($form_id == 'uc_cart_checkout_form') {
  if ($form_state['panes']['delivery']['delivery_postal_code'] !=='93330') {
            form_set_error('delivery_postal_code','we dont deliver in your town');
  }
}
}
Maybe my form_set_error cannot find 'delivery_postal_code' as it is nested into another one. But how to specify it into the args of the function ?

Maybe It's possible to override a validate function but I dont know how to achieve this.
Any idea is welcome...

Категории: Drupal.org

Ajax in Ajax callback subquery

Module development - 6 часа 43 минуты назад

Hello! a form which is processed by ajax, need this form to add a new ajax subquery, process, and return the results. There are opinions on this issue?

<?php
// $Id$

/**
*Implementation of hook_menu().
*/
function test_module_menu() {
    $items = array();
    $items['test_module_page'] = array(
  'title' => t('test_module_page'),
      'page callback'    => 'test_module_module_page',
      'access callback'  => TRUE,
      'type'             => MENU_CALLBACK,
    );


    return $items;
}

/**
* Page callback for test_module_module_page
*/
function test_module_module_page(){
  $fc_form = drupal_get_form('fc_form');
  return render($fc_form);
}


/**
* Form for page
*/
function fc_form($form, $form_state) {

  $form['#prefix'] = '<div id="fc-form-ajax-wrapper">';
  $form['#suffix'] = '</div>';
     
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'submit ajax',
    '#ajax' => array(
      'callback' => 'preview_form_ajax',
      'wrapper' => 'fc-form-ajax-wrapper', 
    ),
  );

  return $form;
}

function subquery_ajax_example_form_callback($form, $form_state) {
     $form['subquery']['ajax_form']['result'] = array(
'#markup' => t('This is some form delivered via subquery AJAX'),
  );
return $form;

    }

/**
* Ajax callback for FC FORM
*/
function preview_form_ajax($form, &$form_state) {  
 
  $form['ajax_form']['#prefix'] = '<div id="subquery-ajax-wrapper">';
  $form['ajax_form']['#suffix'] = '</div>';
 
  $form['ajax_form'] = array(
    '#type' => 'fieldset',
    '#title' => t('This is some form delivered via AJAX'),
   
);
     
  $form['ajax_form']['submit'] = array(
    '#type' => 'submit',
    '#value' => 'submit subquery ajax',
    '#ajax' => array(
      'callback' => 'subquery_ajax_example_form_callback',
      'wrapper' => 'subquery-ajax-wrapper', 
    ),
  );

return $form;   
       
  }
this code does not work.
Категории: Drupal.org

How to print a variable from xxxxx.module?

Module development - 6 часа 45 минуты назад

Hello,

I'm trying to implement sms in drupal using SMS frame work and sms simple gateway, that will allow me to use an HTTP api

I entered credential of my account and the link gived to me from the sms gate way provider, but it doesn't work..

the URL work but when i putted the credential in the configuration it doesn't work...

i want to know how can i print the url executed? how can i print it ??

this is the variable that i want to see the result:

$http_result = drupal_http_request($url, array(), 'GET');

devel will help? or should add something to the module?

this is the full code of the module:

<?php
/**
* @file
* Simple gateway module for Drupal SMS Framework. Outbound+Inbound
*
* For inbound messaging you must configure your gateway to send messages to:
*  - http(s)://yourhost.example.com/sms/simplegateway/receiver
*
* @package sms
* @subpackage sms_simplegateway
*/


/**
* Implement hook_gateway_info()
*
* @ingroup hooks
*/
function sms_simplegateway_gateway_info() {
  return array(
    'simplegateway' => array(
      'name'           => 'Simple gateway',
      'send'           => 'sms_simplegateway_send',
      'configure form' => 'sms_simplegateway_admin_form',
    ),
  );
}


/**
* Implement hook_menu()
*
* @ingroup hooks
*/
function sms_simplegateway_menu() {
  $items = array();
  $items['sms/simplegateway/receiver'] = array(
    'title' => 'Simple gateway SMS message receiver',
    'page callback' => 'sms_simplegateway_receive_message',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
}


/**
* Configuration form for gateway module
*
* @param $configuration
*
* @return
*   Drupal form array
*/
function sms_simplegateway_admin_form($configuration) {
  $form['sms_simplegateway_send'] = array(
    '#type' => 'fieldset',
    '#title' => 'Sender (outgoing messages)',
    '#collapsible' => TRUE,
  );
  $form['sms_simplegateway_send']['sms_simplegateway_base_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Base URL for sending messages'),
    '#description' => t('Eg: http://simplegateway.example.com:13031/sendsms'),
    '#size' => 60,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_base_url'],
  );
  $form['sms_simplegateway_send']['sms_simplegateway_method'] = array(
    '#type' => 'radios',
    '#title' => t('HTTP method'),
    '#default_value' => $configuration['sms_simplegateway_method'],
    '#options' => array(
      'GET' => 'GET',
      'POST' => 'POST',
    ),
  );
  $form['sms_simplegateway_send']['sms_simplegateway_user_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Username field name'),
    '#description' => t('Optional. The argument/field name for the field that holds the username. Eg: user, username, authid.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_user_field'],
  );
  $form['sms_simplegateway_send']['sms_simplegateway_user_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Username field value'),
    '#description' => t('Optional. Your username for this gateway account.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_user_value'],
  );
  $form['sms_simplegateway_send']['sms_simplegateway_pass_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Password field name'),
    '#description' => t('Optional. The argument/field name for the field that holds the password. Eg: pass, password, passwd.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_pass_field'],
  );
  $form['sms_simplegateway_send']['sms_simplegateway_pass_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Password field value'),
    '#description' => t('Optional. Your password for this gateway account.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_pass_value'],
  );
  $form['sms_simplegateway_send']['sms_simplegateway_sender_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender (from) field name'),
    '#description' => t('The argument/field name for the field that holds the sender number data. Eg: from, sender'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_sender_field'],
  );
  $form['sms_simplegateway_send']['sms_simplegateway_number_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Number (to) field name'),
    '#description' => t('The argument/field name for the field that holds the number data. Eg: number, to, no'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_number_field'],
  );
  $form['sms_simplegateway_send']['sms_simplegateway_message_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Message field name'),
    '#description' => t('The argument/field name for the field that holds the message text. Eg: message, text, content'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_message_field'],
  );

  $form['sms_simplegateway_receive'] = array(
    '#type' => 'fieldset',
    '#title' => 'Receiver (incoming messages)',
    '#collapsible' => TRUE,
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_url'] = array(
    '#type' => 'item',
    '#title' => 'Target URL for the message receiver',
    '#value' => url('sms/simplegateway/receiver', array('absolute' => TRUE)),
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_number_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender (from) field name'),
    '#description' => t('The argument/field name for the field that holds the sender number. Eg: sender, from.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_recv_number_field'],
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_gwnumber_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Receiver (to) field name'),
    '#description' => t('Optional. The argument/field name for the field that holds the gateway receiver number. Eg: to, inNumber, receiver.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_recv_gwnumber_field'],
  );
  $form['sms_simplegateway_receive']['sms_simplegateway_recv_message_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Message field name'),
    '#description' => t('The argument/field name for the field that holds the message. Eg: message, text, content.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $configuration['sms_simplegateway_recv_message_field'],
  );

  return $form;
}


/**
* Send a message
*
* @param $number
*   MSISDN of message recipient. Expected to include the country code prefix.
* @param $message
*   Message body text.
* @param $options
*   Options array from SMS Framework.
*
* @return
*   Response array.
*/
function sms_simplegateway_send($number, $message, $options) {
  // Get config
  $gateway = sms_gateways('gateway', 'simplegateway');
  $config = $gateway['configuration'];

  // Prepare the URL and get the method
  $url_base = $config['sms_simplegateway_base_url'];
  $method   = $config['sms_simplegateway_method'];

  // Lets specify a gw number
  $sender = '';
  if (array_key_exists('sender', $options)) {
    $sender = $options['sender'];
  }

  // Prepare required arguments
  $params = array();

  $user_field = $config['sms_simplegateway_user_field'];
  $user       = $config['sms_simplegateway_user_value'];
  if (! empty($user_field)) {
    $params[$user_field] = $user;
  }

  $pass_field = $config['sms_simplegateway_pass_field'];
  $pass       = $config['sms_simplegateway_pass_value'];
  if (! empty($pass_field)) {
    $params[$pass_field] = $pass;
  }

  $sender_field = $config['sms_simplegateway_sender_field'];
  if (! empty($sender_field) && ! empty($sender)) {
    $params[$sender_field] = $sender;
  }

  $number_field = $config['sms_simplegateway_number_field'];
  $params[$number_field] = $number;

  $message_field = $config['sms_simplegateway_message_field'];
  $params[$message_field] = $message;

  // Prepare the query string
  // Note that we are forcing http_build_query to use '&' as a separator instead of the usual '&amp;'
  $query_string = http_build_query($params, NULL, '&');

  if ($method == 'GET') {
    $url = $url_base . '?' . $query_string;
    $http_result = drupal_http_request($url, array(), 'GET');
  }
  elseif ($method == 'POST') {
    $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
    $http_result = drupal_http_request($url_base, $headers, 'POST', $query_string);
  }

  // Check for HTTP errors
  if ($http_result->error) {
    return array(
      'status'  => FALSE,
      'message' => t('An error occured during the HTTP request: @error',
                     array('@error' => $http_result->error)),
    );
  }

  if ($http_result->data) {
    // Test the HTTP return code
    if ($http_result->code >= 200 && $http_result->code <= 299) {
      // Prepare a good response array
      $result = array(
        'status'      => TRUE,
        'status_code' => SMS_GW_OK,
        'gateway_status_code' => $http_result->code,
        'gateway_status_text' => $http_result->data,
      );
    }
    else {
      // We got a (possibly) bad response code
      $result = array(
        'status'      => FALSE,
        'status_code' => SMS_GW_ERR_OTHER,
        'gateway_status_code' => $http_result->code,
        'gateway_status_text' => $http_result->data,
      );
    }
  }
  return $result;
}


/**
* Receive an SMS message and pass it into the SMS Framework
*/
function sms_simplegateway_receive_message() {
  // Get config
  $gateway = sms_gateways('gateway', 'simplegateway');
  $config  = $gateway['configuration'];

  $number_field   = $config['sms_simplegateway_recv_number_field'];
  $gwnumber_field = $config['sms_simplegateway_recv_gwnumber_field'];
  $message_field  = $config['sms_simplegateway_recv_message_field'];

  $number  = $_REQUEST[$number_field];
  $message = $_REQUEST[$message_field];
  $options = array();

  // Define raw gateway response parameters
  $options['gateway_params'] = array();

  // Define message receiver if possible
  if (array_key_exists($gwnumber_field, $_REQUEST) && !empty($_REQUEST[$gwnumber_field])) {
    $options['receiver'] = $_REQUEST[$gwnumber_field];
  }

  sms_incoming($number, $message, $options);
}
Категории: Drupal.org

Reply sandbox

New Drupal modules - 8 часа 28 минуты назад

This is a sandbox to develop things for http://drupal.org/project/reply

Категории: Drupal.org

dynatree

New Drupal modules - 8 часа 32 минуты назад

Future home of the implementation of http://code.google.com/p/dynatree/ to create tree menus.

Alternatives

http://drupal.org/project/jstree
http://drupal.org/project/dhtml_menu

Категории: Drupal.org

Entity bundle plugin

New Drupal modules - 9 часа 13 минуты назад

This API module allow developers to build an entity type which is attached to strong behaviors.

Категории: Drupal.org

HTML img tag directory problem

Module development - 10 часа 8 минуты назад

Hi,

I'm working on the 'about us' page on my website, and the page is not able to call up some .jpg files.
I'm using < i m g s r c = "example.jpg" / > on the page to display the pictures.
Where would I need to save the pictures so Drupal is able to call them up locally?

Any help is appreciated.

Категории: Drupal.org

Commerce Emporiki Bank

New Drupal modules - 10 часа 34 минуты назад

Adds a payment method to Drupal Commerce to accept credit card payments through the Emporiki Bank (Greek bank) API via XML (not redirection).

Provides options to select the live or the test Emporiki Bank environment and also to have money authorized only or authorized and captured.

Works with euros, dollars and pounds. If there is need for more currencies, please contact me sending me the currency code and I'll add them.

This project is maintained and sponsored by netstudio, a Drupal E-Commerce Solutions company in Athens, Greece.

Категории: Drupal.org

Bot GitHub

New Drupal modules - 10 часа 39 минуты назад

Unlike Bot Commit, this module does not react to repository changes. It is a lookup tool in the fashion of the Bot Project URL lookup.

This project provides an integration between GitHub and the Bot module. More specifically it makes GitHub a Bot Project provider by utilizing the patch in #969294: Make issue-tracking integration extensible (for Redmine), following the example of Bot project Redmine.

This module currently has support for Commits and Branches. Additional Github-related tricks may be added later.

It depends on the php-github-api library, which for now must be copied into the module directory.

What Does It Do?
  • Paste of a git commit url gets commit data.
  • Shorthand syntax allows request of commit and branch information.
    • Configurable prefix for the commit or branch name.
    • Per-channel default for the GitHub account/Organization namespace.
    • Per-channel default for the GitHub repository.
    • Ability to specify a repository to override the channel default.
  • Ability to specify user account & api key for authenticated GitHub requests. This allows the Bot to pull information about otherwise private repositories.
  • De-duplication and 5-item flood control per line.

A commit request might look like:
  Grayside: ~0a6fc5129b, %master
or
  Grayside: ~bot_github:0a6fc5129b

And produce:
  GitHubBot: Commit "Issue #1042: Create an Awesome GitHub Bot integration." by Grayside, http://github.com/Grayside/fakeproject/0a6fc5129b (47 IRC men$
  GitHubBot: Branch "master" last updated on Fri, 03 Feb 2012 15:03:31 -0800, https://github.com/Grayside/fakeproject/tree/master (2 IRC mentions)

Категории: Drupal.org

hook_language_alter?

Module development - 12 часа 33 минуты назад

H
what is the best way to execute some PHP commands when user swicth website to another language?
D7 have some hooks concerning language but there is no hook for switching the language.

I can change language switcher links in that way that I add some URL parameter to them. Then I can test in hook_init() whether some language switcher link was clicked.

Is there any simplier solution?

Категории: Drupal.org

Media: Responsive

New Drupal modules - 12 часа 38 минуты назад

This module adds a responsive images view mode when inserting images using the Media module browser.

The view mode sets images to have a width of 100% and it will also use core image styles to shrink the image to the maximum width of your widest layout. Max-widths are set on images whose orignal source is less than this maximum width to prevent upscaling.

Tested with 7.x-1.0-rc3 of Media.

Категории: Drupal.org

Newbie stuck with unexpected T_VARIABLE

Module development - 14 часа 39 минуты назад

Hello everyone!

After searching for a long time I am still without an answer, so I apologize in advance for having to ask for help. I started working on the form API tutorial, but I can't get my sample code to load. Here is the snippet in question:

<?php

/**
* This function defines the URL to the page created etc.
* See http://api.drupal.org/api/function/hook_menu/6
*/
function walkthrough_menu() {
  $items = array();
  $items['walkthrough/form'] = array(
    'title' => t('My form'),
    'page callback' => 'walkthrough_form',
    'access arguments' => array('access content'),
    'description' => t('My form'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

Error is coming from line 8, saying there is an unexpected t_variable. Any help on what I've done wrong? You'll really be setting me on the right path, so thank you in advance!
-JB

Категории: Drupal.org

FullCalendar Create

New Drupal modules - 15 часа 9 минуты назад

A new extension for FullCalendar. This module allows you to click directly on the calendar to create new events. Currently only supports nodes, generic entities will come soon.

Needs the patch from #1427664: Don't use hook_fullcalendar_options_submit when not appropriate until it's committed.

Категории: Drupal.org

manually deleting a node from the different databases

Module development - 15 часа 23 минуты назад

We are having one master site which works like, if node is added in master site it will be added in different sub-sites too. Want to do the same for deleting a node and have an issue that master site node gets deleted before sub-site node.

I am having an issue in deleting a node of the sub-site from the database i.e database1 while node is deleted from the master database i.e database0.

if ((($op=="delete")) && ($node->type=="page")) {
  
  
// if(is_array($node->field_checkbox_value)){
      foreach($node->field_checkbox_value as $cbs) {
         if($cbs['value'] > 0) {
           if ($cbs==1) {
            $db='co1';
           }
           if($cbs['value']==2)
           {
            $db='co2';
           }
           if($cbs['value']==3)
           {
            $db='co3';
           }
          
   $node->nid;
            $tempnid=$node->nid;
            //print $tempnid;

         $coid = db_fetch_object(db_query("SELECT field_corporate_news_id_value FROM content_type_page where nid=$tempnid"));
         $coid = $coid->field_corporate_news_id_value;
         print $coid;
          
          
           $k = db_set_active($db);
           if (db_is_active()) {
        

            //db_insert('node');
           $cnid = db_fetch_object(db_query("SELECT nid,field_corporate_news_id_value FROM content_type_page where content_type_page.field_corporate_news_id_value=$coid "));
           $cnid = $cnid->nid;
           print $cnid;
          
           db_query("DELETE FROM node WHERE nid =$cnid ");
          
        
           db_query("DELETE FROM node_revisions WHERE nid=$cnid");
          
           db_query("DELETE FROM url_alias WHERE src='node/$cnid' ");
          
           db_query("DELETE FROM content_type_page WHERE nid=$cnid ");
          
          

           
           
            $x = db_set_active('default');
           
           
           }
         }
      }
   //}
  }
Категории: Drupal.org

ELMS Features

New Drupal modules - 17 часа 42 минуты назад

This repository is used to manage all of the features in ELMS like content, places, timelines, polls, schedule, and many, many others.

Категории: Drupal.org

"On Order" instead of the field price = 0 in the Advanced Catalog 2.x-dev. How do I?

Module development - 18 часа 30 минуты назад

Hello.

Set advanced catalog 2.x-dev which already does not work for views and displayed using the Node Dislay and Display suite.

Actually the question, problem, override the conclusion of the field sell_price so at zero cost, zero is not withdrawn, and the inscription "to order" and that's all for the views he is simply doing, but with this set did not work and I can not understand.

Thank you for your attention.

Категории: Drupal.org

Arguments Relationship problem

Module development - 18 часа 39 минуты назад

Ok, Hope somebody can Help me,
I need to have the next structure; level1-objects suppose to have several level2-objects and in each level2-object suppose to be able to display a view with the pictures linked to the other level2-objects of the same level1-object. Each level2-object has a reference to their level1-object. I have an extra page where I display a list with different views displaying the different objects of the same level1-object and that one it is working perfectly, however I can’t get the one that access to others of the same kind. I was using Arguments, to get the node IDE of the same level1-object.

Thank you in advance.

Категории: Drupal.org

Simple Field

New Drupal modules - 19 часа 55 минуты назад
What is Simple Field?

The Simple Field module provides a simplified UI for creating Fields. The primary goal is to make it easier to allow non-powerusers to administer fields without necessarily giving them access to the entire core Field interface. Simple Field also allows for more fine-grained control of what types of fields users may create, and what field settings they have access to.

The module can separate the process of field creation from the process of field instance creation. This allows admins to create pre-defined fields, and then allow other users to add the fields to entity types without the complex UI usually associated with adding field instances.
API

Simple Field simplifies the Field UI by making use of default Field settings, overriding defaults in code and only allowing modification of specific field settings. To accomplish this, Simple Field defines it's own 'types' that encompass both field type and widget type settings, and any custom types must define forms for editing values they wish to override. For information on creating new types, among other things, take a look at the documentation.

Todo
  • Submodule for defining new Simple Field types in the UI
Dependencies
  • Entity
  • Ctools (for Simple Field Modal submodule)
Documentation

Documentation explaining how to define custom simple field types can be found in simple_field.api.php

Sponsorship

The project is sponsored by Evolving Web.

Категории: Drupal.org
RSS-материал