Code Duplication    Length = 21-24 lines in 2 locations

admin/category.php 1 location

@@ 214-234 (lines=21) @@
211
    $hidden = new XoopsFormHidden('op', 'addcategory');
212
    $button_tray->addElement($hidden);
213
    // No ID for category -- then it's new category, button says 'Create'
214
    if (!$categoryid) {
215
        $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
216
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
217
        $button_tray->addElement($butt_create);
218
219
        $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
220
        $button_tray->addElement($butt_clear);
221
222
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
223
        $butt_cancel->setExtra('onclick="history.go(-1)"');
224
        $button_tray->addElement($butt_cancel);
225
    } else {
226
        // button says 'Update'
227
        $butt_create = new XoopsFormButton('', '', _AM_SF_MODIFY, 'submit');
228
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
229
        $button_tray->addElement($butt_create);
230
231
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
232
        $butt_cancel->setExtra('onclick="history.go(-1)"');
233
        $button_tray->addElement($butt_cancel);
234
    }
235
236
    $sform->addElement($button_tray);
237
    $sform->display();

admin/faq.php 1 location

@@ 313-336 (lines=24) @@
310
    $status_tray->addElement($status_select);
311
    $sform->addElement($status_tray);
312
    */
313
    if (!$faqid) {
314
        // there's no faqid? Then it's a new faq
315
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_CREATE, 'submit' ) );
316
        $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
317
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
318
        $button_tray->addElement($butt_create);
319
320
        $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
321
        $button_tray->addElement($butt_clear);
322
323
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
324
        $butt_cancel->setExtra('onclick="history.go(-1)"');
325
        $button_tray->addElement($butt_cancel);
326
    } else {
327
        // else, we're editing an existing faq
328
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_MODIFY, 'submit' ) );
329
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
330
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
331
        $button_tray->addElement($butt_create);
332
333
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
334
        $butt_cancel->setExtra('onclick="history.go(-1)"');
335
        $button_tray->addElement($butt_cancel);
336
    }
337
338
    $sform->addElement($button_tray);
339
    $sform->display();