0

こんにちは:私はまだいくつかのクライアントが使用しているレガシーphp4アプリを持っています。あるクライアントは、リストページに機能を追加して、複数のジョブを選択し、選択したジョブをワンクリックで削除できるようにしたいと考えています。

チェックボックスを含む現在の最初の列の左側に列を追加したいユーザーが必要な数のチェックボックスを選択し、[削除]をクリックすると、5、8、20が削除され、この場合は実際にアーカイブされます。

だから私は基本的にこのコードベースに適用されるGmailにある同様の機能が欲しいです。

どんな助けでもいただければ幸いです。

これがジョブリストページを吐き出すコードです

function getRequest(rn)
{
    document.forms.intake.R_NUMBER.value=rn;
    goTo('WHOLEBRIEF','display');
}

function archiveRequest(rn)
{
    if(confirm('Are you sure you want to remove this request?'))
    {
        document.forms.intake.R_NUMBER.value=rn;
        goTo('LIST','remove');
    }
}

</script>

<SCRIPT LANGUAGE="JavaScript" SRC="include/table.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="include/jquery.js"></SCRIPT>
<style type="text/css">
th.table-sortable {
    cursor:pointer;
    background-image:url("/images/sortable.gif");
    background-position:center left;
    background-repeat:no-repeat;
    padding-left:12px;
}
th.table-sorted-asc {
    background-image:url("/images/sorted_up.gif");
    background-position:center left;
    background-repeat:no-repeat;
}
th.table-sorted-desc {
    background-image:url("/images/sorted_down.gif");
    background-position:center left;
    background-repeat:no-repeat;
}
tr.alternates {
    background-color:#f0f0f0;
}
</style>
<input type="hidden" name="JOB_NUMBER">
 <center>
<table class="jobs" width="700" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<label>Show All Jobs</label>

<table width="1150" style="border: 1px solid #660099;" class="jobs sort01 table-autosort table-autofilter table-stripeclass:alternate table-filtered-rowcount:t1filtercount">
<thead>
<tr bgcolor="#cccccc" align="center">
<th width="50"  class="table-sortable:numeric"><label>Number</label></td>
<th width="200" class="table-filterable table-sortable:default"><label>Requested By</label></td>
<th width="200" class="table-sortable:default"><label>Project Name</label></td>
<th width="200" class="table-filterable table-sortable:default"><label>Project Category</label></td>
<th width="200" class="table-filterable table-sortable:default"><label>Job Type</label></td>  
<th width="150" class="table-sortable:date"><label>Date Submitted</label></td>
<th width="150" class="table-sortable:date"><label>Due Date</label></td>
<th width="100" class="table-filterable table-sortable:default"><label>Status</label></td>
<th width="20">&nbsp;</td>
</tr>
</thead>
<?

$i=0;
if(is_array($R)):
foreach ($R as $key=>$val):?>
<tr bgcolor="<?=getBGC($i)?>">
<td><a href="#" onclick="getReqs('<?=$R[$key]['JOB_NUMBER']?>');return false;"><?=$key?></a></td>
<td><?=$R[$key]['ANSWER']['Q_2']?></td><!--requestor name-->
<td><?=$R[$key]['ANSWER']['Q_5']?></td><!--project name-->
<td><?=$R[$key]['ANSWER']['Q_4']?></td><!--project category-->
<td><?=$R[$key]['ANSWER']['Q_25']?></td><!--job specs-->
<td align="center"><?=formatDate($R[$key]['R_DATE_SUBMITTED'],'y-m-d','m/d/y')?></td>
<td  align="center"><?=$R[$key]['ANSWER']['Q_22']?></td><!--due Date-->

<td  align="center"><?=lookupChange($R[$key]['R_STATUS'])?></td>
<td width="20">
    <?if($tKey):?>
       <a href="#" onclick="archiveRequest('<?=$R[$key]['JOB_NUMBER']?>');return false"><img src="images/b_close.gif" border="0"></a>
    <?endif;?>
    </td>
</tr>

<?$i++;endforeach;endif;?>
</table>  
</td>
</tr>
<tr><td>&nbsp;</td></tr>

</table>    </center>
4

1 に答える 1

0

広いストローク:名前が[]で終わるチェックボックスを追加します。送信されると、複数の結果をループしてそれぞれを処理できるようになります。

<input type="checkbox" name="archive[]" value="<?=$R[$key]['JOB_NUMBER']?>" />

フォームを使用してこれらの値を送信します(テーブルをフォームでラップできるように見えます)。

サーバー側では、次のように結果の配列をループできます。

if(!empty($_POST['archive'])) {
    foreach($_POST['archive'] as $archiveId) {
        echo $archiveId;
        // archive the values specified
    }
}
于 2013-01-07T21:33:44.737 に答える