function plog_collection_manager($from, $limit) { plogger_init_collections(array('from' => $from, 'limit' => $limit, 'all_collections' => 1, 'sortby' => 'id', 'sortdir' => 'asc')); // create javascript initiation function for editable elements if (plogger_has_collections()) { $output .= '<script type="text/javascript">'; $output .= "Event.observe(window, 'load', init, false);"; $output .= "function init() {"; while (plogger_has_collections()) { plogger_load_collection(); // makeEditable('collection-name-".plogger_get_collection_id()."'); $output .= "makeEditable('collection-description-" . plogger_get_collection_id() . "');"; } $output .= "}"; $output .= '</script>'; } plogger_init_collections(array('from' => $from, 'limit' => $limit, 'all_collections' => 1, 'sortby' => 'id', 'sortdir' => 'asc')); if (plogger_has_collections()) { $output .= '<table style="width: 100%" cellpadding="4"> <col style="width: 15px;"/><tr class="header"><td class="table-header-left"></td>'; $output .= '<td class="table-header-middle">' . plog_tr('Name') . '</td>'; $output .= '<td class="table-header-middle">' . plog_tr('Description') . '</td>'; $output .= '<td class="table-header-right">' . plog_tr('Actions') . '</td></tr>'; $counter = 0; while (plogger_has_collections()) { plogger_load_collection(); if ($counter % 2 == 0) { $table_row_color = "color-1"; } else { $table_row_color = "color-2"; } $counter++; $id = plogger_get_collection_id(); $output .= "<tr class='{$table_row_color}'>"; $output .= "<td><input type='checkbox' name='selected[]' value='" . $id . "'/></td>"; $output .= "<td><a class='folder' href='?level=albums&id=" . $id . "'><strong><span id='collection-name-" . plogger_get_collection_id() . "'>" . plogger_get_collection_name() . "</span></a></strong> — " . sprintf(plog_tr('contains %d albums'), plogger_collection_album_count()) . "</td>"; $output .= "<td><p id='collection-description-" . plogger_get_collection_id() . "'>" . plogger_get_collection_description() . " </p></td>"; $output .= '<td><a href="?action=edit-collection&id=' . $id . '"><img style="display:inline" src="../graphics/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '"></a>'; $output .= '<a href="?action=1&selected%5B%5D=' . $id . '&level=collections&delete_checked=1&id=' . @$_REQUEST["id"] . '" onClick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display:inline" src="../graphics/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '"></a></td>'; $output .= "</tr>"; } $output .= '<tr class="header"><td colspan="7"></td></tr></table>'; $output .= "</table>"; } else { $output .= "<p class='actions'>" . plog_tr('There are no collections yet') . "</p>"; } return $output; }
function plogger_init() { global $config; $page = isset($_GET['plog_page']) ? intval($_GET['plog_page']) : 1; $from = ($page - 1) * $config['thumb_num']; if ($from < 0) { $from = 0; } // We shouldn't set a limit for the slideshow if ($GLOBALS['plogger_mode'] == 'slideshow') { $lim = -1; } else { $lim = $config['thumb_num']; } $id = $GLOBALS['plogger_id']; if ($GLOBALS['plogger_level'] == 'search') { plogger_init_search(array('searchterms' => $_REQUEST['searchterms'], 'from' => $from, 'limit' => $lim)); } else { if ($GLOBALS['plogger_level'] == 'album') { if (check_album_id($id)) { plogger_init_pictures(array('type' => 'album', 'value' => $id, 'from' => $from, 'limit' => $lim, 'sortby' => isset($_SESSION['plogger_sortby']) ? $_SESSION['plogger_sortby'] : '', 'sortdir' => isset($_SESSION['plogger_sortdir']) ? $_SESSION['plogger_sortdir'] : '')); } } else { if ($GLOBALS['plogger_level'] == 'collection') { if (check_collection_id($id)) { plogger_init_albums(array('from' => $from, 'limit' => $lim, 'collection_id' => $id, 'sortby' => !empty($config['album_sortby']) ? $config['album_sortby'] : 'id', 'sortdir' => !empty($config['album_sortdir']) ? $config['album_sortdir'] : 'DESC')); } } else { if ($GLOBALS['plogger_level'] == 'picture') { if (check_picture_id($id)) { // First let's load the thumbnail of the picture at the correct size plogger_init_picture(array('id' => $id)); } } else { // Show all of the collections plogger_init_collections(array('from' => $from, 'limit' => $lim, 'sortby' => !empty($config['collection_sortby']) ? $config['collection_sortby'] : 'id', 'sortdir' => !empty($config['collection_sortdir']) ? $config['collection_sortdir'] : 'DESC')); } } } } }
function plogger_init() { global $config; $_SESSION['require_captcha'] = false; $page = isset($_GET["plog_page"]) ? intval($_GET["plog_page"]) : 1; $from = ($page - 1) * $config["thumb_num"]; if ($from < 0) { $from = 0; } // we shouldn't set a limit for the slideshow if ($GLOBALS["plogger_mode"] == 'slideshow') { $lim = 0; } else { $lim = $config["thumb_num"]; } $id = $GLOBALS["plogger_id"]; if ($GLOBALS["plogger_level"] == "search") { plogger_init_search(array('searchterms' => $_GET['searchterms'], 'from' => $from, 'limit' => $lim)); } else { if ($GLOBALS["plogger_level"] == "album") { plogger_init_pictures(array('type' => 'album', 'value' => $id, 'from' => $from, 'limit' => $lim, 'sortby' => isset($_SESSION['plogger_sortby']) ? $_SESSION['plogger_sortby'] : '', 'sortdir' => isset($_SESSION['plogger_sortdir']) ? $_SESSION['plogger_sortdir'] : '')); } else { if ($GLOBALS["plogger_level"] == "collection") { plogger_init_albums(array('from' => $from, 'limit' => $lim, 'collection_id' => $id, 'sortby' => !empty($config['album_sortby']) ? $config['album_sortby'] : 'id', 'sortdir' => !empty($config['album_sortdir']) ? $config['album_sortdir'] : 'DESC')); } else { if ($GLOBALS["plogger_level"] == "picture") { // first lets load the thumbnail of the picture at the correct size plogger_init_picture(array('id' => $id)); } else { // Show all of the collections plogger_init_collections(array('from' => $from, 'limit' => $lim, 'sortby' => !empty($config['collection_sortby']) ? $config['collection_sortby'] : 'id', 'sortdir' => !empty($config['collection_sortdir']) ? $config['collection_sortdir'] : 'DESC')); } } } } }
function plog_collection_manager($from, $limit) { global $config, $empty; $output = ''; plogger_init_collections(array('from' => $from, 'limit' => $limit, 'all_collections' => 1, 'sortby' => !empty($config['collection_sortby']) ? $config['collection_sortby'] : 'id', 'sortdir' => !empty($config['collection_sortdir']) ? $config['collection_sortdir'] : 'ASC')); // Create javascript initiation function for editable elements if (plogger_has_collections()) { $output .= "\n\t\t" . '<script type="text/javascript">'; $output .= "\n\t\t\t" . 'Event.observe(window, \'load\', init, false);'; $output .= "\n\t\t\t" . 'function init() {' . "\n"; while (plogger_has_collections()) { plogger_load_collection(); // makeEditable('collection-name-".plogger_get_collection_id()."'); $output .= "\t\t\t\tmakeEditable('collection-description-" . plogger_get_collection_id() . "');\n"; } $output .= "\t\t\t" . '}'; $output .= "\n\t\t" . '</script>'; } plogger_init_collections(array('from' => $from, 'limit' => $limit, 'all_collections' => 1, 'sortby' => !empty($config['collection_sortby']) ? $config['collection_sortby'] : 'id', 'sortdir' => !empty($config['collection_sortdir']) ? $config['collection_sortdir'] : 'ASC')); if (plogger_has_collections()) { $output .= "\n\t\t" . '<table style="width: 100%;" cellpadding="3" cellspacing="0"> <col style="width: 15px;" /> <tr class="header"> <th class="table-header-left align-center width-15"><input name="allbox" type="checkbox" onclick="checkAll(document.getElementById(\'contentList\'));" /></th> <th class="table-header-middle align-left width-275">' . plog_tr('Name') . '</th> <th class="table-header-middle align-left">' . plog_tr('Description') . '</th> <th class="table-header-right align-center width-100">' . plog_tr('Actions') . '</th> </tr>'; $counter = 0; while (plogger_has_collections()) { plogger_load_collection(); if ($counter % 2 == 0) { $table_row_color = 'color-1'; } else { $table_row_color = 'color-2'; } $counter++; $id = plogger_get_collection_id(); $text = plogger_collection_album_count() == 1 ? plog_tr('album') : plog_tr('albums'); $output .= "\n\t\t\t" . '<tr class="' . $table_row_color . '">'; $output .= "\n\t\t\t\t" . '<td class="align-center width-15"><p class="margin-5"><input type="checkbox" name="selected[]" value="' . $id . '" /></p></td>'; $output .= "\n\t\t\t\t" . '<td class="align-left width-275"><p class="margin-5"><a class="folder" href="?level=albums&id=' . $id . '"><span id="collection-name-' . plogger_get_collection_id() . '"><strong>' . plogger_get_collection_name() . '</strong></span></a> - ' . sprintf(plog_tr('%d'), plogger_collection_album_count()) . ' ' . $text . '</p></td>'; $output .= "\n\t\t\t\t" . '<td class="align-left vertical-top"><p class="margin-5" id="collection-description-' . plogger_get_collection_id() . '">' . plogger_get_collection_description() . '</p></td>'; $output .= "\n\t\t\t\t" . '<td class="align-center width-100"><p class="margin-5"><a href="?action=edit-collection&id=' . $id . '"><img style="display: inline;" src="' . $config['gallery_url'] . 'plog-admin/images/edit.gif" alt="' . plog_tr('Edit') . '" title="' . plog_tr('Edit') . '" /></a>'; $output .= ' <a href="?action=move-delete&selected%5B%5D=' . $id . '&level=collections&delete_checked=1&'; if (isset($_REQUEST['id'])) { $output .= 'id=' . intval($_REQUEST['id']); } if (isset($_GET['plog_page'])) { $output .= '&plog_page=' . intval($_GET['plog_page']); } $output .= '" onclick="return confirm(\'' . plog_tr('Are you sure you want to delete this item?') . '\');"><img style="display: inline;" src="' . $config['gallery_url'] . 'plog-admin/images/x.gif" alt="' . plog_tr('Delete') . '" title="' . plog_tr('Delete') . '" /></a></p></td>'; $output .= "\n\t\t\t" . '</tr>'; } $output .= "\n\t\t\t" . '<tr class="footer"> <td class="align-left invert-selection" colspan="7"><a href="#" onclick="checkToggle(document.getElementById(\'contentList\')); return false;">' . plog_tr('Toggle Checkbox Selection') . '</a></td> </tr> </table>' . "\n"; } else { $output .= "\n\n\t\t" . '<p class="actions">' . plog_tr('There are no collections yet') . '.</p>' . "\n"; $empty = true; } return $output; }