Code Duplication    Length = 21-24 lines in 2 locations

admin/faq.php 1 location

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

admin/category.php 1 location

@@ 184-204 (lines=21) @@
181
    $hidden = new XoopsFormHidden('op', 'addcategory');
182
    $button_tray->addElement($hidden);
183
    // No ID for category -- then it's new category, button says 'Create'
184
    if (!$categoryid) {
185
        $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
186
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
187
        $button_tray->addElement($butt_create);
188
189
        $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
190
        $button_tray->addElement($butt_clear);
191
192
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
193
        $butt_cancel->setExtra('onclick="history.go(-1)"');
194
        $button_tray->addElement($butt_cancel);
195
    } else {
196
        // button says 'Update'
197
        $butt_create = new XoopsFormButton('', '', _AM_SF_MODIFY, 'submit');
198
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
199
        $button_tray->addElement($butt_create);
200
201
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
202
        $butt_cancel->setExtra('onclick="history.go(-1)"');
203
        $button_tray->addElement($butt_cancel);
204
    }
205
206
    $sform->addElement($button_tray);
207
    $sform->display();