? tools/lib/publisher.drupal_elements.cls ? tools/lib/publisher.form.cls ? tools/lib/publisher.form2.cls ? tools/lib/publisher.msp_db.cls Index: publisher.inc =================================================================== RCS file: publisher.inc diff -N publisher.inc --- publisher.inc 15 Mar 2008 19:48:38 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -' - . t("Publisher provides a set of tools that are common to - publishing data in batch mode. Some of the tools are - third party tools and are interfaced to the Drupal module - via glue magic. The publisher module considers these tools - as plugins and can be found in the tools directory.") - . '

' - . t("The tools directory provides a hierarchy for include files, - libraries and executables. So within the tools directory - you will find directories named bin/, etc/, include/, lib/ - and modules/. I suggest that the bin/, etc/, include/ and - lib/ directories be copied to DRUPALROOT/local/ to make it - easier to execute. The bin/ directory contains batch - executables that will normally be executed by cron. The - modules/ directory provides the Drupal glue for controlling - installation and access.") - . '

'; - } break; - default: { - $output = NULL; - } - } - $output .= '
'."\n" - . pub_module_hook_call_all('help', $what)."\n" - . '
'."\n"; - return $output; -} - -function publisher_menu($may_cache) { - $menu = array(); - if ($may_cache) { - $menu[] = array( - 'path' => 'admin/publisher', - 'title' => t('Pubisher'), - ); - $menu[] = array( - 'path' => 'admin/publisher/msp', - 'title' => t('Merchant Service Provider'), - ); - $menu[] = array( - 'path' => 'admin/publisher/merchants', - 'title' => t('Merchants'), - ); - $menu[] = array( - 'path' => 'admin/publisher/webs', - 'title' => t('Websites'), - ); - } - return $menu; -} - -// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: publisher.uninstall.mysql =================================================================== RCS file: publisher.uninstall.mysql diff -N publisher.uninstall.mysql --- publisher.uninstall.mysql 2 Apr 2008 18:10:25 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,22 +0,0 @@ -Module Status: This module version is considered +ALPHA development and not functioning. This module version +should be used for evaluation of development only. Released versions of this +module will be announced on the developer and support lists.

+ '); +} + +function pub_publisher_header($form, $tool = 'Publisher', $module = 'Publisher', $build = NULL) { + global $publisherBuild; + if (!isset($build)) { + $build = $publisherBuild; + } + $output = '

'; + $output .= 'Sponsored by: Give-Me-An-Offer.com
'; + $output .= 'Tool: ' . $tool . '
'; + $output .= 'Module: ' . $module . '
'; + $output .= 'Form: ' . $form . '
'; + $output .= 'Build: ' . $build . '
'; + $output .= '

'; + $output .= pub_module_status('publisher'); + return t($output); +} + +/** + * Define publisher help function via hook_help API + */ +function publisher_help($what) { + switch ($what) { + case 'admin/help#publisher': { + require 'help/publisher.help'; + } break; + + default: { + switch (arg(1)) { + case 'help': + case 'publisher': { + switch (arg(2)) { + case 'msp': { + require 'help/publisher.msp.help'; + } break; + + case 'merchants': { + require 'help/publisher.merchants.help'; + } break; + + case 'webs': { + require 'help/publisher.webs.help'; + } break; + + default: { + require 'help/publisher.default.help'; + } break; + } + } break; + default: { + $output = NULL; + } break; + } + } + } + return $output; +} + +function publisher_menu($may_cache) { + static $pub_menu; + if (!isset($pub_menu)) { + require 'menu/publisher.menu'; + } + + return $pub_menu->get(); +} + + +function admin_publisher() { + $admin_tool = arg(2); + $op = arg(3); + $output = ''; + switch ($admin_tool) { + case 'msp': { + require 'form/publisher.msp.form'; + $output = '

' . theme('item_list', array('#message' => print_r($mspForm->get(),true))) . '

'; + // $output = drupal_render($mspForm->id, $mspForm->get()); + } break; + case 'merchants': { + } break; + case 'webs': { + } break; + default: { + $output = t('

Available tools:

'); + $links = array(); + require 'menu/publisher.menu'; + $links[] = $pub_menu->link('msp'); + $links[] = $pub_menu->link('merchants'); + $links[] = $pub_menu->link('websites'); + $output .= '

