/** * This Methode is called on loadtime. * After all variables initiated, it calls the block dependent init methode. * Finaly the css is loaded if exist */ function pmxc_AdmArticle_loadinit() { $this->smf_groups = PortaMx_getUserGroups(); // get all usergroups $this->title_icons = PortaMx_getAllTitleIcons(); // get all title icons $this->custom_css = PortaMx_getCustomCssDefs(); // custom css definitions $this->usedClass = PortaMx_getdefaultClass(false, true); // default class types $this->categories = PortaMx_getCategories(); // exist categories if ($this->cfg['ctype'] == 'php') { addInlineJavascript(str_replace("\n", "\n\t", PortaMx_compressJS(' function php_syntax(elmid) { document.getElementById("check_" + elmid).className = "info_frame"; var result = pmx_setCookie("pmx_php_check", document.getElementById(elmid).value, "php_snytax", false); result = result.replace(/@elm@/g, elmid); document.getElementById("check_" + elmid).innerHTML = result; Show_help("check_" + elmid); var errLine = /(on\\sline\\s)(\\d+)(.*)/; errLine.exec(result); errLine = RegExp.$2; php_showerrline(elmid, errLine); } function php_showerrline(elmid, errLine) { if(errLine != "" && !isNaN(errLine)) { var lines = document.getElementById(elmid).value.split("\\n"); var count = 0; for(var i = 0; i < errLine -1; i++) count += lines[i].length +1; if(document.getElementById(elmid).setSelectionRange) { document.getElementById(elmid).focus(); document.getElementById(elmid).setSelectionRange(count, count+lines[i].length); } else if(document.getElementById(elmid).createTextRange) { range=document.getElementById(elmid).createTextRange(); range.collapse(true); range.moveStart("character", count); range.moveEnd("character", count+lines[i].length); range.select(); } } }'))); } }
/** * This Methode is called on loadtime. * After all variables initiated, it calls the block dependent init methode. * Finaly the css is loaded if exist */ function pmxc_AdmCategories_loadinit() { $this->smf_groups = PortaMx_getUserGroups(); // get all usergroups $this->title_icons = PortaMx_getAllTitleIcons(); // get all title icons $this->custom_css = PortaMx_getCustomCssDefs(); // custom css definitions $this->usedClass = PortaMx_getdefaultClass(false, true); // default class types $this->categories = PortaMx_getCategories(); // exist categories }
/** * AdmBlock_init(). * Setup caching and get categories. */ function pmxc_AdmBlock_init() { $this->can_cached = 1; // enable caching $this->categories = PortaMx_getCategories(); }
/** * Get all Category detais **/ function pmx_getAllCatDetais($allcats, &$detais) { global $txt; foreach ($allcats as $cat) { $detais[$cat['id']] = PortaMx_getCatDetails($cat, PortaMx_getCategories()); if (!empty($cat['childs'])) { pmx_getAllCatDetais($cat['childs'], $detais); } } $detais[0] = array('class' => 'cat_none', 'level' => '0', 'parent' => $txt['pmx_categories_none'], 'name' => $txt['pmx_categories_none']); }
/** * Insert categories **/ function pmx_insert_cat($place, $id, $category) { global $smcFunc, $pmxCacheFunc; // get max catorder $request = $smcFunc['db_query']('', ' SELECT MAX(catorder) FROM {db_prefix}portamx_categories', array()); list($maxorder) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); // category table empty? if (empty($maxorder)) { $category['catorder'] = 1; return $category; } // handle the placement $allcats = PortaMx_getCategories(); if ($category['id'] == $id) { $placeCat = $category; } else { $placeCat = PortaMx_getCatByID($allcats, $id); } // insert before if ($place == 'before') { $category['catorder'] = $placeCat['catorder']; $category['parent'] = $placeCat['parent']; $category['level'] = $placeCat['level']; } elseif ($place == 'after') { $lastFnd = $placeCat; if (($placeCat['level'] < $category['level'] || $placeCat['level'] == 0) && is_array($placeCat['childs'])) { while (is_array($lastFnd['childs']) || !empty($lastFnd['parent'])) { $lastFnd = PortaMx_getCatByOrder($allcats, PortaMx_getNextCat($lastFnd['catorder'])); } } else { $lastFnd['catorder'] = PortaMx_getNextCat($lastFnd['catorder']); } if (empty($lastFnd)) { $category['catorder'] = $maxorder + 1; $category['parent'] = 0; $category['level'] = 0; } else { $category['catorder'] = $lastFnd['catorder']; $category['parent'] = $placeCat['parent']; $category['level'] = $placeCat['level']; } unset($lastFnd); } elseif ($place == 'child') { $category['catorder'] = PortaMx_getNextCat($placeCat['catorder']); $category['parent'] = $placeCat['id']; $category['level'] = $placeCat['level'] + 1; } // shiftup the catorder $smcFunc['db_query']('', ' UPDATE {db_prefix}portamx_categories SET catorder = catorder + 1 WHERE catorder >= {int:corder}', array('corder' => $category['catorder'])); // cleanup.. unset($allcats); unset($placeCat); // clear cache $pmxCacheFunc['clean'](); return $category; }
/** * AdmArticleOverview * Called for each artile. */ function PmxArticleOverview($article, &$cfg_titleicons, &$cfg_smfgroups, $categories) { global $context, $user_info, $txt; if (empty($article['config']['title_align'])) { $article['config']['title_align'] = 'left'; } if (empty($article['config']['title_icon'])) { $article['config']['title_icon'] = 'none.png'; } if (!empty($article['acsgrp'])) { list($grpacs, $denyacs) = Pmx_StrToArray($article['acsgrp'], ',', '='); } else { $grpacs = $denyacs = array(); } // ID row echo ' <div class="pmx_tbl_tr"> <div class="pmx_tbl_tdgrid" id="RowMove-' . $article['id'] . '">'; if (count($context['pmx']['article_rows']) > 1) { echo ' <div class="pmx_clickrow' . (allowPmx('pmx_articles, pmx_admin') ? ' pmx_moveimg" title="' . $txt['pmx_rowmove_updown'] . '" onclick="pmxArtMove(\'' . $article['id'] . '\', \'<b>' . $article['name'] . '</b> - [' . (empty($article['cat']) ? $txt['pmx_default_none'] : $article['cat']) . ']\')"' : '"') . '> <div style="padding-left:20px;margin-top:-2px;width:22px;">' . $article['id'] . '</div> </div>'; } echo ' </div>'; // title row echo ' <div class="pmx_tbl_tdgrid" id="pWind.ypos.' . $article['id'] . '"> <div onclick="pmxSetTitle(\'' . $article['id'] . '\')" title="' . $txt['pmx_click_edit_ttl'] . '" style="cursor:pointer;"> <img id="uTitle.icon.' . $article['id'] . '" style="padding-right:4px;" src="' . $context['pmx_Iconsurl'] . $article['config']['title_icon'] . '" alt="*" title="' . substr($txt['pmx_edit_titleicon'], 0, -1) . '" /> <img id="uTitle.align.' . $article['id'] . '" src="' . $context['pmx_imageurl'] . 'text_align_' . $article['config']['title_align'] . '.gif" alt="*" title="' . $txt['pmx_edit_title_align'] . $txt['pmx_edit_title_align_types'][$article['config']['title_align']] . '" /> <span id="sTitle.text.' . $article['id'] . '.">' . (isset($article['config']['title'][$context['pmx']['currlang']]) ? htmlspecialchars($article['config']['title'][$context['pmx']['currlang']], ENT_QUOTES) : '') . '</span>'; foreach ($context['pmx']['languages'] as $lang => $sel) { echo ' <input id="sTitle.text.' . $lang . '.' . $article['id'] . '." type="hidden" value="' . (isset($article['config']['title'][$lang]) ? htmlspecialchars($article['config']['title'][$lang], ENT_QUOTES) : '') . '" />'; } echo ' <input id="sTitle.icon.' . $article['id'] . '" type="hidden" value="' . $article['config']['title_icon'] . '" /> <input id="sTitle.align.' . $article['id'] . '" type="hidden" value="' . $article['config']['title_align'] . '" /> </div> </div>'; // type row echo ' <div class="pmx_tbl_tdgrid"> <div style="cursor:default;" title="' . $context['pmx']['RegBlocks'][$article['ctype']]['blocktype'] . ' ' . $context['pmx']['RegBlocks'][$article['ctype']]['description'] . '"><img style="padding-right:5px;" src="' . $context['pmx_imageurl'] . 'type_' . $article['ctype'] . '.gif" alt="*" title="' . $article['ctype'] . '" /><span style="cursor:default;">' . $context['pmx']['RegBlocks'][$article['ctype']]['description'] . '</span></div> </div>'; $detais = array(); $cat = !empty($article['catid']) ? $article['catid'] : '0'; pmx_getAllCatDetais(PortaMx_getCategories(), $detais, $txt['pmx_chg_articlcats']); $detais['0'] = array('class' => 'cat_none', 'level' => '0', 'parent' => $txt['pmx_categories_none'], 'name' => $txt['pmx_categories_none']); // category row echo ' <div class="pmx_tbl_tdgrid"> <input id="pWind.catid.' . $article['id'] . '" type="hidden" value="' . $cat . '" /> <div onclick="pmxSetCats(\'' . $article['id'] . '\')" style="cursor:pointer;">'; foreach ($detais as $cid => $catsDetais) { echo ' <div id="pWind.cat.' . $cid . '.' . $article['id'] . '" title="' . $catsDetais['parent'] . $txt['pmx_chg_articlcats'] . '" class="' . $catsDetais['class'] . '" style="display:' . ($cid == $cat ? 'block' : 'none') . ';"> <b>' . $catsDetais['level'] . '</b> <span><span class="cat_names">' . $catsDetais['name'] . '</span></span> </div>'; } echo ' </div> </div>'; // create acs groups for acs Popup if (!empty($article['acsgrp'])) { list($grpacs, $denyacs) = Pmx_StrToArray($article['acsgrp'], ',', '='); } else { $grpacs = $denyacs = array(); } // options row echo ' <div class="pmx_tbl_tdgrid"> <input id="grpAcs.' . $article['id'] . '" type="hidden" value="' . implode(',', $grpacs) . '" /> <input id="denyAcs.' . $article['id'] . '" type="hidden" value="' . implode(',', $denyacs) . '" /> <div id="pmxSetArtDelete.' . $article['id'] . '"><span id="pmxSetArtClone.' . $article['id'] . '"></span> <div id="pWind.grp.' . $article['id'] . '" class="pmx_clickrow' . (!empty($article['acsgrp']) ? ' pmx_access" title="' . $txt['pmx_article_groupaccess'] : '') . '"></div> <div class="pmx_clickrow' . (!empty($article['config']['can_moderate']) ? ' pmx_moderate" title="' . $txt['pmx_article_modaccess'] : '') . '"></div> <div class="pmx_clickrow' . (!empty($article['config']['check_ecl']) ? ' pmx_eclsettings" title="' . $txt['pmx_have_artecl_settings'] : '') . '"></div> <div class="pmx_clickrow' . (!empty($article['config']['cssfile']) ? ' pmx_custcss" title="' . $txt['pmx_article_cssfile'] : '') . '"></div> </div> </div>'; // status row echo ' <div class="pmx_tbl_tdgrid"> <div class="pmx_clickrow' . ($article['approved'] ? ' pmx_approved" title="' . $txt['pmx_article_approved'] : ' pmx_notapproved" title="' . $txt['pmx_article_not_approved']) . (allowPmx('pmx_articles, pmx_admin') ? ' - ' . $txt['pmx_status_change'] . '" onclick="pToggleArtStatus(this,' . $article['id'] . ',\'approved\')' : '" style="cursor:default') . '"></div> <div class="pmx_clickrow' . ($article['active'] ? ' pmx_active" title="' . $txt['pmx_status_activ'] : ' pmx_notactive" title="' . $txt['pmx_status_inactiv']) . ' - ' . $txt['pmx_status_change'] . '" onclick="pToggleArtStatus(this,' . $article['id'] . ',\'active\')"></div> </div>'; // functions row echo ' <div class="pmx_tbl_tdgrid"> <div class="pmx_clickrow pmx_pgedit" title="' . $txt['pmx_edit_article'] . '" onclick="FormFunc(\'edit_article\', \'' . $article['id'] . '\')"></div> <div class="pmx_clickrow pmx_grpacs" title="' . $txt['pmx_chg_articleaccess'] . '" onclick="pmxSetAcs(\'' . $article['id'] . '\')"></div> <div class="pmx_clickrow' . (allowPmx('pmx_admin, pmx_articles') || allowPmx('pmx_create') && $article['owner'] == $user_info['id'] ? ' pmx_pgclone" title="' . $txt['pmx_clone_article'] . '" onclick="pmxSetArtClone(\'' . $article['id'] . '\')"' : '"') . '></div> <div class="pmx_clickrow' . (allowPmx('pmx_admin, pmx_articles') || allowPmx('pmx_create') && $article['owner'] == $user_info['id'] ? ' pmx_pgdelete" title="' . $txt['pmx_delete_article'] . '" onclick="pmxSetArtDelete(\'' . $article['id'] . '\')"' : '"') . '></div> </div> </div>'; }