}
 unset($oUser);
 if (!isset($_REQUEST["member_page"]) || !is_numeric($_REQUEST["member_page"]) || $_REQUEST["member_page"] <= 0 || $_REQUEST["member_elemperpage"] == 0) {
     $_REQUEST["member_page"] = 1;
 }
 if ($_REQUEST["member_sortorder"] != "DESC") {
     $_REQUEST["member_sortorder"] = "ASC";
 }
 if (!isset($_REQUEST["outsider_page"]) || !is_numeric($_REQUEST["outsider_page"]) || $_REQUEST["outsider_page"] <= 0 || $_REQUEST["outsider_elemperpage"] == 0) {
     $_REQUEST["outsider_page"] = 1;
 }
 if ($_REQUEST["outsider_sortorder"] != "DESC") {
     $_REQUEST["outsider_sortorder"] = "ASC";
 }
 // Output form
 $oForm = new UI_Table_Form("properties", "main.php?1", "get");
 // Use "get" for folding rows...
 $oForm->setVar("frame", $frame);
 $oForm->setVar("area", $area);
 $oForm->setVar("action", "recipientgroup_save_group");
 $oForm->setVar("idrecipientgroup", $_REQUEST["idrecipientgroup"]);
 $oForm->setSubmitJS("append_registered_parameters(this);");
 $oForm->addHeader(i18n("Edit group", $plugin_name));
 $oTxtGroupName = new cHTMLTextbox("groupname", $oRGroup->get("groupname"), 40);
 $oForm->add(i18n("Group name", $plugin_name), $oTxtGroupName->render());
 $oCkbDefault = new cHTMLCheckbox("defaultgroup", "1");
 $oCkbDefault->setChecked($oRGroup->get("defaultgroup"));
 $oForm->add(i18n("Default group", $plugin_name), $oCkbDefault->toHTML(false));
 // Member list options folding row
 $oMemberListOptionRow = new cFoldingRow("a91f5540-52db-11db-b0de-0800200c9a66", i18n("Member list options", $plugin_name));
 $oSelItemsPerPage = new cHTMLSelectElement("member_elemperpage");
     }
     $recipient->store();
     // Remove group associations
     if (isset($_REQUEST["ckbRemove"])) {
         $oGroupMembers = new RecipientGroupMemberCollection();
         foreach ($_REQUEST["ckbRemove"] as $iGroupMemberID) {
             if (is_numeric($iGroupMemberID)) {
                 $oGroupMembers->delete($iGroupMemberID);
             }
         }
     }
 }
 if (count($aMessages) > 0) {
     $sNotis = $notification->returnNotification("warning", implode("<br>", $aMessages)) . "<br>";
 }
 $oForm = new UI_Table_Form("properties");
 $oForm->setVar("frame", $frame);
 $oForm->setVar("area", $area);
 $oForm->setVar("action", "recipients_save");
 $oForm->setVar("idrecipient", $recipient->get("idnewsrcp"));
 $oForm->addHeader(i18n("Edit recipient", $plugin_name));
 $oTxtName = new cHTMLTextbox("name", $recipient->get("name"), 40);
 $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");
            // we need the sortmode in the header link
            $oList->sort($_REQUEST["sortby"], $_REQUEST["sortmode"]);
            // HerrB: Hardcore UI for browsing elements ... sorry
            $sBrowseHTML = '<table width="100%" cellspacing="0" cellpadding="2" border="0">
    <tr>
        <td><img src="images/spacer.gif" width="1" height="10"></td>
    </tr>
	<tr class="text_medium" style="background-color: #ffffff;">
        <td style="border: 1px; border-color: #B3B3B3; border-style: solid; background-color: #E2E2E2; color:#666666"> ' . sprintf(i18n("Go to page: %s", $plugin_name), $sBrowseLinks) . '</td>
    </tr>
