function AddDiscussionOptions(&$Context, &$Panel, $Discussion)
{
    if ($Context->Session->UserID > 0) {
        $Options = $Context->GetDefinition("Options");
        $Panel->AddList($Options, 1);
        $BookmarkText = $Context->GetDefinition($Discussion->Bookmarked ? "UnbookmarkThisDiscussion" : "BookmarkThisDiscussion");
        $Panel->AddListItem($Options, $BookmarkText, "javascript:SetBookmark(" . $Discussion->Bookmarked . ", '" . $Discussion->DiscussionID . "', '" . $Context->GetDefinition("BookmarkText") . "', '" . $Context->GetDefinition("UnbookmarkThisDiscussion") . "');", "", "", "id=\"SetBookmark\"");
        if ($Context->Session->User->AdminCategories) {
            $HideText = $Context->GetDefinition(($Discussion->Active ? "Hide" : "Unhide") . "ThisDiscussion");
            $Panel->AddListItem($Options, $HideText, "javascript:DiscussionSwitch('Active', '" . $Discussion->DiscussionID . "', '" . FlipBool($Discussion->Active) . "');", "", "", "onclick=\"return confirm('" . $Context->GetDefinition($Discussion->Active ? "ConfirmHideDiscussion" : "ConfirmUnhideDiscussion") . "');\"");
            $CloseText = $Context->GetDefinition(($Discussion->Closed ? "ReOpen" : "Close") . "ThisDiscussion");
            $Panel->AddListItem($Options, $CloseText, "javascript:DiscussionSwitch('Closed', '" . $Discussion->DiscussionID . "', '" . FlipBool($Discussion->Closed) . "');", "", "", "onclick=\"return confirm('" . $Context->GetDefinition($Discussion->Closed ? "ConfirmReopenDiscussion" : "ConfirmCloseDiscussion") . "');\"");
            $StickyText = $Context->GetDefinition("MakeThisDiscussion" . ($Discussion->Sticky ? "Unsticky" : "Sticky"));
            $Panel->AddListItem($Options, $StickyText, "javascript:DiscussionSwitch('Sticky', '" . $Discussion->DiscussionID . "', '" . FlipBool($Discussion->Sticky) . "');", "", "", "onclick=\"return confirm('" . $Context->GetDefinition($Discussion->Sticky ? "ConfirmUnsticky" : "ConfirmSticky") . "');\"");
        }
    }
}
 function Get()
 {
     $sReturn = "";
     for ($i = 0; $i < count($this->aOptions); $i++) {
         $ElementID = str_replace(" ", "_", $this->Name) . "_" . $this->aOptions[$i]["IdValue"];
         $Checked = $this->aOptions[$i]["Checked"];
         if ($this->aOptions[$i]["FlipCheckedValue"]) {
             $Checked = FlipBool($Checked);
         }
         $sReturn .= "<div class=\"" . $this->CssClass . "\"";
         if ($this->aOptions[$i]["ElementID"] != "") {
             $sReturn .= " id=\"" . $this->aOptions[$i]["ElementID"] . "\"";
         }
         $sReturn .= ">" . GetDynamicCheckBox($ElementID, $this->aOptions[$i]["IdValue"], $Checked, "", $this->aOptions[$i]["DisplayValue"], $this->Attributes) . "</div>\r\n";
     }
     return $sReturn;
 }
    function Render()
    {
        global $NuggetObj;
        if ($this->IsPostBack) {
            $this->PostBackParams->Clear();
            //editing or creating a nugget
            if ($this->PostBackAction == 'Nugget' || $this->PostBackAction == 'ProcessNugget') {
                // Allow Page Manager pages and any other tabs which are not added by Vanilla
                global $Menu;
                reset($Menu->Tabs);
                while (list(, $Value) = each($Menu->Tabs)) {
                    if (!in_array($Value['Value'], array("settings", "search", "account", "discussions", "categories"))) {
                        $NuggetObj->Pages = array_merge($NuggetObj->Pages, array(array('name' => $Value['Text'], 'page' => $Value['Value'])));
                    }
                }
                // Create RoleCheckboxes and PageCheckboxes
                $IsValid = isset($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]) || $this->PostBackAction == 'ProcessNugget';
                if ($IsValid && $this->PostBackAction == 'Nugget') {
                    $this->NuggetRoles = $NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['roles'];
                    $this->NuggetPages = $NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['pages'];
                }
                for ($i = 0; $i < count($NuggetObj->Roles); $i++) {
                    $this->RoleCheckboxes .= "<li><p><span>" . GetDynamicCheckBox("AllowedRoles[]", $NuggetObj->Roles[$i]['ID'], $IsValid ? in_array($NuggetObj->Roles[$i]['ID'], $this->NuggetRoles) : 1, "", $NuggetObj->Roles[$i]['Name'], '', 'RoleID_' . $NuggetObj->Roles[$i]['ID']) . "</span></p></li>\r\n";
                }
                for ($i = 0; $i < count($NuggetObj->Pages); $i++) {
                    $this->PageCheckboxes .= "<li><p><span>" . GetDynamicCheckBox("AllowedPages[]", $NuggetObj->Pages[$i]['page'], $IsValid ? in_array($NuggetObj->Pages[$i]['page'], $this->NuggetPages) : 1, "", $NuggetObj->Pages[$i]['name'], '', 'PageID_' . str_replace(" ", "_", $NuggetObj->Pages[$i]['name'])) . "</span></p></li>\r\n";
                }
                if (isset($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]) && $this->PostBackAction == 'Nugget') {
                    $this->NuggetName = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['name']);
                    $this->NuggetID = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['id'];
                    $this->NuggetHTML = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['html']);
                    $this->NuggetHideName = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['hideName'];
                    $this->NuggetDescription = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['description']);
                    $this->NuggetPosition = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['position']);
                    $this->NuggetWeight = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['weight'];
                    $this->PositionSelect->SelectedValue = $NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['position'];
                    $this->WeightSelect->SelectedValue = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['weight'];
                }
                $this->PostBackParams->Set('PostBackAction', 'ProcessNugget');
                echo '<div id="Form" class="Account NuggetList RoleEditForm">
					<fieldset>
						<legend>' . $this->Context->GetDefinition("NuggetManagement") . '</legend>';
                if (isset($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex])) {
                    $this->NuggetSelect->Attributes .= ' onchange="document.location=\'?PostBackAction=Nugget&NuggetID=\'+this.options[this.selectedIndex].value;"';
                    $this->NuggetSelect->SelectedValue = $GLOBALS['NuggetObj']->SentNuggetID;
                    echo '
						' . $this->Get_Warnings() . '
						' . $this->Get_PostBackForm('frmNugget') . '
						<h2>1. ' . $this->Context->GetDefinition('SelectPage') . '</h2>
						<ul><li>' . $this->NuggetSelect->Get() . '</li></ul>
						<h2>2. ' . $this->Context->GetDefinition('NuggetEdit') . '</h2>';
                } else {
                    echo '
						' . $this->Get_Warnings() . '
						' . $this->Get_PostBackForm('frmNugget') . '
						<h2>' . $this->Context->GetDefinition('DefineNewNugget') . '</h2>';
                }
                echo '
					<ul>
						<li>
							<label for="txtNuggetName">' . $this->Context->GetDefinition('NuggetName') . '</label>
							<input type="text" name="Name" value="' . $this->NuggetName . '" maxlength="80" class="SmallInput" id="txtNuggetName" />
						</li>
						<li>
							<p class="Description"><span>' . GetDynamicCheckBox('HideName', 1, $this->NuggetHideName, '', $this->Context->GetDefinition('NuggetNameHide')) . '</span></p>
						</li>
						<li>
							<label for="txtNuggetDescription">' . $this->Context->GetDefinition('NuggetDescription') . ' <small>' . $this->Context->GetDefinition('(optional)') . '</small></label>
							<input type="text" name="Description" value="' . $this->NuggetDescription . '" maxlength="80" class="SmallInput" id="txtNuggetDescription" />
							<p class="Description">' . $this->Context->GetDefinition('NuggetDescriptionNotes') . '</p>
						</li>
						<li>
							<label for="Position">' . $this->Context->GetDefinition('NuggetPan') . '</label>
							' . $this->PositionSelect->Get() . '
						</li>
						<li>
							<label for="Weight">' . $this->Context->GetDefinition('NuggetWeight') . '</label>
							' . $this->WeightSelect->Get() . '
							<p class="Description">' . $this->Context->GetDefinition('NuggetWeightNotes') . '</p>

						</li>
						<li>
							<input type="hidden" name="ID" value="' . $this->NuggetID . '" maxlength="80" class="SmallInput" id="txtNuggetID" />
							<label for="txtNuggetHTML">' . $this->Context->GetDefinition('NuggetHTML') . '</label>
							<textarea name="HTML" id="txtNuggetHTML" rows=25>' . $this->NuggetHTML . '</textarea>
							<p class="Description">' . $this->Context->GetDefinition('NuggetHTMLNotes') . '</p>
						</li>
							<table cellspacing="5">
							<tbody><tr><td>
								<p class="Description"><strong>' . $this->Context->GetDefinition('NuggetPages') . '</strong><br />
								' . $this->Context->GetDefinition('NuggetPagesNotes') . '</p>
							</td>
							<td>
								<p class="Description"><strong>' . $this->Context->GetDefinition('Roles') . '</strong><br />
								' . $this->Context->GetDefinition('NuggetRoleNotes') . '</p>
							</td></tr>
							<tr><td>Check: <a onclick="CheckAll(\'PageID_\'); return false;" href="./">All</a>, <a onclick="CheckNone(\'PageID_\'); return false;" href="./">None</a></td>
							<td>Check: <a onclick="CheckAll(\'RoleID_\'); return false;" href="./">All</a>, <a onclick="CheckNone(\'RoleID_\'); return false;" href="./">None</a></td>
							</tr>

							<tr><td valign="top" >
								' . $this->PageCheckboxes . '
							</td>
							<td valign="top">
								' . $this->RoleCheckboxes . '
							</td></tr></tbody></table>
						</ul>
					<div class="Submit">

						<input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Save') . '" class="Button SubmitButton" />
						<a href="./settings.php?PostBackAction=NuggetList" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a>
					</div>
					</form>
				</fieldset>
				</div>';
            } else {
                if ($this->PostBackAction == 'RemoveNugget') {
                    $this->PostBackParams->Set('PostBackAction', 'ProcessRemoveNugget');
                    $this->NuggetSelect->Attributes .= ' onchange="document.location=\'?PostBackAction=RemoveNugget&NuggetID=\'+this.options[this.selectedIndex].value;"';
                    $this->NuggetSelect->SelectedValue = $GLOBALS['NuggetObj']->SentNuggetID;
                    $this->NuggetName = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['name']);
                    echo '<div id="Form" class="Account RoleRemoveForm"><fieldset>
					<legend>' . $this->Context->GetDefinition('NuggetManagement') . '</legend>
					' . $this->Get_PostBackForm('frmRemoveNugget') . '

					<p><strong>Are you sure you want to trash "' . $this->NuggetName . '" nugget and not freeze it for later use.</strong></p><p> If you want to freeze it, select [Frozen] from the Pan select box</p>
					<ul><li>' . $this->NuggetSelect->Get() . '</li></ul>
					<div class="Submit">
						<input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Trash it') . '" class="Button SubmitButton RoleRemoveButton" />
						<a href="./settings.php?PostBackAction=NuggetList" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a>
					</div>
					</form>
					</fieldset>
					</div>';
                } else {
                    if ($this->PostBackAction == 'NuggetList') {
                        echo '<div id="Form" class="Account NuggetList">
					<fieldset>
						<legend>' . $this->Context->GetDefinition('NuggetManagement') . '</legend>
						<form method="get" action="' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl) . '">
							<input type="hidden" name="PostBackAction" value="Nugget" />
							<p>' . $this->Context->GetDefinition('NuggetNotes') . '</p>
							<p id="ReadDocumentation"><a href="#" onclick="document.getElementById(\'NuggetDocumentation\').style.display = \'block\';document.getElementById(\'ReadDocumentation\').style.display = \'none\';">Read Cooking Documentation</a></p>
							<div id="NuggetDocumentation" style="display:none">' . $this->Context->GetDefinition('NuggetDocumentation') . '</div>
							<p><input type="submit" name="btnNewNugget" value="' . $this->Context->GetDefinition('CreateANewNugget') . '" class="Button SubmitButton NewRoleButton" /></p>

						</form>

					</fieldset>
					</div>
				';
                        if ($GLOBALS['NuggetObj']->Nugget) {
                            $this->PostBackParams->Set('PostBackAction', 'ProcessNuggetList');
                            echo '<div id="Form" class="Account NuggetList">
					     <fieldset>

						' . $this->Get_PostBackForm('frmNuggetList') . '
						<table id="NuggetListTable">
							<thead>
								<tr>
									<th>Nugget</th>
									<th>Pan</th>
									<th>Weight</th>
									<th>Serving</th>
								</tr>
							</thead>
							<tbody>';
                            $cooked = 0;
                            $frozen = 0;
                            for ($i = 0; $i < count($NuggetObj->Nugget); $i++) {
                                $this->NuggetName = htmlspecialchars($GLOBALS['NuggetObj']->Nugget[$i]['name']);
                                $this->NuggetDescription = htmlspecialchars($GLOBALS['NuggetObj']->Nugget[$i]['description']);
                                $this->PositionSelect->Name = $i . '[Position]';
                                $this->PositionSelect->SelectedValue = $GLOBALS['NuggetObj']->Nugget[$i]['position'];
                                $this->WeightSelect->Name = $i . '[Weight]';
                                $this->WeightSelect->SelectedValue = (int) @$GLOBALS['NuggetObj']->Nugget[$i]['weight'];
                                $this->NuggetStatus = (int) @$GLOBALS['NuggetObj']->Nugget[$i]['status'];
                                $this->Alternate = FlipBool($this->Alternate);
                                $this->Alternate ? $class = 'even' : ($class = 'odd');
                                // Display the heading only once
                                if ($this->NuggetStatus && !$cooked) {
                                    echo '<tr><td class="region" colspan="4">Cooked</td></tr>';
                                    $cooked = 1;
                                } else {
                                    if (!$this->NuggetStatus && !$frozen) {
                                        echo '<tr><td class="region" colspan="4">Frozen</td></tr>';
                                        $frozen = 1;
                                    }
                                }
                                echo '<tr class=' . $class . '>
					        <td class="name"><strong>' . $this->NuggetName . '</strong><br />' . $this->NuggetDescription . '</td>
						<td>' . $this->PositionSelect->Get() . '</td>
						<td>' . $this->WeightSelect->Get() . '</td>
						<td><a href="' . $this->Context->Configuration['WEB_ROOT'] . 'settings.php?PostBackAction=Nugget&NuggetID=' . $GLOBALS['NuggetObj']->Nugget[$i]['id'] . '">' . $this->Context->GetDefinition('Edit') . '</a>
						| <a href="' . $this->Context->Configuration['WEB_ROOT'] . 'settings.php?PostBackAction=RemoveNugget&NuggetID=' . $GLOBALS['NuggetObj']->Nugget[$i]['id'] . '">Trash it</a></td>
						</tr>
					';
                            }
                            echo '</tbody></table>
					<div class="Submit">
						<input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Save Nuggets') . '" class="Button SubmitButton" />
						<a href="' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl) . '" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a>
					</div>
				</form>
				</fieldset>
				</div>';
                        }
                    }
                }
            }
        }
    }
 function Render_NoPostBack()
 {
     $this->CallDelegate('PreSearchFormRender');
     include ThemeFilePath($this->Context->Configuration, 'search_form.php');
     if ($this->PostBackAction == 'Search') {
         $this->CallDelegate('PreSearchResultsRender');
         include ThemeFilePath($this->Context->Configuration, 'search_results_top.php');
         if ($this->DataCount > 0) {
             $Alternate = 0;
             $FirstRow = 1;
             $Counter = 0;
             if ($this->Search->Type == 'Topics') {
                 $Discussion = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Discussion');
                 $CurrentUserJumpToLastCommentPref = $this->Context->Session->User->Preference('JumpToLastReadComment');
                 $DiscussionList = '';
                 $ThemeFilePath = ThemeFilePath($this->Context->Configuration, 'discussion.php');
                 while ($Row = $this->Context->Database->GetRow($this->Data)) {
                     $Discussion->Clear();
                     $Discussion->GetPropertiesFromDataSet($Row, $this->Context->Configuration);
                     $Discussion->FormatPropertiesForDisplay();
                     if ($Counter < $this->Context->Configuration['SEARCH_RESULTS_PER_PAGE']) {
                         include $ThemeFilePath;
                     }
                     $FirstRow = 0;
                     $Counter++;
                     $Alternate = FlipBool($Alternate);
                 }
                 echo $DiscussionList;
             } elseif ($this->Search->Type == 'Comments') {
                 $Comment = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Comment');
                 $HighlightWords = ParseQueryForHighlighting($this->Context, $this->Search->Query);
                 $CommentList = '';
                 $ThemeFilePath = ThemeFilePath($this->Context->Configuration, 'search_results_comments.php');
                 while ($Row = $this->Context->Database->GetRow($this->Data)) {
                     $Comment->Clear();
                     $Comment->GetPropertiesFromDataSet($Row, $this->Context->Session->UserID);
                     $Comment->FormatPropertiesForSafeDisplay();
                     if ($Counter < $this->Context->Configuration['SEARCH_RESULTS_PER_PAGE']) {
                         include $ThemeFilePath;
                     }
                     $FirstRow = 0;
                     $Counter++;
                     $Alternate = FlipBool($Alternate);
                 }
                 echo $CommentList;
             } elseif ($this->Search->Type == 'Users') {
                 $u = $this->Context->ObjectFactory->NewContextObject($this->Context, 'User');
                 $UserList = '';
                 $ThemeFilePath = ThemeFilePath($this->Context->Configuration, 'search_results_users.php');
                 while ($Row = $this->Context->Database->GetRow($this->Data)) {
                     $u->Clear();
                     $u->GetPropertiesFromDataSet($Row);
                     $u->FormatPropertiesForDisplay();
                     if ($Counter < $this->Context->Configuration['SEARCH_RESULTS_PER_PAGE']) {
                         include $ThemeFilePath;
                     }
                     $FirstRow = 0;
                     $Counter++;
                     $Alternate = FlipBool($Alternate);
                 }
                 echo $UserList;
             } else {
                 $this->CallDelegate('MidSearchResultsRender');
             }
         }
         include ThemeFilePath($this->Context->Configuration, 'search_results_bottom.php');
     }
 }
