Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites
View Statistics - Next Notice - Previous NoticeDirectory filter : [ all ] / postnuke_modules / articles [ view in CVS ]
Date | Directory [filter] | File(s) [view] | Author [filter] |
02 Aug 2002 00:08:25 | postnuke_modules/articles | pnuser.php,1.38,1.39 pnuserapi.php,1.31,1.32 | Mike |
allow filtering on both pubtype & category (part 2) |
Update of /home/cvsroot/postnuke_modules/articles In directory ns7.hostnuke.net:/tmp/cvs-serv16684 Modified Files: pnuser.php pnuserapi.php Log Message: allow filtering on both pubtype & category (part 2) Index: pnuser.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/articles/pnuser.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** pnuser.php 31 Jul 2002 18:18:11 -0000 1.38 --- pnuser.php 2 Aug 2002 00:08:22 -0000 1.39 *************** *** 144,147 **** --- 144,154 ---- // TODO: make this dependent on publication type too ? + $output->Text('[ '); + $output->URL(pnModURL('articles', + 'user', + 'view', + array('ptid' => $ptid)), + pnVarPrepForDisplay(pnML('all'))); + $output->Text(' ] '); // display one (or more) bread-crumb trails of categories *************** *** 161,165 **** 'user', 'view', ! array('cids' => array($info['cid']))), pnVarPrepForDisplay(pnVarCensor($info['name']))); $output->Text(" - "); --- 168,173 ---- 'user', 'view', ! array('cids' => array($info['cid']), ! 'ptid' => $ptid)), pnVarPrepForDisplay(pnVarCensor($info['name']))); $output->Text(" - "); *************** *** 357,360 **** --- 365,370 ---- } + $ptid = $article['pubtypeid']; + // TODO: add a function to userapi to get the list of all categories (with // their name and description) for this article at once *************** *** 385,389 **** 'user', 'view', ! array('cids' => array($info['cid']))); $item['ptitle'] = pnVarPrepForDisplay(pnVarCensor($info['name'])); if ($info['cid'] != $cid) { --- 395,400 ---- 'user', 'view', ! array('cids' => array($info['cid']), ! 'ptid' => $ptid)); $item['ptitle'] = pnVarPrepForDisplay(pnVarCensor($info['name'])); if ($info['cid'] != $cid) { *************** *** 397,401 **** $icons .= '<a href="' . pnModURL('articles','user','view', ! array('cids' => array($info['cid']))) . '"><img src="' . $info['image'] . '" border="0" ' . 'alt="' . --- 408,413 ---- $icons .= '<a href="' . pnModURL('articles','user','view', ! array('cids' => array($info['cid']), ! 'ptid' => $ptid)) . '"><img src="' . $info['image'] . '" border="0" ' . 'alt="' . *************** *** 440,444 **** 'display', array('aid' => $aid, ! 'ptid' => $article['pubtypeid']))); // Template depending on publication type --- 452,456 ---- 'display', array('aid' => $aid, ! 'ptid' => $ptid))); // Template depending on publication type *************** *** 644,647 **** --- 656,661 ---- } + // TODO: improve this nightmarish (but working) code + // get the links and counts for all publication types $publinks = pnModAPIFunc('articles','user','getpublinks', *************** *** 701,707 **** --- 715,730 ---- $cattree[$cid] = $list; } + // for all publication types for ($i=0;$i<count($publinks);$i++) { $publinks[$i]['cats'] = array(); + // for each root category of this publication type foreach ($publinks[$i]['rootcats'] as $cid) { + // update the links in the category tree to include both cid & ptid + for ($j=0;$j<count($cattree[$cid]);$j++) { + $cattree[$cid][$j]['link'] = pnModURL('articles','user','view', + array('ptid' => $publinks[$i]['pubid'], + 'cids' => array($cattree[$cid][$j]['id']))); + } + // and add the category tree to the categories to show $item['item'] = $cattree[$cid]; $publinks[$i]['cats'][] = $item; Index: pnuserapi.php =================================================================== RCS file: /home/cvsroot/postnuke_modules/articles/pnuserapi.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** pnuserapi.php 1 Aug 2002 01:38:50 -0000 1.31 --- pnuserapi.php 2 Aug 2002 00:08:22 -0000 1.32 *************** *** 222,226 **** } // check security ! if (pnSecAuthAction(0, 'articles::item', "$item[title]::$item[aid]", ACCESS_READ)) { $articles[] = $item; } --- 222,226 ---- } // check security ! if (pnSecAuthAction(0, 'articles::item', "$item[title]::$item[aid]", ACCESS_OVERVIEW)) { $articles[] = $item; } *************** *** 317,321 **** // Security check ! if (!pnSecAuthAction(0, 'articles::Item', "$title::$aid", ACCESS_READ)) { return false; } --- 317,321 ---- // Security check ! if (!pnSecAuthAction(0, 'articles::item', "$title::$aid", ACCESS_READ)) { return false; } *************** *** 849,865 **** // specify some short URLs relevant to your module if ($func == 'main') { ! $path = '/' . $module . '/news/index.html'; } elseif ($func == 'view') { ! if (isset($cids) && is_array($cids)) { if (count($cids) == 1) { ! $path = '/' . $module . '/category' . $cids[0] . '.html'; } else { // this is *not* supported for short URLs -> do nothing // (e.g. for multiple category selections) } ! } elseif (isset($ptid) && isset($pubtypes[$ptid])) { ! $path = '/' . $module . '/' . $pubtypes[$ptid]['name'] . '/index.html'; ! } else { ! $path = '/' . $module . '/index.html'; } } elseif ($func == 'display' && isset($aid)) { --- 849,899 ---- // specify some short URLs relevant to your module if ($func == 'main') { ! $path = '/' . $module . '/news/'; } elseif ($func == 'view') { ! if (isset($ptid) && isset($pubtypes[$ptid])) { ! $path = '/' . $module . '/' . $pubtypes[$ptid]['name'] . '/'; ! } ! if (isset($cids) && is_array($cids) && count($cids) > 0) { if (count($cids) == 1) { ! if (isset($ptid) && isset($pubtypes[$ptid])) { ! if (isset($bycat)) { ! $path = '/' . $module . '/c' . $cids[0] ! . '/' . $pubtypes[$ptid]['name'] . '/'; ! } else { ! $path = '/' . $module . '/' . $pubtypes[$ptid]['name'] ! . '/c' . $cids[0] . '/'; ! } ! } else { ! $path = '/' . $module . '/c' . $cids[0] . '/'; ! } ! /* perhaps someday, with a convertor to 7-bit ASCII or something... ! // use a cache to avoid re-querying for each URL in the same cat ! static $catcache = array(); ! $cid = $cids[0]; ! if (pnModAPILoad('categories','user')) { ! if (isset($catcache[$cid])) { ! $cat = $catcache[$cid]; ! } else { ! $cat = pnModAPIFunc('categories','user','getcatinfo', ! array('cid' => $cid)); ! // put the category in cache ! $catcache[$cid] = $cat; ! } ! if (!empty($cat) && !empty($cat['name'])) { ! // use the category name as part of the path here ! $name = preg_replace('/\s+/','_',$cat['name']); ! $name = strtolower($name); ! $path = '/' . $module . '/c/' . rawurlencode($name) .'/'; ! } ! } ! */ ! } else { // this is *not* supported for short URLs -> do nothing // (e.g. for multiple category selections) + $path = ''; } ! } elseif (empty($path)) { ! $path = '/' . $module . '/'; } } elseif ($func == 'display' && isset($aid)) { *************** *** 882,888 **** } elseif ($func == 'archive') { if (isset($month)) { ! $path = '/' . $module . '/archive/' . $month . '.html'; } else { ! $path = '/' . $module . '/archive/index.html'; } } elseif ($func == 'viewmap') { --- 916,927 ---- } elseif ($func == 'archive') { if (isset($month)) { ! if ($month == 'all') { ! $path = '/' . $module . '/archive/' . $month .'/'; ! } else { ! list($year,$mon) = split('-',$month); ! $path = '/' . $module . '/archive/' . $year .'/'. $mon . '/'; ! } } else { ! $path = '/' . $module . '/archive/'; } } elseif ($func == 'viewmap') { *************** *** 915,935 **** if (empty($params[1])) { return array('main', $args); ! } elseif ($params[1] == 'index.html') { return array('main', $args); ! } elseif ($params[1] == 'map.html') { return array('viewmap', $args); } elseif (preg_match('/^(\d+)/',$params[1],$matches)) { $aid = $matches[1]; $args['aid'] = $aid; return array('display', $args); ! } elseif (preg_match('/^category(\d+)/',$params[1],$matches)) { ! $cids[0] = $matches[1]; ! $args['cids'] = $cids; ! return array('view', $args); } elseif ($params[1] == 'archive') { ! if (!empty($params[2]) && preg_match('/^(\d{4}-\d+|all)/',$params[2],$matches)) { $args['month'] = $matches[1]; } return array('archive', $args); } else { $pubtypes = pnModAPIFunc('articles','user','getpubtypes'); --- 954,996 ---- if (empty($params[1])) { return array('main', $args); ! ! } elseif (preg_match('/^index\.htm/i',$params[1])) { return array('main', $args); ! ! } elseif (preg_match('/^map\.htm/i',$params[1])) { return array('viewmap', $args); + } elseif (preg_match('/^(\d+)/',$params[1],$matches)) { $aid = $matches[1]; $args['aid'] = $aid; return array('display', $args); ! } elseif ($params[1] == 'archive') { ! if (!empty($params[2]) && preg_match('/^(\d{4}|all)/',$params[2],$matches)) { $args['month'] = $matches[1]; + if ($args['month'] != 'all' && !empty($params[3]) && is_numeric($params[3])) { + $args['month'] .= '-' . $params[3]; + } } return array('archive', $args); + + } elseif (preg_match('/^c(\d+)/',$params[1],$matches)) { + $cids[0] = $matches[1]; + $args['cids'] = $cids; + if (!empty($params[2])) { + $pubtypes = pnModAPIFunc('articles','user','getpubtypes'); + foreach ($pubtypes as $id => $pubtype) { + if ($params[1] == $pubtype['name']) { + $args['ptid'] = $id; + $args['bycat'] = 1; + break; + } + } + } + return array('view', $args); + + } elseif ($params[1] == 'c') { + // perhaps someday... + } else { $pubtypes = pnModAPIFunc('articles','user','getpubtypes'); *************** *** 942,945 **** --- 1003,1010 ---- $args['aid'] = $aid; return array('display', $args); + } elseif (preg_match('/^c(\d+)/',$params[2],$matches)) { + $cids[0] = $matches[1]; + $args['cids'] = $cids; + return array('view', $args); } elseif ($params[2] == 'archive') { return array('archive', $args);
View Statistics - Next Notice - Previous Notice
Visit Developer Site - Browse CVS Repository |
Syndicate via backend.rss (max. once per hour please) | Powered by CVSNotice 0.1.3 |