Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

1850
 
1851
 
1851
 
batch_edit.php
_> 11 <?php
  22 /*
<> 3 -  $Id: batch_edit.php 1850 2009-02-28 03:07:56Z hpdl $
   3+  $Id: batch_edit.php 1851 2009-02-28 03:08:07Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
  77 
<> 8 -  Copyright (c) 2007 osCommerce
   8+  Copyright (c) 2009 osCommerce
99 
  1010   This program is free software; you can redistribute it and/or modify
  1111   it under the terms of the GNU General Public License v2 (1991)
  1212   as published by the Free Software Foundation.
  1313 */
<> 14 -
  15 -  $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access');
  16 -  $osC_DirectoryListing->setIncludeDirectories(false);
  17 -
  18 -  $access_modules_array = array();
  19 -
  20 -  foreach ($osC_DirectoryListing->getFiles() as $file) {
  21 -    $module = substr($file['name'], 0, strrpos($file['name'], '.'));
  22 -
  23 -    if (!class_exists('osC_Access_' . ucfirst($module))) {
  24 -      $osC_Language->loadIniFile('modules/access/' . $file['name']);
  25 -      include($osC_DirectoryListing->getDirectory() . '/' . $file['name']);
  26 -    }
  27 -
  28 -    $module = 'osC_Access_' . ucfirst($module);
  29 -    $module = new $module();
  30 -
  31 -    $access_modules_array[osC_Access::getGroupTitle( $module->getGroup() )][] = array('id' => $module->getModule(),
  32 -                                                                                      'text' => $module->getTitle());
  33 -  }
  34 -
  35 -  ksort($access_modules_array);
3614 ?>
  3715 
  3816 <h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?></h1>
  3917 
  4018 <?php
