Recent comments

  • Calling A Custom Or Panel Page From Code (Panels 3.x)   14 hours 38 min ago

    Mike, you are right, the Ctools API has changed how to do this.
    In the latest versions of Ctools and Panels you now need to do the following -

    in your .module file -

    /**
    * Implementation of hook_ctools_plugin_api().
    */
    function mymodule_ctools_plugin_api($module, $api) {
      if ($module == 'page_manager' && $api == 'pages_default') {
        $module_path = drupal_get_path('module', 'mymodule');
        return array('version' => 1, 'path' => $module_path);
      }
    }

    In your module folder now create mymodule.pages_default.inc file and inside that put the following -

    /**
    * Implementation of hook_default_page_manager_handlers()
    */
    function mymodule_default_page_manager_handlers() { 
      $handlers = array();

      //handler export code here.

      $handlers[$handler->name] = $handler;
      return $handlers;
    }

    /**
    * Implementation of hook_default_page_manager_pages()
    */
    function mymodule_default_page_manager_handlers() { 
      $pages = array();

      //page export code here.

      $pages[$page->name] = $page;
      return $pages;
    }

    Depending on the type of Panel you are exporting you may only need 1 of the above hooks, which will contain the whole export.

  • Calling A Custom Or Panel Page From Code (Panels 3.x)   14 hours 40 min ago

    This is/was a Panels 3 tutorial, but the CTools API seems to have changed since it was written. We're going to update it.

  • Missing Anonymous User   21 hours 6 min ago

    I am so happy that I found this post.

    It has been very helpful.. actually I was trying from days together to figure out page not found error..

    Thank you

  • More On Deploying With JMeter - Shell Scripting Deployment   2 days 6 hours ago

    I have recorded the script and modified to extract the form_build_id. Even then the Login fails. Could not figure out how to make login work.
    Can you provide a sample script with login step would be of great help.

    Thanking in advance.

  • Six Reasons To Get A Handbook Page For Your Module   4 days 20 hours ago

    I prefer just the normal homepage. Why get a handbook page when you can use the right column plug?

  • Why Is Writing Drupal Documentation Harder Than Writing Wikipedia?   6 days 17 hours ago

    -1 for there being any inherant advantage of wiki-markup over actual HTML. I speak HTML now better than English to express what I want to say, and a friend recently pointed out how awful true wiki-code has become (not that I tried too hard to learn YetAnotherMarkupLanguage before now.

    +1 But I totally see what you are saying about the ownership issues. But that's muchly an attitude thing. I know I an hesitant about 'stepping on toes' when reviewing or revising stuff that other folk I respect have edited, and there is a feeling of 'ownership' on pages I (or others?) have mostly done on their own.
    So I check a revision history. If I see 3 or 6 different editors have already touched a page, that means it's part of the organic doc project, and if it needs rewriting, so be it.

    The major real issues with drupal docs vs wikipedia are cultural, not technical. We have wiki+comments which is a bit of a hybrid. Any large structural stuff usually comes through the d.o webmaster or doc queues for feedback. I follow them.

    and even now .. I wonder why I'm replying on this off-drupal blog instead of the d.o doc queue. :-B

  • The Joys Of Preprocessing   1 week 11 hours ago

    You can call drupal_get_js() any time. Drupal only calls it once, but *you* can call it whenever you need it.

    If you want to invoke a drupal_add_js() *after* Drupal has called drupal_get_js() in the system page preprocess, you can call drupal_add_js() - which will still add your JavaScript to the list, then call drupal_get_js() again for the list of JavaScripts, now containing the one you just added.

    Hope that clears it up...

  • The Joys Of Preprocessing   1 week 1 day ago

    Reading this blog post I'm a bit confused. On the one had you say that if you use drupal_add_js() in your theme_preprocess_page() it won't won't work because drupal_get_js() has already been called. But as a solution you say to just rebuild $variables['scripts'] ... but that shouldn't work either since drupal_get_js() has already been called and won't be called again to render the HTML for the scripts.

  • OpenID, I'm Starting To Understand   1 week 1 day ago

    I believe it's with the introduction of Google Buzz that you now need to enter your Google profile url instead of your e-mail address. If you go to http://google.com/profiles/me you will be redirected to the correct url that you can use to log in with OpenID.

  • Getting French Characters On Your English Keyboard With Gnome   1 week 2 days ago
    But

    Thanks, but that is only the accent *one way*. As far as I can tell, there's no way to get an e with a grave accent (è), for example, with the Compose key.

    And what about î or maybe ï? Or à? Etc.

    Compose key gives you *some* options, but unless I'm mistaken they're fairly limited.

  • Getting French Characters On Your English Keyboard With Gnome   1 week 2 days ago

    In keyboard layout options, rather than choosing a different level, select 'Compose key position'. Select a suitable Compose key (I use the right hand 'win' key). Press this key the ' then e and you get an accented é, similarly for other accented characters.

  • Complex Calls With Soap Client   1 week 3 days ago

    Ok, so I get too many requests for this now. Here's the submit function from the module I usually send to people who ask for an example. There's loads of irrelevant crap in there, but if you look past all that, the guts of working with a SOAP web service are there:

    <?php
    /**

    * Submit function for processing the mortgage calculator data.

    *

    * This is where our web service actually gets called.

    */

    function mortgage_calculator_submit(&$form,&$form_state) {



     
    // get web service details

     
    $wsdl = variable_get('defaqto_mortgages_calculator_url','http://calculators.internaltest.co.uk/calculators/mortgages/V2_1/Mortgages.asmx?WSDL');

     
    $username = variable_get('defaqto_mortgages_calculator_username', '');

     
    $pword = variable_get('defaqto_mortgages_calculator_password', '');

     

     
    // initialise web service and get guid to use in request

     
    $options = array();

     
    $options['use'] = 'encoded';

     
    $options['style'] = 'rpc';

     

     
    $client = soapclient_init_client($wsdl, 1, $options);



     
    // if cant establish connection, log error and exit.

     
    if(!empty($client['#error'])){

         
    drupal_set_message(t('Could not open connection to the webservice'));

         
    watchdog('mortgages calculator', t('couldnt connect to webservice'), array(), WATCHDOG_ERROR);

          return;

      }

     

     
    // get username pass in args and login to webservice

     
    $login = array(

       
    'username' => $username,

       
    'password' => $pword,

      );



     
    //Call the login webmethod with the relevant parameters

     
    $result = $client['#return']->call('Login', $login);



      if(
    $result['#error'] !== FALSE ){

       
    drupal_set_message(t('Error: Could not login to webservice'), 'error');

        return;

      }

     

     
    // Form the parameters to be used in the FindBestMortgages webmethod

     
    $guid = $result['#return']['LoginResult'];

     
    $mortgageterm = $form_state['values']['mortgageterm'];

     
    $calccostover = $form_state['values']['calccostover'];

     
    $houseprice    = $form_state['values']['houseprice'];

     
    $mortgageamount = $form_state['values']['mortgageamount'];

     
    $firstappincome = $form_state['values']['firstappincome'];

     
    $secondappincome = $form_state['values']['secondappincome'];

     
    $reason = $form_state['values']['reason'];

     

     
    // note that there will only be one payment method (radio buttons), and one will be selected by default

     
    $paymentmethod = array('MortgagePaymentMethodEnum' => $form_state['values']['paymentmethod']);

     

     
    // Rate Types

     
    $ratetype = array();

     
    $mortgageRateTypeEnumArray = array();

      foreach (
    $form_state['values']['ratetype'] as $key => $value)

      {

        if (!
    is_null($value) && $value<>"All")

          {

           
    array_push($mortgageRateTypeEnumArray,$value);

          }

      }

      if(!empty(
    $mortgageRateTypeEnumArray)){

         
    $ratetype = array('MortgageRateTypeEnum' => $mortgageRateTypeEnumArray);

      }

     

     
    // Initial rate period

     
    $initialrateperiod = $form_state['values']['initialrateperiod'];

     

     
    // Product options

     
    $productoptions = array();

     
    $mortgageProductOptionsEnumArray = array();

      foreach (
    $form_state['values']['productoptions'] as $key => $value)

      {

        if (!
    is_null($value) && $value<>"All")

          {

           
    array_push($mortgageProductOptionsEnumArray,$value);

          }

      }

      if(!empty(
    $mortgageProductOptionsEnumArray)){

         
    $productoptions = array('MortgageProductOptionsEnum' => $mortgageProductOptionsEnumArray);

      }

     

     
    // Excluded providers

     
    $excludedproviders = array(); //Exclude no providers

     

      // Required Countries

     
    $requiredcountries = array();

     
    $countriesAvailableInEnumArray = array();

      foreach (
    $form_state['values']['requiredcountries'] as $key => $value)

      {

        if (
    $value<>"All")

          {

           
    array_push($countriesAvailableInEnumArray,$value);

          }

      }

      if(!empty(
    $countriesAvailableInEnumArray)){

       
    $requiredcountries = array('CountriesAvailableInEnum' => $countriesAvailableInEnumArray);

      }



     
    //Include regional products

     
    $includeregionalproducts = 'true';

     

     
    // Required dictribution channels

     
    $requiredDistributionChannel = array();

     
    $distributionChannelEnumArray = array();

      foreach (array(
    "Branch","Intermediary","Telephone","Internet") as $key => $value)

      {

         
    array_push($distributionChannelEnumArray,$value);

      }

      if(!empty(
    $distributionChannelEnumArray)){

         
    $requiredDistributionChannel = array('DistributionChannelEnum' => $distributionChannelEnumArray);

      }

     

     
    // Purchase Types to include

     
    $purchaseTypesToInclude = array('PurchaseTypesToIncludeEnum' => array("SharedOwnershipOnly","RightToBuyOnly","SelfCertifiedOnly"));

     

     
    // Results Options

     
    $resultsOptions = array('ResultsOptionsEnum'=>"ShowERCColumn",);

     

     
    // Calculation Options

     
    $calculationOptions = array('CalculationOptionsEnum','IncludeERCInTrueCost',);

     

     
    // Size of results set

     
    $numberofproducts = "100";

     

     
    // Sort field for results

      //$sortby = $form_state['values']['sortby'];

     
    $sortby = 'QuotedAPR';



     
    // Refactor fields

     
    $calccostover=$calccostover*12;

      if (
    trim($firstappincome)=="")

      {

       
    $firstappincome="50000";

      }

      if (
    trim($secondappincome)=="")

      {

       
    $secondappincome="0";

      }

      if (empty(
    $requiredcountries) OR !isset($requiredcountries) )

      {

       
    $requiredcountries = array('CountriesAvailableInEnum' => array('England','Wales','Scotland'),);

      }

     

     
    // Build the parameter array

     
    $mortgageargs = array(

     
    'userToken' => $guid,

     
    'mortgageTerm' => $mortgageterm,

     
    'noMonthsToCalculateCostOver' => $calccostover,// defaulting to 36

     
    'housePrice' => $houseprice,

     
    'mortgageAmount' => $mortgageamount,

     
    'firstApplicantIncome' => $firstappincome,

     
    'secondApplicantIncome' => $secondappincome,

     
    'reasonForMortgage' => $reason,

     
    'requiredPaymentMethods' => $paymentmethod,

     
    'requiredMortgageRateTypes' => $ratetype,

     
    'requiredInitialRateMonths' => $initialrateperiod, // defaulting to 36

     
    'requiredMortgageProductOptions' => $productoptions,

     
    'excludeProviderList' => $excludedproviders,

     
    'requiredCountries' => $requiredcountries,

     
    'includeRegionalProducts' => $includeregionalproducts,

     
    'requiredDistributionChannel' => $requiredDistributionChannel,

     
    'purchaseTypesToInclude' => $purchaseTypesToInclude,

     
    'resultsOptions' => $resultsOptions,

     
    'calculationOptions' => $calculationOptions,

     
    'overridingProductCodes' => array(),

     
    'numberOfProductsToReturn' => $numberofproducts,

     
    'sortBy' => $sortby,

      );



     

     
    // Find the Best mortgages

     
    $result = $client['#return']->call('FindBestMortgages', $mortgageargs);



     
    // output results if error

     
    if( $result['#error'] !== FALSE){

       
    drupal_set_message('An error occurred');

      }

      else

      {

         
    // Empty the

       
    if(empty($result['#return']['FindBestMortgagesResult']['diffgram'])){

         
    drupal_set_message(t('Your search return no results, Please adjust your criteria and try again.'));

         
    $form_state['redirect'] = FALSE;

        }

        else

        {

         
    //save results in storage, automatically rebuild the form.

         
    $form_state['storage']['results'] = $result['#return']['FindBestMortgagesResult']['diffgram']['NewDataSet']['BestMortgages'];

        }

      }

    }
    ?>

  • Calling A Custom Or Panel Page From Code (Panels 3.x)   2 weeks 23 hours ago

    I've tired to follow these steps with the latest version of panels(3.3)/ctools(1.3) but it doesn't work. delegator is no longer used I believe it's page_manager now.

    Inside the api call back $module and $api return different defaults.
    _ctools_plugin_api($module, $api) {
    $module = page_manager
    $api = pages_default
    }

    This guide is for panels 2, but it's labeled for panels 3. Please fix guide or title.

  • Validating & Submitting Forms To Other Websites With Drupal   2 weeks 1 day ago

    Lucky for me there are some Drupal gurus like you out there. I also bumped into the validation error and had no idea how to go around ti. Thanks for the tips. I really hope they'll work in my case as well.
    ______________
    Mathew Farney

  • Small Core, Big Drupal, Tighter Contrib: Outer Core?   2 weeks 3 days ago

    I'm also waiting for D8 core, hope that It will beat much of the current problems :-)

  • Complex Calls With Soap Client   2 weeks 6 days ago

    Bill, I've been piecing together SOAP today and I found the following page also helpful:

    http://www.lokad.com/WsPhpTutorial.ashx

  • Cleaning Up After Migrating To Drupal   3 weeks 7 hours ago

    When I did this for HealthConnection.co.nz's migration from .net to Drupal I toyed with Apache ReWrites but went with a Drupal module instead. We stored the mappings of .net IDs to Drupal IDs then implemented a menu item for "Article.asp". In the callback function it looks for the old ID in the query string, uses it to retrieve the new ID and issues a drupal_goto() redirect to "node/$new_id". There were several different menu callbacks for different ASP files.

    This might not be quite as scalable as an approach that offloads more of the work to path module and .htaccess, but was fast and easy to implement and debug.

  • Drupal And Linux, A Deployment Script   3 weeks 1 day ago

    Just found this cool article about using Subversion:
    http://developer.r-project.org/SVNtips.html

    Most of it we know, but some handy ideas, for setting the svn repository and target directory as Linux variables. Nice!

    [gharvey@eeepc ~]$ export REPOS=svn+ssh://my.svn.server/path/to/repositories
    [gharvey@eeepc ~]$ export WORKSPACE=~/workspace
    [gharvey@eeepc ~]$ svn co $REPOS/application_dir $WORKSPACE/checkout_location

  • Drupal And Linux, A Deployment Script   3 weeks 1 day ago

    We're using checkout, and no, the .svn directories don't concern us at all. If you don't use checkout, you can't switch branch, at which point I fail to see the benefit. You might as well just FTP up your files.

  • Drupal And Linux, A Deployment Script   3 weeks 1 day ago

    we *only* checkout www on to servers, nothing else, so we can't pull "cruft"

    Are you using checkout or export of your www directory for production? If you are using checkout, do you have any concerns with having the .snv directories on your live servers?

  • Getting Stuff Done   3 weeks 2 days ago
    ...

    Getting Stuff Properly Done
    http://drupal.org/node/621618

  • Importing Nodes Using The Batch API   3 weeks 2 days ago

    What happens if your XML file has a huge number of nodes in it, you can't go loading all that in to memory before starting the batch process, can you?

    I would assume you need to only read/parse 50 records from your file at a time, then batch them... or something along those lines?

  • Why Is Writing Drupal Documentation Harder Than Writing Wikipedia?   3 weeks 3 days ago

    I have to say, I hate Wiki 'markup'. Put an HTML toolbar at the top if you want to be quick! If you're using Drupal as anything more than an end user you should know some basic HTML anyway, no? <em> </em> is really not that much typing!

    While the value of having a Talk page associated with a document is clear, the way Wikipedia manages it is a colossal mess. Good idea; terrible execution.

  • Multilingual Drupal: Some Dos And Don'ts   3 weeks 6 days ago

    "There are four options for taxonomy translation"

    Really? Is there a list of these somewhere explaining them?

    As maintainer of Image module, I've had a lot of support requests/bug reports about problems with translating the image gallery names, which are just taxonomy terms. And I have no idea what to say or whether my module needs fixing, because I've no idea how it works.

  • Services, or How I Learned We're All Just Secretly hook_menu()   4 weeks 6 hours ago

    I have a group of websites (bookstores) which should ideally do the following:

    - each site publishes book review nodes and selectively enables some of those to be "shared" to a central server
    - on this central server each site admin then selects book review nodes he would like to pull to his own website
    - by some act of magic the selected nodes get pushed back to the subscriber's site

    As far as I understand it, the second and third steps would be nicely done with your module. But how about the first one (pushing nodes from receiving sites to the central site)? Would it be possible/necessary for all the sites to be both receivers and publishers?

    Currently I am using Feeds Api to realize my workflow, but I am not really satisfied with this since the act of creating proper feeds from nodes and then parsing those feeds back into nodes is quite complicated.