$oSelItemsPerPage = new cHTMLSelectElement("elemperpage"); $oSelItemsPerPage->autoFill(array(0 => i18n("-- All --", $plugin_name), 25 => 25, 50 => 50, 75 => 75, 100 => 100)); $oSelItemsPerPage->setDefault($iItemsPerPage); $oSelSortBy = new cHTMLSelectElement("sortby"); foreach ($aFields as $sKey => $aData) { if (strpos($aData["type"], "sort") !== false) { $oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]); $oSelSortBy->addOptionElement($aData["field"], $oOption); } } $oSelSortBy->setDefault("name"); $oSelSortOrder = new cHTMLSelectElement("sortorder"); $oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", $plugin_name), "DESC" => i18n("Descending", $plugin_name))); $oSelSortOrder->setDefault("ASC"); $oTxtFilter = new cHTMLTextbox("filter", "", 16); $oSelSearchIn = new cHTMLSelectElement("searchin"); $oOption = new cHTMLOptionElement(i18n("-- All fields --", $plugin_name), "--all--"); $oSelSearchIn->addOptionElement("all", $oOption); foreach ($aFields as $sKey => $aData) { if (strpos($aData["type"], "search") !== false) { $oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]); $oSelSearchIn->addOptionElement($aData["field"], $oOption); } } $oSelSearchIn->setDefault("--all--"); $oBtnApply = new cHTMLButton("submit", i18n("Apply", $plugin_name)); $sContent = '<div style="border-bottom: 0px solid #B3B3B3; padding-left: 17px; background: ' . $cfg['color']['table_dark'] . ';">' . "\n"; $sContent .= '<form target="left_bottom" onsubmit="reloadLeftBottomAndTransportFormVars(this);" id="groups_listoptionsform" name="groups_listoptionsform" method="get" action="">' . "\n"; $sContent .= ' <input type="hidden" name="area" value="recipientgroups">' . "\n"; $sContent .= ' <input type="hidden" name="frame" value="2">' . "\n"; $sContent .= ' <input type="hidden" name="contenido" value="' . $sess->id . '">' . "\n";
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"); $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")) {
if ($_REQUEST["outsider_sortby"] == "name") { // Name field may be empty, add email as sort criteria $sSQLSort .= ", email " . $_REQUEST["outsider_sortorder"]; } $sSQL .= $sSQLSort . $sSQLLimit; $oOutsiders->flexSelect("", "", $sSQL, ""); $aItems = array(); while ($oRecipient = $oOutsiders->next()) { $sName = $oRecipient->get("name"); $sEMail = $oRecipient->get("email"); if (empty($sName)) { $sName = $sEMail; } $aItems[] = array($oRecipient->get("idnewsrcp"), $sName . " (" . $sEMail . ")"); } $oSelUser = new cHTMLSelectElement("adduser[]"); $oSelUser->setSize(25); $oSelUser->setStyle("width: 100%;"); $oSelUser->setMultiSelect(); $oSelUser->autoFill($aItems); // Outsider list pager (-> below data, as iOutsiders is needed) $oPagerLink = new cHTMLLink(); $oPagerLink->setLink("main.php"); $oPagerLink->setCustom("member_elemperpage", $_REQUEST["member_elemperpage"]); $oPagerLink->setCustom("member_filter", $_REQUEST["member_filter"]); $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"]);
if ($_REQUEST["elemperpage"] > 0) { // - All - will not be saved $oUser->setProperty("itemsperpage", $area . "_job_details", $_REQUEST["elemperpage"]); } $oFrmOptions = new UI_Table_Form("frmOptions"); $oFrmOptions->setVar("contenido", $sess->id); $oFrmOptions->setVar("area", $area); $oFrmOptions->setVar("action", $action); $oFrmOptions->setVar("frame", $frame); $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");
$sTagInfoHTML .= '[mail name="' . strtolower($sPluginVar) . '" type="text"][/mail]<br />'; } } } } } else { setSystemProperty("newsletter", "newsletter-recipients-plugin", "false"); // -> Property available in system settings } $sTagInfoText .= "</div>"; $sTagInfoHTML .= "</div>"; $iTplIDArt = 0; // Used later for on change event if ($oNewsletter->get("type") == "html") { $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() . " " . i18n("Note, that changing the template discards the current html message content", $plugin_name)); if ($iTplIDArt != 0) {
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")); }
} 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 /><column name>[delimiter]<column name>...", $plugin_name) . '<br /><br /><strong>' . i18n("Data structure:", $plugin_name) . '</strong><br />' . i18n("The recipients have to be entered using the following format:<br /><data>[Delimiter]<data>... - 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);