'. theme('item_list', $links) . '

'; + } + } + return $output; +} + +function admin_publisher_msp_add_form() { + require 'form/publisher.msp_add.form'; + return $mspForm; +} + +function admin_publisher_msp_add_form_submit($formId, $formValues) { + require 'form/submit/publisher.msp_add.submit'; +} + +function admin_publisher_msp_add_form_validate($formId, $formValues) { + require 'form/validate/publisher.msp_add.validate'; +} + +function theme_admin_publisher_msp_add_form($form) { + require 'form/publisher.msp_add.form'; + return drupal_render($form); +} + +function admin_publisher_msp_list_form() { + require 'form/publisher.msp_list.form'; + return $mspForm; +} + +function admin_publisher_msp_list_form_submit($formId, $formValues) { + require 'form/submit/publisher.msp_list.submit'; +} + +function admin_publisher_msp_list_form_validate($formId, $formValues) { + require 'form/validate/publisher.msp_list.validate'; +} + +function theme_admin_publisher_msp_list_form($form) { + require 'form/theme/publisher.msp_list.theme'; + return $theme; +} + +function _publisher_msp_get($args) { + static $sql = 'SELECT * FROM {pub_msp} WHERE id IN (%s)'; + if (is_array($args)) { + $args = implode(', ', $args); + } + $result = db_query($sql, $args); + $msps = array(); + while ($msp = db_fetch_object($result)) { + $msps[] = $msp; + } + return $msps; +} + +function _publisher_msp_enable($args) { + static $sql = 'UPDATE {pub_msp} SET enabled = 1 WHERE id = %d'; + db_query($sql, $args); +} + +function _publisher_msp_disable($args) { + static $sql = 'UPDATE {pub_msp} SET enabled = 0 WHERE id = %d'; + db_query($sql, $args); +} + +function _publisher_msp_delete($args) { + static $sql = 'UPDATE {pub_msp} SET deleted = 1, enabled = 0 WHERE id = %d'; + db_query($sql, $args); +} + +function _publisher_msp_undelete($args) { + static $sql = 'UPDATE {pub_msp} SET deleted = 0 WHERE id = %d'; + db_query($sql, $args); +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/publisher.uninstall.mysql =================================================================== RCS file: module/publisher.uninstall.mysql diff -N module/publisher.uninstall.mysql --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/publisher.uninstall.mysql 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,24 @@ + 'markup', + '#value' => '
', + ); + $mspForm['controlName'] = array( + '#type' => 'textfield', + '#title' => t('Control Name'), + '#description' => t('Automation control value for this record.'), + '#required' => TRUE, + '#size' => 32, + '#maxsize' => 32, + ); + $mspForm['displayName'] = array( + '#type' => 'textfield', + '#title' => t('Display Name'), + '#description' => t('The user eye value for the controlName.'), + '#required' => TRUE, + '#size' => 64, + '#maxsize' => 128, + ); + $mspForm['mspHomeURL'] = array( + '#type' => 'textfield', + '#title' => t('MSP Home URL'), + '#description' => t('The URL of the MSP Home page.'), + '#required' => FALSE, + '#maxsize' => 255, + ); + $mspForm['mspLoginURL'] = array( + '#type' => 'textfield', + '#title' => t('MSP Login URL'), + '#description' => t('The URL that presents you with the MSP login form.'), + '#required' => FALSE, + '#maxsize' => 255, + ); + $mspForm['userName'] = array( + '#type' => 'textfield', + '#title' => t('MSP Affiliate User Name'), + '#description' => t('The user id you use authenticate to the MSP.'), + '#required' => FALSE, + '#size' => 32, + '#maxsize' => 32, + ); + $mspForm['userPass'] = array( + '#type' => 'password', + '#title' => t('MSP Affiliate User Password'), + '#description' => t('The password you use to authenticate to the MSP.'), + '#required' => FALSE, + '#size' => 12, + '#maxsize' => 32, + ); + $mspForm['enabled'] = array( + '#type' => 'checkbox', + '#title' => t('Enabled'), + '#description' => t('Leave the MSP disabled if you\'re not ready to use it.'), + '#required' => FALSE, + ); + $mspForm['save'] = array( + '#type' => 'submit', + '#title' => t('Save'), + '#description' => t('Save'), + '#value' => t('Save'), + ); +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/form/publisher.msp_list.form =================================================================== RCS file: module/form/publisher.msp_list.form diff -N module/form/publisher.msp_list.form --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/form/publisher.msp_list.form 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,64 @@ + 'markup', + '#value' => '
', + ); + $sql = 'SELECT id, displayName, enabled, deleted, created, lastUpdated FROM {pub_msp} '; + $cnt = 'SELECT COUNT(DISTINCT id) FROM {pub_msp} '; + $hdr = array( + theme('table_select_header_cell'), + array('data' => t('Row ID'), 'field' => 'id'), + array('data' => t('MSP'), 'field' => 'displayName'), + array('data' => t('Enabled'), 'field' => 'enabled'), + array('data' => t('Deleted'), 'field' => 'deleted'), + array('data' => t('Created'), 'field' => 'created'), + array('data' => t('Updated'), 'field' => 'lastUpdated'), + ); + $sql .= tablesort_sql($hdr); + $result = pager_query($sql, $pageRows, 0, $cnt); + $mspForm['options']['operations'] = array( + '#type' => 'select', + '#options' => array( + t('--- Choose Action ---'), + t('Enable'), + t('Disable'), + t('Delete'), + t('Undelete'), + ), + '#default_value' => 'enable', + ); + $mspForm['options']['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + while ($data = db_fetch_array($result)) { + $id = $data['id']; + $checks[$id] = ''; + $mspForm['id'][$id] = array('#value' => $data['id']); + $mspForm['displayName'][$id] = array('#value' => $data['displayName']); + $mspForm['enabled'][$id] = array('#value' => $data['enabled']); + $mspForm['deleted'][$id] = array('#value' => $data['deleted']); + $mspForm['created'][$id] = array('#value' => $data['created']); + $mspForm['lastUpdated'][$id] = array('#value' => $data['lastUpdated']); + } + $mspForm['checks'] = array( + '#type' => 'checkboxes', + '#options' => $checks, + ); +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/form/submit/publisher.msp_add.submit =================================================================== RCS file: module/form/submit/publisher.msp_add.submit diff -N module/form/submit/publisher.msp_add.submit --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/form/submit/publisher.msp_add.submit 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,18 @@ + $checked) { + if ($checked) { + call_user_func_array($callback, array($key)); + } +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/form/theme/publisher.msp_list.theme =================================================================== RCS file: module/form/theme/publisher.msp_list.theme diff -N module/form/theme/publisher.msp_list.theme --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/form/theme/publisher.msp_list.theme 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,28 @@ +deleted) { + form_set_error('operations', t('You cannot enable a deleted MSP.')); + break; + } + } +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/help/publisher.default.help =================================================================== RCS file: module/help/publisher.default.help diff -N module/help/publisher.default.help --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/help/publisher.default.help 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,20 @@ + +The Publisher set of tools provides you with the means to control your +associations to merchant service providers, the merchants themselves and your +online web site publishing. You will be able to use tools to +provide data either by RSS/ATOM, XML, CSV, TSV and other delimited data files. +You will be able to batch the data import and node creation as well as control +the node activation, deactivation and deletion of the node and data control set. +

"); + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/help/publisher.help =================================================================== RCS file: module/help/publisher.help diff -N module/help/publisher.help --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/help/publisher.help 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,33 @@ +' + . t("Publisher provides a set of tools that are common to + publishing data in batch mode. Some of the tools are + third party tools and are interfaced to the Drupal module + via glue magic. The publisher module considers these tools + as plugins and can be found in the tools directory.") + . '

' + . t("The tools directory provides a hierarchy for include files, + libraries and executables. So within the tools directory + you will find directories named bin/, etc/, include/, lib/ + and modules/. I suggest that the bin/, etc/, include/ and + lib/ directories be copied to DRUPALROOT/local/ to make it + easier to execute. The bin/ directory contains batch + executables that will normally be executed by cron. The + modules/ directory provides the Drupal glue for controlling + installation and access.") + . '

'; +$pubout = pub_module_hook_call_all('help', $what); +if (isset($pubout)) { + $output .= '
'."\n" + . "$pubout\n" + . '
'."\n"; +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/help/publisher.merchants.help =================================================================== RCS file: module/help/publisher.merchants.help diff -N module/help/publisher.merchants.help --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/help/publisher.merchants.help 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,26 @@ + +Merchants are those that provide goods for retail and give you a percentage of +the sale for delivering someone to their door. The merchants are picky about +the content on your sites and provide you with data for you. They give you +URL to pictures and text for titles and descriptions. They also provide the +current retail price and maybe a ``on-sale\'\' price. You are free to format +the data however you choose. Merchants choose which ever MSP they feel will +provide them with the best service. Some merchants use more than one MSP +because they want to give you the best opportunity to serve them. +

