Ignore:
Timestamp:
Sep 12, 2005 1:02:01 AM (19 years ago)
Author:
scdev
Message:

update module_maker to print module variables instead of writing files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/skel/admin.php

    r9 r10  
    186186        %SET_VALUES_DEFAULT%,
    187187        'new_op' => 'insert',
    188         'submit_buttons' = array(
    189             'submit'   => _("Add %ITEM_TITLE%"),
    190             'repeat'   => _("Add & repeat"),
    191             'cancel'   => _("Cancel")
     188        'submit_buttons' => array(
     189            'submit' => _("Add %ITEM_TITLE%"),
     190            'repeat' => _("Add & repeat"),
     191            'cancel' => _("Cancel"),
    192192        ),
    193193    );
     
    202202    if ($lock->isLocked() && !$lock->isMine()) {
    203203        $lock->dieErrorPage();
    204     } else {
    205         // Get the information for the form.
    206         $qid = DB::query("
    207             SELECT *
    208             FROM %DB_TBL%
    209             WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'
    210         ");
    211         if (!$frm = mysql_fetch_assoc($qid)) {
    212             App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    213             App::raiseMsg(sprintf(_("The requested record %s could not be found"), $id), MSG_ERR, __FILE__, __LINE__);
    214             App::dieBoomerangURL();
    215         }
    216    
    217         // Lock this record.
    218         $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['address']);
    219        
    220         // Set misc values for the form.
    221         $frm['new_op'] = 'update';
    222         $frm['submit_caption'] = _("Save changes");
    223         $frm['repeat_caption'] = _("Save & edit next");
    224         $frm['reset_caption']  = _("Reset");
    225         $frm['cancel_caption'] = _("Cancel");
    226         $frm['%PRIMARY_KEY%'] = $id;
    227    
    228         return $frm;
    229     }
     204    }
     205
     206    // Get the information for the form.
     207    $qid = DB::query("
     208        SELECT *
     209        FROM %DB_TBL%
     210        WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'
     211    ");
     212    if (!$frm = mysql_fetch_assoc($qid)) {
     213        App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
     214        App::raiseMsg(sprintf(_("The requested record %s could not be found"), $id), MSG_ERR, __FILE__, __LINE__);
     215        App::dieBoomerangURL();
     216    }
     217
     218    // Lock this record.
     219    $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['address']);
     220   
     221    // Set misc values for the form.
     222    $frm = array_merge(array(
     223        %SET_VALUES_DEFAULT%,
     224        'new_op' => 'update',
     225        'submit_buttons' => array(
     226            'submit' => _("Save changes"),
     227            'repeat' => _("Save & edit next"),
     228            'reset' => _("Reset"),
     229            'cancel' => _("Cancel"),
     230        ),
     231    ), $frm);
     232
     233    return $frm;
    230234}
    231235
Note: See TracChangeset for help on using the changeset viewer.