Exemple #5
0
$Discussion = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Discussion');
$FirstRow = 1;
$CurrentUserJumpToLastCommentPref = $this->Context->Session->User->Preference('JumpToLastReadComment');
$DiscussionList = '';
$ThemeFilePath = ThemeFilePath($this->Context->Configuration, 'discussion.php');
$Alternate = 0;
while ($Row = $this->Context->Database->GetRow($this->DiscussionData)) {
    $Discussion->Clear();
    $Discussion->GetPropertiesFromDataSet($Row, $this->Context->Configuration);
    $Discussion->FormatPropertiesForDisplay();
    // Prefix the discussion name with the whispered-to username if this is a whisper
    if ($Discussion->WhisperUserID > 0) {
        $Discussion->Name = @$Discussion->WhisperUsername . ': ' . $Discussion->Name;
    }
    // Discussion search results are identical to regular discussion listings, so include the discussion search results template here.
    include $ThemeFilePath;
    $FirstRow = 0;
    $Alternate = FlipBool($Alternate);
}
echo $DiscussionList . '
	</ol>
</div>';
if ($this->DiscussionDataCount > 0) {
    echo '<div class="ContentInfo Bottom">
		<div class="PageInfo">
			<p>' . $pl->GetPageDetails($this->Context) . '</p>
			' . $PageList . '
		</div>
		<a id="TopOfPage" href="' . GetRequestUri() . '#pgtop">' . $this->Context->GetDefinition('TopOfPage') . '</a>
	</div>';
}
 function AddOption($IdValue, $DisplayValue, $Checked, $FlipCheckedValue, $Attributes = '')
 {
     $this->aOptions[] = array('IdValue' => $IdValue, 'DisplayValue' => $DisplayValue, 'Checked' => $FlipCheckedValue ? FlipBool($Checked) : $Checked, 'Attributes' => $Attributes);
 }
