2005-02-03 01:27:31 +00:00
< ? php
2006-06-17 06:10:10 +00:00
require_once ( BASE . " include/util.php " );
2006-09-01 02:25:18 +00:00
require_once ( BASE . " include/version.php " );
2006-06-17 06:10:10 +00:00
2005-02-03 01:27:31 +00:00
/************************************/
/* note class and related functions */
/************************************/
2009-07-28 17:48:52 +02:00
define ( 'APPNOTE_SHOW_FOR_ALL' , - 1 );
define ( 'APPNOTE_SHOW_FOR_VERSIONS' , - 2 );
define ( 'APPNOTE_SHOW_FOR_APP' , - 3 );
2005-02-03 01:27:31 +00:00
/**
* Note class for handling notes
*/
class Note {
var $iNoteId ;
var $iVersionId ;
2009-07-28 17:48:52 +02:00
var $iAppId ;
2005-02-03 01:27:31 +00:00
var $sTitle ;
2007-01-06 06:21:41 +00:00
var $shDescription ;
2007-01-02 04:44:27 +00:00
var $iSubmitterId ;
var $sSubmitTime ;
2005-02-03 01:27:31 +00:00
/**
* Constructor .
* If $iNoteId is provided , fetches note .
*/
2007-07-30 00:27:37 +00:00
function Note ( $iNoteId = null , $oRow = null )
2005-02-03 01:27:31 +00:00
{
2007-07-30 00:27:37 +00:00
if ( ! $iNoteId && ! $oRow )
return ;
if ( ! $oRow )
2005-02-03 01:27:31 +00:00
{
2007-07-30 00:27:37 +00:00
$sQuery = " SELECT * FROM appNotes WHERE noteId = '?' " ;
if ( $hResult = query_parameters ( $sQuery , $iNoteId ))
2007-08-03 23:27:25 +00:00
$oRow = query_fetch_object ( $hResult );
2007-07-30 00:27:37 +00:00
}
if ( $oRow )
{
$this -> iNoteId = $oRow -> noteId ;
$this -> iVersionId = $oRow -> versionId ;
2009-07-28 17:48:52 +02:00
$this -> iAppId = $oRow -> appId ;
2007-07-30 00:27:37 +00:00
$this -> sTitle = $oRow -> noteTitle ;
$this -> shDescription = $oRow -> noteDesc ;
$this -> sSubmitTime = $oRow -> submitTime ;
$this -> iSubmitterId = $oRow -> submitterId ;
2005-02-03 01:27:31 +00:00
}
}
/*
* Creates a new note .
* Informs interested people about the creation .
* Returns true on success , false on failure
*/
2006-06-30 19:48:33 +00:00
function create ()
2005-02-03 01:27:31 +00:00
{
2007-07-31 23:48:22 +00:00
$hResult = query_parameters ( " INSERT INTO appNotes (versionId, " .
2009-07-28 17:48:52 +02:00
" appId, noteTitle, noteDesc, submitterId, " .
2007-07-31 23:48:22 +00:00
" submitTime) " .
2009-07-28 17:48:52 +02:00
" VALUES('?', '?', '?', '?', '?', ?) " ,
$this -> iVersionId , $this -> iAppId ,
$this -> sTitle , $this -> shDescription ,
2007-07-31 23:48:22 +00:00
$_SESSION [ 'current' ] -> iUserId ,
" NOW() " );
2005-02-03 01:27:31 +00:00
2006-06-24 04:20:32 +00:00
if ( $hResult )
2005-02-03 01:27:31 +00:00
{
2007-08-03 23:27:25 +00:00
$this -> note ( query_appdb_insert_id ());
2007-01-06 06:21:41 +00:00
$sWhatChanged = " Description is: \n " . $this -> shDescription . " . \n \n " ;
2005-09-30 01:55:51 +00:00
$this -> SendNotificationMail ( " add " , $sWhatChanged );
2005-02-03 01:27:31 +00:00
return true ;
}
else
2006-06-24 04:20:32 +00:00
{
addmsg ( " Error while creating a new note. " , " red " );
2005-02-03 01:27:31 +00:00
return false ;
2006-06-24 04:20:32 +00:00
}
2005-02-03 01:27:31 +00:00
}
2008-01-23 14:18:43 +01:00
function unQueue ()
{
return true ; // We don't queue notes
}
2005-02-03 01:27:31 +00:00
/**
* Update note .
* Returns true on success and false on failure .
*/
2006-06-30 19:48:33 +00:00
function update ()
2005-02-03 01:27:31 +00:00
{
2005-02-09 23:50:27 +00:00
$sWhatChanged = " " ;
2006-06-30 19:48:33 +00:00
/* create an instance of ourselves so we can see what has changed */
$oNote = new Note ( $this -> iNoteId );
2005-02-09 23:50:27 +00:00
2006-06-30 19:48:33 +00:00
if ( $this -> sTitle && $this -> sTitle != $oNote -> sTitle )
2005-02-03 01:27:31 +00:00
{
2006-06-27 19:16:27 +00:00
if ( ! query_parameters ( " UPDATE appNotes SET noteTitle = '?' WHERE noteId = '?' " ,
2006-06-30 19:48:33 +00:00
$this -> sTitle , $this -> iNoteId ))
2005-02-03 01:27:31 +00:00
return false ;
2006-06-30 19:48:33 +00:00
$sWhatChanged .= " Title was changed from " . $oNote -> sTitle . " to " . $this -> sTitle . " . \n \n " ;
2005-02-03 01:27:31 +00:00
}
2007-01-06 06:21:41 +00:00
if ( $this -> shDescription && $this -> shDescription != $oNote -> shDescription )
2005-02-03 01:27:31 +00:00
{
2006-06-27 19:16:27 +00:00
if ( ! query_parameters ( " UPDATE appNotes SET noteDesc = '?' WHERE noteId = '?' " ,
2007-01-06 06:21:41 +00:00
$this -> shDescription , $this -> iNoteId ))
2005-02-03 01:27:31 +00:00
return false ;
2007-01-06 06:21:41 +00:00
$sWhatChanged .= " Description was changed from \n " . $oNote -> shDescription . " \n to \n " . $this -> shDescription . " . \n \n " ;
2005-02-03 01:27:31 +00:00
}
2009-07-29 03:10:00 +02:00
if (( $this -> iVersionId || $this -> iAppId ) && $this -> iVersionId != $oNote -> iVersionId )
2005-02-03 01:27:31 +00:00
{
2006-06-27 19:16:27 +00:00
if ( ! query_parameters ( " UPDATE appNotes SET versionId = '?' WHERE noteId = '?' " ,
2006-06-30 19:48:33 +00:00
$this -> iVersionId , $this -> iNoteId ))
2005-02-03 01:27:31 +00:00
return false ;
2009-07-29 03:10:00 +02:00
2006-06-30 19:48:33 +00:00
$sVersionBefore = Version :: lookup_name ( $oNote -> iVersionId );
2009-07-29 03:10:00 +02:00
if ( ! $this -> iAppId )
{
$sVersionAfter = Version :: lookup_name ( $this -> iVersionId );
$sWhatChanged .= " Version was changed from " . $sVersionBefore . " to " . $sVersionAfter . " . \n \n " ;
} else
{
$oApp = new application ( $this -> iAppId );
$sNewApp = $oApp -> sName ;
$sWhatChanged .= " Moved from version $shVersionBefore to application $sNewApp " ;
}
}
if (( $this -> iAppId || $this -> iVersionId ) && $this -> iAppId != $oNote -> iAppId )
{
if ( ! query_parameters ( " UPDATE appNotes SET appId = '?' WHERE noteId = '?' " ,
$this -> iAppId , $this -> iNoteId ))
return false ;
2005-02-03 01:27:31 +00:00
}
2005-02-09 23:50:27 +00:00
if ( $sWhatChanged )
2005-09-30 01:55:51 +00:00
$this -> SendNotificationMail ( " edit " , $sWhatChanged );
2005-02-03 01:27:31 +00:00
return true ;
}
2007-12-12 22:43:22 +01:00
function purge ()
{
return $this -> delete ();
}
2005-02-03 01:27:31 +00:00
/**
* Removes the current note from the database .
* Informs interested people about the deletion .
2007-07-30 00:27:37 +00:00
*
* Returns : true if successful , false if not
2005-02-03 01:27:31 +00:00
*/
2007-09-14 23:02:12 -04:00
function delete ()
2005-02-03 01:27:31 +00:00
{
2006-06-27 19:16:27 +00:00
$hResult = query_parameters ( " DELETE FROM appNotes WHERE noteId = '?' " , $this -> iNoteId );
2007-07-30 00:27:37 +00:00
2007-09-14 23:02:12 -04:00
if ( ! $hResult )
return FALSE ;
return TRUE ;
2005-02-09 23:50:27 +00:00
}
2007-09-23 16:09:38 +02:00
function objectShowPreview ()
{
return TRUE ;
}
2005-02-09 23:50:27 +00:00
2005-09-30 01:55:51 +00:00
function SendNotificationMail ( $sAction = " add " , $sMsg = null )
2005-02-09 23:50:27 +00:00
{
2009-07-28 17:48:52 +02:00
if ( ! $this -> iAppId )
{
$oVersion = new version ( $this -> iVersionId );
$sAppName = version :: fullName ( $this -> iVersionId );
$sMsg .= $oVersion -> objectMakeUrl () . " \n " ;
} else
{
$oApp = new application ( $this -> iAppId );
$sAppName = $oApp -> sName ;
$sMsg .= $oApp -> objectMakeUrl () . " \n " ;
}
2005-02-09 23:50:27 +00:00
switch ( $sAction )
2005-02-03 01:27:31 +00:00
{
2005-02-09 23:50:27 +00:00
case " add " :
2007-04-08 23:04:31 +00:00
$sSubject = " Note $this->sTitle for $sAppName added by " .
$_SESSION [ 'current' ] -> sRealname ;
2005-02-09 23:50:27 +00:00
addmsg ( " The note was successfully added into the database. " , " green " );
break ;
case " edit " :
2007-04-08 23:04:31 +00:00
$sSubject = " Note $this->sTitle for $sAppName has been modified by " .
$_SESSION [ 'current' ] -> sRealname ;
2005-02-09 23:50:27 +00:00
addmsg ( " Note modified. " , " green " );
break ;
case " delete " :
2007-01-02 04:44:27 +00:00
$oSubmitter = new User ( $this -> iSubmitterId );
2007-04-08 23:04:31 +00:00
$sSubject = " Note $this->sTitle for $sAppName has been deleted by " .
$_SESSION [ 'current' ] -> sRealname ;
2007-07-31 23:48:22 +00:00
$sMsg .= " This note was made on " . print_date ( mysqldatetime_to_unixtimestamp ( $this -> sSubmitTime )) .
" by " . $oSubmitter -> sRealname . " \n " ;
2005-02-03 01:27:31 +00:00
$sMsg .= " \n " ;
2005-02-09 23:50:27 +00:00
$sMsg .= " Subject: " . $this -> sTitle . " \n " ;
2005-02-03 01:27:31 +00:00
$sMsg .= " \n " ;
2007-01-02 04:44:27 +00:00
$sMsg .= " Note contents: \n " ;
2007-01-06 06:21:41 +00:00
$sMsg .= $this -> shDescription . " \n " ;
2005-02-03 01:27:31 +00:00
$sMsg .= " \n " ;
$sMsg .= " Because: \n " ;
2007-07-30 00:27:37 +00:00
if ( isset ( $aClean [ 'sReplyText' ]) && $aClean [ 'sReplyText' ])
2006-07-13 18:54:10 +00:00
$sMsg .= $aClean [ 'sReplyText' ] . " \n " ;
2005-02-03 01:27:31 +00:00
else
$sMsg .= " No reason given. \n " ;
2005-02-09 23:50:27 +00:00
addmsg ( " Note deleted. " , " green " );
break ;
2005-02-03 01:27:31 +00:00
}
2006-06-29 15:54:29 +00:00
$sEmail = User :: get_notify_email_address_list ( null , $this -> iVersionId );
2005-02-09 23:50:27 +00:00
if ( $sEmail )
mail_appdb ( $sEmail , $sSubject , $sMsg );
}
2006-06-29 19:22:26 +00:00
/* Show note */
2006-06-30 19:48:33 +00:00
/* $bDisplayOnly means we should not display any editing controls, even if */
/* the user has the ability to edit this note */
2007-09-23 16:09:38 +02:00
function display ( $aVars = null )
2006-06-29 19:22:26 +00:00
{
switch ( $this -> sTitle )
{
case 'WARNING' :
2008-02-20 13:57:35 +11:00
$sClass = 'warning' ;
2006-06-29 19:22:26 +00:00
$sTitle = 'Warning' ;
break ;
case 'HOWTO' :
2008-02-20 13:57:35 +11:00
$sClass = 'howto' ;
2006-06-29 19:22:26 +00:00
$sTitle = 'HOWTO' ;
break ;
default :
if ( ! empty ( $this -> sTitle ))
$sTitle = $this -> sTitle ;
else
$sTitle = 'Note' ;
2008-02-20 13:57:35 +11:00
$sClass = 'defaultnote' ;
2006-06-29 19:22:26 +00:00
}
2007-09-19 20:12:37 +02:00
2009-07-28 17:48:52 +02:00
if ( ! $aVars || ! getInput ( 'shReturnTo' , $aVars ))
{
$oVersion = new version ( $this -> iVersionId );
$shReturnTo = $oVersion -> objectMakeUrl ();
} else
{
$shReturnTo = $aVars [ 'shReturnTo' ];
}
2007-09-19 20:12:37 +02:00
2006-06-29 19:22:26 +00:00
$shOutput = html_frame_start ( " " , " 98% " , '' , 0 );
$shOutput .= " <table width= \" 100% \" border= \" 0 \" cellspacing= \" 0 \" > \n " ;
2008-02-21 19:59:19 +11:00
$shOutput .= " <tr class= \" " . $sClass . " \" align= \" center \" valign= \" top \" ><td> </td></tr><tr class= \" notetitle \" valign= \" top \" align= \" center \" ><td> " . $sTitle . " </td></tr> \n " ;
2006-06-29 19:22:26 +00:00
$shOutput .= " <tr><td class= \" note \" > \n " ;
2007-01-06 06:21:41 +00:00
$shOutput .= $this -> shDescription ;
2006-06-29 19:22:26 +00:00
$shOutput .= " </td></tr> \n " ;
2007-09-23 16:09:38 +02:00
if (( ! $aVars || $aVars [ 'bEditing' ] != " true " ) && $this -> canEdit ())
2006-06-29 19:22:26 +00:00
{
2007-09-23 16:09:38 +02:00
$shOutput .= " <tr class= \" color1 \" align= \" center \" valign= \" top \" ><td> " ;
2009-07-28 17:48:52 +02:00
$shOutput .= " <form method= \" post \" name= \" message \" action= \" objectManager.php?sClass=note&sAction=edit&iId= " . $this -> iNoteId . " &sReturnTo= " . urlencode ( $shReturnTo ) . " \" > " ;
2007-09-23 16:09:38 +02:00
$shOutput .= '<input type="submit" value="Edit Note" class="button">' ;
$shOutput .= '</form></td></tr>' ;
2006-06-29 19:22:26 +00:00
}
$shOutput .= " </table> \n " ;
$shOutput .= html_frame_end ();
echo $shOutput ;
}
2006-06-30 19:48:33 +00:00
2009-07-28 17:48:52 +02:00
function displayNotesForEntry ( $iVersionId , $iAppId = null )
{
if ( $iVersionId )
{
$oVersion = new version ( $iVersionId );
$oApp = $oVersion -> objectGetParent ();
$hResult = query_parameters ( " SELECT noteId FROM appNotes WHERE versionId = '?' OR (appId = '?' AND (versionId = '?' OR versionId = '?')) " , $iVersionId , $oApp -> objectGetId (), APPNOTE_SHOW_FOR_ALL , APPNOTE_SHOW_FOR_VERSIONS );
} else if ( $iAppId )
{
$hResult = query_parameters ( " SELECT noteId FROM appNotes WHERE appId = '?' AND versionId = '?' OR versionId = '?' " , $iAppId , APPNOTE_SHOW_FOR_ALL , APPNOTE_SHOW_FOR_APP );
}
if ( ! $hResult )
return ;
if ( $iVersionId )
$oVersion = new version ( $iVersionId );
else
$oApp = new application ( $iAppId );
while ( $oRow = mysql_fetch_object ( $hResult ))
{
$oNote = new note ( $oRow -> noteId );
$shReturnTo = $iVersionId ? $oVersion -> objectMakeUrl () : $oApp -> objectMakeUrl ();
$aVars = array ( 'shReturnTo' => $shReturnTo , 'bEditing' => 'false' );
$oNote -> display ( $aVars );
}
}
2007-09-19 20:12:37 +02:00
function objectGetCustomVars ( $sAction )
{
switch ( $sAction )
{
2007-09-23 16:09:38 +02:00
case " preview " :
return array ( " bEditing " );
2007-09-19 20:12:37 +02:00
case " add " :
2009-07-28 17:48:52 +02:00
return array ( 'iVersionId' , 'iAppId' , 'sNoteTitle' );
2006-06-30 19:48:33 +00:00
2007-09-19 20:12:37 +02:00
default :
return null ;
}
}
2009-07-29 03:10:00 +02:00
public static function isRealVersionId ( $iVersionId )
{
return $iVersionId > 0 ;
}
2007-09-19 20:12:37 +02:00
function outputEditor ( $aValues = null )
2006-06-30 19:48:33 +00:00
{
2009-07-29 16:32:37 +02:00
if ( $aValues )
{
if ( ! $this -> iVersionId )
$this -> iVersionId = getInput ( 'iVersionId' , $aValues );
2007-09-19 20:12:37 +02:00
2009-07-29 16:32:37 +02:00
if ( ! $this -> iAppId )
$this -> iAppId = getInput ( 'iAppId' , $aValues );
if ( ! $this -> sTitle )
$this -> sTitle = getInput ( 'sNoteTitle' , $aValues );
}
2009-07-28 17:48:52 +02:00
2009-07-29 03:10:00 +02:00
if ( $this -> iAppId && ! $this -> iVersionId )
$this -> iVersionId = APPNOTE_SHOW_FOR_ALL ;
2009-07-28 17:48:52 +02:00
2009-07-29 03:10:00 +02:00
if ( ! $this -> iAppId )
{
$oVersion = new version ( $this -> iVersionId );
$this -> iAppId = $oVersion -> iAppId ;
2007-09-19 20:12:37 +02:00
}
2006-06-30 19:48:33 +00:00
HtmlAreaLoaderScript ( array ( " editor " ));
2007-09-19 20:12:37 +02:00
2009-07-29 16:34:02 +02:00
echo html_frame_start ( " Edit Application Note " , " 90% " , " " , 0 );
2006-06-30 19:48:33 +00:00
echo html_table_begin ( " width='100%' border=0 align=left cellpadding=6 cellspacing=0 class='box-body' " );
2008-02-23 12:06:24 +11:00
echo '<input type="hidden" name="bEditing" value="true">' ;
echo '<input type="hidden" name="iNoteId" value="' . $this -> iNoteId . '">' ;
2009-07-29 03:10:00 +02:00
2009-07-28 17:48:52 +02:00
echo '<input type="hidden" name="iAppId" value="' . $this -> iAppId . '">' ;
2006-06-30 19:48:33 +00:00
echo '<tr><td class=color1>Title</td>' . " \n " ;
echo ' <td class=color0><input size=80% type="text" name="sNoteTitle" type="text" value="' . $this -> sTitle . '"></td></tr>' , " \n " ;
echo '<tr><td class=color4>Description</td><td class=color0>' , " \n " ;
echo '<p style="width:700px">' , " \n " ;
2007-01-06 06:21:41 +00:00
echo '<textarea cols="80" rows="20" id="editor" name="shNoteDesc">' . $this -> shDescription . '</textarea>' , " \n " ;
2006-06-30 19:48:33 +00:00
echo '</p>' ;
echo '</td></tr>' . " \n " ;
2009-07-29 03:10:00 +02:00
if ( $this -> iAppId );
$oApp = new application ( $this -> iAppId );
if ( $this -> iAppId || $oApp -> canEdit ())
2009-07-28 17:48:52 +02:00
{
2009-07-29 03:10:00 +02:00
$aIds = array ();
$aOptions = array ();
if ( $this -> isRealVersionId ( $this -> iVersionId ))
{
$aIds [] = $this -> iVersionId ;
$aOptions [] = 'Show for this version only' ;
}
$aIds = array_merge ( $aIds , array ( APPNOTE_SHOW_FOR_ALL , APPNOTE_SHOW_FOR_VERSIONS , APPNOTE_SHOW_FOR_APP ));
$aOptions = array_merge ( $aOptions , array ( 'Show on both application and version pages' , 'Show on all version pages only' , 'Show on application page only' ));;
2009-07-28 17:48:52 +02:00
echo '<tr><td class="color1">Display mode</td>' . " \n " ;
echo '<td class="color0">' . html_radiobuttons ( $aIds , $aOptions , 'iVersionId' , $this -> iVersionId );
echo '</td></tr>' ;
2009-07-29 03:10:00 +02:00
} else if ( ! $this -> iAppId )
{
echo '<input type="hidden" name="iVersionId" value="' . $this -> iVersionId . '">' ;
2009-07-28 17:48:52 +02:00
}
2009-07-29 03:10:00 +02:00
2006-06-30 19:48:33 +00:00
echo '<tr><td colspan="2" align="center" class="color3">' , " \n " ;
echo html_table_end ();
echo html_frame_end ();
}
2007-01-17 03:18:49 +00:00
/* retrieves values from $aValue that were output by outputEditor() */
/* $aValues can be $_REQUEST or any array with the values from outputEditor() */
2006-07-08 22:06:28 +00:00
function GetOutputEditorValues ( $aValues )
2006-06-30 19:48:33 +00:00
{
2009-07-28 17:48:52 +02:00
$this -> iVersionId = getInput ( 'iVersionId' , $aValues );
2009-07-29 03:10:00 +02:00
if ( ! $this -> isRealVersionId ( $this -> iVersionId ))
$this -> iAppId = getInput ( 'iAppId' , $aValues );
else
$this -> iAppId = 0 ;
2006-07-08 22:06:28 +00:00
$this -> sTitle = $aValues [ 'sNoteTitle' ];
2007-01-06 06:21:41 +00:00
$this -> shDescription = $aValues [ 'shNoteDesc' ];
2006-06-30 19:48:33 +00:00
}
2007-07-30 00:27:37 +00:00
function allowAnonymousSubmissions ()
{
return false ;
}
2008-06-26 12:07:29 -04:00
// NOTE: notes cannot be queued at this point
2007-07-30 00:27:37 +00:00
function mustBeQueued ()
{
return false ;
}
function objectGetId ()
{
return $this -> iNoteId ;
}
// TODO: we ignore $bQueued and $bRejected as notes
// do not support queuing at this point
// TODO: we have no permissions scope on retrieving entries
// as notes are typically only added to unqueued versions
2008-04-12 21:50:02 +02:00
function objectGetEntries ( $sState , $iRows = 0 , $iStart = 0 , $sOrderBy = '' , $bAscending = true )
2007-07-30 00:27:37 +00:00
{
$sQuery = " select * from appNotes " ;
$hResult = query_parameters ( $sQuery );
return $hResult ;
}
2008-01-23 15:10:49 +01:00
function objectGetEntriesCount ( $sState )
{
$sQuery = " SELECT COUNT(DISTINCT noteId) as count FROM appNotes " ;
$hResult = query_parameters ( $sQuery );
if ( ! $hResult )
return false ;
if (( $oRow = mysql_fetch_object ( $hResult )))
return $oRow -> count ;
return false ;
}
2007-07-30 00:27:37 +00:00
//TODO: not sure how to best let users view a table of notes
// since the note contents could be very long we would only
// want to show a small amount of the text. Implement this
// routine when we need it
function objectGetHeader ()
{
return null ;
}
//TODO: implement this when we implement objectGetHeader()
function objectGetTableRow ()
{
return null ;
}
function objectMakeUrl ()
{
$oManager = new objectManager ( " note " , " View Note " );
return $oManager -> makeUrl ( " view " , $this -> objectGetId ());
}
2007-09-14 23:02:12 -04:00
function objectGetSubmitterId ()
{
return $this -> iSubmitterId ;
}
function objectGetMailOptions ( $sAction , $bMailSubmitter , $bParentAction )
{
return new mailOptions ();
}
function objectGetMail ( $sAction , $bMailSubmitter , $bParentAction )
{
/* We don't do this at the moment */
return array ( null , null , null );
}
2009-07-23 01:40:25 +02:00
public function objectGetParent ( $sClass = '' )
{
if ( $this -> iVersionId )
return new version ( $this -> iVersionId );
else
return new application ( $this -> iAppId );
}
public function objectSetParent ( $iNewId , $sClass = '' )
{
if ( $this -> iVersionId )
$this -> iVersionId = $iNewId ;
else
$this -> iAppId = $iNewId ;
}
2007-12-12 22:43:22 +01:00
function objectGetChildren ( $bIncludeDeleted = false )
2007-09-08 22:29:17 +00:00
{
return array ();
}
2007-07-30 00:27:37 +00:00
//TODO: not sure if we want to use sTitle here or what
function objectMakeLink ()
{
$sLink = " <a href= \" " . $this -> objectMakeUrl () . " \" > " .
$this -> sTitle . " </a> " ;
return $sLink ;
}
2008-01-23 14:18:43 +01:00
function objectGetState ()
{
return 'accepted' ; // We don't queue notes
}
2007-07-30 00:27:37 +00:00
// users can edit the note if they:
// - have "admin" privileges
// - maintain the version, or supermaintain the application that
// this version is under
function canEdit ()
{
if ( $_SESSION [ 'current' ] -> hasPriv ( " admin " ))
return true ;
2009-07-28 17:48:52 +02:00
else if ( $this -> iVersionId && ! $this -> iAppId )
return maintainer :: isUserMaintainer ( $_SESSION [ 'current' ], $this -> iVersionId );
else if ( $this -> iAppId )
return maintainer :: isUserSuperMaintainer ( $_SESSION [ 'current' ], $this -> iAppId );
2007-07-30 00:27:37 +00:00
return false ;
}
2005-02-03 01:27:31 +00:00
}
?>