+The goal of this module tool is to provide you with the means to control your +association to merchants. You will be able to list, add, edit and delete data +relevant to your associatino to the merchant. You need to have each of the MSP +entered into the MSP control data before you enter the merchants so that you +can associate the merchants to the appropriate MSP. +

'); + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/help/publisher.msp.help =================================================================== RCS file: module/help/publisher.msp.help diff -N module/help/publisher.msp.help --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/help/publisher.msp.help 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,24 @@ + +The merchant service provider (MSP) provides the merchants with the abilitiy to +control the relationship of the affiliate and the products and/or services that +the merchants offer for retail sales. There are many various MSP and the +requirements of each MSP are quite different from each other. The common thing +for most MSP are an ID for the merchant, an ID for the affiliate and a +redirection URI for the product item and/or service. +

+The goal of this module tool is to provide you the means to control your +association to the MSP. You may be a member of many of the MSP already. With +this tool you will be able to list, add, edit and delete data relevant to your +association to the MSP. +

'); + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/help/publisher.webs.help =================================================================== RCS file: module/help/publisher.webs.help diff -N module/help/publisher.webs.help --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/help/publisher.webs.help 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,18 @@ + +You can\'t publish online without a website and this is about online publishing. +

+The goal of this module tool is to provide you with the means to control your +web site data and to tie the web presence to each merchant and MSP. You will be +able to list, add edit and delete data relevant to each web site and the +relationship between each merchant and MSP. +

'); + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: module/menu/publisher.menu =================================================================== RCS file: module/menu/publisher.menu diff -N module/menu/publisher.menu --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ module/menu/publisher.menu 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,64 @@ +item('publisher'); + $pub_menu->description('Publisher Maintenance'); + $pub_menu->title('Publisher'); + $pub_menu->path('admin/publisher'); + $pub_menu->access('administer publisher'); + $pub_menu->callback('admin_publisher'); + $pub_menu->type(MENU_NORMAL_ITEM); + + $pub_menu->item('msp'); + $pub_menu->description('Publisher MSP Maintenance'); + $pub_menu->title('Merchant Service Provider'); + $pub_menu->path('admin/publisher/msp'); + $pub_menu->access('administer publisher msp'); + $pub_menu->callback('drupal_get_form', 'admin_publisher_msp_list_form'); + $pub_menu->type(MENU_NORMAL_ITEM); + + $pub_menu->item('msp_list'); + $pub_menu->description('Publisher MSP List'); + $pub_menu->title('MSP List'); + $pub_menu->path('admin/publisher/msp/list'); + $pub_menu->access('view publisher msp'); + $pub_menu->callback('drupal_get_form', 'admin_publisher_msp_list_form'); + $pub_menu->type(MENU_DEFAULT_LOCAL_TASK); + + $pub_menu->item('msp_add'); + $pub_menu->description('Publisher MSP Add'); + $pub_menu->title('MSP Add'); + $pub_menu->path('admin/publisher/msp/add'); + $pub_menu->access('administer publisher msp'); + $pub_menu->callback('drupal_get_form', 'admin_publisher_msp_add_form'); + $pub_menu->type(MENU_LOCAL_TASK); + + $pub_menu->item('merchants'); + $pub_menu->description('Publisher Merchants Maintenance'); + $pub_menu->title('Merchants'); + $pub_menu->path('admin/publisher/merchants'); + $pub_menu->access('administer publisher merchants'); + + $pub_menu->item('websites'); + $pub_menu->description('Publisher Web Sites Maintenance'); + $pub_menu->title('Web Sites'); + $pub_menu->path('admin/publisher/webs'); + $pub_menu->access('administer publisher webs'); +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: tools/lib/publisher.lib =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/publisher/tools/lib/publisher.lib,v retrieving revision 1.3 diff -u -p -r1.3 publisher.lib --- tools/lib/publisher.lib 2 Apr 2008 18:10:25 -0000 1.3 +++ tools/lib/publisher.lib 25 Apr 2008 18:22:48 -0000 @@ -174,12 +174,9 @@ function pub_module_hook_exists ($module function pub_module_hook_call ($module, $hook/*, ...*/) { $args = func_get_args(); array_shift($args); array_shift($args); - $ret = array(); + $ret = NULL; if (pub_module_hook_exists($module, $hook)) { $ret = call_user_func_array(pub_module_hook_name($module, $hook), $args); - if (!is_array($ret)) { - $ret = array(); - } } return $ret; } @@ -266,6 +263,18 @@ function pub_module_unregister($module) } /** + * TODO: + */ +function pub_module_status($module) { + if (pub_module_hook_exists($module, 'status')) { + return pub_module_hook_call($module, 'status'); + } + else { + return "

