28
Nov, 2014
selvam's picture

0 Comments | Submitted by selvam

When you build Android app for an existing Drupal website which allows it's users to login using their social media account, it is important to include such features in your app as well. Instead of using app specific APIs, we can use WebView to achieve the login mechanism. Let me explain the method that I followed,

1) Setup Drupal menu paths for social login(s).

2) From android app, use webview that can call Drupal path for social login.

3) Drupal side completes the authentication and sends back an identification token to Android.

4) Android app uses the token to make further calls to Drupal site. Drupal side authenticates user by this token.

Drupal side

First we need to define entry point for social login,

Read more →

06
Nov, 2014
Manikandan's picture

0 Comments | Submitted by Manikandan

The AmazonS3 module allows the drupal local file system to be replaced with S3, where the files can be uploaded or downloaded from S3. I used the following modules to achieve this:
 
Download and install these modules and place SDK library at sites/all/libraries/awssdk.
Check  'Status report'  for information about the installation of  AmazonS3 and AWSSDK.
 
 
Here we go:
 
  •  In admin/config/media/amazons3, give your default bucket name which you would have created in S3.

          

Read more →

05
Nov, 2014
suresh's picture

3 Comments | Submitted by suresh

In Drupal views, we have the option of exposing the filters to users. By default, the exposed filters are displayed as Select boxes. Recently in a multilingual project, there was a requirement to display Courses based on Language. And the Languages had to be shown as links. In order to achieve this functionality, the Views exposed filter had to be customized.

To start with the customization, we need to alter "views_exposed_form" using hook_form_alter

function module_name_form_alter(&$form, &$form_state, $form_id) {
  global $language;
  if ($form['#id'] == 'views-exposed-form-course-listing-page') {
    $links = $form['language']['#options'];
    $vars = array();
    foreach ($links as $tid => $term_name) {
      if ($language->language != $tid && $tid != 'All')  {
        $options = array(
          'attributes' => array(
            'class' => array( 'course-filter-tab' . $tid),
            'id' => $tid,
          ),
          'html' => TRUE,
        ),
        $language_list = language_list();
        $language_title = $language_list[$tid]->name;
        $vars['items'][] = l($language_title, "course", $options);
      }
    }
    $vars['type'] = 'ul';
    $vars['attributes']['class'] = array('course-tabbed-filter');
    $prefix = theme('item_list', $vars);
    $form['links'] = array(
      '#markup' => $prefix,
    );
  }  
}
       

The above code will help us render the select box as link, but to make the links functional we need some jQuery code.

Read more →

28
Oct, 2014
Sujith's picture

2 Comments | Submitted by Sujith

Autocomplete is a feature for textfields in Drupal. It provides a dropdown list of matching options from the server. It is implemented through AJAX. To know how to add an autocomplete form element in Drupal visit https://www.drupal.org/node/854216

 

For customizing autocomplete we need to override the Drupal system file "misc/autocomplete.js". This can be achieved ideally in two ways:

  • Replace the entire "autocomplete.js" with your customised version

    function MY_MODULE_js_alter(&$javascript) {
      $javascript['misc/autocomplete.js']['data'] = drupal_get_path('module', 'MY_MODULE') . '/js/autocomplete.js';
    }
  • Override "Drupal.ACDB.prototype.search" with a custom behaviour in theme script.js or module js file, as long as it's added after /misc/autocomplete.js it will override it.

Read more →

28
Oct, 2014
Karalmax's picture

0 Comments | Submitted by Karalmax

I'm sure that this script will help you in some of your projects that needs a username and password.
Sometimes when we want access to a secure page that asks for a username and password and we submit the information but we didn't know that the password was submitted in upper case, we get an error.
 
Solution: 
jQuery('#username').keypress(function(e) {
  var s = String.fromCharCode( e.which );
  if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) {
    jQuery('#capslockdiv').show();
  }
  else {
    jQuery('#capslockdiv').hide();
  }
});
jQuery('#password').keypress(function(e) {
  var s = String.fromCharCode( e.which );
  if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) {
    jQuery('#capslockdiv').show();
  }
  else { 
    jQuery('#capslockdiv').hide();
  }
});

Sample HTML code

Read more →

Subscribe to RSS - Drupal planet

Get a quote