Changeset 17626


Ignore:
Timestamp:
Aug 23, 2012, 11:01:02 AM (8 years ago)
Author:
mistic100
Message:

add a tab on element edition page to edit video properties

Location:
extensions/gvideo
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/gvideo/admin.php

    r17383 r17626  
    66$conf['gvideo'] = unserialize($conf['gvideo']);
    77
    8 // tabsheet
    9 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    108$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'add';
    11  
    12 $tabsheet = new tabsheet();
    13 $tabsheet->add('add', l10n('Add a video'), GVIDEO_ADMIN . '-add');
    14 $tabsheet->add('config', l10n('Configuration'), GVIDEO_ADMIN . '-config');
    15 $tabsheet->select($page['tab']);
    16 $tabsheet->assign();
     9
     10
     11if ($page['tab'] != 'photo')
     12{
     13  // tabsheet
     14  include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
     15  $tabsheet = new tabsheet();
     16  $tabsheet->add('add', l10n('Add a video'), GVIDEO_ADMIN . '-add');
     17  $tabsheet->add('config', l10n('Configuration'), GVIDEO_ADMIN . '-config');
     18  $tabsheet->select($page['tab']);
     19  $tabsheet->assign();
     20}
    1721
    1822// include page
  • extensions/gvideo/admin/template/add.tpl

    r17423 r17626  
    3737      <label>
    3838        <span class="property">{'Video URL'|@translate}</span>
    39         <input type="text" name="url" value="{$POST.url}" style="width:400px">
     39        <input type="text" name="url" value="{$POST.url}" style="width:400px;">
    4040      </label>
    4141    </li>
  • extensions/gvideo/admin/template/style.css

    r17383 r17626  
    5757  margin-left:20px;
    5858}
     59
     60#change_warning {
     61  display:block;
     62  color:#c00;
     63  font-weight:bold;
     64}
  • extensions/gvideo/include/gvideo.inc.php

    r17488 r17626  
    6868}
    6969
    70 /**
    71  * add message and link on edition page
    72  */
    73 function gvideo_photo_edit()
    74 {
    75   global $page, $template, $conf;
    76  
    77   if ($page['page'] != 'photo') return;
    78  
    79   $query = '
    80 SELECT *
    81   FROM '.GVIDEO_TABLE.'
    82   WHERE picture_id = '.$_GET['image_id'].'
    83 ;';
    84   $result = pwg_query($query);
    85  
    86   if (!pwg_db_num_rows($result)) return;
    87    
    88   $video = pwg_db_fetch_assoc($result);
    89    
    90   array_push($page['warnings'], l10n('This element is a video added with "Embedded Video"'));
    91  
    92   if (function_exists('imagecreatetruecolor'))
    93   {
    94     if (isset($_GET['add_film_frame']))
    95     {
    96       include_once(GVIDEO_PATH . '/include/functions.inc.php');
    97       include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
    98      
    99       $image_infos = pwg_db_fetch_assoc(pwg_query('SELECT path, file FROM '.IMAGES_TABLE.' WHERE id = '.$_GET['image_id'].';'));
    100       $thumb_source = $conf['data_location'].$image_infos['file'];
    101      
    102       add_film_frame($image_infos['path'], $thumb_source);
    103       add_uploaded_file($thumb_source, $image_infos['file'], null, null, $_GET['image_id']);
    104       $template->assign('TN_UPDATE', true);
    105     }
    106    
    107     $admin_photo_base_url = get_root_url().'admin.php?page=photo-'.$_GET['image_id'];
    108     $admin_url_start = $admin_photo_base_url.'-properties';
    109     $admin_url_start.= isset($_GET['cat_id']) ? '&amp;cat_id='.$_GET['cat_id'] : '';
    110    
    111     $template->assign('U_ADD_FILM_FRAME', $admin_url_start.'&amp;add_film_frame=1');
    112     $template->set_prefilter('picture_modify', 'gvideo_photo_edit_prefilter');
    113   }
    114 }
    115 
    116 function gvideo_photo_edit_prefilter($content)
    117 {
    118   $search[0] = '{if !url_is_remote($PATH)}';
    119   $replace[0] = '<li><a href="{$U_ADD_FILM_FRAME}" id="refresh_video">{\'Add film effect\'|@translate}</a></li>'.$search[0];
    120  
    121   $search[1] = '{$TN_SRC}';
    122   $replace[1] = $search[1].'{if $TN_UPDATE}?'.time().'{/if}';
    123  
    124   return str_replace($search, $replace, $content);
    125 }
    126 
    12770?>
  • extensions/gvideo/language/en_UK/plugin.lang.php

    r17397 r17626  
    1818$lang['This element is a video added with "Embedded Video"'] = 'This element is a video added with "Embedded Video"';
    1919$lang['Add film effect'] = 'Add film effect';
     20$lang['Upload a new thumbnail'] = 'Upload a new thumbnail';
     21$lang['The thumbnail was updated'] = 'The thumbnail was updated';
     22$lang['Video successfully updated'] = 'Video successfully updated';
     23$lang['Changing the url will reset video description, name and thumbnail'] = 'Changing the url will reset video description, name and thumbnail';
    2024
    2125?>
  • extensions/gvideo/language/fr_FR/plugin.lang.php

    r17397 r17626  
    1818$lang['This element is a video added with "Embedded Video"'] = 'Cet élément est une vidéo ajoutée avec "Embedded Video"';
    1919$lang['Add film effect'] = 'Ajouter un effet pellicule';
     20$lang['Upload a new thumbnail'] = 'Uploader une nouvelle miniature';
     21$lang['The thumbnail was updated'] = 'La miniature a été mise à jour';
     22$lang['Video successfully updated'] = 'Vidéo mise à jour';
     23$lang['Changing the url will reset video description, name and thumbnail'] = 'Changer l\'url réinitialisera le nom, la description et la miniature de la vidéo';
    2024
    2125?>
  • extensions/gvideo/main.inc.php

    r17383 r17626  
    2424{
    2525  add_event_handler('delete_elements', 'gvideo_delete_elements');
    26   add_event_handler('loc_begin_admin_page', 'gvideo_photo_edit');
    2726  add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu');
     27  add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2);
    2828  add_event_handler('init', 'gvideo_init');
    2929 
     
    4141    return $menu;
    4242  }
     43 
     44  function gvideo_tab($sheets, $id)
     45  {
     46    if ($id != 'photo') return $sheets;
     47   
     48    $query = '
     49SELECT *
     50  FROM '.GVIDEO_TABLE.'
     51  WHERE picture_id = '.$_GET['image_id'].'
     52;';
     53    $result = pwg_query($query);
     54 
     55    if (!pwg_db_num_rows($result)) return $sheets;
     56   
     57    global $gvideo;
     58    $gvideo = pwg_db_fetch_assoc($result);
     59   
     60    $sheets['gvideo'] = array(
     61      'caption' => l10n('Video properties'),
     62      'url' => GVIDEO_ADMIN.'-photo&amp;image_id='.$_GET['image_id'],
     63      );
     64    unset($sheets['coi'], $sheets['update']);
     65   
     66    return $sheets;
     67  }
    4368}
    4469
Note: See TracChangeset for help on using the changeset viewer.