<> 41 -  if ($osC_MessageStack->size($osC_Template->getModule()) > 0) {
   19+  if ( $osC_MessageStack->exists($osC_Template->getModule()) ) {
4220     echo $osC_MessageStack->get($osC_Template->getModule());
  4321   }
  4422 ?>
  4523 
  4624 <div class="infoBoxHeading"><?php echo osc_icon('edit.png') . ' ' . $osC_Language->get('action_heading_batch_edit_administrators'); ?></div>
  4725 <div class="infoBoxContent">
<> 48 -  <form name="aEditBatch" action="<?php echo osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&page=' . $_GET['page'] . '&action=batchSave'); ?>" method="post">
   26+  <form name="aEditBatch" class="dataForm" action="<?php echo osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&action=batch_save'); ?>" method="post">
4927 
  5028   <p><?php echo $osC_Language->get('introduction_batch_edit_administrators'); ?></p>
  5129 
     
 !
5735 
  5836   $names_string = '';
  5937 
<> 60 -  while ($Qadmins->next()) {
  61 -    $names_string .= osc_draw_hidden_field('batch[]', $Qadmins->valueInt('id')) . '<b>' . $Qadmins->value('user_name') . '</b>, ';
   38+  while ( $Qadmins->next() ) {
   39+    $names_string .= osc_draw_hidden_field('batch[]', $Qadmins->valueInt('id')) . '<b>' . $Qadmins->valueProtected('user_name') . '</b>, ';
6240   }
  6341 
  6442   if ( !empty($names_string) ) {
  6543     $names_string = substr($names_string, 0, -2);
  6644   }
  6745 
  6846   echo '<p>' . $names_string . '</p>';
<>  47+?>
6948 
<> 70 -  echo '<p>' . osc_draw_radio_field('mode', array(array('id' => OSC_ADMINISTRATORS_ACCESS_MODE_ADD, 'text' => $osC_Language->get('add_to')), array('id' => OSC_ADMINISTRATORS_ACCESS_MODE_REMOVE, 'text' => $osC_Language->get('remove_from')), array('id' => OSC_ADMINISTRATORS_ACCESS_MODE_SET, 'text' => $osC_Language->get('set_to'))), OSC_ADMINISTRATORS_ACCESS_MODE_ADD) . '</p>';
   49+  <fieldset>
   50+    <div><?php echo osc_draw_radio_field('mode', array(array('id' => osC_Administrators_Admin::ACCESS_MODE_ADD, 'text' => $osC_Language->get('add_to')), array('id' => osC_Administrators_Admin::ACCESS_MODE_REMOVE, 'text' => $osC_Language->get('remove_from')), array('id' => osC_Administrators_Admin::ACCESS_MODE_SET, 'text' => $osC_Language->get('set_to'))), osC_Administrators_Admin::ACCESS_MODE_ADD); ?></div>
7151 
<> 72 -  echo '<ul style="list-style-type: none; padding-left: 0;">' .
  73 -       '  <li>' . osc_draw_checkbox_field('modules[]', '*', null, 'id="access_globaladmin"') . '&nbsp;<label for="access_globaladmin"><b>' . $osC_Language->get('global_access') . '</b></label></li>' .
  74 -       '</ul>' .
  75 -       '<ul style="list-style-type: none; padding-left: 0;">';
   52+    <div><select name="accessModules" id="modulesList"><option value="-1" disabled="disabled">-- Access Modules --</option><option value="0"><?php echo $osC_Language->get('global_access'); ?></option></select></div>
7653 
<> 77 -  foreach ( $access_modules_array as $group => $modules ) {
  78 -    echo '  <li><b>' . $group . '</b>' .
  79 -         '    <ul style="list-style-type: none; padding-left: 15px;">';
   54+    <ul id="accessToModules" class="modulesListing"></ul>
   55+  </fieldset>
8056 
<> 81 -    foreach ($modules as $module) {
  82 -      echo '      <li>' . osc_draw_checkbox_field('modules[]', $module['id'], null, 'id="access_' . $module['id'] . '"') . '&nbsp;<label for="access_' . $module['id'] . '" class="fieldLabel">' . $module['text'] . '</label></li>';
  83 -    }
   57+  <p align="center"><?php echo osc_draw_hidden_field('subaction', 'confirm') . '<input type="submit" value="' . $osC_Language->get('button_save') . '" class="operationButton" /> <input type="button" value="' . $osC_Language->get('button_cancel') . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()) . '\';" class="operationButton" />'; ?></p>
8458 
<> 85 -    echo '    </ul>' .
  86 -         '  </li>';
  87 -  }
   59+  </form>
   60+</div>
8861 
<> 89 -  echo '</ul>';
  90 -?>
   62+<script type="text/javascript"><!--
   63+  var accessModules = <?php echo json_encode(osC_Administrators_Admin::getAccessModules()); ?>;
   64+  var deleteAccessModuleIcon = '<?php echo osc_icon('uninstall.png'); ?>';
9165 
<> 92 -  <p align="center"><?php echo osc_draw_hidden_field('subaction', 'confirm') . '<input type="submit" value="' . $osC_Language->get('button_save') . '" class="operationButton" /> <input type="button" value="' . $osC_Language->get('button_cancel') . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&page=' . $_GET['page']) . '\';" class="operationButton" />'; ?></p>
   66+  var $modulesList = $('#modulesList');
9367 
<_ 94 -  </form>
  95 -</div>
   68+  $.each(accessModules, function(i, item) {
   69+    var sGroup = document.createElement('optgroup');
   70+    sGroup.label = i;
   71+
   72+    $.each(item, function(key, value) {
   73+      var sOption = new Option(value['text'], value['id']);
   74+      sOption.id = 'am' + value['id'];
   75+
   76+      sGroup.appendChild(sOption);
   77+    });
   78+
   79+    $modulesList.append(sGroup);
   80+  });
   81+
   82+  $('#modulesList').change(function() {
   83+    if ( $('#modulesList :selected').val() == '0' ) {
   84+      $('#accessToModules li').remove();
   85+      $('#accessToModules').append('<li id="atm' + $('#modulesList :selected').val() + '">' + $('#modulesList :selected').text() + ' <span style="float: right;"><a href="#" onclick="removeAccessToModule(\'' + $('#modulesList :selected').val() + '\');">' + deleteAccessModuleIcon + '</a><input type="hidden" name="modules[]" value="' + $('#modulesList :selected').val() + '" /></span></li>');
   86+
   87+      $('#modulesList').attr('disabled', 'disabled');
   88+      $('#modulesList').val('-1');
   89+
   90+      $('#accessToModules li').tsort();
   91+    } else if ( $('#modulesList :selected').val() != '-1' ) {
   92+      $('#accessToModules').append('<li id="atm' + $('#modulesList :selected').val() + '">' + $('#modulesList :selected').parent().attr('label') + ' &raquo; ' + $('#modulesList :selected').text() + ' <span style="float: right;"><a href="#" onclick="removeAccessToModule(\'' + $('#modulesList :selected').val() + '\');">' + deleteAccessModuleIcon + '</a><input type="hidden" name="modules[]" value="' + $('#modulesList :selected').val() + '" /></span></li>');
   93+
   94+      $('#modulesList :selected').attr('disabled', 'disabled');
   95+      $('#modulesList').val('-1');
   96+
   97+      $('#accessToModules li').tsort();
   98+    }
   99+  });
   100+
   101+  function removeAccessToModule(module) {
   102+    if ( module == '0' ) {
   103+      $('#modulesList').removeAttr('disabled');
   104+      $('#modulesList :disabled').removeAttr('disabled');
   105+      $('#modulesList :first').attr('disabled', 'disabled');
   106+    } else {
   107+      $('#am' + module).removeAttr('disabled');
   108+    }
   109+
   110+    $('#atm' + module).remove();
   111+  }
   112+//--></script>