Changeset 8331


Ignore:
Timestamp:
Dec 28, 2010, 12:15:48 AM (10 years ago)
Author:
rub
Message:

Admin configuration page:

o Fix cancel Button
o Change layout
o Like Button and comments cannot be enabled together (php and JQuery test)

Location:
extensions/FacebookPlug/Plugin
Files:
16 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/admin.config.php

    r8298 r8331  
    4747$colorscheme_l10n = array_map('l10n', $colorscheme);
    4848
     49
    4950// Tabsheet
    5051$tabsheet = new tabsheet();
     
    6162if (isset($_POST['submit']))
    6263{
     64  $save_conf['fbp'] = $conf['fbp'];
     65
    6366  switch ($page['tab'])
    6467  {
     
    8891      $conf['fbp']['social_plugin_like_box']['stream'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_STREAM']) ? false : true;
    8992      $conf['fbp']['social_plugin_like_box']['header'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_HEADER']) ? false : true;
     93     
     94      // Check
     95      if ($conf['fbp']['social_plugin_like_button']['enabled'] and $conf['fbp']['social_plugin_comments']['enabled'])
     96      {
     97        $conf['fbp']['social_plugin_like_button']['enabled'] = $save_conf['fbp']['social_plugin_like_button']['enabled'];
     98        $conf['fbp']['social_plugin_comments']['enabled'] = $save_conf['fbp']['social_plugin_comments']['enabled'];
     99        array_push($page['infos'], l10n('Like button and comments cannot be enabled together').', '.l10n('enabled values are restored'));
     100      }
    90101      break;
    91102    }
     
    183194}
    184195
    185 /*$template->assign(
    186   array(
    187     'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''),
    188     //~ 'FBP_DAY_NUMBER'=> $conf['fbp']['day_number'],
    189     ));*/
    190 
     196// Global value
     197//~ $template->assign('FBP_PATH', FBP_PATH);
     198$template->assign('FBP_ACTION', add_url_params($base_url, array('tab' => $page['tab'])));
     199$template->block_html_head('', '<link rel="stylesheet" type="text/css" href="'.FBP_PATH.'/css/admin.config.css">', $smarty, $repeat);
     200
     201//Apply tpl
    191202$template->set_filename('plugin_admin_content', FBP_DIR.'/tpl/admin.config.tpl');
    192203$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
  • extensions/FacebookPlug/Plugin/language/en_UK/plugin.lang.php

    r8298 r8331  
    4949$lang['Show header'] = 'Show header';
    5050$lang['Facebook Page URL'] = 'Facebook Page URL';
    51 $lang['on picture pages'] = 'on picture pages';
    52 $lang['on main pages'] = 'on main pages';
    5351$lang['Data updated with success'] = 'Data updated with success';
    5452$lang['Data updated with error'] = 'Data updated with error';
     
    6361$lang['Publish feed'] = 'Publish feed';
    6462$lang['Facebook application identifient'] = 'Facebook application identifient';
     63$lang['On picture pages'] = 'On picture pages';
     64$lang['On menu of main pages'] = 'On menu of main pages';
     65$lang['Options'] = 'Options';
     66$lang['Like button and comments cannot be enabled together'] = 'Like button and comments cannot be enabled together';
     67$lang['enabled values are restored'] = 'enabled values are restored';
     68$lang['Informations'] = 'Informations';
     69$lang['Continue'] = 'Continue';
     70//~ $lang[''] = '';
     71//~ $lang[''] = '';
     72//~ $lang[''] = '';
     73//~ $lang[''] = '';
     74//~ $lang[''] = '';
     75//~ $lang[''] = '';
    6576
    6677?>
  • extensions/FacebookPlug/Plugin/language/fr_FR/plugin.lang.php

    r8298 r8331  
    4949$lang['Show header'] = 'Voir l\'entête';
    5050$lang['Facebook Page URL'] = 'URL de la page Facebook';
    51 $lang['on picture pages'] = 'sur les pages d\'images';
    52 $lang['on main pages'] = 'sur les pages principales';
    5351$lang['Data updated with success'] = 'Données mises à jour avec succès';
    5452$lang['Data updated with error'] = 'Données mises à jour avec erreur';
     
    6361$lang['Publish feed'] = 'Publier les commentaires';
    6462$lang['Facebook application identifient'] = 'Identifiant de l\'application Facebook';
     63$lang['On picture pages'] = 'Sur les pages d\'images';
     64$lang['On menu of main pages'] = 'Dans les menus des pages principales';
     65$lang['Options'] = 'Options';
     66$lang['Like button and comments cannot be enabled together'] = 'Le bouton "J\'aime" et les commentaires ne peuvent être activés en même temps';
     67$lang['enabled values are restored'] = 'les valeurs d\'activation ont été restaurées';
     68$lang['Informations'] = 'Informations';
     69$lang['Continue'] = 'Continuer';
     70
    6571
    6672?>
  • extensions/FacebookPlug/Plugin/tpl/admin.config.tpl

    r8298 r8331  
     1{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
     2{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"}
     3{known_script id="jquery.ui.dialog" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.dialog.packed.js"}
     4
     5{*
     6{html_head}
     7<link rel="stylesheet" type="text/css" href="{$FBP_PATH|@cat:'/css/admin.config.css'}">
     8{/html_head}
     9*}
     10
     11{*html_head}
     12<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css">
     13{/html_head*}
     14
    115<div class="titrePage">
    216  <h2>FacebookPlug</h2>
     
    418<br>
    519
    6 <form method="post" class="properties">
    7 
     20<form method="post" class="properties" action="{$FBP_ACTION}">
    821{if isset($social_plugin)}
    9 <fieldset>
    10   <ul>
    11     <h3><a href="{$social_plugin.like_button.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like button'|@translate}</a> {'on picture pages'|@translate}</h3>
     22<h3>{'On picture pages'|@translate}</h3>
     23<fieldset>
     24  <legend><a href="{$social_plugin.like_button.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like button'|@translate}</a></legend>
     25  <ul>
    1226    <li>
    1327      <label>
     
    5367
    5468<fieldset>
    55   <ul>
    56     <h3><a href="{$social_plugin.facepile.FB_PAGE}" onclick="window.open(this.href); return false;">{'Facepile'|@translate}</a> {'on slideshow pages'|@translate}</h3>
     69  <legend><a href="{$social_plugin.facepile.FB_PAGE}" onclick="window.open(this.href); return false;">{'Facepile'|@translate}</a> {'on slideshow pages'|@translate}</legend>
     70  <ul>
    5771    <li>
    5872      <label>
     
    7488
    7589<fieldset>
    76   <ul>
    77     <h3><a href="{$social_plugin.comments.FB_PAGE}" onclick="window.open(this.href); return false;">{'Comments'|@translate}</a> {'on picture pages'|@translate}</h3>
     90  <legend><a href="{$social_plugin.comments.FB_PAGE}" onclick="window.open(this.href); return false;">{'Comments'|@translate}</a></legend>
     91  <ul>
    7892    <li>
    7993      <label>
     
    118132</fieldset>
    119133
    120 <fieldset>
    121   <ul>
    122     <h3><a href="{$social_plugin.like_box.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like box'|@translate}</a> {'on main pages'|@translate}</h3>
     134<h3>{'On menu of main pages'|@translate}</h3>
     135<fieldset>
     136  <legend><a href="{$social_plugin.like_box.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like box'|@translate}</a></legend>
     137  <ul>
    123138    <li>
    124139      <label>
     
    168183{if isset($advanced)}
    169184<fieldset>
     185  <legend>{'Options'|@translate}</legend>
    170186  <ul>
    171187      <li>
     
    207223</form>
    208224
     225<div id="dialog_modal_like_button_comments" title="{'Informations'|@translate}">{'Like button and comments cannot be enabled together'|@translate}</div>
     226{*<div id="dialog_modal_can_close" title="{'Informations'|@translate}">{'Data are modified but not saved! Are you sure to quit this tabsheet?'|@translate}</div>*}
     227
    209228{literal}
    210229<script type="text/javascript">
    211230  function show_hide(checkbox_name, div_name)
    212231  {
    213     if (jQuery("input[name="+checkbox_name+"]").attr('checked'))
     232    if ($("input[name="+checkbox_name+"]").attr('checked'))
    214233    {
    215       jQuery("#"+div_name).show();
     234      $("#"+div_name).show();
    216235    }
    217236    else
    218237    {
    219       jQuery("#"+div_name).hide();
     238      $("#"+div_name).hide();
    220239    }
    221240  }
    222241
     242  function inverse_check_value(checkbox_name_1, checkbox_name_2)
     243  {
     244    if ($("input[name="+checkbox_name_1+"]").attr('checked') && $("input[name="+checkbox_name_2+"]").attr('checked'))
     245    {
     246      $("input[name="+checkbox_name_1+"]").attr('checked', false);
     247      $("#dialog_modal_like_button_comments").dialog('open');
     248    }
     249  }
     250
    223251  function init_checkbox(checkbox_name, div_name)
    224252  {
    225     jQuery("input[name="+checkbox_name+"]").click(
     253    $("input[name="+checkbox_name+"]").click(
    226254      function()
    227255      {
     
    232260  }
    233261
    234   jQuery(document).ready(
     262  function init_checkbox_with_inverse_value(checkbox_name_1, checkbox_name_2)
     263  {
     264    $("input[name="+checkbox_name_1+"]").click(
     265      function()
     266      {
     267        inverse_check_value(checkbox_name_1, checkbox_name_2);
     268      }
     269    );
     270    $("input[name="+checkbox_name_2+"]").click(
     271      function()
     272      {
     273        inverse_check_value(checkbox_name_2, checkbox_name_1);
     274      }
     275    );
     276  }
     277
     278  $(document).ready(
    235279    function()
    236280    {
    237281      //Init all main checkbox
     282      init_checkbox_with_inverse_value("FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED", "FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED");
    238283      init_checkbox("FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED", "like_button");
    239284      init_checkbox("FBP_SOCIAL_PLUGIN_FACEPILE_ENABLED", "facepile");
    240285      init_checkbox("FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED", "comments");
    241286      init_checkbox("FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED", "like_box");
     287      // Init message box
     288      $("#dialog_modal_like_button_comments").dialog({
     289        autoOpen: false, modal: true, dialogClass: 'admin_config', // necessary to have a specific class because there are conflic with main menu accordeon
     290        buttons: { "{/literal}{'Continue'|@translate}{literal}": function() { $(this).dialog("close"); } },
     291      });
     292      $("#dialog_modal_can_close").dialog({
     293        autoOpen: false, modal: true, dialogClass: 'admin_config', // necessary to have a specific class because there are conflic with main menu accordeon
     294        buttons: { "Cancel": function() { $(this).dialog("close"); }, "{/literal}{'Submit'|@translate}{literal}": function() { IsDataChanged = false; $(this).dialog("close"); } },
     295      });
     296      // Detect data change
     297      /*IsDataChanged = false;
     298      $("input, select").change(function() { IsDataChanged = true; });
     299      //~ $(".tabsheet").click(function()
     300      $(window).unload(function()
     301        {
     302          if (IsDataChanged)
     303          {
     304            //~ alert($(this).attr("name"));
     305           //~ $("#dialog_modal_can_close").dialog( "option", "buttons", { "{/literal}{'Submit'|@translate}{literal}": function() { $(this).dialog("close"); } } );
     306            $("#dialog_modal_can_close").dialog('open');
     307           
     308            //~ return true;
     309            return false
     310          }
     311          else
     312          {
     313            return true;
     314          }
     315          //return ! IsDataChanged;
     316        });*/
    242317    });
    243318
Note: See TracChangeset for help on using the changeset viewer.