Assembla home | Assembla project page
 

Changeset 112

Show
Ignore:
Timestamp:
11/09/06 14:54:22 (2 years ago)
Author:
moensch
Message:

The checkout form now checks directly via JavaScript? whether an entered code is correct or not.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/com_mls_events/barcodes/admin.mls_events.html.php

    r111 r112  
    11861186        } 
    11871187         
    1188         function checkoutForm( $user, $event, $lists, $option, $act ) { 
     1188        function checkoutForm( $user, $event, $barcodes, $lists, $option, $act ) { 
    11891189                global $l; 
    11901190                $l->setBlock("checkin"); 
    11911191                ?> 
     1192                <script language="JavaScript"> 
     1193                var barcodes = new Array(<?php echo count($barcodes); ?>); 
     1194                <?php 
     1195                for($i = 0; $i < count($barcodes); $i++) { 
     1196                        echo "barcodes[".$i."] = '".$barcodes[$i]->code."';\n"; 
     1197                } 
     1198                ?> 
     1199                 
     1200                function verifyCode(varCode) { 
     1201                        var codeExists; 
     1202                        codeExists = 0; 
     1203                        for (var i = 0; i < barcodes.length; i++) { 
     1204                                if(barcodes[i] == varCode) { 
     1205                                        codeExists = 1; 
     1206                                } 
     1207                        } 
     1208                        if(codeExists == 0) { 
     1209                                alert('<?php echo $l->m("msg_code_wrong", "general"); ?>'); 
     1210                        } 
     1211                } 
     1212                </script> 
    11921213                <form action="index2.php" method="post" name="adminForm"> 
    11931214                <table class="adminheading"> 
     
    12041225                                <td width="20%" valign="top" align="right"><?php echo $l->m("user") ?>:</td> 
    12051226                                <td width="80%"><?php echo $user->id; ?>: <?php echo $user->name; ?> (<?php echo $user->username; ?>)</td> 
     1227                        </tr> 
     1228                        <tr> 
     1229                                <td width="20%" valign="top" align="right"><?php echo $l->m("barcodes") ?>:</td> 
     1230                                <td width="80%"> 
     1231                                        <ol> 
     1232                                        <?php 
     1233                                        foreach($barcodes as $code) { 
     1234                                                echo "<li>".$code->code."</li>\n"; 
     1235                                        } 
     1236                                        ?> 
     1237                                </ol> 
     1238                                </td> 
    12061239                        </tr> 
    12071240                        <?php 
     
    12241257                        <tr> 
    12251258                                <td width="20%" valign="top" align="right"><?php echo $l->m("barcode") ?> 1:</td> 
    1226                                 <td width="80%"><input class="text_area" id="barcode1" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="document.getElementById('barcode2').focus()" /></td> 
     1259                                <td width="80%"><input class="text_area" id="barcode1" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="verifyCode(this.value);document.getElementById('barcode2').focus()" /></td> 
    12271260                        </tr> 
    12281261                        <tr> 
    12291262                                <td width="20%" valign="top" align="right"><?php echo $l->m("barcode") ?> 2:</td> 
    1230                                 <td width="80%"><input class="text_area" id="barcode2" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="document.getElementById('barcode3').focus()" /></td> 
     1263                                <td width="80%"><input class="text_area" id="barcode2" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="verifyCode(this.value);document.getElementById('barcode3').focus()" /></td> 
    12311264                        </tr> 
    12321265                        <tr> 
    12331266                                <td width="20%" valign="top" align="right"><?php echo $l->m("barcode") ?> 3:</td> 
    1234                                 <td width="80%"><input class="text_area" id="barcode3" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="document.getElementById('barcode4').focus()" /></td> 
     1267                                <td width="80%"><input class="text_area" id="barcode3" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="verifyCode(this.value);document.getElementById('barcode4').focus()" /></td> 
    12351268                        </tr> 
    12361269                        <tr> 
    12371270                                <td width="20%" valign="top" align="right"><?php echo $l->m("barcode") ?> 4:</td> 
    1238                                 <td width="80%"><input class="text_area" id="barcode4" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="document.getElementById('barcode5').focus()" /></td> 
     1271                                <td width="80%"><input class="text_area" id="barcode4" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="verifyCode(this.value);document.getElementById('barcode5').focus()" /></td> 
    12391272                        </tr> 
    12401273                        <tr> 
    12411274                                <td width="20%" valign="top" align="right"><?php echo $l->m("barcode") ?> 5:</td> 
    1242                                 <td width="80%"><input class="text_area" id="barcode5" type="text" name="barcodes[]" size="10" maxlength="12" value="" /></td> 
     1275                                <td width="80%"><input class="text_area" id="barcode5" type="text" name="barcodes[]" size="10" maxlength="12" value="" onChange="verifyCode(this.value);" /></td> 
    12431276                        </tr> 
    12441277                        <tr> 
     
    12481281                </table> 
    12491282                <input type="hidden" name="userid" value="<?php echo $user->id; ?>" /> 
    1250                 <input type="text" name="eventid" value="<?php echo $event->id; ?>" /> 
     1283                <input type="hidden" name="eventid" value="<?php echo $event->id; ?>" /> 
    12511284                <input type="hidden" name="option" value="<?php echo $option; ?>" /> 
    12521285                <input type="hidden" name="act" value="<?php echo $act; ?>" /> 
  • branches/com_mls_events/barcodes/admin.mls_events.php

    r111 r112  
    356356                                //Payback list 
    357357                                $lists["payback"] = mosHTML::yesnoRadioList('payback', ' class="inputbox"', '1'); 
     358                                 
     359                                //Load barcodes 
     360                                $database->setQuery( "SELECT `code` FROM `#__mls_events_barcodes` WHERE `userid`='".$user->id."' AND `status`='1'" ); 
     361                                $barcodes = $database->loadObjectList(); 
    358362                        } else { 
    359363                                $lists = array(); 
    360364                        } 
    361                         HTML_MLS_events_checkin::checkoutForm( $user, $event, $lists, $option, $act ); 
     365                        HTML_MLS_events_checkin::checkoutForm( $user, $event, $barcodes, $lists, $option, $act ); 
    362366                } else { 
    363367                        HTML_MLS_events_checkin::checkinForm( $user, $event, $option, $act ); 
     
    442446        if(count($wrongcodes)) { 
    443447                //There were some wrong codes 
    444                 mosRedirect( "index2.php?option=$option&act=$act", $l->m("err_codes_mismatch","general") ); 
     448                mosRedirect( "index2.php?option=$option&act=$act", sprintf($l->m("err_codes_mismatch","general"),implode( ',', $wrongcodes )) ); 
    445449        } else { 
    446450                //All codes ok, disable codes 
  • branches/com_mls_events/barcodes/lang/english.php

    r111 r112  
    5252                "msg_barcode_saved" => "Barcode saved!", 
    5353                "err_please_select_user" => "Please select User!", 
    54                 "err_codes_mismatch" => "Some of the codes entered mismatch!", 
     54                "err_codes_mismatch" => "Some of the codes entered mismatch! Wrong codes entered: %s", 
    5555                "msg_user_checked_out" => "The user has been checked out!", 
    56                 "msg_user_checked_out_payback" => "The user has been checked out! Please Pay %s back to user!"); 
     56                "msg_user_checked_out_payback" => "The user has been checked out! Please Pay %s back to user!", 
     57                "msg_code_wrong" => "This code is not assigned to this user or does not exist in the database!"); 
    5758 
    5859$lang_data["events"] = array( 
     
    247248                "user" => "User", 
    248249                "event" => "Event", 
    249                  
     250                "save" => "Save", 
    250251                "name" => "Name", 
    251252                "username" => "Username", 
     
    268269                "user" => "User", 
    269270                "barcode" => "Barcode", 
     271                "barcodes" => "Barcodes", 
    270272                "save" => "Save", 
    271273                "checkin" => "Checkin",