Ignore:
Timestamp:
Dec 28, 2010, 12:15:48 AM (13 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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.