Changeset 288

Show
Ignore:
Timestamp:
04/20/08 10:40:32 (8 months ago)
Author:
kevin
Message:

Corrected a bug in managing personal and community profile fields that have the same name. Also added the ability to receive form submit notifications.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • form/form.php

    r277 r288  
    5454                $body = form_save($result->data,$_SESSION['userid'],$preview); 
    5555                $body = '<p>'.$form->response_text.'</p>'.$body; 
     56                if ($form->notification) { 
     57                    $msg = "Someone has submitted the form '$title'. \n\n" 
     58                            ."To export the form results or turn form notification off, please login as a site administrator and visit:\n\n" 
     59                            ."{$CFG->wwwroot}mod/form/index.php"; 
     60                    $subject = "Form submission for '$title'"; 
     61                    notify_user($form->owner, $subject, $msg); 
     62                } 
    5663            } 
    5764        } 
  • form/import_profile.php

    r277 r288  
    192192            $fd = new stdClass; 
    193193            $fd->internal_name = $field->internal_name; 
     194            $fd->original_internal_name = $field->internal_name; 
    194195            $fd->title = $field->name; 
    195196            $fd->description = $field->description; 
  • form/lib.php

    r277 r288  
    7979        $response_text = $form->response_text; 
    8080        $access = $form->access; 
     81        $notification = $form->notification; 
    8182        $field_list = '<h1>'.__gettext("Current fields").'</h1><br />'; 
    8283        if (isset($form->fields) && count($form->fields) > 0 ) { 
     
    173174        $response_text = ''; 
    174175        $access = $CFG->default_access; 
     176        $notification = 0; 
    175177        $field_list = ''; 
    176178        $buttons = ''; 
     
    191193    $response_description = __gettext("Enter the content that will be displayed after the form has been submitted.");  
    192194    $access_label = __gettext("Access"); 
    193     $access_description = __gettext("The access determines who is allowed to see this form.");            
     195    $access_description = __gettext("The access determines who is allowed to see this form."); 
     196    $notification_label = __gettext("Notification"); 
     197    $notification_description = __gettext("Tick this box to receive a notification each time someone submits this form."); 
     198    if ($notification) { 
     199        $notification_checked = 'checked'; 
     200    } else { 
     201        $notification_checked = ''; 
     202    } 
     203                   
    194204     
    195205    $body = <<<END 
     
    263273$access_select 
    264274<p class="description">$access_description</p> 
     275<label class="labelclass" for="notification">$notification_label</label> 
     276<input type="checkbox" name="notification" value="1" $notification_checked> 
     277<p class="description">$notification_description</p> 
    265278<br /> 
    266 <input type="submit" name="submit" value="$form_manage_button"> 
     279<input type="submit" name="submit" value="$form_manage_button"> 
    267280</form> 
    268281END; 
     
    428441        $form->response_text = optional_param('response_text',''); 
    429442    $form->access = optional_param('access',''); 
     443    $form->notification = optional_param('notification',0,PARAM_INT); 
    430444    if ($action == 'change') { 
    431445        $form->ident = optional_param('form_id',0,PARAM_INT); 
     
    492506    $obj = new stdClass; 
    493507    $obj->name = $field->title; 
    494     $obj->internal_name = $field->internal_name;        // Short / unique internal name 
     508    $obj->internal_name = $field->original_internal_name;        // Short / unique internal name 
    495509    $obj->description  = $field->description;           // User instructions for entering data 
    496510    $obj->user_type = $user_type;                         // Type of user that can see this field 
  • form/mysql.sql

    r277 r288  
    88    owner int(11) NOT NULL, 
    99    access varchar(20) NOT NULL, 
     10    notification int(1) NOT NULL, 
    1011    PRIMARY KEY  (ident), 
    1112    KEY owner (owner), 
     
    1718    ident int(11) NOT NULL auto_increment, 
    1819    internal_name varchar(128) NOT NULL, 
     20    original_internal_name varchar(128) NOT NULL, 
    1921    field_type varchar(128) NOT NULL, 
    2022    title text, 
  • form/plugin.info

    r277 r288  
    11Maintainer: Kevin Jardine <kevin@radagast.biz> 
    22Title: Form builder 
    3 Version: 0.1 
     3Version: 0.2 
    44Package: form 
    55Source-URL: https://svn.elgg.org/plugins/form