Monday, October 31, 2011

Is Drupal the right tool for the job?

  • Last modified: February 24, 2011

Drupal is a powerful and flexible framework for building virtually any kind of website. Below are some circumstances in which Drupal is a particularly compelling choice.

  • You need a site that is flexible enough to evolve in any direction. For example, you might start with a blog but want the option of adding other features like a wiki, electronic commerce, forums etc.
  • You need a site that can easily be configured to interact with other sites or with other technologies.
  • You need a site that can easily handle complex forms and workflows.
  • You need the ability to create your own content types. For example, you need to add a custom field to a page.
  • You need the ability to quickly organize and display lists of information.
  • One or more of the many contributed Drupal modules addresses your needs.
  • You need to quickly develop custom functionality.
  • You need to create web applications and mashups using third party API's.

On the other hand, for certain limited uses, Drupal may not be the best choice:


  • If your only requirement is to write a personal blog, you may also want to evaluate one of the more specialized blogging platforms like WordPress or a hosted blogging solution like Blogger. Although Drupal can serve as a blogging platform out-of-the-box, blog-specific software may have a simpler administration interface.

  • Similarly, if your only requirement is to create a wiki, you should probably consider using dedicated wiki software like MediaWiki or a hosted wiki solution. You can certainly configure Drupal so that anyone can edit content (and even enable advanced wiki features with the help of several contributed modules like wikitools and Diff), but it may be simpler for you to use a more specialized solution.

  • If your only requirement is to host discussion forums, you will want to consider a system such as SimpleMachines or phpBB with a mature set of Forum features, or Vanilla which has many plug-ins. If you need a custom forum, however, Drupal's forum module with forum enhancement modules like Advanced Forum may be better suited to extension.

With every release, Drupal is becoming easier to use; but like most powerful tools, it will always have a learning curve. If you or your organization are not prepared to spend some time learning how Drupal works (or if you are not able to hire Drupal expertise), it may not be your best option.

Tuesday, October 4, 2011

username_check issue with secure pages drupal6

Hi everyone,
I was facing this same issue , the issue was due to cross domain request. when we enable the secure pages the protocol changes to https but username_check module sends ajax request using http so browser rejects this request , and the cycle will not complete .
here is my quick solution to this :
line number 45 of username_check_auto.js
$.ajax({
// url: Drupal.settings.usernameCheck.ajaxUrl,
url: 'https://secure.myprop.com.au/username_check/isunique',
data: {username: Drupal.usernameCheckUsername},
dataType: 'json',

//this is hard coded url but can be made dynamic by checking secure pages module is enabled or not from the variables table .

Wednesday, August 31, 2011

Dynamic select list in Drupal7 using #ajax property

array(
'title' => 'A page to test ajax',
'page callback' => 'drupal_get_form',
'page arguments' => array('mymodule_page'),
'access arguments' => array('access content'),
)
);
}



/**
* A form with a dropdown whose options are dependent on a
* choice made in a previous dropdown.
*
* On changing the first dropdown, the options in the second are updated.
*/
function mymodule_page($form, &$form_state) {
// Get the list of options to populate the first dropdown.
$options_first = mymodule_first_dropdown_options();

// If we have a value for the first dropdown from $form_state['values'] we use
// this both as the default value for the first dropdown and also as a
// parameter to pass to the function that retrieves the options for the
// second dropdown.
$value_dropdown_first = isset($form_state['values']['dropdown_first']) ? $form_state['values']['dropdown_first'] : key($options_first);

$form['dropdown_first'] = array(
'#type' => 'select',
'#title' => 'First Dropdown',
'#options' => $options_first,
'#default_value' => $value_dropdown_first,

// Bind an ajax callback to the change event (which is the default for the
// select form type) of the first dropdown. It will replace the second
// dropdown when rebuilt
'#ajax' => array(
// When 'event' occurs, Drupal will perform an ajax request in the
// background. Usually the default value is sufficient (eg. change for
// select elements), but valid values include any jQuery event,
// most notably 'mousedown', 'blur', and 'submit'.
'event' => 'change',
'callback' => 'mymodule_ajax_callback',
'wrapper' => 'dropdown_second_replace',
),
);
$form['dropdown_second'] = array(
'#type' => 'select',
'#title' => 'Second Dropdown',
// The entire enclosing div created here gets replaced when dropdown_first
// is changed.
'#prefix' => '',
// when the form is rebuilt during ajax processing, the $value_dropdown_first variable
// will now have the new value and so the options will change
'#options' => mymodule_second_dropdown_options($value_dropdown_first),
'#default_value' => isset($form_state['values']['dropdown_second']) ? $form_state['values']['dropdown_second'] : '',
);
return $form;
}

/**
* Selects just the second dropdown to be returned for re-rendering
*
* Since the controlling logic for populating the form is in the form builder
* function, all we do here is select the element and return it to be updated.
*
* @return renderable array (the second dropdown)
*/
function mymodule_ajax_callback($form, $form_state) {
return $form['dropdown_second'];
}


/**
* Helper function to populate the first dropdown. This would normally be
* pulling data from the database.
*
* @return array of options
*/
function mymodule_first_dropdown_options() {
return array(
'colors' => 'Names of colors',
'cities' => 'Names of cities',
'animals' => 'Names of animals',
);
}


/**
* Helper function to populate the second dropdown. This would normally be
* pulling data from the database.
*
* @param key. This will determine which set of options is returned.
*
* @return array of options
*/
function mymodule_second_dropdown_options($key = '') {
$options = array(
'colors' => array(
'red' => 'Red',
'green' => 'Green',
'blue' => 'Blue'
),
'cities' => array(
'paris' => 'Paris, France',
'tokyo' => 'Tokyo, Japan',
'newyork' => 'New York, US'
),
'animals' => array(
'dog' => 'Dog',
'cat' => 'Cat',
'bird' => 'Bird'
),
);
if (isset($options[$key])) {
return $options[$key];
}
else {
return array();
}
}