</table>';
            $oPage->setContent($oFrmOptions->render() . "<br />" . $oList->render() . $sBrowseHTML);
        } else {
            // Just show the job data
            $oJob = new cNewsletterJob($_REQUEST["idnewsjob"]);
            $oForm = new UI_Table_Form("properties");
            $oForm->setVar("frame", $frame);
            $oForm->setVar("area", $area);
            $oForm->setVar("action", "");
            $oForm->setVar("idnewsjob", $idnewsjob);
            $oForm->addHeader(i18n("Newsletter Dispatch Job", $plugin_name));
            $oForm->add(i18n("Name", $plugin_name), $oJob->get("name"));
            $sDateFormat = getEffectiveSetting("backend", "timeformat", "d.m.Y H:i");
            switch ($oJob->get("status")) {
                case 1:
                    $oForm->add(i18n("Status", $plugin_name), i18n("Pending", $plugin_name));
                    break;
                case 2:
                    $oForm->add(i18n("Status", $plugin_name), sprintf(i18n("Sending (started: %s)", $plugin_name), date($sDateFormat, strtotime($oJob->get("started")))));
                    break;
                case 9:
function editWorkflowStep($idworkflowitem)
{
    global $area, $idworkflow, $idworkflowitem, $frame, $availableWorkflowActions;
    global $notification;
    $workflowitem = new WorkflowItem();
    if ($workflowitem->loadByPrimaryKey($idworkflowitem) == false) {
        return "&nbsp;";
    }
    $workflowactions = new WorkflowActions();
    $stepname = $workflowitem->get("name");
    $stepdescription = $workflowitem->get("description");
    $id = $workflowitem->get("idworkflowitem");
    $task = $workflowitem->get("idtask");
    $form = new UI_Table_Form("workflow_edit");
    $form->setVar("area", $area);
    $form->setVar("action", "workflow_save_step");
    $form->setVar("idworkflow", $idworkflow);
    $form->setVar("idworkflowitem", $idworkflowitem);
    $form->setVar("frame", $frame);
    $form->addHeader(i18n("Edit workflow step", "workflow"));
    $form->add(i18n("Step name", "workflow"), formGenerateField("text", "wfstepname", $stepname, 40, 255));
    $form->add(i18n("Step description", "workflow"), formGenerateField("textbox", "wfstepdescription", $stepdescription, 60, 10));
    foreach ($availableWorkflowActions as $key => $value) {
        $actions .= formGenerateCheckbox("wfactions[" . $key . "]", "1", $workflowactions->get($id, $key)) . '<label for="wfactions[' . $key . ']1">' . $value . '</label>' . "<br>";
    }
    $form->add(i18n("Actions", "workflow"), $actions);
    $form->add(i18n("Assigned users", "workflow"), getWorkflowUsers($idworkflowitem));
    return $form->render(true);
}
 * @license    http://www.contenido.org/license/LIZENZ.txt
 * @link       http://www.4fb.de
 * @link       http://www.contenido.org
 * 
 * {@internal 
 *   created 2003-05-20
 *   
 *   $Id$
 * }}
 * 
 */
if (!defined('CON_FRAMEWORK')) {
    die('Illegal call');
}
plugin_include('workflow', 'classes/class.workflow.php');
$form = new UI_Table_Form("workflow_edit");
$userclass = new User();
$workflows = new Workflows();
$workflow = $workflows->loadItem($idworkflow);
if ($action == "workflow_save") {
    if ($idworkflow == "-1") {
        $workflow = $workflows->create();
    }
    $workflow->set("name", htmlspecialchars($wfname));
    $workflow->set("description", htmlspecialchars($wfdescription));
    $idworkflow = $workflow->get("idworkflow");
    $workflow->store();
}
if ((int) $idworkflow == 0) {
    $idworkflow = $_GET['idworkflow'];
}
         } else {
             $oArticles->resetQuery();
             $oArticles->setWhere("idlang", $lang);
             $oArticles->setWhere("idart", $oNewsletter->get("template_idart"));
             $oArticles->query();
             if ($oArticles->count() == 0) {
                 // Ups, template has been deleted: Restore from current newsletter message article
                 $notis = $notification->returnNotification("warning", i18n("The html newsletter template article has been deleted, it has been restored using the html message article of this newsletter", $plugin_name)) . "<br>";
                 $iIDArt = conCopyArticle($oNewsletter->get("idart"), $oClientLang->getProperty("newsletter", "html_template_idcat"), sprintf(i18n("%s (Template restored)", $plugin_name), $oNewsletter->get("name")));
                 $oNewsletter->set("template_idart", $iIDArt);
                 $oNewsletter->store();
             }
         }
     }
 }
 $oForm = new UI_Table_Form("frmNewsletterMsg");
 $oForm->setVar("frame", $frame);
 $oForm->setVar("area", $area);
 $oForm->setVar("action", "news_save");
 $oForm->setVar("idnewsletter", $idnewsletter);
 $oForm->setWidth("100%");
 $oForm->addHeader(sprintf(i18n("Edit newsletter message (%s)", $plugin_name), $oNewsletter->get("name")));
 $oForm->add(i18n("Subject", $plugin_name), $oNewsletter->get("subject"));
 $sTagInfoText = '<a href="javascript:fncShowHide(\'idTagInfoText\');"><strong>' . i18n("Tag information", $plugin_name) . '</strong></a>' . '<div id="idTagInfoText" style="display: none"><br /><b>' . i18n("Special message tags (will be replaced when sending)", $plugin_name) . ':</b><br>' . 'MAIL_NAME: ' . i18n("Name of the recipient", $plugin_name) . '<br />' . 'MAIL_DATE: ' . i18n("Date, when the mail has been sent", $plugin_name) . '<br />' . 'MAIL_TIME: ' . i18n("Time, when the mail has been sent", $plugin_name) . '<br />' . 'MAIL_NUMBER: ' . i18n("Number of recipients", $plugin_name) . '<br />' . 'MAIL_UNSUBSCRIBE: ' . i18n("Link to unsubscribe", $plugin_name) . '<br />' . 'MAIL_STOP: ' . i18n("Link to pause the subscription", $plugin_name) . '<br />' . 'MAIL_GOON: ' . i18n("Link to resume the subscription", $plugin_name);
 $sTagInfoHTML = '<a href="javascript:fncShowHide(\'idTagInfoHTML\');"><strong>' . i18n("Tag information", $plugin_name) . '</strong></a>' . '<div id="idTagInfoHTML" style="display: none"><br /><b>' . i18n("Special message tags (will be replaced when sending, {..} = optional)", $plugin_name) . ":</b><br />" . '[mail name="name" type="text"]{text}MAIL_NAME{text}[/mail]: ' . i18n("Name of the recipient", $plugin_name) . "<br />" . '[mail name="date" type="text"]{text}MAIL_DATE{text}[/mail]: ' . i18n("Date, when the mail has been sent", $plugin_name) . "<br />" . '[mail name="time" type="text"]{text}MAIL_TIME{text}[/mail]: ' . i18n("Time, when the mail has been sent", $plugin_name) . "<br />" . '[mail name="number" type="text"]{text}MAIL_NUMBER{text}[/mail]: ' . i18n("Number of recipients", $plugin_name) . "<br />" . '[mail name="unsubscribe" type="link" {text="' . i18n("Link text", $plugin_name) . '" }]{text}MAIL_UNSUBSCRIBE{text}[/mail]: ' . i18n("Link to unsubscribe", $plugin_name) . "<br />" . '[mail name="stop" type="link" {text="' . i18n("Link text", $plugin_name) . '" }]{text}MAIL_STOP{text}[/mail]: ' . i18n("Link to pause the subscription", $plugin_name) . "<br />" . '[mail name="goon" type="link" {text="' . i18n("Link text", $plugin_name) . '" }]{text}MAIL_GOON{text}[/mail]: ' . i18n("Link to resume the subscription", $plugin_name);
 // Mention plugin interface
 if (getSystemProperty("newsletter", "newsletter-recipients-plugin") == "true") {
     $sTagInfoText .= "<br /><br /><strong>" . i18n("Additional message tags from recipients plugins:", $plugin_name) . "</strong><br />";
     $sTagInfoHTML .= "<br /><br /><strong>" . i18n("Additional message tags from recipients plugins:", $plugin_name) . "</strong><br />";
     if (is_array($cfg['plugins']['recipients'])) {
         foreach ($cfg['plugins']['recipients'] as $plugin) {
                }
            }
        }
        if (count($aInvalidLines) > 1) {
            $_REQUEST["txtData"] = implode("\n", $aInvalidLines);
        }
        if (count($aMessage) > 0) {
            $sMessage = $notification->returnNotification("warning", implode("<br />", $aMessage)) . "<br />";
        }
        $sMessage .= $notification->returnNotification("info", sprintf(i18n("%d recipients added, %d recipients skipped (email already exists) and %d invalid recipients/e-mail adresses ignored. Invalid recipients are shown (if any).", $plugin_name), $iAdded, $iDublettes, $iInvalid));
        if ($iAdded > 0) {
            $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);