$sContent .= '      </tr>' . "\n";
$sContent .= '      <tr>' . "\n";
$sContent .= '         <td>' . i18n("Sort by", $plugin_name) . '</td>' . "\n";
$sContent .= '         <td>' . $oSelSortBy->render() . '</td>' . "\n";
$sContent .= '      </tr>' . "\n";
$sContent .= '      <tr>' . "\n";
$sContent .= '         <td>' . i18n("Sort order", $plugin_name) . '</td>' . "\n";
$sContent .= '         <td>' . $oSelSortOrder->render() . '</td>' . "\n";
$sContent .= '      </tr>' . "\n";
$sContent .= '      <tr>' . "\n";
$sContent .= '         <td>' . i18n("Search for", $plugin_name) . '</td>' . "\n";
$sContent .= '         <td>' . $oTxtFilter->render() . '</td>' . "\n";
$sContent .= '      </tr>' . "\n";
$sContent .= '      <tr>' . "\n";
$sContent .= '         <td>' . i18n("Search in", $plugin_name) . '</td>' . "\n";
$sContent .= '         <td>' . $oSelSearchIn->render() . '</td>' . "\n";
$sContent .= '      </tr>' . "\n";
$sContent .= '      <tr>' . "\n";
$sContent .= '         <td>&nbsp;</td>' . "\n";
$sContent .= '         <td>' . $oBtnApply->render() . '</td>' . "\n";
$sContent .= '      </tr>' . "\n";
$sContent .= '    </table>' . "\n";
$sContent .= '</form>' . "\n";
$sContent .= '</div>' . "\n";
// To template
$sLink = "listoptionsgroup";
$oListOptionsRow = new cFoldingRow("79efc1fc-111d-11dc-8314-0800200c9a66", i18n("List options", $plugin_name), $sLink, false);
$oListOptionsRow->setContentData($sContent);
$oTpl->set('s', 'LISTOPTIONLINKGROUP', $sLink);
######################################
# 4.3 Recipient groups: Paging
 $oTxtEMail = new cHTMLTextbox("email", $recipient->get("email"), 40);
 $oCkbConfirmed = new cHTMLCheckbox("confirmed", "1");
 $oCkbConfirmed->setChecked($recipient->get("confirmed"));
 $oCkbDeactivated = new cHTMLCheckbox("deactivated", "1");
 $oCkbDeactivated->setChecked($recipient->get("deactivated"));
 $oSelNewsType = new cHTMLSelectElement("newstype");
 $oOption = new cHTMLOptionElement(i18n("Text only", $plugin_name), "0");
 $oSelNewsType->addOptionElement(0, $oOption);
 $oOption = new cHTMLOptionElement(i18n("HTML and text", $plugin_name), "1");
 $oSelNewsType->addOptionElement(1, $oOption);
 $oSelNewsType->setDefault($recipient->get("news_type"));
 $oForm->add(i18n("Name", $plugin_name), $oTxtName->render());
 $oForm->add(i18n("E-Mail", $plugin_name), $oTxtEMail->render());
 $oForm->add(i18n("Confirmed", $plugin_name), $oCkbConfirmed->toHTML(false) . " (" . $recipient->get("confirmeddate") . ")");
 $oForm->add(i18n("Deactivated", $plugin_name), $oCkbDeactivated->toHTML(false));
 $oForm->add(i18n("Message type", $plugin_name), $oSelNewsType->render());
 $aPluginOrder = trim_array(explode(",", getSystemProperty("plugin", "recipients-pluginorder")));
 // Check out if there are any plugins
 if (is_array($aPluginOrder)) {
     foreach ($aPluginOrder as $sPlugin) {
         if (function_exists("recipients_" . $sPlugin . "_getTitle") && function_exists("recipients_" . $sPlugin . "_display")) {
             $aPluginTitle = call_user_func("recipients_" . $sPlugin . "_getTitle");
             $aPluginDisplay = call_user_func("recipients_" . $sPlugin . "_display", $recipient);
             if (is_array($aPluginTitle) && is_array($aPluginDisplay)) {
                 foreach ($aPluginTitle as $sKey => $sValue) {
                     $oForm->add($sValue, $aPluginDisplay[$sKey]);
                 }
             } else {
                 if (is_array($aPluginTitle) || is_array($aPluginDisplay)) {
                     $oForm->add(i18n("WARNING", $plugin_name), sprintf(i18n("The plugin %s delivered an array for the displayed titles, but did not return an array for the contents.", $plugin_name), $sPlugin));
                 } else {
    $oPagerLink->setCustom("member_sortby", $_REQUEST["member_sortby"]);
    $oPagerLink->setCustom("member_sortorder", $_REQUEST["member_sortorder"]);
    $oPagerLink->setCustom("member_searchin", $_REQUEST["member_searchin"]);
    $oPagerLink->setCustom("outsider_elemperpage", $_REQUEST["outsider_elemperpage"]);
    $oPagerLink->setCustom("outsider_filter", $_REQUEST["outsider_filter"]);
    $oPagerLink->setCustom("outsider_sortby", $_REQUEST["outsider_sortby"]);
    $oPagerLink->setCustom("outsider_sortorder", $_REQUEST["outsider_sortorder"]);
    $oPagerLink->setCustom("outsider_searchin", $_REQUEST["outsider_searchin"]);
    $oPagerLink->setCustom("idrecipientgroup", $_REQUEST["idrecipientgroup"]);
    $oPagerLink->setCustom("frame", $frame);
    $oPagerLink->setCustom("area", $area);
    #$oPagerLink->enableAutomaticParameterAppend();
    $oPagerLink->setCustom("contenido", $sess->id);
    $oOutsiderPager = new cObjectPager("4d3a7330-52eb-11db-b0de-0800200c9a66", $iOutsiders, $_REQUEST["outsider_elemperpage"], $_REQUEST["outsider_page"], $oPagerLink, "outsider_page");
    $oOutsiderPager->setCaption(i18n("Outsider navigation", $plugin_name));
    $oForm->add(i18n("Add recipients", $plugin_name), '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . $oOutsiderListOptionRow->render() . $oOutsiderPager->render() . '<tr><td>' . $oSelUser->render() . '<br />' . i18n("Note: Hold &lt;Ctrl&gt; to<br>select multiple items.", $plugin_name) . '</td></tr></table>');
    unset($oOutsiders);
    unset($oOutsiderListOptionRow);
    unset($oOutsiderPager);
    $sDelMarkScript = '    <script type="text/javascript">
        /* Function to select all ckbDel boxes */
        function fncCheckDel(elementname) {
			var aBoxes = document.getElementsByName(elementname);

            if (aBoxes.length > 0) {
                for (var i = 0; i < aBoxes.length; i++) {
                    if (aBoxes[i].checked) {
                       aBoxes[i].checked = false;
                    } else {
                       aBoxes[i].checked = true;
                    }
 $oFrmOptions->setVar("sortmode", $_REQUEST["sortmode"]);
 $oFrmOptions->setVar("sortby", $_REQUEST["sortby"]);
 $oFrmOptions->setVar("idnewsjob", $_REQUEST["idnewsjob"]);
 //$oFrmOptions->setVar("startpage", $startpage);
 //$oFrmOptions->setVar("appendparameters", $appendparameters);
 $oFrmOptions->addHeader(i18n("List options", $plugin_name));
 $oSelElements = new cHTMLSelectElement("elemperpage");
 $oSelElements->setEvent("onchange", "document.forms.frmOptions.submit();");
 $aData = array("0" => i18n("-All-", $plugin_name), "50" => "50", "100" => "100", "250" => "250", "500" => "500");
 foreach ($aData as $sKey => $sValue) {
     $oOption = new cHTMLOptionElement($sValue, $sKey);
     $oSelElements->addOptionElement($sKey, $oOption);
 }
 $oSelElements->setDefault($_REQUEST["elemperpage"]);
 //$oSelElements->setStyle('border:1px;border-style:solid;border-color:black;');
 $oFrmOptions->add(i18n("Items per page:", $plugin_name), $oSelElements->render());
 // Ouput data
 $oList = new cScrollList(true, "news_job_details");
 $oList->setCustom("idnewsjob", $_REQUEST["idnewsjob"]);
 $oList->setCustom("nextpage", $iNextPage);
 $oList->setCustom("elemperpage", $_REQUEST["elemperpage"]);
 $aCols = array("rcpname", "rcpemail", "", "status", "sent");
 $oList->setHeader(i18n("Recipient", $plugin_name), i18n("E-Mail", $plugin_name), i18n("Type", $plugin_name), i18n("Status", $plugin_name), i18n("Sent", $plugin_name), i18n("Actions", $plugin_name));
 $oList->setSortable(0, true);
 $oList->setSortable(1, true);
 $oList->setSortable(2, false);
 $oList->setSortable(3, true);
 $oList->setSortable(4, true);
 // Get data
 $oLogs->resetQuery();
 $oLogs->setWhere("idnewsjob", $_REQUEST["idnewsjob"]);
        $iTplIDArt = $oNewsletter->get("template_idart");
        $oSelTemplate = new cHTMLSelectElement("selTemplate");
        $oSelTemplate->setEvent("change", "askSubmitOnTplChange(this);");
        $aOptions = array("idcat" => $oClientLang->getProperty("newsletter", "html_template_idcat"), "start" => true, "offline" => true, "order" => "title");
        $oTemplateArticles = new ArticleCollection($aOptions);
        $aItems = array();
        $aItems[] = array(0, i18n("-- none --", $plugin_name));
        while ($oArticle = $oTemplateArticles->nextArticle()) {
            $aItems[] = array($oArticle->get("idart"), $oArticle->get("title"));
        }
        $oSelTemplate->autoFill($aItems);
        $oSelTemplate->setDefault($iTplIDArt);
        unset($aItems);
        unset($oArticles);
        unset($oTemplateArticles);
        $oForm->add(i18n("HTML Template", $plugin_name), $oSelTemplate->render() . "&nbsp;" . i18n("Note, that changing the template discards the current html message content", $plugin_name));
        if ($iTplIDArt != 0) {
            $sFrameSrc = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changeview=edit&action=con_editart&idart=" . $oNewsletter->get("idart") . "&idcat=" . $oClientLang->getProperty("newsletter", "html_newsletter_idcat") . "&lang=" . $lang . "&contenido=" . $sess->id;
            $oForm->add(i18n("HTML Message", $plugin_name), '<iframe width="100%" height="600" src="' . $sFrameSrc . '"></iframe><br />' . $sTagInfoHTML);
        } else {
            // Add a real note, that a template has to be specified
            $notis .= $notification->returnNotification("warning", i18n("Newsletter type has been set to HTML/text, please remember to select an html template", $plugin_name)) . "<br />";
            $oForm->add(i18n("HTML Message", $plugin_name), i18n("Please choose a template first", $plugin_name));
        }
    }
    $oTxtMessage = new cHTMLTextarea("txtMessage", $oNewsletter->get("message"), 80, 20);
    $oForm->add(i18n("Text Message", $plugin_name), $oTxtMessage->render() . "<br />" . $sTagInfoText);
    $sExecScript = '
	<script type="text/javascript">
		// Enabled/Disable group box
		function fncShowHide(strItemID) {
function prepareWorkflowItems()
{
    global $action, $lang, $modidcat, $workflowSelectBox, $workflowworkflows, $client, $tpl, $cfg;
    $workflowworkflows = new Workflows();
    if ($action === 'workflow_inherit_down') {
        $tmp = strDeeperCategoriesArray($modidcat);
        $asworkflow = getWorkflowForCat($modidcat);
        $wfa = new WorkflowAllocations();
        foreach ($tmp as $tmp_cat) {
            $idcatlang = getCatLang($tmp_cat, $lang);
            if ($asworkflow == 0) {
                $wfa->select("idcatlang = '{$idcatlang}'");
                if ($item = $wfa->next()) {
                    $wfa->delete($item->get("idallocation"));
                    # delete user sequences for listing in tasklist for each included article
                    $oArticles = new ArticleCollection(array('idcat' => $idcatlang, 'start' => true, 'offline' => true));
                    while ($oArticle = $oArticles->nextArticle()) {
                        setUserSequence($oArticle->getField('idartlang'), -1);
                    }
                }
            } else {
                $wfa->select("idcatlang = '{$idcatlang}'");
                if ($item = $wfa->next()) {
                    $item->setWorkflow($asworkflow);
                    $item->store();
                } else {
                    $wfa->create($asworkflow, $idcatlang);
                    # generate user sequences for listing in tasklist for each included article
                    $oArticles = new ArticleCollection(array('idcat' => $tmp_cat, 'start' => true, 'offline' => true));
                    while ($oArticle = $oArticles->nextArticle()) {
                        setUserSequence($oArticle->getField('idartlang'), $asworkflow);
                    }
                }
            }
        }
    }
    if ($action == "workflow_cat_assign") {
        $seltpl = "wfselect" . $modidcat;
        $wfa = new WorkflowAllocations();
        $idcatlang = getCatLang($modidcat, $lang);
        #associate workflow with category
        if ($GLOBALS[$seltpl] != 0) {
            $wfa->select("idcatlang = '{$idcatlang}'");
            if ($item = $wfa->next()) {
                $item->setWorkflow($GLOBALS[$seltpl]);
                $item->store();
            } else {
                $wfa->create($GLOBALS[$seltpl], $idcatlang);
            }
            # generate user sequences for listing in tasklist for each included article
            $oArticles = new ArticleCollection(array('idcat' => $modidcat, 'start' => true, 'offline' => true));
            while ($oArticle = $oArticles->nextArticle()) {
                setUserSequence($oArticle->getField('idartlang'), $GLOBALS[$seltpl]);
            }
            #unlink workflow with category
        } else {
            $wfa->select("idcatlang = '{$idcatlang}'");
            if ($item = $wfa->next()) {
                $alloc = $item->get("idallocation");
            }
            $wfa->delete($alloc);
            # delete user sequences for listing in tasklist for each included article
            $oArticles = new ArticleCollection(array('idcat' => $modidcat, 'start' => true, 'offline' => true));
            while ($oArticle = $oArticles->nextArticle()) {
                setUserSequence($oArticle->getField('idartlang'), -1);
            }
        }
    }
    $workflowSelectBox = new cHTMLSelectElement("foo");
    $workflowSelectBox->setClass("text_medium");
    $workflowworkflows->select("idclient = '{$client}' AND idlang = '" . Contenido_Security::escapeDB($lang, null) . "'");
    $workflowOption = new cHTMLOptionElement("--- " . i18n("None", "workflow") . " ---", 0);
    $workflowSelectBox->addOptionElement(0, $workflowOption);
    while ($workflow = $workflowworkflows->next()) {
        $workflowOption = new cHTMLOptionElement($workflow->get("name"), $workflow->get("idworkflow"));
        $workflowSelectBox->addOptionElement($workflow->get("idworkflow"), $workflowOption);
    }
    $workflowSelectBox->updateAttributes(array("id" => "wfselect{IDCAT}"));
    $workflowSelectBox->updateAttributes(array("name" => "wfselect{IDCAT}"));
    $tpl->set('s', 'PLUGIN_WORKFLOW', $workflowSelectBox->render() . '<a href="javascript:setWorkflow({IDCAT}, \\\'wfselect{IDCAT}\\\')"><img src="' . $cfg["path"]["images"] . 'submit.gif" class="spaced"></a>');
    $tpl->set('s', 'PLUGIN_WORKFLOW_TRANSLATION', i18n("Inherit workflow down", "workflow"));
}
            $oPage->setReload();
        }
    }
}
$oForm = new UI_Table_Form("properties");
$oForm->setVar("frame", $frame);
$oForm->setVar("area", $area);
$oForm->setVar("action", "recipients_import_exec");
$oForm->addHeader(i18n("Import recipients", $plugin_name));
$oSelDelimiter = new cHTMLSelectElement("selDelimiter");
$aItems = array();
$aItems[] = array("semicolon", i18n("Semicolon", $plugin_name));
$aItems[] = array("tab", i18n("Tab", $plugin_name));
$oSelDelimiter->autoFill($aItems);
$oSelDelimiter->setDefault($_REQUEST["selDelimiter"]);
$oForm->add(i18n("Delimiter", $plugin_name), $oSelDelimiter->render());
$oAreaData = new cHTMLTextarea("txtData", $_REQUEST["txtData"], 80, 20);
$sInfo = '<a href="javascript:fncShowHide(\'idInfoText\');"><strong>' . i18n("Import information", $plugin_name) . '</strong></a>' . '<div id="idInfoText" style="display: none">' . '<br /><br /><strong>' . i18n("Specify colum types:", $plugin_name) . '</strong>' . i18n("<br />The first line must contain the column names; this specifies the column order.<br />&lt;column name&gt;[delimiter]&lt;column name&gt;...", $plugin_name) . '<br /><br /><strong>' . i18n("Data structure:", $plugin_name) . '</strong><br />' . i18n("The recipients have to be entered using the following format:<br />&lt;data&gt;[Delimiter]&lt;data&gt;... - each recipient in a new line.", $plugin_name) . '<br /><br /><strong>' . i18n("Example:", $plugin_name) . '</strong>' . i18n("<br />name;mail;confirmed<br />Smith;jon.smith@example.org;1", $plugin_name) . '<br /><br /><strong>' . i18n("The following column names will be recognized:", $plugin_name) . '</strong><br />' . implode("<br />\n", $aFields) . '</div>';
$oForm->add(i18n("Recipients", $plugin_name), $oAreaData->render() . "<br />" . $sInfo);
unset($sInfo);
$sExecScript = '
<script type="text/javascript">
    /* Enabled/Disable group box */
    function fncShowHide(strItemID) {
        objItem = document.getElementById(strItemID);

        if (objItem.style.display == "none") {
           objItem.style.display = "inline";
        } else {
           objItem.style.display = "none";
        }