Exemple #7
0
 function DefineProperties()
 {
     $this->DefineBrowsingDirectory();
     // Create some holder variables
     $this->FolderCollection = array();
     $this->ImageCollection = new FileCollection();
     $ThumbnailCollection = array();
     // RETRIEVE FILES
     // Loop through files in the current browsing directory
     $FolderKey = 0;
     $FolderHandle = opendir($this->CurrentBrowsingDirectory);
     $CurrentExtension = "";
     $RecordItem = true;
     while (false !== ($Item = readdir($FolderHandle))) {
         $RecordItem = true;
         if ($Item == "." || $Item == ".." || $Item == $this->SelfUrl || in_array($this->CurrentBrowsingDirectory . "/" . $Item, $this->FullyQualifiedHideFiles)) {
             $RecordItem = false;
         }
         if ($RecordItem) {
             // If dealing with a folder, add it to the folder collection
             if (is_dir($this->CurrentBrowsingDirectory . "/" . $Item)) {
                 $this->FolderCollection[] = $Item;
                 // If not dealing with a folder, add it to the proper file collection
             } elseif (substr($Item, 0, 7) == $this->ThumbPrefix) {
                 $ThumbnailCollection[] = $Item;
             } elseif (substr($Item, 0, 1) == "_") {
                 // Ignore "hidden" files
             } elseif (in_array($this->GetFileType($this->CurrentBrowsingDirectory, $Item), $this->ThumbnailableFormats)) {
                 $this->ImageCollection->AddFile($Item, filesize($this->CurrentBrowsingDirectory . "/" . $Item), filemtime($this->CurrentBrowsingDirectory . "/" . $Item), "");
             }
         }
     }
     // BUILD THE PAGE ELEMENTS
     $ThumbedList = "";
     $NonThumbedList = "";
     // Create a parameters class to manage querystring values
     $Params = new Parameters();
     $Params->DefineCollection($_GET);
     $Params->Remove("smf");
     if ($this->FolderIDs == "") {
         $Params->Remove("did");
     }
     $FileCounter = 0;
     // Build the file listing
     // Get the sorted files
     $Files = $this->ImageCollection->GetFiles($this->SortBy, $this->SortDirection, $ThumbnailCollection);
     $ThumbBool = 0;
     $NonThumbBool = 0;
     if (count($Files) > 0) {
         for ($j = 0; $j < count($Files); $j++) {
             $FileCounter += 1;
             $CurrentFileName = $Files[$j]["Name"];
             $CurrentFileSize = $Files[$j]["Size"];
             $CurrentFileDate = $Files[$j]["Date"];
             $CurrentFileHandlerMethod = $Files[$j]["HandlerMethod"];
             if ($Files[$j]["ThumbnailPresent"]) {
                 $ThumbedList .= $this->FormatListItem($FileCounter, $CurrentFileName, $CurrentFileSize, $CurrentFileDate, $Params, $ThumbBool);
                 $ThumbBool = FlipBool($ThumbBool);
             } else {
                 $NonThumbedList .= $this->FormatListItem($FileCounter, $CurrentFileName, $CurrentFileSize, $CurrentFileDate, $Params, $NonThumbBool);
                 $NonThumbBool = FlipBool($NonThumbBool);
             }
         }
     }
     if ($NonThumbedList != "") {
         $NonThumbedList = $this->FormatImageList($NonThumbedList, "Images Without Thumbnails", "Images");
     }
     if ($ThumbedList != "") {
         $ThumbedList = $this->FormatImageList($ThumbedList, "Images With Thumbnails", "ThumbedImages");
     }
     $this->FileList = $NonThumbedList . $ThumbedList;
     // Define the current folder path
     $RootPath = substr($this->SelfWebPath, 0, strlen($this->SelfWebPath) - 1);
     $CurrentPath = "<a href=\"" . $RootPath . "/" . $this->SelfUrl . "\">" . str_replace("http://", "", $RootPath) . "</a>";
     $this->FolderList = "<div class=\"Container Folders\">\r\n\t\t\t<dl class=\"CurrentFolder\">\r\n\t\t\t\t<dt>Current Folder</dt>\r\n\t\t\t\t<dd>" . $CurrentPath . BuildPath($this->FolderNavigator, $this->SelfUrl, 0) . "</dd>\r\n\t\t\t</dl>";
     // Build the folder listing
     if (count($this->FolderCollection) > 0 || count($this->aFolderID) > 0) {
         // Sort the folders
         usort($this->FolderCollection, "strcasecmp");
         reset($this->FolderCollection);
         if ($this->SortDirection == "desc") {
             $this->FolderCollection = array_reverse($this->FolderCollection);
         }
         $Params->Remove("fid");
         $this->FolderList .= "<h2>Folders</h2>\r\n\t\t\t\t<ul class=\"FolderList\">\r\n";
         // Display the updirectory link if necessary
         if (count($this->aFolderID) > 0) {
             $ParentFolder = "";
             if (count($this->aFolderID) > 1) {
                 for ($i = 0; $i < count($this->aFolderID) - 1; $i++) {
                     $ParentFolder = FormatDelimitedString($ParentFolder, $this->aFolderID[$i], $this->FolderDelimiter);
                 }
                 $Params->Set("did", $ParentFolder);
             } else {
                 $Params->Remove("did");
             }
             $this->FolderList .= "<li><a href=\"" . $this->SelfUrl . $Params->GetQueryString() . "\">Parent Folder</a></li>\r\n";
         }
         // Add actual folders
         for ($i = 0; $i < count($this->FolderCollection); $i++) {
             $Params->Set("did", FormatDelimitedString($this->FolderIDs, $i, $this->FolderDelimiter));
             $this->FolderList .= "<li><a href=\"" . $this->SelfUrl . $Params->GetQueryString() . "\">" . $this->FolderCollection[$i] . "</a></li>\r\n";
         }
         $this->FolderList .= "</ul>";
     }
     $this->FolderList .= "</div>";
 }
