Changeset 21 for trunk/bin


Ignore:
Timestamp:
Nov 17, 2005 7:37:40 AM (19 years ago)
Author:
scdev
Message:

More random updates. Improved self-instantiation pattern in SessionCache? to match that of App. More little tweaks.

Location:
trunk/bin/module_maker
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/skel/adm_list.ihtml

    r20 r21  
    1212        <?php // printSelectForm('<##>_tbl', "CONCAT(<##>_id, '&mdash;', city, '&mdash;', title)", '<##>_id', getFormData('filter_<##>'), array('Any <##>'), 'ORDER BY <##> ASC'); ?>
    1313    </select>
    14     <input type="submit" name="list" value="<?php echo _("Search"); ?>" />
     14    <input type="submit" value="<?php echo _("Search"); ?>" />
    1515</div>
    1616</form>
  • trunk/bin/module_maker/skel/admin.php

    r20 r21  
    216216    if (!$frm = mysql_fetch_assoc($qid)) {
    217217        App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    218         App::raiseMsg(sprintf(_("The requested record %s could not be found"), $id), MSG_ERR, __FILE__, __LINE__);
     218        App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
    219219        App::dieBoomerangURL();
    220220    }
     
    244244    if ($lock->isLocked() && !$lock->isMine()) {
    245245        $lock->dieErrorPage();
    246     } else {
    247         // Break the cache because we are changing the list data.
    248         SessionCache::breakCache($_SERVER['PHP_SELF']);
    249        
    250         // Get the information for this object.
    251         $qid = DB::query("
    252             SELECT <##>
    253             FROM %DB_TBL%
    254             WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'
    255         ");
    256         if (! list($name) = mysql_fetch_row($qid)) {
    257             App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    258             App::raiseMsg(sprintf(_("The requested record %s could not be found"), $id), MSG_ERR, __FILE__, __LINE__);
    259             App::dieBoomerangURL();
    260         }
    261        
    262         // Delete the record.
    263         DB::query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'");
    264        
    265         App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);
    266 
    267         // Unlock record.
    268         $lock->remove();
    269     }
     246    }
     247
     248    // Break the cache because we are changing the list data.
     249    SessionCache::breakCache($_SERVER['PHP_SELF']);
     250   
     251    // Get the information for this object.
     252    $qid = DB::query("
     253        SELECT <##>
     254        FROM %DB_TBL%
     255        WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'
     256    ");
     257    if (! list($name) = mysql_fetch_row($qid)) {
     258        App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);
     259        App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
     260        App::dieBoomerangURL();
     261    }
     262   
     263    // Delete the record.
     264    DB::query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . addslashes($id) . "'");
     265   
     266    App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);
     267
     268    // Unlock record.
     269    $lock->remove();
    270270}
    271271
     
    297297    if ($lock->isLocked() && !$lock->isMine()) {
    298298        $lock->dieErrorPage();
    299     } else {
    300         // Break the cache because we are changing the list data.
    301         SessionCache::breakCache($_SERVER['PHP_SELF']);
     299    }
     300
     301    // Break the cache because we are changing the list data.
     302    SessionCache::breakCache($_SERVER['PHP_SELF']);
    302303
    303304%UPDATE%
    304        
    305         // Create version.
    306         $version = RecordVersion::getInstance($GLOBALS['auth']);
    307         $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']);
    308    
    309         App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);
    310 
    311         // Unlock record.
    312         $lock->remove();
    313     }
     305   
     306    // Create version.
     307    $version = RecordVersion::getInstance($GLOBALS['auth']);
     308    $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']);
     309
     310    App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);
     311
     312    // Unlock record.
     313    $lock->remove();
    314314}
    315315
  • trunk/bin/module_maker/sql.cli.php

    r20 r21  
    127127        continue;
    128128    }
    129     $key_eq_val .= $comma . "\n                $k = $v";
     129    $key_eq_val .= $comma . "\n            $k = $v";
    130130    $comma = ',';
    131131}
    132132echo <<<E_O_F
    133         // Update record data.
    134         DB::query("
    135             UPDATE $db_tbl SET$key_eq_val
    136             WHERE $primary_key = '" . addslashes(\$frm['$primary_key']) . "'
    137         ");
     133    // Update record data.
     134    DB::query("
     135        UPDATE $db_tbl SET$key_eq_val
     136        WHERE $primary_key = '" . addslashes(\$frm['$primary_key']) . "'
     137    ");
    138138E_O_F;
    139139}
Note: See TracChangeset for help on using the changeset viewer.