Module $module status is not given!

"; + } +} + +/** * Disable a publisher tool module. * * @param string $module // Name of disabled Index: tools/lib/publisher.menu.cls =================================================================== RCS file: tools/lib/publisher.menu.cls diff -N tools/lib/publisher.menu.cls --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tools/lib/publisher.menu.cls 25 Apr 2008 18:22:48 -0000 @@ -0,0 +1,119 @@ +menu = array(); + } + + function item($item, $title=NULL, $path=NULL, $desc=NULL) { + $this->currentItem = $item; + $this->menu[$item] = array(); + if (isset($title)) { + $this->title($title); + } + if (isset($path)) { + $this->path($path); + } + if (isset($desc)) { + $this->description($desc); + } + $this->type(MENU_NORMAL_ITEM); + $this->weight($this->autoWeight); + } + + function access($access) { + $this->menu[$this->currentItem]['access'] = is_string($access) + ? user_access($access) + : $access + ; + } + + function callback($func, $func_args=NULL) { + $this->menu[$this->currentItem]['callback'] = $func; + $this->type(MENU_CALLBACK); + $this->callbackArguments($func_args); + } + + function callbackArguments($args) { + if (isset($args)) { + if (!is_array($args)) { + $args = array($args); + } + $this->menu[$this->currentItem]['callback arguments'] = $args; + } + } + + function description($desc) { + $this->menu[$this->currentItem]['description'] = t($desc); + } + + function path($path) { + $this->menu[$this->currentItem]['path'] = $path; + } + + function title($title) { + $this->menu[$this->currentItem]['title'] = t($title); + } + + function type($type) { + $this->menu[$this->currentItem]['type'] = $type; + } + + function weight($weight) { + $this->menu[$this->currentItem]['weight'] = $weight; + $this->autoWeight = ++$weight; + } + + /** + * Return the menu array + */ + function get() { + return $this->menu; + } + + /** + * Return a link for the given menu id or an array of links based on the + * full set of menu items. + * + * @return mixed + */ + function link($id = NULL) { + if (isset($id)) { + return l($this->menu[$id]['title'], + $this->menu[$id]['path'], + array('title' => $this->menu[$id]['description']) + ); + } + else { + $links = array(); + foreach ($this->menu as $id) { + $links[] = $this->link($id); + } + return $links; + } + } + } +} + +// vim:ft=php:sts=2:sw=2:ts=2:et:ai:sta:ff=unix Index: tools/modules/datafeed/datafeed.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/publisher/tools/modules/datafeed/datafeed.module,v retrieving revision 1.2 diff -u -p -r1.2 datafeed.module --- tools/modules/datafeed/datafeed.module 2 Apr 2008 18:10:25 -0000 1.2 +++ tools/modules/datafeed/datafeed.module 25 Apr 2008 18:22:48 -0000 @@ -17,6 +17,7 @@ function pub_datafeed_perm() { * Define publisher datafeed help function via hook_help API. */ function pub_datafeed_help($what) { + $output = NULL; switch ($what) { case 'admin/help#publisher': case 'admin/help#datafeed': {