function afg_edit_galleries()
{
    global $afg_photo_size_map, $afg_on_off_map, $afg_descr_map, $afg_columns_map, $afg_bg_color_map, $afg_photo_source_map, $default_gallery_id, $pf;
    $user_id = get_option('afg_user_id');
    $cur_page_url = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    preg_match('/\\&gallery_id=(?P<gallery_id>\\d+)/', $cur_page_url, $matches);
    if ($matches && !$default_gallery_id) {
        $default_gallery_id = $matches['gallery_id'];
        $match_pos = strpos($cur_page_url, "&gallery_id={$default_gallery_id}");
        $cur_page_url = substr($cur_page_url, 0, $match_pos);
    }
    $photosets_map = array();
    $groups_map = array();
    $galleries_map = array();
    afg_get_sets_groups_galleries($photosets_map, $groups_map, $galleries_map, $user_id);
    ?>
   <div class='wrap'>
   <h2><a href='http://www.ronakg.com/projects/awesome-flickr-gallery-wordpress-plugin/'><img src="<?php 
    echo BASE_URL . '/images/logo_big.png';
    ?>
" align='center'/></a>Edit Galleries | Awesome Flickr Gallery</h2>

<?php 
    if ($_POST && $_POST['afg_edit_gallery_name']) {
        global $warning;
        if ($warning) {
            echo "<div class='updated'><p><strong>You entered invalid value for Per Page option.  It has been set to Default.</strong></p></div>";
            $warning = false;
        }
        echo "<div class='updated'><p><strong>Gallery updated successfully.</strong></p></div>";
    }
    echo afg_generate_version_line();
    $url = $_SERVER['REQUEST_URI'];
    ?>

         <form method='post' action='<?php 
    echo $url;
    ?>
'>
            <div id="afg-wrap">
                  <div id="afg-main-box">
                     <h3>Saved Galleries</h3>
                     <table class='widefat fixed afg-settings-box'>
                        <tr>
                            <th class="afg-label"></th>
                            <th class="afg-input"></th>
                            <th class="afg-help-bubble"></th>
                        </tr>
                         <tr>
                           <td>Select Gallery to Edit</td>
                           <td><select id='afg_photo_gallery' name='afg_photo_gallery' onchange='loadGallerySettings()'>
                                 <?php 
    echo afg_get_galleries($default_gallery_id);
    ?>
                           </select></td>
                           <tr>
                              <td>Gallery Name</td>
                              <td><input class='afg-input' maxlength='30' type='text' id='afg_edit_gallery_name' name='afg_edit_gallery_name' onblur='verifyEditBlank()' value="" />*</td>
                           </tr>
                           <tr>
                              <td>Gallery Description</td>
                              <td><input class='afg-input' maxlength='100' type='text' id='afg_edit_gallery_descr' name='afg_edit_gallery_descr' value="" /></td>
                           </tr>
                        </table>
<?php 
    echo afg_generate_flickr_settings_table($photosets_map, $galleries_map, $groups_map);
    echo afg_generate_gallery_settings_table();
    $gals = get_option('afg_galleries');
    if (sizeof($gals) == 1) {
        $disable_submit = True;
    } else {
        $disable_submit = False;
    }
    ?>

                  <input type="submit" id="afg_save_changes" class="button-primary"
                  <?php 
    if ($disable_submit) {
        echo "disabled='yes'";
    }
    ?>
                  value="Save Changes" style="margin-top: 15px"/>
                  <br /><br />
                </div>
               <div id="afg-side-box">
                   <h3>Gallery Code</h3>
                        <table class='widefat fixed afg-side-box'>
                           <tr valign='top'>
                              <td>
                                 <p id='afg_flickr_gallery_code'>[AFG_gallery]</p>
                              </td>
                           </tr>
                        </table>
<?php 
    echo afg_box('Usage Instructions', 'Insert the Gallery Code in any of your posts or pages to display your Flickr Gallery.');
    echo afg_donate_box();
    echo afg_share_box();
    ?>
               </div>
              </div>
            </form>
<?php 
}
Beispiel #2
0
function afg_edit_galleries()
{
    global $afg_photo_size_map, $afg_on_off_map, $afg_descr_map, $afg_columns_map, $afg_bg_color_map, $afg_photo_source_map, $default_gallery_id, $pf;
    $user_id = get_option('afg_user_id');
    $cur_page_url = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    preg_match('/\\&gallery_id=(?P<gallery_id>\\d+)/', $cur_page_url, $matches);
    if ($matches && !$default_gallery_id) {
        $default_gallery_id = $matches['gallery_id'];
        $match_pos = strpos($cur_page_url, "&gallery_id={$default_gallery_id}");
        $cur_page_url = substr($cur_page_url, 0, $match_pos);
    }
    $photosets_map = array();
    $rsp_obj = $pf->photosets_getList($user_id);
    if (!$pf->error_code) {
        foreach ($rsp_obj['photoset'] as $photoset) {
            $photosets_map[$photoset['id']] = $photoset['title']['_content'];
        }
    }
    $galleries_map = array();
    $rsp_obj = $pf->galleries_getList($user_id);
    if (!$pf->error_code) {
        foreach ($rsp_obj['galleries']['gallery'] as $gallery) {
            $galleries_map[$gallery['id']] = $gallery['title']['_content'];
        }
    }
    $groups_map = array();
    if (get_option('afg_flickr_token')) {
        $rsp_obj = $pf->groups_pools_getGroups();
        if (!$pf->error_code) {
            foreach ($rsp_obj['group'] as $group) {
                $groups_map[$group['nsid']] = $group['name'];
            }
        }
    } else {
        $rsp_obj = $pf->people_getPublicGroups($user_id);
        if (!$pf->error_code) {
            foreach ($rsp_obj as $group) {
                $groups_map[$group['nsid']] = $group['name'];
            }
        }
    }
    ?>
   <div class='wrap'>
   <h2><a href='http://www.ronakg.com/projects/awesome-flickr-gallery-wordpress-plugin/'><img src="<?php 
    echo BASE_URL . '/images/logo_big.png';
    ?>
" align='center'/></a>Edit Galleries | Awesome Flickr Gallery</h2>

<?php 
    if ($_POST && $_POST['afg_edit_gallery_name']) {
        global $warning;
        if ($warning) {
            echo "<div class='updated'><p><strong>You entered invalid value for Per Page option.  It has been set to Default.</strong></p></div>";
            $warning = false;
        }
        echo "<div class='updated'><p><strong>Gallery updated successfully.</strong></p></div>";
    }
    echo afg_generate_version_line();
    $url = $_SERVER['REQUEST_URI'];
    ?>

         <form method='post' action='<?php 
    echo $url;
    ?>
'>
            <div class="postbox-container" style="width:69%; margin-right:1%">

               <div id="poststuff">
                  <div class="postbox" style='box-shadow:0 0 2px'>
                     <h3>Saved Galleries</h3>
                     <table class='form-table'>
                        <tr valign='top'>
                           <th scope='row'>Select Gallery to Edit</th>
                           <td><select id='afg_photo_gallery' name='afg_photo_gallery' onchange='loadGallerySettings()'>
                                 <?php 
    echo afg_get_galleries($default_gallery_id);
    ?>
                           </select></td>
                           <tr valign='top'>
                              <th scope='row'>Gallery Name</th>
                              <td><input maxlength='30' type='text' id='afg_edit_gallery_name' name='afg_edit_gallery_name' onblur='verifyEditBlank()' value="" /><font size='3' color='red'>*</font></td>
                           </tr>
                           <tr valign='top'>
                              <th scope='row'>Gallery Description</th>
                              <td><input maxlength='100' size='70%' type='text' id='afg_edit_gallery_descr' name='afg_edit_gallery_descr' value="" /></td>
                           </tr>
                        </table>
                  </div></div>

<?php 
    echo afg_generate_flickr_settings_table($photosets_map, $galleries_map, $groups_map);
    echo afg_generate_gallery_settings_table();
    $gals = get_option('afg_galleries');
    if (sizeof($gals) == 1) {
        $disable_submit = True;
    } else {
        $disable_submit = False;
    }
    ?>

                  <input type="submit" id="afg_save_changes" class="button-primary"
                  <?php 
    if ($disable_submit) {
        echo "disabled='yes'";
    }
    ?>
                  value="Save Changes" />
                  <br /><br />
                  <div id="poststuff">
                     <div class="postbox" style='box-shadow:0 0 2px'>
                        <h3>Gallery Code</h3>
                        <table class='form-table'>
                           <tr valign='top'>
                              <td>
                                 <p id='afg_flickr_gallery_code'>[AFG_gallery]</p>
                              </td>
                           </tr>
                        </table>
                  </div></div>
               </div>
               <div class="postbox-container" style="width: 29%;">
<?php 
    echo afg_box('Usage Instructions', 'Insert the Gallery Code in any of your posts of pages to display your Flickr Gallery.');
    echo afg_donate_box();
    echo afg_share_box();
    ?>
               </div>
            </form>
<?php 
}