Exemple #8
0
    $Panel->AddListItem($Options, $BookmarkText, "./", "", "id=\"SetBookmark\" onclick=\"SetBookmark('" . $Configuration['WEB_ROOT'] . "ajax/switch.php', " . $CommentGrid->Discussion->Bookmarked . ", '" . $CommentGrid->Discussion->DiscussionID . "', '" . $Context->GetDefinition("BookmarkText") . "', '" . $Context->GetDefinition("UnbookmarkThisDiscussion") . "', '" . $SessionPostBackKey . "'); " . $Context->PassThruVars['SetBookmarkOnClick'] . "return false;\"");
    if ($Context->Session->User->Permission("PERMISSION_HIDE_DISCUSSIONS")) {
        $HideText = $Context->GetDefinition(($CommentGrid->Discussion->Active ? "Hide" : "Unhide") . "ThisDiscussion");
        $Panel->AddListItem($Options, $HideText, "./", "", "id=\"HideDiscussion\" onclick=\"if (confirm('" . $Context->GetDefinition($CommentGrid->Discussion->Active ? "ConfirmHideDiscussion" : "ConfirmUnhideDiscussion") . "')) DiscussionSwitch('" . $CommentGrid->Context->Configuration['WEB_ROOT'] . "ajax/switch.php', 'Active', '" . $CommentGrid->Discussion->DiscussionID . "', '" . FlipBool($CommentGrid->Discussion->Active) . "', 'HideDiscussion', '" . $SessionPostBackKey . "'); return false;\"");
    }
    if ($Context->Session->User->Permission("PERMISSION_CLOSE_DISCUSSIONS")) {
        $CloseText = $Context->GetDefinition(($CommentGrid->Discussion->Closed ? "ReOpen" : "Close") . "ThisDiscussion");
        $Panel->AddListItem($Options, $CloseText, "./", "", "id=\"CloseDiscussion\" onclick=\"if (confirm('" . $Context->GetDefinition($CommentGrid->Discussion->Closed ? "ConfirmReopenDiscussion" : "ConfirmCloseDiscussion") . "')) DiscussionSwitch('" . $CommentGrid->Context->Configuration['WEB_ROOT'] . "ajax/switch.php', 'Closed', '" . $CommentGrid->Discussion->DiscussionID . "', '" . FlipBool($CommentGrid->Discussion->Closed) . "', 'CloseDiscussion', '" . $SessionPostBackKey . "'); return false;\"");
    }
    if ($Context->Session->User->Permission("PERMISSION_STICK_DISCUSSIONS")) {
        $StickyText = $Context->GetDefinition("MakeThisDiscussion" . ($CommentGrid->Discussion->Sticky ? "Unsticky" : "Sticky"));
        $Panel->AddListItem($Options, $StickyText, "./", "", "id=\"StickDiscussion\" onclick=\"if (confirm('" . $Context->GetDefinition($CommentGrid->Discussion->Sticky ? "ConfirmUnsticky" : "ConfirmSticky") . "')) DiscussionSwitch('" . $CommentGrid->Context->Configuration['WEB_ROOT'] . "ajax/switch.php', 'Sticky', '" . $CommentGrid->Discussion->DiscussionID . "', '" . FlipBool($CommentGrid->Discussion->Sticky) . "', 'StickDiscussion', '" . $SessionPostBackKey . "'); return false;\"");
    }
    if ($Context->Session->User->Permission("PERMISSION_SINK_DISCUSSIONS")) {
        $SinkText = $Context->GetDefinition("MakeThisDiscussion" . ($CommentGrid->Discussion->Sink ? "UnSink" : "Sink"));
        $Panel->AddListItem($Options, $SinkText, "./", "", "id=\"SinkDiscussion\" onclick=\"if (confirm('" . $Context->GetDefinition($CommentGrid->Discussion->Sink ? "ConfirmUnSink" : "ConfirmSink") . "')) DiscussionSwitch('" . $CommentGrid->Context->Configuration['WEB_ROOT'] . "ajax/switch.php', 'Sink', '" . $CommentGrid->Discussion->DiscussionID . "', '" . FlipBool($CommentGrid->Discussion->Sink) . "', 'SinkDiscussion', '" . $SessionPostBackKey . "'); return false;\"");
    }
}
// Create the comment footer
$CommentFoot = $Context->ObjectFactory->CreateControl($Context, "CommentFoot");
// 3. ADD CONTROLS TO THE PAGE
$Page->AddRenderControl($Head, $Configuration["CONTROL_POSITION_HEAD"]);
$Page->AddRenderControl($Menu, $Configuration["CONTROL_POSITION_MENU"]);
$Page->AddRenderControl($Panel, $Configuration["CONTROL_POSITION_PANEL"]);
$Page->AddRenderControl($NoticeCollector, $Configuration['CONTROL_POSITION_NOTICES']);
$Page->AddRenderControl($CommentGrid, $Configuration["CONTROL_POSITION_BODY_ITEM"]);
if ($CommentGrid->ShowForm) {
    $Page->AddRenderControl($CommentForm, $Configuration["CONTROL_POSITION_BODY_ITEM"] + 10);
    $Page->AddRenderControl($CommentFoot, $Configuration["CONTROL_POSITION_BODY_ITEM"] + 11);
}
$Page->AddRenderControl($Foot, $Configuration["CONTROL_POSITION_FOOT"]);