$oLnk = new cHTMLLink();
 $oLnk->setMultiLink($area, "", $area, "");
 $oLnk->setCustom("idnewsjob", $iID);
 // Is at present redundant
 // HerrB: No, it's just not used/set...
 //$oMenu->setImage($iMenu, "images/newsletter_16.gif");
 $oMenu->setTitle($iMenu, $sName);
 switch ($oJob->get("status")) {
     case 1:
         // Pending
         if ($oJob->get("cronjob") == 0) {
             // Standard job can be run if user has the right to do so
             if ($perm->have_perm_area_action($area, "news_job_run")) {
                 $sLnkSend = str_replace('{ID}', $iID, $sTplSend);
                 $sLnkSend = str_replace('{NAME}', addslashes($sName), $sLnkSend);
                 $oMenu->setActions($iMenu, 'send', $sLnkSend);
             }
         } else {
             if ($oJob->get("cronjob") == 1) {
                 // It's a cronjob job - no manual sending, show it blue
                 $oLnk->updateAttributes(array("style" => "color:#0000FF"));
             }
         }
         if ($perm->have_perm_area_action($area, "news_job_delete")) {
             // Job may be deleted, if user has the right to do so
             $oMenu->setActions($iMenu, 'delete', '<a title="' . $aMsg["DelTitle"] . '" href="javascript://" onclick="showDelMsg(' . $iID . ',\'' . addslashes($sName) . '\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $aMsg["DelTitle"] . '" alt="' . $aMsg["DelTitle"] . '"></a>');
         }
         break;
     case 2:
         // Sending job
         if ($perm->have_perm_area_action($area, "news_job_run")) {
 // Create the link to show/edit the newsletter
 $oLnk = new cHTMLLink();
 $oLnk->setMultiLink($area, "", $area, "");
 $oLnk->setCustom("idnewsletter", $idnewsletter);
 $oMenu->setTitle($iMenu, $sName);
 $oMenu->setLink($iMenu, $oLnk);
 if ($perm->have_perm_area_action($area, "news_add_job") || $perm->have_perm_area_action($area, "news_create") || $perm->have_perm_area_action($area, "news_save")) {
     // Rights: If you are able to add a job, you should be able to test it
     //         If you are able to add or change a newsletter, you should be able to test it
     // Usability: If no e-mail has been specified, you can't send a test newsletter
     if (isValidMail($oNewsletter->get("newsfrom")) && $lIDCatArt > 0) {
         $sLnkSendTest = '<a title="' . $aMsg["SendTestTitle"] . '" href="javascript://" onclick="showSendTestMsg(' . $idnewsletter . ')"><img src="' . $cfg['path']['images'] . 'newsletter_sendtest_16.gif" border="0" title="' . $aMsg["SendTestTitle"] . '" alt="' . $aMsg["SendTestTitle"] . '" /></a>';
     } else {
         $sLnkSendTest = '<img src="' . $cfg['path']['images'] . 'newsletter_sendtest_16_off.gif" border="0" title="' . $aMsg["SendTestTitleOff"] . '" alt="' . $aMsg["SendTestTitleOff"] . '" />';
     }
     $oMenu->setActions($iMenu, 'test', $sLnkSendTest);
 }
 if ($perm->have_perm_area_action($area, "news_add_job")) {
     if (isValidMail($oNewsletter->get("newsfrom")) && $lIDCatArt > 0) {
         $oLnkAddJob = new Link();
         $oLnkAddJob->setMultiLink("news", "", "news", "news_add_job");
         $oLnkAddJob->setCustom("idnewsletter", $idnewsletter);
         $oLnkAddJob->setAlt($aMsg["AddJobTitle"]);
         $oLnkAddJob->setContent('<img src="' . $cfg['path']['images'] . 'newsletter_dispatch_16.gif" border="0" title="' . $aMsg["AddJobTitle"] . '" alt="' . $aMsg["AddJobTitle"] . '">');
         $sLnkAddJob = $oLnkAddJob->render();
     } else {
         $sLnkAddJob = '<img src="' . $cfg['path']['images'] . 'newsletter_dispatch_16_off.gif" border="0" title="' . $aMsg["AddJobTitleOff"] . '" alt="' . $aMsg["AddJobTitleOff"] . '" />';
     }
     $oMenu->setActions($iMenu, 'dispatch', $sLnkAddJob);
 }
 if ($perm->have_perm_area_action($area, "news_create")) {
function getWorkflowUsers($idworkflowitem)
{
    global $idworkflow, $cfg;
    $ui = new UI_Menu();
    $workflowusers = new WorkflowUserSequences();
    $workflowusers->select("idworkflowitem = '{$idworkflowitem}'", "", "position ASC");
    while ($workflowitem = $workflowusers->next()) {
        $pos = $workflowitem->get("position");
        $iduser = $workflowitem->get("iduser");
        $timelimit = $workflowitem->get("timelimit");
        $timeunit = $workflowitem->get("timeunit");
        $email = $workflowitem->get("emailnoti");
        $escalation = $workflowitem->get("escalationnoti");
        $timeunit = $workflowitem->get("timeunit");
        $id = $workflowitem->get("idusersequence");
        $moveup = new Link();
        $moveup->setCLink("workflow_steps", 4, "workflow_user_up");
        $moveup->setCustom("idworkflowitem", $idworkflowitem);
        $moveup->setCustom("idworkflow", $idworkflow);
        $moveup->setCustom("position", $pos);
        $moveup->setAlt(i18n("Move user up", "workflow"));
        #$moveup->setContent('<img border="0" style="padding-left: 2px" src="images/pfeil_hoch.gif">');
        $moveup->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/no_verschieben.gif" . '">');
        $movedown = new Link();
        $movedown->setCLink("workflow_steps", 4, "workflow_user_down");
        $movedown->setCustom("idworkflowitem", $idworkflowitem);
        $movedown->setCustom("idworkflow", $idworkflow);
        $movedown->setCustom("position", $pos);
        $movedown->setAlt(i18n("Move user down", "workflow"));
        $movedown->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/nu_verschieben.gif" . '">');
        $deletestep = new Link();
        $deletestep->setCLink("workflow_steps", 4, "workflow_user_delete");
        $deletestep->setCustom("idworkflowitem", $idworkflowitem);
        $deletestep->setCustom("idworkflow", $idworkflow);
        $deletestep->setCustom("position", $pos);
        $deletestep->setCustom("idusersequence", $id);
        $deletestep->setAlt(i18n("Delete user", "workflow"));
        $deletestep->setContent('<img style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_step_delete.gif" . '">');
        $title = "{$pos}. " . getUsers($id, $iduser);
        $title .= formGenerateField("text", "wftimelimit" . $id, $timelimit, 3, 6);
        $title .= getTimeUnitSelector($id, $timeunit);
        $altmail = i18n("Notify this user via E-Mail", "workflow");
        $altnoti = i18n("Escalate to this user via E-Mail", "workflow");
        $title .= formGenerateCheckbox("wfemailnoti[" . $id . "]", "1", $email) . '<label for="wfemailnoti[' . $id . ']1"><img alt="' . $altmail . '" title="' . $altmail . '" style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_email_noti.gif" . '"></label>';
        $title .= formGenerateCheckbox("wfescalnoti[" . $id . "]", "1", $escalation) . '<label for="wfescalnoti[' . $id . ']1"><img alt="' . $altnoti . '" title="' . $altnoti . '" style="padding-left: 2px" border="0" src="' . $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_escal_noti.gif" . '"></label>';
        $ui->setTitle($id, $title);
        $ui->setLink($id, NULL);
        if ($pos > 1) {
            $ui->setActions($id, "moveup", $moveup->render());
        } else {
            $ui->setActions($id, "moveup", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">');
        }
        if ($pos < $workflowusers->count()) {
            $ui->setActions($id, "movedown", $movedown->render());
        } else {
            $ui->setActions($id, "movedown", '<img style="padding-left: 2px" src="images/spacer.gif" width="15" height="1">');
        }
        $ui->setActions($id, "delete", $deletestep->render());
        $ui->setImage($id, $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["plugins"] . "workflow/images/workflow_user.gif");
    }
    $createstep = new Link();
    $createstep->setCLink("workflow_steps", 4, "workflow_create_user");
    $createstep->setCustom("idworkflow", $idworkflow);
    $createstep->setCustom("idworkflowitem", $idworkflowitem);
    $ui->setLink("spacer", NULL);
    $ui->setTitle("create", '<input class="text_medium" type="submit" name="adduser" value="' . i18n("Add User", "workflow") . '">');
    $ui->setLink("create", NULL);
    $content = $ui->render(false);
    return $content;
}
$workflows->select("idclient = '{$client}' AND idlang = '{$lang}'");
while ($workflow = $workflows->next()) {
    $wfid = $workflow->getField("idworkflow");
    $wfname = $workflow->getField("name");
    $wfdescription = $workflow->getField("description");
    /* Create the link to show/edit the workflow */
    $link = new Link();
    $link->setMultiLink("workflow", "", "workflow_common", "workflow_show");
    $link->setAlt($wfdescription);
    $link->setCustom("idworkflow", $wfid);
    $delTitle = i18n("Delete workflow", "workflow");
    $delDescr = sprintf(i18n("Do you really want to delete the following workflow:<br><br>%s<br>", "workflow"), $wfname);
    $delete = '<a title="' . $delTitle . '" href="javascript://" onclick="box.confirm(\'' . $delTitle . '\', \'' . $delDescr . '\', \'deleteWorkflow(\\\'' . $wfid . '\\\')\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $delTitle . '" alt="' . $delTitle . '"></a>';
    $ui->setTitle($wfid, $wfname);
    $ui->setLink($wfid, $link);
    $ui->setActions($wfid, 'delete', $delete);
    if ($wfid == $iIdMarked) {
        $ui->setExtra($wfid, 'id="marked" ');
    }
}
$content = $ui->render(false);
$delScript = '
    <script type="text/javascript">

        
        function foo(){return true;}

        /* Session-ID */
        var sid = "' . $sess->id . '";

        /* Create messageBox
    $iMenu++;
    $idnewsrcp = $oRecipient->get("idnewsrcp");
    $sName = $oRecipient->get("name");
    if (empty($sName)) {
        $sName = $oRecipient->get("email");
    }
    $oLnk = new cHTMLLink();
    $oLnk->setMultiLink($area, "", $area, "");
    $oLnk->setCustom("idrecipient", $idnewsrcp);
    if ($oRecipient->get("deactivated") == 1 || $oRecipient->get("confirmed") == 0) {
        $oLnk->updateAttributes(array("style" => "color:#A20000"));
    }
    $oMenu->setTitle($iMenu, $sName);
    $oMenu->setLink($iMenu, $oLnk);
    if ($perm->have_perm_area_action("recipients", "recipients_delete")) {
        $oMenu->setActions($iMenu, "delete", '<a title="' . $aMsg["DelTitle"] . '" href="javascript://" onclick="showDelMsg(' . $idnewsrcp . ',\'' . addslashes($sName) . '\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $aMsg["DelTitle"] . '" alt="' . $aMsg["DelTitle"] . '"></a>');
    }
}
$sExecScript = '
    <script type="text/javascript">       
        // Session-ID
        var sid = "' . $sess->id . '";

        // Create messageBox instance
        box = new messageBox("", "", "", 0, 0);

        function showDelMsg(lngId, strElement) {
            box.confirm("' . $aMsg["DelTitle"] . '", "' . $aMsg["DelDescr"] . '<b>" + strElement + "</b>", "deleteRecipient(\'" + lngId + "\')");
        }

        // Function for deleting recipients