Entity view (Content)

New Feature in osCaddie - Taxonomy

By kso
Apr. 13, 2012

Do you know what osCaddie is? If not click here to find out more. osCaddie by Appnovation integrates a world class Open Source document repository application with the highly scalable and popular Open Source website development tool allowing for the best of both worlds. Alfresco compliments Drupal by providing a feature rich UI for managing web assets, as well as providing full document and knowledge management for entire organizations. Drupal as the frontend provides Alfresco with a highly flexible presentation layer that can be used to build websites that would be more or less impossible with Alfresco alone. We have been expanding osCaddie's features and today I will be talking about categorisation. Both Drupal and Alfresco are great individually with categorisation, but together they're even better. We needed a way to sync taxonomy terms for Drupal and Categories in Alfresco. We achieve this by providing RESTful API between the applications so that each will know when there are new terms to be added in the system. In Drupal, we provided hooks to pre-existing taxonomy functions by adding submit handlers that, when triggered, will send the data to a custom Alfresco webscript. Here is a small snapshot of the code


/**  * Implementation of hook_form_alter  */ function alfresco_taxonomy_form_alter(&$form, &$form_state, $form_id) {   switch ($form_id) {     case 'taxonomy_form_vocabulary':     $form['#submit'][] = 'alfresco_taxonomy_form_vocabulary';     break;   case 'taxonomy_vocabulary_confirm_delete':     $form['#submit'][] = 'alfresco_taxonomy_vocabulary_confirm_delete_submit';     break;   case 'taxonomy_form_term':     $form['#submit'][] = 'alfresco_taxonomy_form_term';     break;   } } /**  * Alfresco taxonomy submit function  */ function alfresco_taxonomy_form_term(&$form, $form_state = array()) {   module_load_include('inc', 'alfresco_connector', 'includes/alfresco_connector.alfresco_api');   module_load_include('inc', 'alfresco_connector', 'includes/alfresco_connector.helpers');   $values = $form_state['values'];   $alfresco_endpoint = variable_get(AFRESCO_CONNECTOR_ENDPOINT_KEY, '');   $alf_ticket = alfresco_connector__alfresco_api_get_api_ticket();   if(empty($alf_ticket)) {     return NULL;   }   switch ($values['op']) {     case 'Save':       $path = ALFRESCO_TAXONOMY_CATEGORY_URL;       break;   }   $url = $alfresco_endpoint . $path . "?alf_ticket=$alf_ticket";   $boundary = 'A0sFSD';   $method = 'POST';   $headers = array(     "Content-Type" => "multipart/form-data; boundary=$boundary",   );   $params = array(     'tagName' => $values['name'],   );   $data = wl_alfresco_connector__helpers_multipart_encode($boundary, $params);   $response = drupal_http_request($url, $headers, $method, $data); }


// See if the tag already exists tagExists = taxonomyCheckTagExist(store, tagName); if (!tagExists) {   tag = taggingService.createTag(store, tagName);   if (tag == null) {     model.result = FAILURE_MESSAGE;   } } else {   tag = tagName;   model.response = ERROR_1000_DUPLICATE; } // Put the created tag into the model model.tag = tag; model.tagExists = (tagExists) ? "TRUE" : "FALSE"; model.tags = taggingService.getTags(store);

This just one of the neat features that we are working on with Appnovation's osCaddie. We are always updating and creating new features that will benefit our clients. Happy Coding!

Post Tags: