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] |
| 28 Jul 2002 23:20:35 | postnuke_modules/articles | pnadmin.php,1.20,1.21 pnadminapi.php,1.7,1.8 pnuserapi.php,1.21,1.22 | Mike |
| templated adding & modifying of articles with publication type | |||
Update of /home/cvsroot/postnuke_modules/articles
In directory ns7.hostnuke.net:/tmp/cvs-serv4552
Modified Files:
pnadmin.php pnadminapi.php pnuserapi.php
Log Message:
templated adding & modifying of articles with publication type
Index: pnadmin.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/articles/pnadmin.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** pnadmin.php 28 Jul 2002 20:00:53 -0000 1.20
--- pnadmin.php 28 Jul 2002 23:20:33 -0000 1.21
***************
*** 47,52 ****
function articles_admin_new()
{
! // Create output object
! $output = new pnHTML();
// Security check
--- 47,55 ----
function articles_admin_new()
{
! // Get parameters
! $ptid= pnVarCleanFromInput('ptid');
! if (!isset($ptid)) {
! $ptid = '';
! }
// Security check
***************
*** 56,89 ****
}
! // Add menu to output
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->Text(articles_adminmenu());
! $output->SetInputMode(_PNH_PARSEINPUT);
!
! // Title
! $output->Title(_ADDARTICLE);
!
! $text = "
! // TODO : allow to set publication type (news, section, review etc.)
! // Mike: Is this necessary?
! // What i think is that maybe the difference between news/section�s article/
! // article�s article and review�s article are somewhat too
! ";
! $output->Text($text);
!
! // Start form
! $output->UploadMode();
! $output->FormStart(pnModURL('articles', 'admin', 'create'));
! $output->FormHidden('authid', pnSecGenAuthKey());
!
! $output->TableStart('', array(), 0, '80%');
// category to add the Article
- $row = array();
- $output->SetOutputMode(_PNH_RETURNOUTPUT);
- $row[] = $output->Text(pnVarPrepForDisplay(_ARTICLECAT));
// Get the cids concatenated by semi-colons
! $string = pnModGetVar('articles', 'cids');
if (!isset($string) ||
!($string))
--- 59,73 ----
}
! $item = array();
// category to add the Article
// Get the cids concatenated by semi-colons
! if (!empty($ptid)) {
! $string = pnModGetVar('articles', 'cids.'.$ptid);
! }
! if (empty($string)) {
! $string = pnModGetVar('articles', 'cids');
! }
if (!isset($string) ||
!($string))
***************
*** 119,193 ****
}
! $row[] = $catsel;
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
!
! // Title
! $row = array();
! $output->SetOutputMode(_PNH_RETURNOUTPUT);
! $row[] = $output->Text(_TITLE);
! $row[] = $output->FormTextArea('title', '', 1, 40);
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
!
! // Summary
! $row = array();
! $output->SetOutputMode(_PNH_RETURNOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $row[] = $output->Text(_SUMMARY);
! $output->SetInputMode(_PNH_PARSEINPUT);
! $row[] = $output->FormTextArea('summary', '', 8, 40);
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
!
! // Body
! $row = array();
! $output->SetOutputMode(_PNH_RETURNOUTPUT);
! $row[] = $output->Text(_BODY);
! $row[] = $output->FormTextArea('bodytext', '', 20, 40)
! . $output->LineBreak(1)
! . $output->Text(_TYPEINPUT)
! . $output->FormCheckbox('bodytype', true, 'text', 'radio')
! . $output->LineBreak(1)
! . $output->Text(_FROMFILE)
! . $output->FormCheckbox('bodytype', false, 'file', 'radio')
! . $output->LineBreak(1)
! . $output->FormFile('bodyfile');
!
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
// Show allowable HTML
! $output->TableRowStart();
! $output->TableColStart(1, 'left', 'top');
! $output->Text(_ALLOWEDHTML);
! $output->TableColEnd();
! $output->TableColStart(1, 'left', 'top');
foreach (pnConfigGetVar('AllowableHTML') as $k=>$v) {
if ($v) {
! $output->Text("<$k>");
}
}
- $output->TableColEnd();
- $output->TableRowEnd();
// TODO - language
! // End form
! $output->TableEnd();
! $output->FormSubmit(_ADDARTICLE);
! $output->FormEnd();
! // Return output
! return $output->GetOutput();
}
--- 103,160 ----
}
! $item['categories'] = $catsel;
// Show allowable HTML
! $item['allowed'] = '';
foreach (pnConfigGetVar('AllowableHTML') as $k=>$v) {
if ($v) {
! $item['allowed'] .= '<' . $k . '>';
}
}
// TODO - language
! $labels = array();
! $labels['header'] = pnVarPrepForDisplay(_ADDARTICLE);
! $labels['pubtype'] = pnML('Publication Type');
! $labels['categories'] = pnVarPrepForDisplay(_ARTICLECAT);
! $labels['title'] = pnVarPrepForDisplay(_TITLE);
! $labels['summary'] = pnVarPrepForDisplay(_SUMMARY);
! $labels['bodytext'] = pnVarPrepForDisplay(_BODYTEXT);
! $labels['bodyfile'] = pnVarPrepForDisplay(_BODYFILE);
! $labels['allowedhtml'] = pnVarPrepForDisplay(_ALLOWEDHTML);
! $labels['add'] = pnVarPrepForDisplay(_ADDARTICLE);
+ // Load user API to obtain item information function
+ if (!pnModAPILoad('articles', 'user')) {
+ $msg = pnML('Unable to load #(1) user API',
+ 'Articles');
+ pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
+ new SystemException($msg));
+ return;
+ }
! $pubtypes = pnModAPIFunc('articles','user','getpubtypes');
!
! $pubfilters = array();
! foreach ($pubtypes as $id => $pubtype) {
! $pubitem = array();
! if ($id == $ptid) {
! $pubitem['plink'] = '';
! } else {
! $pubitem['plink'] = pnModURL('articles','admin','new',
! array('ptid' => $id));
! }
! $pubitem['ptitle'] = $pubtype['descr'];
! $pubfilters[] = $pubitem;
! }
!
! // Return the template variables defined in this function
! return array('menu' => articles_admin_getmenu(),
! 'pubfilters' => $pubfilters,
! 'labels' => $labels,
! 'item' => $item,
! 'authid' => pnSecGenAuthKey(),
! 'ptid' => $ptid);
}
***************
*** 204,207 ****
--- 171,175 ----
$bodytext,
$language,
+ $ptid,
$cids) = pnVarCleanFromInput('title',
'summary',
***************
*** 210,213 ****
--- 178,182 ----
'bodytext',
'language',
+ 'ptid',
'cids');
***************
*** 226,229 ****
--- 195,202 ----
}
+ if (!isset($summary)) {
+ $summary = '';
+ }
+
// Pass to API
$aid = pnModAPIFunc('articles',
***************
*** 236,239 ****
--- 209,213 ----
'bodytext' => $bodytext,
'language' => '',
+ 'ptid' => $ptid,
'cids' => $cids));
***************
*** 284,287 ****
--- 258,265 ----
}
+ if (!isset($summary)) {
+ $summary = '';
+ }
+
// Pass to API
if(pnModAPIFunc('articles',
***************
*** 436,448 ****
{
// Get parameters
! $aid = pnVarCleanFromInput('aid');
!
! // Create output object
! $output = new pnHTML();
// Load user API to obtain article information function
if (!pnModAPILoad('articles', 'user')) {
! $output->Text(_LOADFAILED);
! return $output->GetOutput();
}
--- 414,426 ----
{
// Get parameters
! $aid= pnVarCleanFromInput('aid');
// Load user API to obtain article information function
if (!pnModAPILoad('articles', 'user')) {
! $msg = pnML('Unable to load #(1) user API',
! 'Articles');
! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
! new SystemException($msg));
! return;
}
***************
*** 454,465 ****
if ($article == false) {
! $output->Text(_ARTICLESNOSUCHITEM);
! return $output->GetOutput();
}
// Load user API to obtain category information function
if (!pnModAPILoad('categories', 'user')) {
! $output->Text(_LOADFAILED);
! return $output->GetOutput();
}
--- 432,454 ----
if ($article == false) {
! $msg = pnML('Unable to find #(1) item #(2)',
! 'Article', pnVarPrepForDisplay($aid));
! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
! new SystemException($msg));
! return;
! }
!
! $ptid = $article['pubtypeid'];
! if (!isset($ptid)) {
! $ptid = '';
}
// Load user API to obtain category information function
if (!pnModAPILoad('categories', 'user')) {
! $msg = pnML('Unable to load #(1) user API',
! 'Articles');
! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
! new SystemException($msg));
! return;
}
***************
*** 481,516 ****
// Security check
if (!pnSecAuthAction(0, 'articles::Item', "$article[title]::$aid", ACCESS_EDIT)) {
! $output->Text('Not authorised to carry out that operation');
! return $output->GetOutput();
}
! // Add menu to output
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->Text(articles_adminmenu());
! $output->SetInputMode(_PNH_PARSEINPUT);
!
! // Title
! $output->LineBreak(2);
! $output->Title(_ARTICLESMODIFY);
!
! $text = "
! // TODO : allow to set publication type (news, section, review etc.)
! ";
! $output->Text($text);
!
! // Start form
! $output->UploadMode();
! $output->FormStart(pnModURL('articles', 'admin', 'update'));
! $output->FormHidden('aid', $aid);
! $output->FormHidden('authid', pnSecGenAuthKey());
!
! $output->TableStart('', array(), 0, '80%');
// category to add the Article
- $row = array();
- $output->SetOutputMode(_PNH_RETURNOUTPUT);
- $row[] = $output->Text(pnVarPrepForDisplay(_ARTICLECAT));
! $string = pnModGetVar('articles', 'cids');
$main_cids = explode (';', $string);
--- 470,490 ----
// Security check
if (!pnSecAuthAction(0, 'articles::Item', "$article[title]::$aid", ACCESS_EDIT)) {
! $msg = pnML('Not authorized to modify #(1) item #(2)',
! 'Article', pnVarPrepForDisplay($aid));
! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
! new SystemException($msg));
! return;
}
! $item = array();
// category to add the Article
! if (!empty($ptid)) {
! $string = pnModGetVar('articles', 'cids.'.$ptid);
! }
! if (empty($string)) {
! $string = pnModGetVar('articles', 'cids');
! }
$main_cids = explode (';', $string);
***************
*** 543,630 ****
'values' => &$values));
}
!
! $row[] = $catsel;
!
!
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
// Author
! $row = array();
! $output->SetOutputMode(_PNH_RETURNOUTPUT);
! $row[] = $output->Text(_AUTHOR);
! $row[] = $output->Text(pnUserGetVar('name', $article['authorid']) . ' (' . pnUserGetVar('uname', $article['authorid']) . ')');
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
// Title
! $row = array();
! $output->SetOutputMode(_PNH_RETURNOUTPUT);
! $row[] = $output->Text(_TITLE);
! $row[] = $output->FormTextArea('title', $article['title'], 1, 40);
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
// Summary
! $row = array();
! $output->SetOutputMode(_PNH_RETURNOUTPUT);
! $row[] = _SUMMARY;
! $row[] = $output->FormTextArea('summary', $article['summary'], 8, 40);
! $output->SetOutputMode(_PNH_KEEPOUTPUT);
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->TableAddrow($row, 'left');
! $output->SetInputMode(_PNH_PARSEINPUT);
! // Body
! $output->TableRowStart('left');
! $output->TableColStart(1, 'left', 'center');
! $output->Text(_BODY);
! $output->TableColEnd();
! $output->TableColStart(1, 'left', 'top');
! $output->TableColEnd();
! $output->TableRowEnd();
// Body text
! $output->TableRowStart('left');
! $output->TableColStart(1, 'left', 'center');
! $output->FormCheckbox('bodytype', true, 'text', 'radio');
! $output->SetInputMode(_PNH_VERBATIMINPUT);
! $output->Text(_BODYTEXT);
! $output->SetInputMode(_PNH_PARSEINPUT);
! $output->TableColEnd();
! $output->TableColStart(1, 'left', 'center');
! $output->FormTextArea('bodytext', $article['body'], 20, 40);
! $output->TableColEnd();
! $output->TableRowEnd();
- // Body file
- $output->TableRowStart();
- $output->TableColStart(1, 'left', 'top');
- $output->FormCheckbox('bodytype', false, 'file', 'radio');
- $output->SetInputMode(_PNH_VERBATIMINPUT);
- $output->Text(_BODYFILE);
- $output->SetInputMode(_PNH_PARSEINPUT);
- $output->TableColEnd();
- $output->TableColStart(1, 'left', 'center');
- $output->FormFile('bodyfile');
- $output->TableColEnd();
- $output->TableRowEnd();
-
// TODO - show allowable HTML
// TODO - language
! // End form
! $output->TableEnd();
! $output->FormSubmit(_ARTICLESUPDATE);
! $output->FormEnd();
! return $output->GetOutput();
}
--- 517,587 ----
'values' => &$values));
}
! $item['categories'] = $catsel;
// Author
! $item['author'] = pnUserGetVar('name', $article['authorid']) . ' (' . pnUserGetVar('uname', $article['authorid']) . ')';
// Title
! $item['title'] = $article['title'];
// Summary
! $item['summary'] = $article['summary'];
! // Date
! $item['date'] = strftime(_DATETIMELONG, $article['pubdate']);
// Body text
! $item['bodytext'] = $article['body'];
// TODO - show allowable HTML
// TODO - language
! $labels = array();
! $labels['header'] = pnVarPrepForDisplay(_ARTICLESMODIFY);
! $labels['pubtype'] = pnML('Publication Type');
! $labels['categories'] = pnVarPrepForDisplay(_ARTICLECAT);
! $labels['author'] = pnVarPrepForDisplay(_AUTHOR);
! $labels['title'] = pnVarPrepForDisplay(_TITLE);
! $labels['summary'] = pnVarPrepForDisplay(_SUMMARY);
! $labels['date'] = pnML('Publication Date');
! $labels['body'] = pnVarPrepForDisplay(_BODY);
! $labels['bodytext'] = pnVarPrepForDisplay(_BODYTEXT);
! $labels['bodyfile'] = pnVarPrepForDisplay(_BODYFILE);
! $labels['update'] = pnVarPrepForDisplay(_ARTICLESUPDATE);
! // Load user API to obtain item information function
! if (!pnModAPILoad('articles', 'user')) {
! $msg = pnML('Unable to load #(1) user API',
! 'Articles');
! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
! new SystemException($msg));
! return;
! }
!
! $pubtypes = pnModAPIFunc('articles','user','getpubtypes');
! $item['pubtype'] = $pubtypes[$ptid]['descr'];
!
! $pubfilters = array();
! foreach ($pubtypes as $id => $pubtype) {
! $pubitem = array();
! if ($id == $ptid) {
! $pubitem['plink'] = '';
! } else {
! $pubitem['plink'] = pnModURL('articles','admin','modify',
! array('aid' => $aid, 'ptid' => $id));
! }
! $pubitem['ptitle'] = $pubtype['descr'];
! $pubfilters[] = $pubitem;
! }
!
! // Return the template variables defined in this function
! return array('menu' => articles_admin_getmenu(),
! 'pubfilters' => $pubfilters,
! 'labels' => $labels,
! 'item' => $item,
! 'authid' => pnSecGenAuthKey(),
! 'ptid' => $ptid,
! 'aid' => $aid);
}
Index: pnadminapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/articles/pnadminapi.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** pnadminapi.php 6 Jul 2002 11:50:08 -0000 1.7
--- pnadminapi.php 28 Jul 2002 23:20:33 -0000 1.8
***************
*** 32,35 ****
--- 32,36 ----
* @param $args['bodyfile'] file input text for this item
* @param $args['langauge'] language of the item
+ * @param $args['ptid'] publication type ID for the item
* @returns int
* @return articles item ID on success, false on failure
***************
*** 43,46 ****
--- 44,48 ----
if ((!isset($title)) ||
(!isset($summary)) ||
+ (!isset($ptid)) ||
// (!isset($cids)) ||
(!isset($bodytype)) ||
***************
*** 83,86 ****
--- 85,89 ----
$articlescolumn[authorid],
$articlescolumn[pubdate],
+ $articlescolumn[pubtypeid],
$articlescolumn[language])
VALUES (
***************
*** 91,94 ****
--- 94,98 ----
'" . pnvarPrepForStore(pnUserGetVar('uid')) . "',
" . pnVarPrepForStore(time()) . ",
+ '" . pnvarPrepForStore($ptid) . "',
'" . pnvarPrepForStore($language) . "')";
$dbconn->Execute($sql);
Index: pnuserapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/articles/pnuserapi.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** pnuserapi.php 28 Jul 2002 23:16:08 -0000 1.21
--- pnuserapi.php 28 Jul 2002 23:20:33 -0000 1.22
***************
*** 172,176 ****
$sql .= IterateSQL (' ORDER BY', $orderings, ',');
- error_log($sql);
$result = $dbconn->SelectLimit($sql, $numitems, $startnum-1);
--- 172,175 ----
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 |