/[drupal]/contributions/modules/ed_classified/ed_classified_settings.inc
ViewVC logotype

Contents of /contributions/modules/ed_classified/ed_classified_settings.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Sun Sep 13 03:06:58 2009 UTC (2 months, 1 week ago) by milesgillham
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
File MIME type: text/x-php
stable checkin
1 <?php
2 // $Id: ed_classified_settings.inc,v 1.2 2009/09/03 02:58:11 milesgillham Exp $
3
4 /**
5 * @file
6 * Simple text-based classified ads module.
7 * Michael Curry, Exodus Development, Inc.
8 * exodusdev@gmail.com
9 * for more information, please visit http://exodusdev.com/drupal/modules/classified.module
10 * Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights Reserved.
11 * Licensed under the terms of the GNU Public License (GPL) version 2. Please see LICENSE.txt for
12 * license terms. Possession and use of this code signifies acceptance of license
13 * terms.
14 */
15
16 /**
17 * Implementation of hook_settings().
18 * TODO - this is hardcoded to the Classified Ads vid - needs to be able to handle
19 * any taxonomy assigned
20 */
21 function ed_classified_admin_settings() {
22 module_load_include('inc', 'ed_classified', 'ed_classified_utils');
23
24 // lifted from image.module - neat trick
25 $form[_ed_classified_cfg_varname('settings_updated')] = array('#type' => 'hidden', '#value' => REQUEST_TIME);
26
27 // Miles - I have disabled this temporarily to keep the form neat and in line with
28 // Drupal guidelines.
29 // _ed_classified_settings_get_banner($form);
30 if (!_ed_classified_check_settings($form)) {
31 // bail, system not configured correctly.
32 return $form;
33 }
34
35 $vid = _ed_classified_get_vid();
36 $taxonomy = taxonomy_get_tree($vid);
37
38 $form['expiration'] = array(
39 '#type' => 'fieldset',
40 '#collapsible' => TRUE,
41 '#collapsed' => FALSE,
42 '#title' => t('Ad Duration and Expiration'),
43 );
44 $form['expiration'][ _ed_classified_cfg_varname('default_ad_duration')] = array('#type' => 'textfield', '#title' => t('New ad default duration (days)'), '#default_value' => _ed_classified_variable_get('default_ad_duration', EDI_CLASSIFIED_VAR_DEF_EXPIRATION_DAYS), '#size' => '3', '#maxlength' => 3, '#description' => t('Ads will auto-expire this many days after the ad is created, unless you override this on a per-category basis (see below.). Requires cron.'), '#required' => TRUE);
45
46 $form['expiration'][ _ed_classified_cfg_varname('ad_expired_purge_age')] = array('#type' => 'textfield', '#title' => t('Expired ad deletion grace period'), '#default_value' => _ed_classified_variable_get('ad_expired_purge_age', EDI_CLASSIFIED_VAR_DEF_PURGE_AGE), '#size' => '3', '#maxlength' => 3, '#description' => t('Expired ads are subject to purging (deletion) this many days after expiration.'), '#required' => TRUE);
47
48
49 $form['expiration']['notifications'] = array(
50 '#type' => 'fieldset',
51 '#collapsible' => TRUE,
52 '#collapsed' => TRUE,
53 '#title' => t('Ad Expiration Notifications'),
54 );
55 $form['expiration']['notifications'][ _ed_classified_cfg_varname('send_email_reminders')] = array('#type' => 'checkbox', '#title' => t('Send email reminders'), '#default_value' => _ed_classified_variable_get('send_email_reminders', EDI_CLASSIFIED_VAR_DEF_SEND_EMAIL_REMINDERS), '#description' => t('Send reminder emails to advertisers (using the specified templates) periodically if they have ads expiring within the warning period defined below.'), '#required' => FALSE);
56 $form['expiration']['notifications'][ _ed_classified_cfg_varname('ad_expiration_email_warning_days')] = array('#type' => 'textfield', '#title' => t('Days before expiration to send reminder emails'), '#default_value' => _ed_classified_variable_get('ad_expiration_email_warning_days', EDI_CLASSIFIED_VAR_DEF_AD_EXPIRATION_EMAIL_WARNING_DAYS), '#size' => '3', '#maxlength' => 3, '#required' => TRUE);
57 $form['expiration']['notifications']['email']
58 = array('#type' => 'fieldset',
59 '#collapsible' => TRUE,
60 '#collapsed' => FALSE,
61 '#title' => t('Notification messages'),
62 '#description' => t('Substitution variables: !sitename = your website name, !siteurl = your site\'s base URL, !user_ads_url = link to user\'s classified ads list.')
63 );
64
65 $form['expiration']['notifications']['email'][ _ed_classified_cfg_varname('email_subj') ]
66 = array('#type' => 'textarea', '#default_value' => t(_ed_classified_variable_get('email_subj', EDI_CLASSIFIED_VAR_DEF_EMAIL_SUBJ)),
67 '#title' => t('Expiration reminder email subject'));
68 $form['expiration']['notifications']['email'][ _ed_classified_cfg_varname('email_body') ]
69 = array('#type' => 'textarea', '#default_value' => t(_ed_classified_variable_get('email_body', EDI_CLASSIFIED_VAR_DEF_EMAIL_BODY)),
70 '#title' => t('Expiration reminder email body'));
71
72 $form['content_policy'] = array(
73 '#type' => 'fieldset',
74 '#collapsible' => TRUE,
75 '#collapsed' => FALSE,
76 '#title' => t('Ad Content Policy'),
77 );
78 $form['content_policy'][ _ed_classified_cfg_varname('ad_standard_body_length')] = array('#type' => 'textfield', '#title' => t('Body length limit for standard ads'), '#default_value' => _ed_classified_variable_get('ad_standard_body_length', EDI_CLASSIFIED_VAR_DEF_BODYLEN_LIMIT), '#size' => '6', '#maxlength' => 5, '#description' => t('Maximum characters to allow in classified ad body.'), '#required' => TRUE);
79
80 $form['content_policy'][ _ed_classified_cfg_varname('show_contact_form_link_on_posts')] = array('#type' => 'checkbox', '#title' => t('Show contact link on classified ad posts'), '#default_value' => _ed_classified_variable_get('show_contact_form_link_on_posts', EDI_CLASSIFIED_VAR_DEF_SHOW_CONTACT_LINK_ON_POSTS), '#description' => t('Provide contact link in classified ad links. Not necessary if you provide an alternative method of contacting advertisers, such as the privatemsg module).'), '#required' => FALSE);
81
82 $form['display'] = array(
83 '#type' => 'fieldset',
84 '#collapsible' => TRUE,
85 '#collapsed' => FALSE,
86 '#title' => t('Ad Display'),
87 );
88 $form['display'][ _ed_classified_cfg_varname('show_body_in_ad_list')] = array('#type' => 'checkbox', '#title' => t('Show ad body in taxonomy lists.'), '#default_value' => _ed_classified_variable_get('show_body_in_ad_list', EDI_CLASSIFIED_VAR_DEF_SHOW_BODY_IN_AD_LIST), '#description' => t('Show full ad body in taxonomy lists (otherwise will just show teaser - curently the title).'), '#required' => FALSE);
89
90 $form['file_attachment_enhancements'] = array(
91 '#type' => 'fieldset',
92 '#collapsible' => TRUE,
93 '#collapsed' => TRUE,
94 '#title' => t('File Attachment Enhancements'),
95 );
96
97 $form['file_attachment_enhancements'][ _ed_classified_cfg_varname('alter_attachment_text')] = array('#type' => 'checkbox', '#title' => t('Alter classified ad create/edit form file attachment text'), '#default_value' => _ed_classified_variable_get('alter_attachment_text', EDI_CLASSIFIED_VAR_DEF_ALTER_ATTACHMENT_TEXT), '#description' => t('If selected, this option will enhance classified node edit forms where attachments are enabled - altering form behavior to help users with attaching an image.'), '#required' => FALSE);
98
99 $form['file_attachment_enhancements'][ _ed_classified_cfg_varname('alter_attachment_text_description')] = array('#type' => 'textarea', '#title' => t('File attachment description text'), '#default_value' => _ed_classified_variable_get('alter_attachment_text_description', t(EDI_CLASSIFIED_VAR_DEF_ALTER_ATTACHMENT_TEXT_DESCRIPTION)), '#description' => t('If you choose to alter the file attachment form behavior, this text will be shown.'), '#required' => TRUE);
100
101 $form['taxonomy_settings'] =
102 array('#type' => 'fieldset',
103 '#collapsible' => TRUE,
104 '#collapsed' => FALSE,
105 '#title' => t('Taxonomy-dependent settings'),
106 '#description' => t('Ad duration, in days, for the ads created in each category. Ads expire this many days after creation in this category - note that changing the category after creation will not change the expiration date unless the author resets the expiration. Ads assigned more than one category at the time of creation or editing receive the maximum duration found in all assigned categories. '),
107 );
108
109 // get terms
110 // _dbg($taxonomy);
111 foreach ($taxonomy as $t) {
112 $name = _ed_classified_cfg_varname('vid_'. $vid .'_tid_'. $t->tid .'_duration');
113 $parms = array('@name' => $t->name, '!tid' => $t->tid);
114 $form['taxonomy_settings'][$name] =
115 array('#type' => 'textfield',
116 '#size' => 10,
117 '#maxlength' => 4,
118 '#title' => t('Ad duration for Category \'@name\'', $parms),
119 '#default_value' => _ed_classified_get_duration(array($vid => $t->tid)),
120 '#prefix' => '<div style="margin: '. $t->depth * 2 .'em; margin-top: 0; margin-bottom: 0;">',
121 '#suffix' => '</div>',
122 );
123 }
124
125 return system_settings_form($form);
126 }

  ViewVC Help
Powered by ViewVC 1.1.2